If you're curious about dh
's internals, here's how it works under
the hood.
In compat 10 (or later), dh
creates a stamp file
debian/debhelper-build-stamp after the build step(s) are complete
to avoid re-running them. It is possible to avoid the stamp file
by passing --without=build-stamp
to dh
. This makes "no clean"
builds behave more like what some people expect at the expense of
possibly running the build and test twice (the second time as
root or under fakeroot
(1)).
Inside an override target, dh_*
commands will create a log file
debian/package.debhelper.log to keep track of which packages the
command(s) have been run for. These log files are then removed
once the override target is complete.
In compat 9 or earlier, each debhelper command will record when
it's successfully run in debian/package.debhelper.log. (Which
dh_clean
deletes.) So dh
can tell which commands have already
been run, for which packages, and skip running those commands
again.
Each time dh
is run (in compat 9 or earlier), it examines the
log, and finds the last logged command that is in the specified
sequence. It then continues with the next command in the
sequence.
A sequence can also run dependent targets in debian/rules. For
example, the "binary" sequence runs the "install" target.
dh
uses the DH_INTERNAL_OPTIONS
environment variable to pass
information through to debhelper commands that are run inside
override targets. The contents (and indeed, existence) of this
environment variable, as the name might suggest, is subject to
change at any time.
Commands in the build-indep
, install-indep
and binary-indep
sequences are passed the -i
option to ensure they only work on
architecture independent packages, and commands in the build-
arch
, install-arch
and binary-arch
sequences are passed the -a
option to ensure they only work on architecture dependent
packages.