dh - debhelper command sequencer
dh sequence [--until cmd] [--before cmd] [--after cmd] [--remaining] [--with addon] [debhelper options]
dh runs a sequence of debhelper commands. The supported sequences correspond to the targets of a debian/rules file: "build", "clean", "install", "binary-arch", "binary-indep", and "binary".
Commands in the binary-indep sequence are passed the "-i" option to ensure they only work on binary independent packages, and commands in the binary-arch sequences are passed the "-a" option to ensure they only work on architecture dependent packages.
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, 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. The --until, --before, --after, and --remaining options can override this behavior.
All other options passed to dh are passed on to each command it runs. This can be used to set an option like "-v" or "-X" or "-N", as well as for more specialised options.
cmd can be a full name of a debhelper command, or a substring. It'll first search for a command in the sequence exactly matching the name, to avoid any ambiguity. If there are multiple substring matches, the last one in the sequence will be used.
When --with addon is used, dh loads the perl module Debian::Debhelper::Sequence::addon. Two functions are provided to let the module add its commands to sequences:
To see what commands are included in a sequence, without actually doing anything:
dh binary-arch --no-act
This is a very simple rules file, for packages where the default sequences of commands work with no additional options.
#!/usr/bin/make -f %: dh $@
This is a simple rules file that is a good starting place for customisation. (It's also available in /usr/share/doc/debhelper/examples/rules.simple
#!/usr/bin/make -f build: build-stamp dh build touch build-stamp clean: dh clean install: build install-stamp install-stamp: dh install touch install-stamp binary-arch: install dh binary-arch binary-indep: install dh binary-indep binary: binary-arch binary-indep
Often you'll want to pass an option to ./configure. This uses dh to run all commands before dh_auto_configure(1), then runs that command by hand, and then finished up by running the rest of the sequence. You could also run ./configure by hand, instead of bothering with using dh_auto_configure. And if necessary, you can add commands to run automake, etc here too.
build: build-stamp build-stamp: dh build --before configure dh_auto_configure -- --kitchen-sink=yes dh build --after configure touch build-stamp
Here's how to skip two automated in a row (configure and build), and instead run the commands by hand.
build: build-stamp build-stamp: dh build --before configure ./mondoconfig make universe-explode-in-delight dh build --after build touch build-stamp
Another common case is wanting to run some code manually after a particular debhelper command is run.
install: build install-stamp install-stamp: dh install --until dh_fixperms # dh_fixperms has run, now override it for one program chmod 4755 debian/foo/usr/bin/foo # and continue dh install --after dh_fixperms touch install-stamp
It's also fine to run debhelper commands early. Just make sure that at least dh_prep is run from the sequence first, and be sure to use the --remaining option to ensure that commands that normally come before those in the sequence are still run.
install: build install-stamp install-stamp: dh install --until dh_prep dh_installdocs README TODO dh_installchangelogs Changes dh install --remaining touch install-stamp binary-arch: install dh_strip -X foo dh binary-arch --remaining
This program is a part of debhelper.
Joey Hess <joeyh@debian.org>