packpack / packpack

Simple building of RPMs & Debian packages from git repos
Other
286 stars 54 forks source link

PackPack

Travis License RPM Packages Debian Packages Demo Video

PackPack is a simple tool to build RPM and Debian packages from git repositories:

PackPack works best with GitHub, Travis CI and PackageCloud:

Watch a demonstration of PackPack.

Motivation

PackPack is designed by folks from Mail.Ru Group, a leading Internet company in Europe, to automate release management cycle of open source products as well as of proprietary software.

Tarantool, an open-source general-purpose database and an application server, has dozens of git commits per day and this number is constantly increasing month after month. In order to deliver the best user experience and offer enterprise-level support quality, the Tarantool team packages almost every git commit from four git branches for (!) fifteen various Linux distribution.

Traditional tools, like mock and pbuilder, were tremendously slow and ridiculously overcomplicated. Customers had to wait hours for hotfix packages and the project paid thousands of dollars annually for hardware and electricity bills. Such costs are unacceptable for most "free as in speech" open-source projects.

PackPack has reduced push-to-package time from hours to minutes. Tarantool team were even able to package all complementary modules, addons and connectors using this tool. Tarantool users now can also package their own proprietary modules in the same manner as official packages.

Our Users

Of course, PackPack itself is packaged using PackPack.

Supported Platforms

Distributions:

Archictectures:

The actual list of distribution is available on Docker Hub. Please file an issue if you want more.

Getting Started

$ git tag -a 1.0
$ git describe --always --long
1.0-0-g5c26e8b # major.minor-patch = 1.0-0
$ git push origin 1.0:1.0 # Push to GitHub
myproject$ git clone https://github.com/packpack/packpack.git packpack
myproject$ OS=fedora DIST=24 ./packpack/packpack
myproject$ ls -1s build/
total 112
76 myproject-1.0.2-0.fc24.src.rpm
36 myproject-devel-1.0.2-0.fc24.x86_64.rpm

Of course, PackPack can also be installed from DEB/RPM packages:

# For Debian, Ubuntu and other Debian-based
curl -s https://packagecloud.io/install/repositories/packpack/packpack/script.deb.sh | sudo bash
# For Fedora, RedHat, CentOS and other RPM-based
curl -s https://packagecloud.io/install/repositories/packpack/packpack/script.rpm.sh | sudo bash

See PackPack Repositories for additional instructions.

How it Works

PackPack performs the following steps:

GitHub, Travis CI and PackageCloud

PackPack is designed to use with GitHub, Travis CI and PackageCloud.

sudo: required
services:
  - docker

cache:
    directories:
     - $HOME/.cache

language: C

env:
    matrix:
      - OS=el DIST=6
      - OS=el DIST=7
      - OS=fedora DIST=24
      - OS=fedora DIST=25
      - OS=ubuntu DIST=trusty
      - OS=ubuntu DIST=precise
      - OS=ubuntu DIST=xenial
      - OS=ubuntu DIST=yakkety
      - OS=debian DIST=jessie
      - OS=debian DIST=wheezy
      - OS=debian DIST=stretch
      - OS=ubuntu DIST=xenial ARCH=i386
      - OS=debian DIST=jessie ARCH=i386

script:
 - git submodule update --init --recursive
 - git describe --long
 - git clone https://github.com/packpack/packpack.git packpack
 - packpack/packpack

deploy:
  # Deploy packages to PackageCloud
  provider: packagecloud
  username: ${PACKAGECLOUD_USER}
  repository: ${PACKAGECLOUD_REPO}
  token: ${PACKAGECLOUD_TOKEN}
  dist: ${OS}/${DIST}
  package_glob: build/*.{deb,rpm}
  skip_cleanup: true
  on:
    branch: master
    condition: -n "${OS}" && -n "${DIST}" && -n "${PACKAGECLOUD_TOKEN}"

That's it.

BTW, Travis CI allow to exclude some builds from matrix, see an example in Tarantool GitHub repo.

Configuration

PackPack can be configured via environment variables:

See the full list of available options and detailed configuration guide in pack/config.mk configuration file.

The actual list of distribution is available on [Docker Hub] (https://hub.docker.com/r/packpack/packpack/tags/).

Contribution

PackPack is written on Makefiles and contains less than 300 lines of code. We've tried different variants, like Python, but GNU Make is actually the simplest (and fastest) one.

Any pull requests are welcome.

Please feel free to fork this repository for experiments. You may need to create your own repository on Docker Hub. Click to see how.

See Also

Watch a demonstration of PackPack. Please feel free to contact us if you need some help:

PackPack can be installed as a regular system tool from RPM/DEB packages.

Check out PackPack Repositories on PackageCloud.


Please "Star" this project on GitHub to help it to survive! Thanks!