
Using fpm, you can easily create both .deb and .rpm files without having to know any of the commands of the packaging tools that it leverages. fpm can make your life easier when attempting to create packages to use across your infrastructure or when distributing publicly downloadable packages of your project. fpm is a command-line program designed to help you build packages.
Installing FPM:
The main method of distribution for the fpm tool itself is as a Ruby gem. We can get our system prepared to install fpm by installing both the Ruby development packages and the software building tools needed to compile additional software. First, update your local package cache and then proceed with the prerequisite installations:
sudo apt-get updateOnce the above packages are installed, you can install the fpm package itself by typing:
sudo apt-get install ruby-dev build-essential
sudo gem install fpmThis will install fpm on the system level and make it available to any user on the system.
You should now have the fpm executable available on your system. You can verify this by checking out the tool's abundant help information:
fpm --helpThe fpm tool is fairly good at telling you what it needs to complete a package build. To get an idea of the most basic requirements, you can call the command with no arguments:
fpm
Missing required -s flag. What package source did you want? {:level=>:warn}
Missing required -t flag. What package output did you want? {:level=>:warn}
No parameters given. You need to pass additional command arguments so that I know what you want to build packages from. For example, for '-s dir' you would pass a list of files and directories. For '-s gem' you would pass a one or more gems to package from. As a full example, this will make an rpm of the 'json' rubygem: `fpm -s gem -t rpm json` {:level=>:warn}
Fix the above problems, and you'll be rolling packages in no time! {:level=>:fatal}
This output tells us the basics of what we need to provide to create a package. A typical call will look like this in its basic form:
fpm -s source_type -t target_type source_name_or_locationThe source can be any of a number of types. The source type will also dictate the way that the source name or location is passed to the command.
Source and Target Formats: The fpm tool can work with quite a few different source and target formats. These each have their own requirements and features. The following source types are currently supported:
Source Type | Source Description | How to Pass Source Name or Location | Additional Packages Needed |
---|---|---|---|
dir | Directory or files | Pass the absolute or relative path(s) of the project files on the local filesystem. | (none) |
tar | A tarball source package | Pass the path to the location of the tarball (compressed or uncompressed) on the local filesystem. | (none) |
gem | A Ruby gem | Pass the name of a Ruby gem that can be find on www.rubygems.org. It will be auto-downloaded to create the package. | ruby, rubygems-integration |
python | A Python package | Pass the name of a Python package as you would pass it to easy_install. Names are searched for in the Python Package Index and auto-downloaded to create the package. | python-setuptools |
pear | A PHP extension | Pass the name of a PHP extension or application found on pear.php.net. The appropriate files will be auto-downloaded when creating the package. | php-pear |
cpan | A Perl module | Pass the name of a Perl module as found at cpan.org. The files will be auto-downloaded and used to build the package. | cpanminus |
zip | A zipped directory structure | Pass the location on the local filesystem of a zip file containing the package. | zip |
npm | A Node.js module | Pass the name of a Node module as specified on npmjs.org. The package will be auto-downloaded and used to make the output package. | npm |
osxpkg | An OS X package | Pass the location on the local filesystem of an OS X package (this will only work on OS X systems with pkgbuild in their path). | pkgbuild (only available for OS X systems) |
empty | (no source) | Used to create a package without any actual packages. This is used most often for meta-packages that only contain dependencies. | (none) |
deb | A .deb package | Pass the location of a .deb file on the local filesystem. | (none on Debian-based systems) |
rpm | An .rpm package | Pass the location of an .rpm file on the local filesystem. | rpm |
No comments:
Post a Comment