Motivation

I found that packaging .deb or .rpm is a little annoying for various reasons:

  • Remembering all the options of rpmbuild/dpkg-buildpackage/mock/cowbuilder is a pain.
  • The rpm and deb tools don’t follow the same patterns, it’s hard to switch between one and the other.
  • The upstream source recovery is a painful story.
  • Easy updates are kind of difficult, specially with several distributions and distribution version to manage.
  • Ordering the packages builds (ex: build this lib(s) before the final binary) is painful.
  • There is no “end to end” build command (From “simple check out of some packaging file” to “complete repository generated”)

To solve these issues, I’ve created a set of Makefiles with easy to remember targets like make rpm or make deb. These targets are chained in bigger targets like make deb_repo or make rpm_repo to build a complete package repository. Using Makefiles also helps for parallel builds, the error handling, and delta (re)builds. I’ve also created a few scripts to help with things like upstream source recovery, package initialization, or determining OS version.

I’ve also stolen some patterns I really liked from Gentoo and its .ebuild files:

  • Templatize upstream URLs: Most upstream normalize how they ship sources. It’s generally a tar.gz file with a fixed pattern like <NAME>-<VERSION>.tar.gz, it’s quite easy to “templatize” upstream download URLs with a $(VERSION) variable. Doing so makes updates easier, just change one variable declaration and it’s done.
  • MANIFEST files: Another thing I liked was that they keep a manifest file with the checksum of upstream sources. It permits to have a safe guard against modification of an existing upstream release, gaining some basic guaranties about build reproductibility and avoiding surprises…
  • Keeping upstream recovery and build distinct: Also the recovery of the upstream sources in Gentoo .ebuild files is a clearly distinct step from the build and install steps, no call to pip or wget in the middle of a compilation.

However, don’t expect this framework to magically package anything for you. Appart from a few metadata substitutions like version, license, packager’s email or description, this framework keeps all the knobs of regular .deb or .rpm packaging.

Name

amkecpak is just an anagram of makepack (for Make Package).

Resources

Amkecpak, a makefile based packaging framework.

https://travis-ci.org/kakwa/amkecpak.svg?branch=master Documentation Status
Doc:Documentation on ReadTheDoc
Dev:GitHub
Author:Pierre-Francois Carpentier - copyright © 2017

Packaging documentation in a nutshell

# Install the packaing tools
$ apt-get install make debhelper reprepro cowbuilder wget
# or
$ yum install make rpm-sign expect rpm-build createrepo mock wget

# Init a package foo
$ ./common/init_pkg.sh -n foo

$ cd foo/

# Implementing the package
$ vim Makefile
$ make manifest
$ vim debian/rules ; vim debian/control
$ vim rpm/component.spec

# Help for the various targets
$ make help

# Building the packages
$ make deb
$ make rpm

# Same in chroots, targeting specific distribution versions
$ make deb_chroot DIST=jessie
$ make rpm_chroot DIST=el7

$ cd ../

# gpg key generation (one time thing)
$ gpg --gen-key

# editing the global configuration
$ vim common/buildenv/Makefile.config

# Building the repositories
# Use ERROR=skip to ignore package build failures and continue building the repo
$ make deb_repo -j 4 DIST=jessie # ERROR=skip
$ make rpm_repo -j 1 DIST=el7    # ERROR=skip

If you need more information, read the detailed documentation.