目次
Let’s describe more basics on Debian packaging.
All customization data for the Debian source package resides in the debian/ directory as presented in 「「Step 3: Modification to the template files」」:
When these are not sufficient to make a good Debian package, -p1 patches of debian/patches/* files are deployed to modify the upstream source. These are applied in the sequence defined in the debian/patches/series file before building the package as presented in 「「Step 3 (alternatives): Modification to the upstream source」」.
You should address the root cause of the Debian packaging problem by the least invasive way. The generated package shall be more robust for future upgrades in this way.
注記 | |
---|---|
Send the patch addressing the root cause to the upstream maintainer if it is useful to the upstream. |
Flexible customization of the 「debian/rules file」 is realized by adding appropriate override_dh_* targets and their rules.
Whenever some special operation is required for a certain dh_foo command invoked by the dh command, any automatic execution of it can be overridden by adding the makefile target override_dh_foo in the debian/rules file.
The build process may be customized via the upstream provided interface such as arguments to the standard source build system commands, such as:
If this is the case, you should add the override_dh_auto_build target with 「dh_auto_build -- arguments」. This ensures passing arguments to the build system after the default parameters that dh_auto_build usually passes.
ヒント | |
---|---|
Please try not to execute the bare build system commands directly if they are supported by the dh_auto_build command. |
See:
Some variable definitions useful for customizing debian/rules can be found in files under /usr/share/dpkg/. Notably:
For example, you can add an extra option to CONFIGURE_FLAGS for linux-any target architectures by adding the followings to debian/rules:
DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS) ... ifeq ($(DEB_HOST_ARCH_OS),linux) CONFIGURE_FLAGS += --enable-wayland endif
See 「「マルチアーチ」」, dpkg-architecture(1) and dpkg-buildflags(1).
When a new upstream release tarball foo-newvwesion.tar.gz is released, the Debian source package can be updated by invoking commands in the old source tree as:
$ uscan ... foo-newversion.tar.gz downloaded $ uupdate -v newversion ../foo-newversion.tar.gz
After the above, you should refresh debian/patches/* files (see 「「Manage patch queue with dquilt」」) and update debian/changelog with the dch(1) command.
When 「debian uupdate」 is specified at the end of line in the debian/watch file, uscan automatically executes uupdate(1) after downloading the tarball.
You can add, drop, and refresh debian/patches/* files with dquilt to manage patch queue.
Add a new patch debian/patches/bugname.patch recording the upstream source modification on the file buggy_file as:
$ dquilt push -a $ dquilt new bugname.patch $ dquilt add buggy_file $ vim buggy_file ... $ dquilt refresh $ dquilt header -e $ dquilt pop -a
Drop (== disable) an existing patch
Refresh debian/patches/* files to make 「dpkg-source -b」 work as expected after updating a Debian package to the new upstream release.
$ uscan; uupdate # updating to the new upstream release $ while dquilt push; do dquilt refresh ; done $ dquilt pop -a
Here is a recap of popular low level package build commands. There are many ways to do the same thing.
The sbuild(1) command is a wrapper script of dpkg-buildpackage which builds Debian binary packages in a chroot environment managed by the schroot(1) command. For example, building for Debian unstable suite can be done as:
$ sudo sbuild -d unstable
In schroot(1) terminology, this builds a Debian package in a clean ephemeral chroot 「chroot:unstable-amd64-sbuild」 started as a copy of the clean minimal persistent chroot 「source:unstable-amd64-sbuild」.
This build environment was set up as described in 「「sbuild setup」」 with 「sbuild-debian-developer-setup -s unstable」 which essentially did the following:
$ sudo mkdir -p /srv/chroot/dist-amd64-sbuild $ sudo sbuild-createchroot unstable /srv/chroot/unstable-amd64-sbuild http://deb.debian.org/debian $ sudo usermod -a -G sbuild <your_user_name> $ sudo newgrp -
The schroot(1) configuration for unstable-amd64-sbuild was generated at /etc/schroot/chroot.d/unstable-amd64-sbuild.$suffix :
[unstable-amd64-sbuild] description=Debian sid/amd64 autobuilder groups=root,sbuild root-groups=root,sbuild profile=sbuild type=directory directory=/srv/chroot/unstable-amd64-sbuild union-type=overlay
Here:
You can update this source chroot 「source:unstable-amd64-sbuild」 by:
$ sudo sbuild-update -udcar unstable
You can log into this source chroot 「source:unstable-amd64-sbuild」 by:
$ sudo sbuild-shell unstable
ヒント | |
---|---|
If your source chroot filesystem is missing packages such as libeatmydata1, ccache, and lintian for your needs, you may want to install these by logging into it. |
The orig.tar.gz file may need to be uploaded for a Debian revision other than 0 or 1 under some exceptional cases (e.g., for a security upload).
When an essential package becomes a non-essential one (e.g., adduser), you need to remove it manually from the existing chroot environment for its use by piuparts.
When you first upload the package to the archive, you need to include the original orig.tar.gz source, too.
If the Debian revision number of the package is either 1 or 0, this is the default. Otherwise, you must provide the dpkg-buildpackage option -sa to the dpkg-buildpackage command.
ヒント | |
---|---|
On the other hand, the -sd option will force the exclusion of the original orig.tar.gz source. |
ヒント | |
---|---|
Security uploads require including the orig.tar.gz file. |
If you created multiple entries in the debian/changelog while skipping uploads, you must create a proper *_.changes file which includes all changes since the last upload. This can be done by specifying the dpkg-buildpackage option -v with the last uploaded version, e.g., 1.2.
The reportbug(1) command used for the bug report of binarypackage can be customized by the files in usr/share/bug/binarypackage/.
The dh_bugfiles command installs these files from the template files in the debian/ directory.
debian/binarypackage.bug-control → usr/share/bug/binarypackage/control
debian/binarypackage.bug-presubj → usr/share/bug/binarypackage/presubj
debian/binarypackage.bug-script → usr/share/bug/binarypackage or usr/share/bug/binarypackage/script
See dh_bugfiles(1) and 「reportbug’s Features for Developers (README.developers)」
ヒント | |
---|---|
If you always remind the bug reporter of something or ask them about their situation, use these files to automate it. |