tpkg

Application packaging and deployment


Open Source and other 3rd party libraries and applications play an important role in many environments. This page has best practices and tips for packaging 3rd party software.

Versioning

The version number of the package should match the upstream version number of the software being packaged. The "package_version" number should be an integer starting at 1 that is incremented with each package build. The package version reflects changes in the package, like the package directory structure, file permissions, any local additions to the package like init scripts, etc.

Dynamic Linking/Shared Libraries

This isn't specific to 3rd party libraries, but seems worth mentioning here. We do not recommend adding /opt/tpkg/lib or other directories to the system's linker configuration, nor do we recommend a global LD_LIBRARY_PATH variable. If you are building a package that is dynamically linked against libraries contained in other tpkgs you should use the -R or -rpath option to the linker to ensure the path to the library is contained in any executables you build.

Autoconf

Third party applications that manage builds via autoconf (i.e. have a ./configure script) are generally easily packaged. The set of steps to build a package of such an application generally runs like:

./configure --prefix=/opt/tpkg
make
pkgdir=`mktemp -d`
mkdir $pkgdir/root
make install DESTDIR=$pkgdir/root (or make install prefix=$pkgdir/reloc to make a relocatable package)
Place an appropriate tpkg.yml/tpkg.xml in $pkgdir
tpkg --make $pkgdir

See the pkgs git repo for scripts we use to build packages of some common applications.

Ruby Gems

Gems can be packaged using the gem2tpkg utility distributed with tpkg. Gems that don't require special options can be packaged as simply as gem2tpkg rails, or if you want a version other than the latest: gem2tpkg rails --version 2.1.2. Any dependencies will automatically be packaged as well. Check the BUILD script in any of the gem- directories in this directory in git for more advanced examples.

Perl CPAN Modules

CPAN modules can be packaged using the cpan2tpkg utility distributed with tpkg. Modules that don't require special options can be packaged as simply as cpan2tpkg File::Cat, or if you want a version other than the latest: cpan2tpkg File::Cat --version 1.1. Currently dependencies are not automatically packaged (they should be, but it is not working). Check the BUILD script in any of the cpan- directories in this directory in git for more advanced examples.

View on GitHub