Packaging tips for unofficial Debian packages
This page offers some tips and tricks on how to
build and maintain an unofficial Debian package repository.
Before using this information, you should have read the Debian packaging
paragraph of the
If you just wanted to search for existing packages, hop over to the Unofficial APT repositories.
First things first: setting the maintainer email
You can set the DEBEMAIL environment variable if you like to have a different email address for Debian packaging. This address will be used in the package metadata information.
$ export DEBEMAILemail@example.com
Setting up the package directory
Generate a separate directory where all the package data will be put in. Download and extract the dh_make templates and the package build Makefile. Installing mini-dinstall and dput finishes up the preparation.
$ mkdir $HOME/packages $ cd $HOME/packages $ wget http://people.debian.org/~calvin/unofficial/package.tar.gz $ tar xzvf package.tar.gz $ sudo apt-get install dput mini-dinstall
Adding a source package
Now it is time to download a source package, let's call it
mypackage-1.0.tar.gz, and extract it.
dh_make is run within the extracted source
directory. A few questions will pop up which should be answered
Now you are ready to edit the files in the
directory which the next paragraphs will describe.
$ wget http://example.org/mypackage-1.0.tar.gz $ tar xzvf mypackage-1.0.tar.gz $ cd mypackage-1.0 && \ dh_make --templates $HOME/packages/dhtemplates -f ../mypackage-1.0.tar.gz; \ cd ..
The Debian package version number is parsed from the
top entry of
mypackage (1.0-0joe1) unstable; urgency=low.
`-0joe1' is the debian release number.
Subsequent releases have release numbers
If there is already an official package, for example with version
`1.0-4', then use
You can compare versions with
dpkg(8) manpage for more info.
$ dpkg --compare-versions "1.0-4.1" gt "1.0-4joe5" && \ echo "NMU version -4.1 greater than -4joe5"
Advanced package versioning
The above scheme is not sufficient in some cases which I will explain here.
- The package version is a beta version or release candidate, for example
Problems will arise because dpkg will consider the final version
1.0lower than the beta or release candidate version. The solution is to use a version like
0.99+1.0rc2-0joe1which uses a lower version than
0.99) and joins the release candidate version with a plus sign. This way the final version is greater than the previous one:
0.99+1.0rc2-0joe1 < 1.0-0joe1.
- The new upstream version is lower than the previous one.
How can this happen? A simple typo for example. Instead of
1.0someone uploaded the package as version
10.0. Now the new upstream version
1.1is not greater than the last one. Solution is to use an epoch:
10.0-0joe1 < 1:1.1-0joe1. See the Debian Policy epoch entry for an explanation.
The package description in
should note that this is not an
official Debian package. Note that there is a single space at the
beginning of each line below the
Description: this is mypackage *** Unofficial package from firstname.lastname@example.org *** . [description follows]
The standard tool for reporting bugs is
/usr/share/doc/reportbug/README.developers for more info.
Your package should have the file
with the following content:
Building the package
Now add the
mypackage target to the
There is already an example there, just adjust it.
The package should be signed with your GPG key (run
gpg --gen-key to generate one).
GPGKEY variable to hold your GPG key id.
After that, build the package:
$ make mypackage
Making it apt-get'able
Copy the mini-dinstall configuration into
$HOME/.mini-dinstall.conf and adjust it to your needs.
Do the same with the dput configuration, putting it in
After that, run dput to install the package into the repository.
$ dput local mypackage_1.0-0joe1.changes
/etc/apt/sources.list and add the deb and deb-src lines.
By putting the files onto a web server, others can also access it with
the http:// protocol.
# /etc/apt/sources.list # local repository deb file:/home/joe/public_html/debian unstable/ deb-src file:/home/joe/public_html/debian unstable/ # http repository deb http://www.joesdomain.org/~joe/debian unstable/ deb-src http://www.joesdomain.org/~joe/debian unstable/