Version number cheatsheet


debhelper - Version number cheatsheet


This is a guide detailing some common packaging scenarios, and the version of debhelper required for them. Contributions are welcomed, especially for any packaging scenarios not already discussed here.

Most Common Scenarios

Forcing Special Tests

Often, Perl packages will have special tests designated for certain environments only. It is often quite beneficial for us to run these tests during build-time, so we prefer to add the tests (if packaged) to Build-Depends-Indep.

Usually there is an environment variable, like AUTOMATED_TESTING, that will run these tests, however. You could enable this flag (and thus the tests) using:

Sometimes tests need X server in order to run. In this case the xvfb(1) and the xauth(1) packages should be declared as Build-Depends. debhelper overrides should be:

dh –with bash-completion

To install bash_completion snippets you may use:

Short debian/rules Format

Older versions of the rules file were pretty long and repetitive. To get most of the same features by default, all you have to do is:

Note that the latest version of dh-make-perl does this automatically.

Occasionally Useful

Note on Paths

In order to save on typing, be a bit lazy and improve a little bit on maintainability and readability of the file, the following variables are typically placed at the top of your debian/rules file when there are some file operations involved.

If the source package contains more than one binary packages dh_listpackagesreturns all of them, so you probably want to use:

Then any of your paths become pretty trivial, you can specify them as: $(TMP)/usr/share/path/to/file. Otherwise, you can accomplish the same thing with: $(CURDIR)/debian/package-name/usr/share/path/to/file

If you need the perl library path, which is variable since 5.20, you can use

and later e.g. $(TMP)/$(ARCHLIB)/....

Removing Something

A File

If for some reason you’re not able to distribute a file, then you’ll need to repack it. But if it’s just causing issues like warnings with lintian or you otherwise don’t want it installed, then you can remove it during build time by adding this override:

A Directory

Sometimes you want to remove an entire directory post-install. You can do that too, but it usually helps to have some extra tests so that the ‘rm’ operation doesn’t make too much noise.

This removes empty directories, ensuring you don’t accidentally destroy things that should be installed. If the package is installing files that you don’t need, remove the files first before removing the empty directory.

If you’re really sure, you could also do:

But this might be dangerous, so it’s not recommended.

Fixing Permissions

Sometimes debhelper’s fix permissions stage (dh_fixperms) sets the wrong permissions for a given file. You can use an override to fix this, like so:

Fixing Interpreter Shebang Lines

Sometimes examples are Perl scripts that do not use the absolute path of the Perl interpreter in the shebang line. In these cases, they should be rewritten to /usr/bin/perl:

Another elegant method for achieving substitution of the shebang from /usr/local/bin/perl to /usr/bin/perl would be:

Parallel building

Some upstream build systems are not parallel-build safe. debhelper’s --max-parallel can be used to disable parallel building:

Note that debhelper does not enable parallel building automatically before compat level 10.

Skipping tests

Sometimes we want to skip a specific test, i.e. when it needs internet access. An option to do this is:

Running tests needing writable HOME

Sometimes tests need to have access to a writable $HOME.


The following people have contributed to the maintainership of this file:

* Jonathan Yu

* Tim Retout

* gregor herrmann

* Damyan Ivanov