набор инструментов debhelper (the debhelper tool suite)
COMPATIBILITY LEVELS
From time to time, major non-backwards-compatible changes need to
be made to debhelper, to keep it clean and well-designed as needs
change and its author gains more experience. To prevent such
major changes from breaking existing packages, the concept of
debhelper compatibility levels was introduced. You must tell
debhelper which compatibility level it should use, and it
modifies its behavior in various ways.
In current debhelper, you can specify the compatibility level in
debian/control by adding a Build-Depends on the debhelper-compat
package. For example, to use v13 mode, ensure debian/control
has:
Build-Depends: debhelper-compat (= 13)
This also serves as an appropriate versioned build dependency on
a sufficient version of the debhelper package, so you do not need
to specify a separate versioned build dependency on the debhelper
package unless you need a specific point release of debhelper
(such as for the introduction of a new feature or bugfix within a
compatibility level).
Note that debhelper does not provide debhelper-compat for
experimental or beta compatibility levels; packages experimenting
with those compatibility levels should use debian/compat or
DH_COMPAT
.
Prior versions of debhelper required specifying the compatibility
level in the file debian/compat, and current debhelper still
supports this for backward compatibility, though a package may
not specify a compatibility level via multiple methods at once.
To use this method, debian/compat should contain the
compatibility level as a single number, and no other content. If
you specify the compatibility level by this method, your package
will also need a versioned build dependency on a version of the
debhelper package equal to (or greater than) the compatibility
level your package uses. So, if you specify compatibility level
13 in debian/compat, ensure debian/control has:
Build-Depends: debhelper (>= 13~)
Unless otherwise indicated, all debhelper documentation assumes
that you are using the most recent compatibility level, and in
most cases does not indicate if the behavior is different in an
earlier compatibility level, so if you are not using the most
recent compatibility level, you're advised to read below for
notes about what is different in earlier compatibility levels.
Supported compatibility levels
These are the available compatibility levels:
v5 This is the lowest supported compatibility level.
If you are upgrading from an earlier compatibility level,
please review debhelper-obsolete-compat(7).
This mode is deprecated.
v6 Changes from v5 are:
- Commands that generate maintainer script fragments
will order the fragments in reverse order for the
prerm and postrm scripts.
- dh_installwm
will install a slave manpage link for
x-window-manager.1.gz, if it sees the man page in
usr/share/man/man1 in the package build directory.
- dh_builddeb
did not previously delete everything
matching DH_ALWAYS_EXCLUDE
, if it was set to a list
of things to exclude, such as CVS:.svn:.git
. Now it
does.
- dh_installman
allows overwriting existing man pages
in the package build directory. In previous
compatibility levels it silently refuses to do this.
This mode is deprecated.
v7 Changes from v6 are:
- dh_install
, will fall back to looking for files in
debian/tmp if it doesn't find them in the current
directory (or wherever you tell it look using
--sourcedir
). This allows dh_install
to interoperate
with dh_auto_install
, which installs to debian/tmp,
without needing any special parameters.
- dh_clean
will read debian/clean and delete files
listed there.
- dh_clean
will delete toplevel *-stamp files.
- dh_installchangelogs
will guess at what file is the
upstream changelog if none is specified.
This mode is deprecated.
v8 Changes from v7 are:
- Commands will fail rather than warning when they are
passed unknown options.
- dh_makeshlibs
will run dpkg-gensymbols
on all shared
libraries that it generates shlibs files for. So -X
can be used to exclude libraries. Also, libraries in
unusual locations that dpkg-gensymbols
would not have
processed before will be passed to it, a behavior
change that can cause some packages to fail to build.
- dh
requires the sequence to run be specified as the
first parameter, and any switches come after it. Ie,
use "dh $@ --foo
", not "dh --foo $@
".
- dh_auto_
* prefer to use Perl's Module::Build
in
preference to Makefile.PL.
This mode is deprecated.
v9 Changes from v8 are:
- Multiarch support. In particular, dh_auto_configure
passes multiarch directories to autoconf in --libdir
and --libexecdir.
- dh is aware of the usual dependencies between targets
in debian/rules. So, "dh binary" will run any build,
build-arch, build-indep, install, etc targets that
exist in the rules file. There's no need to define an
explicit binary target with explicit dependencies on
the other targets.
- dh_strip
compresses debugging symbol files to reduce
the installed size of -dbg packages.
- dh_auto_configure
does not include the source package
name in --libexecdir when using autoconf.
- dh
does not default to enabling --with=python-support
(Obsolete: As the dh_pysupport
tool was removed from
Debian stretch. Since debhelper/10.3, dh
no longer
enables this sequence add-on regardless of compat
level)
- All of the dh_auto_
* debhelper programs and dh
set
environment variables listed by dpkg-buildflags
,
unless they are already set.
- dh_auto_configure
passes dpkg-buildflags
CFLAGS,
CPPFLAGS, and LDFLAGS to perl Makefile.PL and
Build.PL
- dh_strip
puts separated debug symbols in a location
based on their build-id.
- Executable debhelper config files are run and their
output used as the configuration.
This mode is deprecated.
v10 Changes from v9 are:
- dh_installinit
will no longer install a file named
debian/package as an init script.
- dh_installdocs
will error out if it detects links
created with --link-doc between packages of
architecture "all" and non-"all" as it breaks
binNMUs.
- dh_installdeb
no longer installs a maintainer-
provided debian/package.shlibs file. This is now
done by dh_makeshlibs
instead.
- dh_installwm
refuses to create a broken package if no
man page can be found (required to register for the
x-window-manager alternative).
- Debhelper will default to --parallel
for all
buildsystems that support parallel building. This
can be disabled by using either --no-parallel
or
passing --max-parallel
with a value of 1.
- The dh
command will not accept any of the deprecated
"manual sequence control" parameters (--before
,
--after
, etc.). Please use override targets instead.
Retroactively applied to earlier compat levels
: dh
no
longer accepts any of these since debhelper/12.4.
- The dh
command will no longer use log files to track
which commands have been run. The dh
command still
keeps track of whether it already ran the "build"
sequence and skip it if it did.
The main effects of this are:
- With this, it is now easier to debug the install
or/and binary sequences because they can now
trivially be re-run (without having to do a full
"clean and rebuild" cycle)
- The main caveat is that dh_*
now only keeps track
of what happened in a single override target.
When all the calls to a given dh_cmd
command
happens in the same override target everything
will work as before.
Example of where it can go wrong:
override_dh_foo:
dh_foo -pmy-pkg
override_dh_bar:
dh_bar
dh_foo --remaining
In this case, the call to dh_foo --remaining
will
also include my-pkg, since dh_foo -pmy-pkg
was
run in a separate override target. This issue is
not limited to --remaining
, but also includes -a
,
-i
, etc.
- The dh_installdeb
command now shell-escapes the lines
in the maintscript config file. This was the
original intent but it did not work properly and
packages have begun to rely on the incomplete shell
escaping (e.g. quoting file names).
- The dh_installinit
command now defaults to
--restart-after-upgrade
. For packages needing the
previous behaviour, please use
--no-restart-after-upgrade
.
- The autoreconf
sequence is now enabled by default.
Please pass --without autoreconf
to dh
if this is not
desirable for a given package
- The systemd
sequence is now enabled by default.
Please pass --without systemd
to dh
if this is not
desirable for a given package.
- Retroactively removed
: dh
no longer creates the
package build directory when skipping running
debhelper commands. This will not affect packages
that only build with debhelper commands, but it may
expose bugs in commands not included in debhelper.
This compatibility feature had a bug since its
inception in debhelper/9.20130516 that made it fail
to apply in compat 9 and earlier. As there has been
no reports of issues caused by this bug in those ~5
years, this item have been removed rather than fixed.
v11 This mode is discouraged.
The compat 11 is discouraged for new packages as it suffers
from feature interaction between dh_installinit and
dh_installsystemd causing services to not run correctly in
some cases. Please consider using compatibility mode 10 or
12 instead. More details about the issue are available in
Debian#887904 and
<https://lists.debian.org/debian-release/2019/04/msg01442.html>.
Changes from v10 are:
- dh_installinit
no longer installs service or tmpfile
files, nor generates maintainer scripts for those
files. Please use the new dh_installsystemd
helper.
- The dh_systemd_enable
and dh_systemd_start
helpers
have been replaced by the new dh_installsystemd
helper. For the same reason, the systemd
sequence
for dh
has also been removed. If you need to disable
the dh_installsystemd
helper tool, please use an
empty override target.
Please note that the dh_installsystemd
tool has a
slightly different behaviour in some cases (e.g. when
using the --name
parameter).
- dh_installdirs
no longer creates debian/package
directories unless explicitly requested (or it has to
create a subdirectory in it).
The vast majority of all packages will be unaffected
by this change.
- The makefile
buildsystem now passes INSTALL="install
--strip-program=true"
to make(1). Derivative
buildsystems (e.g. configure
or cmake
) are unaffected
by this change.
- The autoconf
buildsystem now passes
--runstatedir=/run
to ./configure.
- The cmake
buildsystem now passes
-DCMAKE_INSTALL_RUNSTATEDIR=/run
to cmake
(1).
- dh_installman
will now prefer detecting the language
from the path name rather than the extension.
- dh_auto_install
will now only create the destination
directory it needs. Previously, it would create the
package build directory for all packages. This will
not affect packages that only build with debhelper
commands, but it may expose bugs in commands not
included in debhelper.
- The helpers dh_installdocs
, dh_installexamples
,
dh_installinfo
, and dh_installman
now error out if
their config has a pattern that does not match
anything or reference a path that does not exist.
Known exceptions include building with the nodoc
profile, where the above tools will silently permit
failed matches where the patterns are used to specify
documentation.
- The helpers dh_installdocs
, dh_installexamples
,
dh_installinfo
, and dh_installman
now accept the
parameter --sourcedir
with same meaning as
dh_install
. Furthermore, they now also fall back to
debian/tmp like dh_install
.
Migration note: A bug in debhelper 11 up to 11.1.5
made dh_installinfo
incorrectly ignore --sourcedir
.
- The perl-makemaker
and perl-build
build systems no
longer pass -I.
to perl. Packages that still need
this behaviour can emulate it by using the PERL5LIB
environment variable. E.g. by adding export
PERL5LIB=.
in their debian/rules file (or similar).
- The PERL_USE_UNSAFE_INC
environment variable is no
longer set by dh
or any of the dh_auto_*
tools. It
was added as a temporary work around to avoid a lot
of packages failing to build at the same time.
Note this item will eventually become obsolete as
upstream intends to drop support for the
PERL_USE_UNSAFE_INC
environment variable. When perl
drops support for it, then this variable will be
removed retroactively from existing compat levels as
well.
- The dh_makeshlibs
helper will now exit with an error
if objdump returns a non-zero exit from analysing a
given file.
- The dh_installdocs
and dh_installexamples
tools may
now install most of the documentation in a different
path to comply with the recommendation from Debian
policy §12.3 (since version 3.9.7).
Note that if a given source package only contains a
single binary package in debian/control or none of
the packages are -doc packages, then this change is
not relevant for that source package and you can skip
to the next change.
By default, these tools will now attempt to determine
a "main package for the documentation" (called a doc-
main-package from here on) for every -doc package.
If they find such a doc-main-package, they will now
install the documentation into the path
/usr/share/doc/doc-main-package in the given doc
package. I.e. the path can change but the
documentation is still shipped in the -doc package.
The --doc-main-package
option can be used when the
auto-detection is insufficient or to reset the path
to its previous value if there is a reason to diverge
from Debian policy recommendation.
Some documentation will not be affected by this
change. These exceptions include the copyright file,
changelog files, README.Debian, etc. These files
will still be installed in the path
/usr/share/doc/package.
- The dh_strip
and dh_shlibdeps
tools no longer uses
filename patterns to determine which files to
process. Instead, they open the file and look for an
ELF header to determine if a given file is an shared
object or an ELF executable.
This change may cause the tools to process more files
than previously.
v12 Changes from v11 are:
- The dh_makeshlibs
tool now generates shlibs files
with versioned dependency by default. This means
that -VUpstream-Version
(a.k.a. -V
) is now the
default.
If an unversioned dependency in the shlibs file is
wanted, this can be obtained by passing -VNone
instead. However, please see dh_makeshlibs(1) for
the caveat of unversioned dependencies.
- The -s
(--same-arch
) option is removed. Please use
-a
(--arch
) instead.
- Invoking dh_clean -k
now causes an error instead of a
deprecation warning.
- The --no-restart-on-upgrade
option in dh_installinit
has been removed. Please use the new name
--no-stop-on-upgrade
- There was a bug in the doit
(and similar) functions
from Debian::Debhelper::Dh_Lib that made them spawn a
shell in one particular circumstance. This bug is
now removed and will cause helpers that rely on the
bug to fail with a "command not found"-error.
- The --list-missing
and --fail-missing
in dh_install
has been removed. Please use dh_missing
and its
corresponding options, which can also see the files
installed by other helpers.
- The dh_installinit
helper no longer installs
configuration for the upstart init system. Instead,
it will abort the build if it finds an old upstart
configuration file. The error is there to remind the
package maintainer to ensure the proper removal of
the conffiles shipped in previous versions of the
package (if any).
- The dh_installdeb
tool will do basic validation of
some dpkg-maintscript-helper(1) commands and will
error out if the commands appear to be invalid.
- The dh_missing
tool will now default to
--list-missing
.
- The dh_makeshlibs
tool will now only pass libraries
to dpkg-gensymbols(1) if the ELF binary has a SONAME
(containing ".so").
- The dh_compress
tool no longer compresses examples
(i.e. anything installed in
</usr/share/doc/package/examples>.)
- The standard sequence in dh
now includes dh_dwz
and
dh_installinitramfs
by default. This makes the dwz
and installinitramfs
sequences obsolete and they will
now fail with an error. If you want to skip these
commands, then please insert an empty override target
for them in debian/rules (e.g. override_dh_dwz:)
- The build systems meson
and autoconf
no longer
explicitly set the --libexecdir
variable and thus
relies on the build system default - which should be
/usr/libexec
(per FHS 3.0, adopted in Debian Policy
4.1.5).
If a particular upstream package does not use the
correct default, the parameter can often be passed
manually via dh_auto_configure(1). E.g. via the
following example:
override_dh_auto_configure:
dh_auto_configure -- --libexecdir=/usr/libexec
Note the --
before the --libexecdir
parameter.
- Retroactively removed in debhelper/13.5
:
The dh_installdeb
tool would no longer installs the
maintainer provided conffiles file as it was deemed
unnecessary. However, the remove-on-upgrade
from
dpkg/1.20 made the file relevant again and
dh_installdeb
now installs it again in compat levels
12+.
- The dh_installsystemd
tool no longer relies on
dh_installinit
for handling systemd services that
have a sysvinit alternative. Both tools must now be
used in such a case to ensure the service is properly
started under both sysvinit and systemd.
If you have an override for dh_installinit
(e.g. to
call it with --no-start
) then you will probably need
one for dh_installsystemd
as well now.
This change makes dh_installinit
inject a
misc:Pre-Depends for init-system-helpers (>= 1.54~)
.
Please ensure that the package lists
${misc:Pre-Depends}
in its Pre-Depends
field before
upgrading to compat 12.
- The third-party dh_golang
tool (from dh-golang
package) now defaults on honoring DH_GOLANG_EXCLUDES
variable for source installation in -dev packages and
not only during the building process. Please set
DH_GOLANG_EXCLUDES_ALL
to false to revert to the
previous behaviour. See
Debian::Debhelper::Buildsystem::golang(3pm)
for
details and examples.
- dh_installsystemduser
is now included in the dh
standard sequence by default.
- The python-distutils
buildsystem is now removed.
Please use the third-party build system pybuild
instead.
v13 This is the recommended mode of operation.
Changes from v12 are:
- The meson+ninja
build system now uses meson test
instead of ninja test
when running the test suite.
Any override of dh_auto_test
that passes extra
parameters to upstream test runner should be reviewed
as meson test
is not command line compatible with
ninja test
.
- All debhelper like tools based on the official
debhelper library (including dh
and the official dh_*
tools) no longer accepts abbreviated command
parameters. At the same time, dh
now optimizes out
calls to redundant dh_*
helpers even when passed long
command line options.
- The ELF related debhelper tools (dh_dwz
, dh_strip
,
dh_makeshlibs
, dh_shlibdeps
) are now only run for
arch dependent packages by default (i.e. they are
excluded from *-indep
targets and are passed -a
by
default). If you need them for *-indep
targets, you
can add an explicit Build-Depends on dh-sequence-elf-
tools
.
- The third-party gradle
build system (from gradle-
debian-helper
package) now runs the upstream-provided
test suite automatically. To suppress such behavior,
override dh_auto_test
.
- The dh_installman
tool now aborts if it sees
conflicting definitions of a manpage. This typically
happens if the upstream build system is installing a
compressed version and the package lists an
uncompressed version of the manpage in
debian/package.manpages. Often the easiest fix is to
remove the manpage from debian/package.manpages
(assuming both versions are identical).
- The dh_auto_*
helpers now reset the environment
variables HOME
and common XDG_*
variable. Please see
description of the environment variables in
"ENVIRONMENT" for how this is handled.
This feature changed between debhelper 13 and
debhelper 13.2.
- The dh
command will now error if an override or hook
target for an obsolete command are present in
debian/rules (e.g. override_dh_systemd_enable:
).
- The dh_missing
command will now default to
--fail-missing
. This can be reverted to a non-fatal
warning by explicitly passing --list-missing
like it
was in compat 12.
If you do not want the warning either, please omit
the call to dh_missing
. If you use the dh
command
sequencer, then you can do this by inserting an empty
override target in the debian/rules file of the
relevant package. As an example:
# Disable dh_missing
override_dh_missing:
- The dh
command sequencer now runs dh_installtmpfiles
in the default sequence. The dh_installtmpfiles
takes over handling of tmpfiles.d configuration
files. Related functionality in dh_installsystemd
is
now disabled.
Note that dh_installtmpfiles
responds to
debian/package.tmpfiles where dh_installsystemd
used
a name without the trailing "s".
- Many dh_*
tools now support limited variable
expansion via the ${foo}
syntax. In many cases, this
can be used to reference paths that contain either
spaces or dpkg-architecture(1) values. While this
can reduce the need for dh-exec
(1) in some cases, it
is not
a replacement dh-exec
(1) in general. If you
need filtering, renaming, etc., the package will
still need dh-exec
(1).
Please see "Substitutions in debhelper config files"
for syntax and available substitution variables. To
dh_*
tool writers, substitution expansion occurs as a
part of the filearray
and filedoublearray
functions.
- The dh
command sequencer will now skip all hook and
override targets for dh_auto_test
, dh_dwz
and
dh_strip
when DEB_BUILD_OPTIONS
lists the relevant
nocheck
/ nostrip
options.
Any package relying on these targets to always be run
should instead move relevant logic out of those
targets. E.g. non-test related packaging code from
override_dh_auto_test
would have to be moved to
execute_after_dh_auto_build
or
execute_before_dh_auto_install
.
- The cmake
buildsystem now passes
-DCMAKE_SKIP_INSTALL_ALL_DEPENDENCY=ON
to cmake
(1) to
speed up automatic installation process. If for some
reason you need previous behavior, override the flag:
dh_auto_configure -- -DCMAKE_SKIP_INSTALL_ALL_DEPENDENCY=OFF ...
v14 This compatibility level is still open for development; use
with caution.
Changes from v13 are:
- The cmake
buildsystem now passes
-DCMAKE_SKIP_RPATH=ON
and
-DCMAKE_BUILD_RPATH_USE_ORIGIN=ON
to cmake
(1) to
avoid some reproducibility issues.
This can cause issues with running binaries directly
from the build directories as they might now require
a manually set LD_LIBRARY_PATH
. If you need to
override this change, we recommend that you try to
pass the -DCMAKE_SKIP_RPATH=OFF
option first to see
if that fixes the problem (leaving
CMAKE_BUILD_RPATH_USE_ORIGIN
at its new default).
This should undo the need for LD_LIBRARY_PATH
and
avoid the reproducibility issues on Linux, where
$ORIGIN
is supported by the runtime linkers.
- The tool dh_installsysusers
is now included in the
default sequence.
- Use of the dh_gconf
command in override and hook
targets now causes an error. The dh_gconf
command
has been a no-op for years and was removed in
debhelper 13.4.