Debian Package Building

Jurjen Bokma

June 2014

Abstract

This is not about how to construct a package source. It's only on how to build packages from a given source. We go from simple dpkg-buildpackage to git-buildpackage for multiple distros.


Table of Contents

dpkg-buildpackage

The simplest way to build a package.

  1. apprentice@host:~/packaging$ apt-get source bash

  2. apprentice@host:~/packaging$ cd bash-4.2
    apprentice@host:~/packaging/bash-4.2$ dpkg-buildpackage
    <snip>
    dpkg-checkbuilddeps: Unmet build dependencies: bison texi2html gettext:any sharutils
    <snip>

  3. apprentice@host:~/packaging/bash-4.2$ sudo apt-get install bison texi2html gettext sharutils
    apprentice@host:~/packaging/bash-4.2$ dpkg-buildpackage -d
    <snip lengthy output>

    (There's often some trickery involved in building packages. The '-d' option is to prevent bash from choking on 'gettext:any', which is listed as a dependency, but satisfied by 'gettext'.)

  4. apprentice@host:~/packaging/bash-4.2$ ls -trl ..
    total 7332
    -rw-rw-r-- 1 apprentice apprentice 4266049 Feb 24  2011 bash_4.2.orig.tar.gz
    -rw-rw-r-- 1 apprentice apprentice   85337 Jun 28 15:43 bash_4.2-2ubuntu2.1.diff.gz
    -rw-rw-r-- 1 apprentice apprentice    1348 Jun 28 15:43 bash_4.2-2ubuntu2.1.dsc
    drwxrwxr-x 9 apprentice apprentice    4096 Jun 28 15:49 bash-4.2
    -rw-r--r-- 1 apprentice apprentice 1201528 Jun 28 15:49 bash-doc_4.2-2ubuntu2.1_all.deb
    -rw-r--r-- 1 apprentice apprentice  986702 Jun 28 15:49 bash_4.2-2ubuntu2.1_amd64.deb
    -rw-r--r-- 1 apprentice apprentice   92116 Jun 28 15:49 bash-builtins_4.2-2ubuntu2.1_amd64.deb
    -rw-r--r-- 1 apprentice apprentice  851998 Jun 28 15:49 bash-static_4.2-2ubuntu2.1_amd64.deb
    -rw-rw-r-- 1 apprentice apprentice    2432 Jun 28 15:49 bash_4.2-2ubuntu2.1_amd64.changes

There are some intersting options to dpkg-buildpackage:

  • -us -uc to sign neither binary packages not changes files.

  • -sa to include the orig.tar.gz in the source package.