Search code examples
debhelper

Default sequence of debhelper


I am trying to get a better understanding of debhelper's dh tool. As I understand it, dh is a frontend for various dh_* helper tools. These helper tools can both be called standalone or automatically from the dh tool. Usually a debian/rules file is created which somehow invokes dh and possibly overrides certain dh_* invocations. dh then seems to know which of the dh_* tools it needs to invoke and in which sequence.

The example under /usr/share/doc/debhelper/examples/rules.tiny contains the following as an example for a debian/rules file:

#!/usr/bin/make -f
%:
    dh $@

What is the sequence of dh_* helper tools that gets executed by dh as result of this rules file? And more importantly, how does dh determine this sequence and where is this documented.


Solution

  • The sequence of helper tools that will get executed depends on a few things:

    1. what build target is being passed. these include: build-arch, build-indep, build, clean, install-indep, install-arch, install, binary-arch, binary-indep, and binary. The meanings of (most of) these are discussed in Debian Policy §4.9.
    2. the Debhelper compat level (as found in the debian/compat file)
    3. your version of Debhelper (although an effort is made to make different versions work the same given the same compat level)
    4. what helper commands have already been run since the last clean (in debhelper compat levels 9 and lower)
    5. what addons are being used (the --with and --without options)
    6. what override targets exist in the makefile (e.g. override_dh_auto_test)

    As you can see, it could be confusing to document which commands are run, in which order, for all the possible build targets and configuration arrangements (or even just for the most common ones). The way to know, therefore, is to use the --no-act argument to dh, with your build directory set up the way you want it.

    Here is an example run with the binary target in a dummy build directory I've just made using dh_make, put into compat level 10. The exact commands or the exact ordering you will see will likely be slightly different:

    ~/dh-demo$ dh binary --no-act
        dh_testdir
        dh_update_autotools_config
        dh_autoreconf
        dh_auto_configure
        dh_auto_build
        dh_auto_test
        dh_testroot
        dh_prep
        dh_installdirs
        dh_auto_install
        dh_install
        dh_installdocs
        dh_installchangelogs
        dh_installexamples
        dh_installman
        dh_installcatalogs
        dh_installcron
        dh_installdebconf
        dh_installemacsen
        dh_installifupdown
        dh_installinfo
        dh_systemd_enable
        dh_installinit
        dh_systemd_start
        dh_installmenu
        dh_installmime
        dh_installmodules
        dh_installlogcheck
        dh_installlogrotate
        dh_installpam
        dh_installppp
        dh_installudev
        dh_installgsettings
        dh_bugfiles
        dh_ucf
        dh_lintian
        dh_gconf
        dh_icons
        dh_perl
        dh_usrlocal
        dh_link
        dh_installwm
        dh_installxfonts
        dh_strip_nondeterminism
        dh_compress
        dh_fixperms
        dh_strip
        dh_makeshlibs
        dh_shlibdeps
        dh_installdeb
        dh_gencontrol
        dh_md5sums
        dh_builddeb