Inhaltsverzeichnis
README.Debiancompatconffilespackage.cron.*dirspackage.doc-basedocsemacsen-*package.examplespackage.init and
package.defaultinstallpackage.infopackage.links{package.,source/}lintian-overridesmanpage.*package.manpagesmenuNEWS{pre,post}{inst,rm}package.symbolsTODOwatchsource/formatsource/local-optionssource/optionspatches/*
To control most of what debhelper
does while building the package, you put optional configuration files under
the debian directory. This chapter will provide an
overview of what each of these does and its format. Please read the Debian Policy Manual and Debian Developer's Reference for
guidelines for packaging.
The dh_make command will create some template
configuration files under the debian directory. Most
of them come with filenames suffixed by .ex. Some of
them come with filenames prefixed by the binary package name such as
. Take a look at all
of them. [54]
package
Some template configuration files for debhelper may not be created by the
dh_make command. In such cases, you need to create them
with an editor.
If you wish or need to activate any of these, please do the following:
rename template files by removing the .ex or
.EX suffix if they have one;
rename the configuration files to use the actual binary package name in
place of ;
package
modify template file contents to suit your needs;
remove template files which you do not need;
modify the control file (see Abschnitt 4.1, „control“), if necessary;
Passen Sie die Datei rules an, falls notwendig (siehe
Abschnitt 4.4, „rules“).
Any debhelper configuration files
without a prefix,
such as packageinstall, apply to the first binary package.
When there are many binary packages, their configurations can be specified
by prefixing their name to their configuration filenames such as
,
package-1.install, etc.
package-2.install
Alle zusätzlichen Details oder Unterschiede zwischen dem urspünglichen Paket und Ihrer Debian-Version sollten hier dokumentiert werden.
dh_make created a default one; this is what it looks like:
gentoo for Debian ----------------- <possible notes regarding this package - if none, delete this file> -- Josip Rodin <joy-mg@debian.org>, Wed, 11 Nov 1998 21:02:14 +0100
Wenn Sie nichts zu dokumentieren haben, löschen Sie diese Datei. Siehe dh_installdocs(1).
The compat file defines the debhelper compatibility level. Currently, you
should set it to the debhelper v9 as
follows:
$ echo 9 > debian/compat
One of the most annoying things about software is when you spend a great deal of time and effort customizing a program, only to have an upgrade stomp all over your changes. Debian solves this problem by marking such configuration files as conffiles. [55] When you upgrade a package, you'll be asked whether you want to keep your old configuration files or not.
dh_installdeb(1) automatically
flags any files under the /etc directory as conffiles,
so if your program only has conffiles there you do not need to specify them
in this file. For most package types, the only place conffiles should ever
be is under /etc, and so this file doesn't need to
exist.
If your program uses configuration files but also rewrites them on its own, it's best not to make them conffiles because dpkg will then prompt users to verify the changes all the time.
If the program you're packaging requires every user to modify the
configuration files in the /etc directory, there are
two popular ways to arrange for them to not be conffiles, keeping
dpkg quiet.
Create a symlink under the /etc directory pointing to a
file under the /var directory generated by the
maintainer scripts.
Create a file generated by the maintainer scripts under the
/etc directory.
For information on maintainer scripts, see Abschnitt 5.19, „{pre,post}{inst,rm}“.
If your package requires regularly scheduled tasks to operate properly, you can use these files to set that up. You can set up regular tasks that either happen hourly, daily, weekly, or monthly, or alternatively happen at any other time that you wish. The filenames are:
-
Installed as
package.cron.hourly/etc/cron.hourly/;
run once an hour.
package
-
Installed as
package.cron.daily/etc/cron.daily/; run
once a day.
package
-
Installed as
package.cron.weekly/etc/cron.weekly/;
run once a week.
package
-
Installed as
package.cron.monthly/etc/cron.monthly/:
run once a month.
package
- Installed
as package.cron.d/etc/cron.d/: for
any other time.
package
Most of these files are shell scripts, with the exception of
which follows
the format of crontab(5).
package.cron.d
No explicit cron.* file is needed to set up log
rotation; for that, see
dh_installlogrotate(1) and
logrotate(8).
This file specifies any directories which we need but which are not created
by the normal installation procedure (make install
DESTDIR=... invoked by dh_auto_install). This
generally means there is a problem with the Makefile.
Files listed in an install file don't need their
directories created first. See Abschnitt 5.11, „install“.
It is best to try to run the installation first and only use this if you run
into trouble. There is no preceding slash on the directory names listed in
the dirs file.
If your package has documentation other than manual and info pages, you
should use the doc-base file to
register it, so the user can find it with e.g. dhelp(1), dwww(1), or doccentral(1).
Das schließt normalerweise HTML-, PS- und PDF-Dateien ein, die sich in
/usr/share/doc/
befinden.
Paketname/
This is what gentoo's doc-base file
gentoo.doc-base looks like:
Document: gentoo Title: Gentoo Manual Author: Emil Brink Abstract: This manual describes what Gentoo is, and how it can be used. Section: File Management Format: HTML Index: /usr/share/doc/gentoo/html/index.html Files: /usr/share/doc/gentoo/html/*.html
For information on the file format, see install-docs(8) and the Debian doc-base Manual at the local copy
/usr/share/doc/doc-base/doc-base.html/index.html provided by the doc-base package.
Für weitere Details über das Installieren von zusätzlicher Dokumentation sehen Sie bitte in Abschnitt 3.3, „Installation of files to their destination“ nach.
Diese Datei enthält die Dateinamen der Dokumentationsdateien, die dh_installdocs(1) für uns in das temporäre Verzeichnis installiert.
Standardmäßig schließt das alle Dateien im obersten Verzeichnis des
Quellcodes ein, die da heißen »BUGS«,
»README*«, »TODO« usw.
For gentoo, some other files are
also included:
BUGS CONFIG-CHANGES CREDITS NEWS README README.gtkrc TODO
Wenn Ihr Paket Emacs-Dateien bereitstellt, die während der Installation des Pakets kompiliert werden, können Sie diese Dateien dafür nutzen.
Sie werden durch dh_installemacsen(1) ins temporäre Verzeichnis installiert.
Wenn Sie dies nicht benötigen, löschen Sie die Dateien.
Der Befehl dh_installexamples(1) installiert die in dieser Datei aufgelisteten Dateien und Verzeichnisse als Beispieldateien.
If your package is a daemon that needs to be run at system start-up, you've obviously disregarded my initial recommendation, haven't you? :-)
The file is
installed as the
package.init/etc/init.d/ script
which starts and stops the daemon. Its fairly generic skeleton template is
provided by the dh_make command as
packageinit.d.ex. You'll likely have to rename and edit it, a
lot, while making sure to provide Linux Standard
Base (LSB) compliant headers. It gets installed into the temporary
directory by dh_installinit(1).
The file
will be installed as
package.default/etc/default/. This
file sets defaults that are sourced by the init script. This
package file is most
often used to disable running a daemon, or to set some default flags or
timeouts. If your init script has certain configurable features, you can
set them in the
package.default file,
instead of in the init script itself.
package.default
If your upstream program provides a file for the init script, you can either
use it or not. If you don't use their init script then create a new one in
. However if
the upstream init script looks fine and installs in the right place you
still need to set up the package.initrc* symlinks. To do this you
will need to override dh_installinit in the
rules file with the following lines:
override_dh_installinit:
dh_installinit --onlyscripts
Wenn Sie das nicht benötigen, löschen Sie die Dateien.
If there are files that need to be installed into your package but your
standard make install won't do it, put the filenames and
destinations into this install file. They are
installed by dh_install(1).[56] You should first check there is not a more specific tool to use.
For example, documents should be in the docs file and
not in this one.
This install file has one line per file installed, with
the name of the file (relative to the top build directory) then a space then
the installation directory (relative to the install directory). One example
of where this is used is if a binary
src/ is left uninstalled;
the barinstall file might look like:
src/bar usr/bin
This means when this package is installed, there will be an executable
command /usr/bin/.
bar
Alternatively, this install can have the name of the
file only without the installation directory when the relative directory
path does not change. This format is usually used for a large package that
splits the output of its build into multiple binary packages using
,
package-1.install, etc.
package-2.install
The dh_install command will fall back to looking in
debian/tmp for files, if it doesn't find them in the
current directory (or wherever you've told it to look using
--sourcedir).
If your package has info pages, you should install them using dh_installinfo(1) by listing them in a
file.
package.info
If you need to create additional symlinks in package build directories as
package maintainer, you should install them using dh_link(1) by listing their full paths of source and destination files
in a file.
package.links
If lintian reports an erroneous
diagnostic for a case where Debian policy allows exceptions to some rule,
you can use
or
package.lintian-overridessource/lintian-overrides to quieten it. Please read
Lintian User's Manual (/usr/share/doc/lintian/lintian.html/index.html) and refrain from
abusing this.
is
for the binary package named package.lintian-overrides and is
installed into
packageusr/share/lintian/overrides/
by the dh_lintian command.
package
source/lintian-overrides ist für das Quellpaket. Diese
Datei wird nicht installiert.
Your program(s) should have a manual page. If they don't, you should create them. The dh_make command creates some template files for manual pages. These need to be copied and edited for each command missing its manual page. Please make sure to remove unused templates.
Handbuchseiten werden üblicherweise in nroff(1) geschrieben. Das Beispiel manpage.1.ex
ist auch in nroff geschrieben. In der Handbuchseite von
man(7) finden Sie eine kurze Erklärung, wie solche Dateien
bearbeitet werden können.
The final manual page file name should give the name of the program it is
documenting, so we will rename it from manpage to
gentoo. The file name also includes
.1 as the first suffix, which means it's a manual page
for a user command. Be sure to verify that this section is indeed the
correct one. Here's a short list of manual page sections:
| Section | Description | Notes |
|---|---|---|
| 1 | User command | Executable commands or scripts |
| 2 | System calls | Functions provided by the kernel |
| 3 | Library calls | Functions within system libraries |
| 4 | Special files | Usually found in /dev |
| 5 | File formats | E.g. /etc/passwd's format |
| 6 | Games | Games or other frivolous programs |
| 7 | Macro packages | Such as man macros |
| 8 | System administration | Programs typically only run by root |
| 9 | Kernel routines | Non-standard calls and internals |
So gentoo's man page should be
called gentoo.1. If there was no
gentoo.1 man page in the original source, you should
create it by renaming the manpage.1.ex template to
gentoo.1 and editing it using information from the
example and from the upstream docs.
You can use the help2man command to generate a man page
out of the --help and --version output
of each program, too. [57]
Wenn Sie es andererseits bevorzugen, in SGML anstatt
nroff zu schreiben, können Sie die Vorlage
manpage.sgml.ex benutzen. Dann müssen Sie Folgendes
tun:
Benennen Sie die Datei um, beispielsweise gentoo.sgml.
Installieren Sie das Paket docbook-to-man
Fügen Sie docbook-to-man der Zeile
Build-Depends in der Datei control
hinzu
add an override_dh_auto_build target to your
rules file:
override_dh_auto_build:
docbook-to-man debian/gentoo.sgml > debian/gentoo.1
dh_auto_build
Wenn Sie XML gegenüber SGML bevorzugen, können Sie die Vorlage
manpage.xml.ex benutzen. Dann müssen Sie Folgendes tun:
rename the source file to something like gentoo.1.xml
Installieren Sie das Paket docbook-xsl und einen XSLT-Prozessor wie
xsltproc (empfohlen)
add the docbook-xsl, docbook-xml, and
xsltproc packages to the Build-Depends
line in the control file
add an override_dh_auto_build target to your
rules file:
override_dh_auto_build:
xsltproc --nonet \
--param make.year.ranges 1 \
--param make.single.year.ranges 1 \
--param man.charmap.use.subset 0 \
-o debian/ \
http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl\
debian/gentoo.1.xml
dh_auto_build
If your package has manual pages, you should install them using
dh_installman(1) by listing them in a
file.
package.manpages
To install docs/gentoo.1 as a manpage for the
gentoo package, create a
gentoo.manpages file as follows.
docs/gentoo.1
Benutzer des X-Window-System haben normalerweise einen Fenstermanager mit
einem Menü, das konfiguriert werden kann, um Programme zu starten. Wenn sie
das Debian-Paket menu installiert
haben, werden Menüeinträge für die installierten Programme automatisch
hinzugefügt.
Here's the default menu.ex file that
dh_make created.
?package(gentoo):needs=X11|text|vc|wm \
section=Applications/see-menu-manual\
title=gentoo command=/usr/bin/gentoo
Das erste Feld nach dem Doppelpunkt ist needs und
bestimmt, welche Art der Benutzerschnittstelle das Programm braucht. Ändern
Sie dies auf eine der aufgeführten Alternativen, beispielsweise
text oder X11.
The next is the section that the menu and submenu entry
should appear in. [58]
Das Feld title enthält den Namen des Programms. Dieser
kann mit Großbuchstaben beginnen, sollte aber kurz gehalten werden.
Zuletzt das Feld command, das den Kommandoaufruf zum
Starten des Programms enthält.
Lassen Sie uns den Dateinamen in menu und den
Menüeintrag wie folgt ändern:
?package(gentoo): needs=X11 \
section=Applications/Tools \
title=Gentoo command=gentoo
You can also add other fields like longtitle,
icon, hints etc. See dh_installmenu(1), menufile(5), update-menus(1), and The Debian Menu
sub-policy for more information.
These postinst, preinst,
postrm, and prerm files
[59] are called maintainer
scripts. They are scripts which are put in the control area of
the package and run by dpkg when your package is
installed, upgraded, or removed.
As a novice maintainer, you should avoid any manual editing of maintainer scripts because they are problematic. For more information refer to the Debian Policy Manual, 6 "Package maintainer scripts and installation procedure", and take a look at the example files provided by dh_make.
If you did not listen to me and have created custom maintainer scripts for a package, you should make sure to test them not only for install and upgrade but also for remove and purge.
Upgrades to the new version should be silent and non-intrusive (existing users should not notice the upgrade except by discovering that old bugs have been fixed and perhaps that there are new features).
When the upgrade is necessarily intrusive (eg., config files scattered
through various home directories with totally different structure), you may
consider as the last resort switching the package to a safe fallback state
(e.g., disabling a service) and providing the proper documentation required
by policy (README.Debian and
NEWS.Debian). Don't bother the user with
debconf notes invoked from these maintainer scripts for
upgrades.
The ucf package provides a
conffile-like handling infrastructure to preserve user
changes for files that may not be labeled as conffiles
such as those managed by the maintainer scripts. This should minimize
issues associated with them.
These maintainer scripts are among the Debian enhancements that explain why people choose Debian. You must be very careful not to turn them into a source of annoyance.
Packaging of library is not easy for a novice maintainer and should be
avoided. Having said it, if your package has libraries, you should have
debian/
files. See Abschnitt A.2, „Managing
package.symbolsdebian/“.
package.symbols
The watch file format is documented in the
uscan(1) manpage. The watch file configures the
uscan program (in the devscripts package) to watch the site where you
originally got the source from. This is also used by the Debian External Health Status (DEHS) service.
Here are its contents:
# watch control file for uscan version=3 http://sf.net/gentoo/gentoo-(.+)\.tar\.gz debian uupdate
Normally with a watch file, the URL at
http://sf.net/gentoo is downloaded and searched for links of
the form <a href=...>. The basename (just the part
after the final /) of each linked URL is compared against
the Perl regular expression pattern (see perlre(1)) gentoo-(.+)\.tar\.gz. Out of the files
that match, the one with the greatest version number is downloaded and the
uupdate program is run to create an updated source tree.
Although this is true for other sites, the SourceForge download service at
http://sf.net is an exception. When the
watch file has an URL matching the Perl regexp
^http://sf\.net/, the uscan program
replaces it with http://qa.debian.org/watch/sf.php/ and then applies
this rule. The URL redirector service at http://qa.debian.org/ is designed
to offer a stable redirect service to the desired file for any
watch pattern of the form
http://sf.net/.
This solves issues related to periodically changing SourceForge URLs.
project/tar-name-(.+)\.tar\.gz
In der Datei debian/source/format soll eine einzelne
Zeile stehen, in der das gewünschte Format für das Quellpaket angegeben wird
(lesen Sie dpkg-source(1) für eine ausführliche Liste). Nach
Squeeze sollte dort entweder:
3.0 (native) für native Debian-Pakete oder
3.0 (quilt) für alles andere stehen.
Das neuere Quellformat 3.0 (quilt) zeichnet Änderungen in
einer Patchserie im Verzeichnis debian/patches für
quilt auf. Diese Änderungen werden dann während des
Entpackens des Quellpakets automatisch angewendet. [60] Die Debian-spezifischen Änderungen werden einfach
in einem Archiv namens debian.tar.gz gespeichert, das
alle Dateien im Verzeichnis debian enthält. Mit diesem
neuen Format können binäre Dateien wie PNG-Icons vom Paketbetreuer
eingebunden werden, ohne Tricks anwenden zu müssen. [61]
Wenn dpkg-source ein Quellpaket im Quellformat
3.0 (quilt) entpackt, werden automatisch alle Patches
angewendet, die in debian/patches/series aufgeführt
sind. Sie können das Anwenden der Patches nach dem Entpacken verhindern,
wenn Sie die Option --skip-patches benutzen.
Wenn Sie die Paketierungsarbeiten für Debian in einem Versionskontrollsystem
verwalten wollen, erstellen Sie üblicherweise einen Zweig (z. B.
upstream), in dem Sie die Quellen des ursprünglichen
Autors verfolgen und einen weiteren Zweig (z. B. üblicherweise
master für Git), in dem Sie das Debian-Paket verfolgen.
Für letzteres wollen Sie sicherlich die unveränderten Ursprungsquellen
zusammen mit Ihren debian/*-Dateien für das Paketieren
haben, um das Zusammenführen von neuen Ursprungsquellen zu vereinfachen.
After you build a package, the source is normally left patched. You need to
unpatch it manually by running dquilt pop -a before
committing to the master branch. You can automate this
by adding the optional debian/source/local-options file
containing unapply-patches. This file is not included in
the generated source package and changes the local build behavior only.
This file may contain abort-on-upstream-changes, too (see
dpkg-source(1)).
unapply-patches abort-on-upstream-changes
The autogenerated files in the source tree can be quite annoying for
packaging since they generate meaningless large patch files. There are
custom modules such as dh_autoreconf to ease this problem
as described in Abschnitt 4.4.3, „Anpassungen der Datei rules“.
You can provide a Perl regular expression to the
--extend-diff-ignore option argument of dpkg-source(1) to ignore changes made to the autogenerated files while
creating the source package.
As a general solution to address this problem of the autogenerated files,
you can store such a dpkg-source option argument in the
source/options file of the source package. The
following will skip creating patch files for
config.sub, config.guess, and
Makefile.
extend-diff-ignore = "(^|/)(config\.sub|config\.guess|Makefile)$"
The old 1.0 source format created a single large
diff.gz file containing package maintenance files in
debian and patch files for the source. Such a package
is a bit cumbersome to inspect and understand for each source tree
modification later. This is not so nice.
The newer 3.0 (quilt) source format stores patches in
debian/patches/* files using the
quilt command. These patches and other package data
which are all contained under the debian directory are
packaged as the debian.tar.gz file. Since the
dpkg-source command can handle quilt
formatted patch data in the 3.0 (quilt) source without
the quilt package, it does not need
a Build-Depends on quilt. [62]
The quilt command is explained in quilt(1). It records modifications to the source as a stack of
-p1 patch files in the
debian/patches directory and the source tree is
untouched outside of the debian directory. The order
of these patches is recorded in the
debian/patches/series file. You can apply (=push),
un-apply (=pop), and refresh patches easily. [63]
For Kapitel 3, Den Quellcode verändern, we created three patches in
debian/patches.
Since Debian patches are located in debian/patches,
please make sure to set up the dquilt command properly as
described in Abschnitt 3.1, „Setting up quilt“.
When anyone (including yourself) provides a patch
to the source
later, modifying a foo.patch3.0 (quilt) source package is quite
simple:
$ dpkg-source -x gentoo_0.9.12.dsc
$ cd gentoo-0.9.12
$ dquilt import ../foo.patch
$ dquilt push
$ dquilt refresh
$ dquilt header -e
... describe patch
The patches stored in the newer 3.0 (quilt) source format
must be fuzz free. You can ensure this with
dquilt pop -a; while dquilt push; do dquilt refresh;
done.
[54]
In this chapter, files in the debian directory are
referred to without the leading debian/ for simplicity
whenever the meaning is obvious.
[55] See dpkg(1) and Debian Policy Manual, "D.2.5 Conffiles".
[56] Dies ersetzt den veralteten Befehl dh_movefiles(1), der durch die Datei files konfiguriert
wurde.
[57] Note that help2man's placeholder man page will claim that more detailed documentation is available in the info system. If the command is missing an info page, you should manually edit the man page created by the help2man command.
[58] The current list of sections is in The Debian
Menu sub-policy 2.1 "Preferred menu structure". There was a major
reorganization of menu structure for squeeze.
[59] Despite this use of the bash shorthand expression
{pre,post}{inst,rm} to indicate these filenames, you
should use pure POSIX syntax for these maintainer scripts for compatibility
with dash as the system shell.
[60] See DebSrc3.0 for a summary on the switch to
the new 3.0 (quilt) and 3.0 (native)
source formats.
[61] Tatsächlich unterstützt dieses neue Format sogar mehrere ursprüngliche Tarballs und mehr Kompressionsmethoden. Dies würde in diesem Dokument aber zu weit führen.
[62] Several methods of patch set maintenance have been proposed and are in use
for Debian packages. The quilt system is the preferred
maintenance system in use. Others include dpatch,
dbs, and cdbs. Many of these keep
such patches as debian/patches/* files.
[63] If you are asking a sponsor to upload your package, this kind of clear separation and documentation of your changes is very important to expedite the package review by your sponsor.