https://github.com/xing/fpm-fry
deep-fried package builder
https://github.com/xing/fpm-fry
debian-packages linux package-builder package-creation rpm-packages
Last synced: about 2 months ago
JSON representation
deep-fried package builder
- Host: GitHub
- URL: https://github.com/xing/fpm-fry
- Owner: xing
- Created: 2015-08-19T09:09:25.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2025-08-07T11:36:55.000Z (2 months ago)
- Last Synced: 2025-08-07T13:29:39.300Z (2 months ago)
- Topics: debian-packages, linux, package-builder, package-creation, rpm-packages
- Language: Ruby
- Homepage:
- Size: 401 KB
- Stars: 18
- Watchers: 7
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
fpm-fry
======================[](https://travis-ci.org/xing/fpm-fry)
[](https://coveralls.io/github/xing/fpm-fry?branch=master)
[](https://inch-ci.org/github/xing/fpm-fry)[fpm-cookery](https://github.com/bernd/fpm-cookery) inspired package builder on [docker](https://docker.io)
What does it do?
------------------ simplifies building rpm and deb packages
- lightweight isolated builds
- build information in files so you can check them into git
- simple hackable ruby codeInstallation
-----------------$> gem install fpm-fry
You also need a running a machine running docker >= 1.8. This does not need to be the same machine, fpm-fry can
use the docker remote api. See [the docker install guide](https://www.docker.io/gettingstarted/?#h_installation).Introduction
---------------fpm-fry like fpm-cookery works with recipe files. A recipe file can look like this:
```ruby
name 'ag'
version '0.21.0'source 'https://github.com/ggreer/the_silver_searcher/archive/0.21.0.tar.gz',
checksum: 'ee921373e2bb1a25c913b0098ab946d137749b166d340a8ae6d88a554940a793',
file_map: {"the_silver_searcher-#{version}" => '.'}if flavour == 'redhat'
build_depends 'pkgconfig'
build_depends 'automake'
build_depends 'gcc'
build_depends 'zlib-devel'
build_depends 'pcre-devel'
build_depends 'xz-devel'depends 'zlib'
depends 'xz'
depends 'zlib'
elsif flavour == 'debian'
build_depends 'automake'
build_depends 'pkg-config'
build_depends 'libpcre3-dev'
build_depends 'zlib1g-dev'
build_depends 'liblzma-dev'
build_depends 'make'depends 'libc6'
depends 'libpcre3'
depends 'zlib1g'
depends 'liblzma5'
endrun './build.sh'
run 'make', 'install'
```Recipe files contains information about used sources, required software packages and build
steps.If you don't tell fpm-fry which recipe to use it will look for a file called `recipe.rb`
in the current directory.Unlike fpm-cookery fpm-fry needs to know additionally which docker image it should use to
build ( `ubuntu:precise` in the example below). fpm-fry does not automatically pull this
image into the docker instance, but you can use the `--pull` option trigger the necessary
pull command. Or you can pull it manually ( `docker pull ubuntu:precise` in our example ).To build your first package type:
$> fpm-fry cook --pull ubuntu:precise recipe.rb
Recipe syntax
-------------------------Recipe are ordinary ruby code. They are evaled inside an FPM::Fry::Recipe::Builder which gives you the following methods:
### General stuff
- `name String`: Sets the package name. This is the only mandatory setting.
```ruby
name "my-awesome-package"
```- `version String`: Sets the package version.
```ruby
version "1.2.3"
```- `depends String, ConstraintsOrOptions = {}`: Adds a dependency. Available options are:
- `install: true|false|String`: Sets if this package is installed during build. You can override the package actually installed by passing a string. This way you can depend on virtual packages but install a real package for building.
- `constraints: String|Array`: Specifies a required version. Required versions are currently not honored for build dependencies.```ruby
depends "other-package"
depends "virtual-package", install: "real-package"
depends "mock-package", install: false
depends "mock-package", constraints: "0.0.1"
depends "mock-package", constraints: ">= 0.0.1"
# These three lines are all equal:
depends "mock-package", ">= 0.0.1, << 0.1.0"
depends "mock-package", constraints: ">= 0.0.1, << 0.1.0"
depends "mock-package", constraints: [">= 0.0.1", "<< 0.1.0"]
```- `source Url, Options = {}`: Sets the source url to use for this package. Out-of-the-box the following types are supported:
**https**: Just pass an http url.
```ruby
source "https://example.com/path/source.tar.gz",
checksum: "DEADBEEEEEEEEEEEEEEEF" # checksum is md5/sha1/sha256/sha512 based on the length of the checksum
```Files ending in .tar, .tar.gz, .tgz, .tar.bz2 and .zip will be extracted. Files ending in .bin and .bundle will be placed in the container as is.
**git**: Understands any url that git understands. Requires git on your system.
```ruby
source "http://github.com/user/repo.git" # Use HEAD
source "http://github.com/user/repo.git", branch: "foo" # Use branch foo
source "http://github.com/user/repo.git", tag: "0.1.0" # Use tag 0.1.0
```**dir**: Uses a directory on _your_ machine.
```ruby
source "./src" # Relative to recipe file
```- `run String, *String`: Run the given command during build. All parts are automatically shellescaped.
```ruby
run "./configure","--prefix=/foo/bar"
run "make"
run "make", "INSTALL"
```- `bash String?, String`: Run arbitrary bash code during build. This method is intended as an interface for plugins.
```ruby
bash "echo 'this works' >> file"
bash "This name will be displayed in the output log", "some code here"
```- `after_install String`: adds a script that gets run after installation of this package.
```ruby
after_install < docker run -t -i stackbrew/ubuntu:precise /bin/bash
root@fce49040a269:/# mkdir bla
root@fce49040a269:/# echo "Hello World" > /bla/foo
root@fce49040a269:/# exit2. Package it using all the fpm stuff you like
$> fpm-fry fpm -sdocker -tdeb -nbla fce49040a269
Created deb package {:path=>"bla_1.0_amd64.deb"}3. Check the result
$> dpkg-deb --contents bla_1.0_amd64.deb
drwx------ 0/0 0 2014-03-12 15:35 ./
drwxr-xr-x 0/0 0 2014-03-12 15:35 ./bla/
-rw-r--r-- 0/0 0 2014-03-12 15:35 ./bla/fooAuthors
------------------- Maxime Lagresle [@maxlaverse](https://github.com/maxlaverse)
- Stefan Kaes [@skaes](https://github.com/skaes)
- Sebastian Brandt [@sebbrandt87](https://github.com/sebbrandt87)
- Hannes Georg [@hannesg](https://github.com/hannesg)
- Julian Tabel [@JTabel](https://github.com/JTabel)License
-----------------The MIT License (MIT)
Copyright (c) 2018-2024 XING AG
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.