Table of Contents
Das Paket build-essential muss in Ihrer Bauumgebung installiert sein.
Das Paket devscripts sollte in der Betreuerumgebung installiert werden.
Although this is not necessarily an absolute requirement, it is a good idea to install and set up all of the popular set of packages mentioned in this chapter in the maintainer environment. This enables us to share the common baseline working environment.
Please install the tools mentioned in the Overview of Debian Maintainer Tools in the “Debian Developer’s Reference”, as needed, too.
![]() |
Caution |
---|---|
Tool setups presented here are only meant as an example and may not be up-to-date with the latest packages on the system. Debian development is a moving target. Please make sure to read the pertinent documentation and update the configuration as needed. |
Verschiedene Debian-Betreuungswerkzeuge erkennen Ihre zu verwendene E-Mail-Adresse und Ihren Namen über die Shell-Umgebungsvariablen $DEBEMAIL und $DEBFULLNAME.
Let’s setup these packages by adding the following lines to ~/.bashrc [6].
Fügen Sie zur ~/.bashrc folgendes hinzu.
DEBEMAIL="your.email.address@example.org" DEBFULLNAME="Firstname Lastname" export DEBEMAIL DEBFULLNAME
The mc command offers very easy ways to manage files. It can open the binary deb file to check its content by pressing the Enter key over the binary deb file. It uses the dpkg-deb command as its back-end. Let’s set it up to support easy chdir as follows.
Fügen Sie zur ~/.bashrc folgendes hinzu.
# mc related export HISTCONTROL=ignoreboth . /usr/lib/mc/mc.sh
Heutzutage ist der Befehl git ein unverzichtbares Werkzeug, um den Quellbau mit Verlauf zu verwalten.
Die globale Benutzerkonfiguration für den Befehl git, wie Ihren Namen und Ihre E-Mail-Adresse, können in ~/.gitconfig wie folgt gesetzt werden:
$ git config --global user.name "Name Surname" $ git config --global user.email yourname@example.com
Falls Sie an die CVS- oder Subversion-Befehle gewöhnt sind, möchten Sie vielleicht eine Reihe von Aliasen wie folgt setzen:
$ git config --global alias.ci "commit -a" $ git config --global alias.co checkout
Sie können Ihre globale Konfiguration wie folgt prüfen:
$ git config --global --list
![]() |
Tip |
---|---|
Es ist essentiell, einige GUI git-Werkzeuge wie gitk oder gitg zu verwenden, um effektiv mit der Chronik des git-Depots zu arbeiten. |
Der Befehl quilt bietet eine grundlegende Methode zur Aufzeichnung von Änderungen. Für die Debian-Paketierung sollte es so angepasst werden, dass Änderungen im debian/patches/-Verzeichnis anstelle des voreingestellten patches/-Verzeichnisses aufgezeichnet werden.
Um zu vermeiden, dass das Verhalten des Befehls quilt selbst geändert wird, erstellen wir einen Alias dquilt für das Debian-Paket, indem wir die folgenden Zeilen in die Datei ~/.bashrc einfügen. Die zweite Zeile bietet die gleiche Shell-Vervollständigungs-Funktion des quilt-Befehls für den dquilt-Befehl.
Fügen Sie zur ~/.bashrc folgendes hinzu.
alias dquilt="quilt --quiltrc=${HOME}/.quiltrc-dpkg" complete -F _quilt_completion $_quilt_complete_opt dquilt
Dann erstellen wir ~/.quiltrc-dpkg wie folgt.
d=. while [ ! -d $d/debian -a `readlink -e $d` != / ]; do d=$d/..; done if [ -d $d/debian ] && [ -z $QUILT_PATCHES ]; then # if in Debian packaging tree with unset $QUILT_PATCHES QUILT_PATCHES="debian/patches" QUILT_PATCH_OPTS="--reject-format=unified" QUILT_DIFF_ARGS="-p ab --no-timestamps --no-index --color=auto" QUILT_REFRESH_ARGS="-p ab --no-timestamps --no-index" QUILT_COLORS="diff_hdr=1;32:diff_add=1;34:" + \ "diff_rem=1;31:diff_hunk=1;33:diff_ctx=35:diff_cctx=33" if ! [ -d $d/debian/patches ]; then mkdir $d/debian/patches; fi fi
See quilt(1) and How To Survive With Many Patches or Introduction to Quilt on how to use the quilt command.
Siehe Section 4.8, “Schritt 3 (alternativ): Änderungen der Quellen der Originalautoren” für beispielhafte Verwendungen.
Der Befehl debsign, der im Paket devscripts enthalten ist, wird verwendet, um das Debian-Paket mit Ihrem privaten GPG-Schlüssel zu signieren.
The debuild command, included in the devscripts package, builds the binary package and checks it with the lintian command. It is useful to have verbose outputs from the lintian command.
Sie können diese in ~/.devscripts wie folgt einrichten.
DEBUILD_DPKG_BUILDPACKAGE_OPTS="-i -I -us -uc" DEBUILD_LINTIAN_OPTS="-i -I --show-overrides" DEBSIGN_KEYID="Your_GPG_keyID"
Die Optionen - und -I in DEBUILD_DPKG_BUILDPACKAGE_OPTS für den Befehl dpkg-source helfen beim erneuten Bauen von Debian-Paketen ohne Fremdinhalte (siehe Section 5.15, “Pakete ohne irrelevante Inhalte bauen”).
Currently, an RSA key with 4096 bits is a good idea. See Creating a new GPG key.
The pbuilder package provides a clean room (chroot) build environment. [7]
Wir passen es mit verschiedenen Hilfspaketen an.
![]() |
Warning |
---|---|
The optional customization may cause negative effects. In case of doubts, disable them. |
Wir erstellen die ~/.pbuilderrc wie folgt (alle optionalen Funktionen sind deaktiviert).
AUTO_DEBSIGN="${AUTO_DEBSIGN:-no}" SOURCE_ONLY_CHANGES="${SOURCE_ONLY_CHANGES:-yes}" PDEBUILD_PBUILDER=cowbuilder HOOKDIR="/var/cache/pbuilder/hooks" MIRRORSITE="http://deb.debian.org/debian/" #APTCACHE=/var/cache/pbuilder/aptcache APTCACHE=/var/cache/apt/archives #BUILDRESULT=/var/cache/pbuilder/result/ BUILDRESULT=../ EXTRAPACKAGES="lintian" #EXTRAPACKAGES="ccache lintian libeatmydata1" # enable to use libeatmydata1 for pbuilder #export LD_PRELOAD=${LD_PRELOAD+$LD_PRELOAD:}libeatmydata.so # enable ccache for pbuilder #export PATH="/usr/lib/ccache${PATH+:$PATH}" #export CCACHE_DIR="/var/cache/pbuilder/ccache" #BINDMOUNTS="${CCACHE_DIR}" # parallel make #DEBBUILDOPTS=-j8
![]() |
Note |
---|---|
A symlink from /root/.pbuilderrc to /home/<user>/.pbuilderrc may help for the consistent experience. |
![]() |
Note |
---|---|
Due to Bug #606542, you may need to manually install packages listed in EXTRAPACKAGES into the chroot. See Section 7.10, “chroot”. |
![]() |
Note |
---|---|
Install libeatmydata1 (>=82-2) both inside and outside of the chroot or disable to use libeatmydata1. This may cause a race condition with some build systems. |
![]() |
Note |
---|---|
The parallel make may fail for some existing packages and may make the build log difficult to read. |
Let’s create a hook scripts as follows.
/var/cache/pbuilder/hooks/A10ccache
#!/bin/sh set -e # increase the ccache caching size ccache -M 4G # output the current statistics ccache -s
/var/cache/pbuilder/hooks/B90lintian
#!/bin/sh set -e apt-get -y --allow-downgrades install lintian echo "+++ lintian output +++" su -c "lintian -i -I --show-overrides /tmp/buildd/*.changes; :" -l pbuilder echo "+++ end of lintian output +++"
/var/cache/pbuilder/hooks/C10shell
#!/bin/sh set -e apt-get -y --allow-downgrades install vim bash mc # invoke shell if build fails cd /tmp/buildd/*/debian/.. /bin/bash < /dev/tty > /dev/tty 2> /dev/tty
![]() |
Note |
---|---|
All these scripts need to be set world executable: “-rwxr-xr-x 1 root root”. |
![]() |
Note |
---|---|
The ccache cache directory /var/cache/pbuilder/ccache needs to be set world writable: “-rwxrwxrwx 1 root root” for the pbuilder command. You should be aware of associated security concerns. |
Es kann sinnvoll sein, dass Sie mehrere globale Konfigurationen in ~/.gbp.conf setzen.
# Configuration file for "gbp <command>" [DEFAULT] # the default build command: builder = git-pbuilder -i -I -us -uc # use pristine-tar: pristine-tar = True # Use color when on a terminal, alternatives: on/true, off/false or auto color = auto
![]() |
Tip |
---|---|
Der Befehl gbp ist ein Alias für den Befehl git-buildpackage. |
You should set up a local HTTP caching proxy to save the bandwidth for the Debian package repository access. There are several choices: