From: Manoj Srivastava Date: Thu, 16 Jun 2005 05:08:53 +0000 (+0000) Subject: * Don't compress version.ent in the doc directory (it gets bigger!) X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=ff1bec107a4a59f6f971bf87b69d4e33f0c87a5d;p=debian%2Fdebian-policy.git * Don't compress version.ent in the doc directory (it gets bigger!) Author: srivasta Date: 2001/01/17 05:57:37 * Don't compress version.ent in the doc directory (it gets bigger!) * Incorporate the packaging manual. The minimal change in version number i because I suspect that this version is going to be buggy. closes: Bug#62943, Bug#72949 * Fixed typo in menu-policy. closes: Bug#70442 * Fixed typo in policy manual closes: Bug#70634, Bug#70643 * Removed extraneous > from policy closes: Bug#77645 * Fixed two typos in upgrading checklist closes: Bug#78809, Bug#78822 * Fixed spelling of utility closes: Bug#82458 * [ACCEPTED 2000/09/08] Free pkgs depending on non-US should go into non-US/{main,contrib} closes: Bug#69229 * Added rsh-server and telnet server to the virtual packages list closes: Bug#77404 * Fixed outdated references to the FHS. closes: Bug#77650 git-archimport-id: srivasta@debian.org--etch/debian-policy--devel--3.0--patch-65 --- diff --git a/debian/changelog b/debian/changelog index cc9435e..ee56c7e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,21 @@ debian-policy (3.2.1.1) unstable; urgency=low * Don't compress version.ent in the doc directory (it gets bigger!) - - -- + * Incorporate the packaging manual. The minimal change in version number + i because I suspect that this version is going to be buggy. + closes: Bug#62943, Bug#72949 + * Fixed typo in menu-policy. closes: Bug#70442 + * Fixed typo in policy manual closes: Bug#70634, Bug#70643 + * Removed extraneous > from policy closes: Bug#77645 + * Fixed two typos in upgrading checklist closes: Bug#78809, Bug#78822 + * Fixed spelling of utility closes: Bug#82458 + * [ACCEPTED 2000/09/08] Free pkgs depending on non-US should go into + non-US/{main,contrib} closes: Bug#69229 + * Added rsh-server and telnet server to the virtual packages list + closes: Bug#77404 + * Fixed outdated references to the FHS. closes: Bug#77650 + + -- Manoj Srivastava Tue, 16 Jan 2001 23:53:31 -0600 debian-policy (3.2.1.0) unstable; urgency=low diff --git a/debian/control b/debian/control index 3685310..c171e30 100644 --- a/debian/control +++ b/debian/control @@ -18,17 +18,3 @@ Description: Debian Policy Manual and related documents - Authoritative list of virtual package names - Paper about libc6 migration - Policy checklist for upgrading your packages - -Package: packaging-manual -Architecture: all -Depends: fileutils (>= 4.0) -Recommends: debian-policy -Suggests: doc-base, dpkg (>= 1.4.0.23) -Description: Debian Packaging Manual - This package installs the Debian Packaging Manual. - . - This manual describes the technical aspects of creating Debian binary - and source packages. It also documents the interface between - dselect and its access method scripts. It does not deal with - the Debian Project policy requirements, and it assumes familiarity - with dpkg's functions from the system administrator's perspective. diff --git a/debian/rules b/debian/rules index 4e95938..8415819 100755 --- a/debian/rules +++ b/debian/rules @@ -5,24 +5,28 @@ ## Created On : Thu Oct 29 15:35:55 1998 ## Created On Node : tiamat.datasync.com ## Last Modified By : Manoj Srivastava -## Last Modified On : Sat Jul 29 23:17:29 2000 +## Last Modified On : Wed Sep 6 09:37:43 2000 ## Last Machine Used: glaurung.green-gryphon.com -## Update Count : 55 +## Update Count : 56 ## Status : Unknown, Use with caution! ## HISTORY : ## Description : ## $Id$ ############################################################################### +ifdef ARCH + ha:=-a$(ARCH) +endif + # set the dpkg-architecture vars -export DEB_BUILD_ARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH) -export DEB_BUILD_GNU_CPU := $(shell dpkg-architecture -qDEB_BUILD_GNU_CPU) -export DEB_BUILD_GNU_SYSTEM:= $(shell dpkg-architecture -qDEB_BUILD_GNU_SYSTEM) -export DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) -export DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH) -export DEB_HOST_GNU_CPU := $(shell dpkg-architecture -qDEB_HOST_GNU_CPU) -export DEB_HOST_GNU_SYSTEM := $(shell dpkg-architecture -qDEB_HOST_GNU_SYSTEM) -export DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +export DEB_BUILD_ARCH := $(shell dpkg-architecture $(ha) -qDEB_BUILD_ARCH) +export DEB_BUILD_GNU_CPU := $(shell dpkg-architecture $(ha) -qDEB_BUILD_GNU_CPU) +export DEB_BUILD_GNU_SYSTEM:= $(shell dpkg-architecture $(ha) -qDEB_BUILD_GNU_SYSTEM) +export DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture $(ha) -qDEB_BUILD_GNU_TYPE) +export DEB_HOST_ARCH := $(shell dpkg-architecture $(ha) -qDEB_HOST_ARCH) +export DEB_HOST_GNU_CPU := $(shell dpkg-architecture $(ha) -qDEB_HOST_GNU_CPU) +export DEB_HOST_GNU_SYSTEM := $(shell dpkg-architecture $(ha) -qDEB_HOST_GNU_SYSTEM) +export DEB_HOST_GNU_TYPE := $(shell dpkg-architecture $(ha) -qDEB_HOST_GNU_TYPE) @@ -32,22 +36,20 @@ arch := $(shell dpkg --print-installation-architecture) date := $(shell date +"%Y-%m-%d") version := $(shell LC_ALL=C dpkg-parsechangelog | \ grep ^Version: | sed 's/^Version: *//') -ppackage:= packaging-manual FILES_TO_CLEAN = debian/files debian/buildinfo debian/substvars \ debian/postinst debian/prerm \ version.ent policy.lout policy.lout.ld lout.li \ upgrading-checklist.text policy.text.gz \ - packaging.lout packaging.text.gz packaging.ps \ - packaging.pdf.gz menu-policy.text.gz \ + menu-policy.text.gz \ policy-process.text.gz policy-process.pdf.gz \ proposal.text.gz menu-policy.pdf.gz proposal.pdf.gz \ mime-policy.text.gz mime-policy.pdf.gz -STAMPS_TO_CLEAN = stamp-policy stamp-packaging stamp-build stamp-configure -DIRS_TO_CLEAN = debian/tmp policy.html fhs debian/tmp-packaging \ - packaging.html menu-policy.html mime-policy.html \ +STAMPS_TO_CLEAN = stamp-policy stamp-build stamp-configure +DIRS_TO_CLEAN = debian/tmp policy.html fhs \ + menu-policy.html mime-policy.html \ proposal.html policy-process.html -SGML_FILES = policy packaging menu-policy mime-policy proposal \ +SGML_FILES = policy menu-policy mime-policy proposal \ policy-process # Location of the source dir @@ -56,9 +58,6 @@ TMPTOP := $(SRCTOP)/debian/tmp DOCDIR := $(TMPTOP)/usr/share/doc/$(package) LIBDIR := $(TMPTOP)/usr/share/doc-base -PTMPTOP := $(SRCTOP)/debian/tmp-packaging -PDOCDIR := $(PTMPTOP)/usr/share/doc/$(ppackage) -PLIBDIR := $(PTMPTOP)/usr/share/doc-base # While we have two versions of the FHS installed in the source package, # we need to modify this to handle it. This is the easiest way to do it. @@ -77,7 +76,7 @@ POLICY_FILES =policy.text.gz policy.sgml virtual-package-names-list.text \ BYHAND_FILES =policy.text.gz libc6-migration.text \ virtual-package-names-list.text menu-policy.text.gz \ mime-policy.text.gz -PBYHAND_FILES=packaging.text.gz + install_file = /usr/bin/install -p -o root -g root -m 644 install_program= /usr/bin/install -p -o root -g root -m 755 @@ -135,7 +134,7 @@ binary-arch: build # generated by this package. If there were any they would be # made here. -binary-indep: stamp-policy stamp-packaging +binary-indep: stamp-policy stamp-policy: build @test $$(id | sed -e 's/(.*$$//' -e 's/^uid=//') || \ (echo need root priviledges; exit 1) @@ -152,7 +151,6 @@ stamp-policy: build # a given that the debian-policy pkg must always comply with # itself... echo "debian-policy:Version=$(version)" > debian/substvars - echo "packaging-manual:Version=$(version)" >> debian/substvars $(install_file) $(POLICY_FILES) $(DOCDIR)/ $(install_file) $(FSSTND_FILES) $(DOCDIR)/fsstnd/ $(install_file) $(FHS_FILES) $(DOCDIR)/fhs/ @@ -179,6 +177,7 @@ stamp-policy: build mv policy.pdf ../ gzip -9qfv ../policy.pdf GZIP=-9v tar zcf ../policy.html.tar.gz policy.html + $(install_file) version.ent $(DOCDIR)/ dpkg-distaddfile -fdebian/files policy.ps.gz byhand - dpkg-distaddfile -fdebian/files policy.pdf.gz byhand - dpkg-distaddfile -fdebian/files policy.html.tar.gz byhand - @@ -188,49 +187,6 @@ stamp-policy: build done touch stamp-policy -stamp-packaging: build - @test $$(id | sed -e 's/(.*$$//' -e 's/^uid=//') || \ - (echo need root priviledges; exit 1) - $(checkdir) - test -f stamp-build || $(MAKE) -f debian/rules build - -rm -rf $(PTMPTOP) - $(make_directory) $(PTMPTOP)/DEBIAN - $(make_directory) $(PDOCDIR) - $(make_directory) $(PLIBDIR) - echo "debian-policy:Version=$(version)" > debian/substvars - echo "packaging-manual:Version=$(version)" >> debian/substvars - - $(install_file) packaging.sgml $(PDOCDIR)/ - $(install_file) debian/changelog $(PDOCDIR)/ - -gzip -fqr9 $(PDOCDIR) - $(install_file) version.ent $(PDOCDIR)/ - $(install_file) packaging.text.gz $(PDOCDIR)/ - $(install_file) debian/copyright $(PDOCDIR)/ - $(install_file) packaging-manual.desc $(PLIBDIR)/packaging-manual - (tar cf - packaging.html) | (cd $(PDOCDIR); tar xf -) - sed -e 's/#PACKAGE#/$(ppackage)/g' debian/postinst.in > debian/postinst - sed -e 's/#PACKAGE#/$(ppackage)/g' debian/prerm.in > debian/prerm - $(install_program) debian/{postinst,prerm} debian/tmp-packaging/DEBIAN/ - dpkg-gencontrol -ppackaging-manual -Pdebian/tmp-packaging -isp - chown -R root.root debian/tmp-packaging - chmod -R go=rX debian/tmp-packaging - dpkg --build debian/tmp-packaging .. - debiandoc2latexps packaging.sgml - debiandoc2latexpdf packaging.sgml - mv packaging.ps ../ - mv packaging.pdf ../ - gzip -9vf ../packaging.ps - gzip -9vf ../packaging.pdf - GZIP=-9v tar zcf ../packaging.html.tar.gz packaging.html - dpkg-distaddfile -fdebian/files packaging.ps.gz byhand - - dpkg-distaddfile -fdebian/files packaging.pdf.gz byhand - - dpkg-distaddfile -fdebian/files packaging.html.tar.gz byhand - - for i in $(PBYHAND_FILES); do \ - $(install_file) $$i .. ; \ - dpkg-distaddfile -fdebian/files $$i byhand - ; \ - done - touch stamp-packaging - define checkdir test -f debian/rules -a -f policy.sgml diff --git a/menu-policy.sgml b/menu-policy.sgml index ce6d243..7a8f4b1 100644 --- a/menu-policy.sgml +++ b/menu-policy.sgml @@ -13,7 +13,7 @@ The debian-policy mailing list has taken responsibility for the contents of this document, with the package maintainers responsible - for packagingn adminstrivia only. + for packaging adminstrivia only. --> diff --git a/packaging-manual.desc b/packaging-manual.desc deleted file mode 100644 index 6648bbb..0000000 --- a/packaging-manual.desc +++ /dev/null @@ -1,19 +0,0 @@ -Document: packaging-manual -Title: Debian Packaging Manual -Author: Ian Jackson and others -Abstract: This manual describes the technical aspects of creating Debian binary - and source packages. It also documents the interface between - dselect and its access method scripts. It does not deal with - the Debian Project policy requirements, and it assumes familiarity - with dpkg's functions from the system administrator's perspective. -Section: Debian - -Format: debiandoc-sgml -Files: /usr/share/doc/packaging-manual/packaging.sgml.gz - -Format: text -Files: /usr/share/doc/packaging-manual/packaging.text.gz - -Format: HTML -Index: /usr/share/doc/packaging-manual/packaging.html/index.html -Files: /usr/share/doc/packaging-manual/packaging.html/*.html diff --git a/packaging.sgml b/packaging.sgml deleted file mode 100644 index 736636a..0000000 --- a/packaging.sgml +++ /dev/null @@ -1,5289 +0,0 @@ - - %versiondata; -]> - - - - - - - Debian Packaging Manual - - Ian Jackson - ijackson@gnu.ai.mit.edu - - - Revised: David A. Morris - bweaver@debian.org - - - Maintainer: Christian Schwarz - schwarz@debian.org - - - Maintainer: Manoj Srivastava - srivasta@debian.org - - - Maintainer: Julian Gilbey - J.D.Gilbey@qmw.ac.uk - - - Maintainer: The Debian Policy group - debian-policy@lists.debian.org - - version &version;, &date; - - - This manual describes the technical aspects of creating Debian - binary and source packages. It does not deal with the Debian - Project policy requirements, and it assumes familiarity with - dpkg's functions from the system administrator's - perspective. This package itself is maintained by a group of - maintainers that have no editorial powers. At the moment, the - list of maintainers is: - - -

Michael Alan Dorman mdorman@debian.org

-
- -

Richard Braakman dark@xs4all.nl

-
- -

Philip Hands phil@hands.com

-
- -

Julian Gilbey J.D.Gilbey@qmw.ac.uk

-
- -

Manoj Srivastava srivasta@debian.org

-
-
-
- - - - Copyright ©1996 Ian Jackson. -

- This manual is free software; you may redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version - 2, or (at your option) any later version. -

- -

- This is distributed in the hope that it will be useful, but - without any warranty; without even the implied - warranty of merchantability or fitness for a particular - purpose. See the GNU General Public License for more - details. -

- -

- A copy of the GNU General Public License is available as - /usr/doc/copyright/GPL in the Debian GNU/Linux - distribution or on the World Wide Web at - http://www.gnu.org/copyleft/gpl.html. You can also - obtain it by writing to the Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -

-
- - - - - - - Introduction and scope of this manual - -

- dpkg is a suite of programs for creating binary - package files and installing and removing them on Unix - systems. -

- dpkg is targetted primarily at Debian - GNU/Linux, but may work on or be ported to other - systems. -

- -

- -

- The binary packages are designed for the management of - installed executable programs (usually compiled binaries) and - their associated data, though source code examples and - documentation are provided as part of some packages.

- -

- This manual describes the technical aspects of creating Debian - binary packages (.deb files). It documents the - behaviour of the package management programs - dpkg, dselect et al. and the way - they interact with packages.

- -

- It also documents the interaction between - dselect's core and the access method scripts it - uses to actually install the selected packages, and describes - how to create a new access method.

- -

- This manual does not go into detail about the options and - usage of the package building and installation tools. It - should therefore be read in conjuction with those programs' - manpages. -

- -

- The utility programs which are provided with dpkg - for managing various system configuration and similar issues, - such as update-rc.d and - install-info, are not described in detail here - - please see their manpages. -

- -

- It does not describe the policy requirements imposed - on Debian packages, such as the permissions on files and - directories, documentation requirements, upload procedure, and - so on. You should see the Debian packaging policy manual for - these details. (Many of them will probably turn out to be - helpful even if you don't plan to upload your package and make - it available as part of the distribution.) -

- -

- It is assumed that the reader is reasonably familiar with the - dpkg System Administrators' manual. - Unfortunately this manual does not yet exist. -

- -

- The Debian version of the FSF's GNU hello program is provided - as an example for people wishing to create Debian - packages. The Debian debmake package is - recommended as a very helpful tool in creating and maintaining - Debian packages. However, while the tools and examples are - helpful, they do not replace the need to read and follow the - Policy and Programmer's Manual.

-
- - Binary packages - - -

- The binary package has two main sections. The first part - consists of various control information files and scripts used - by dpkg when installing and removing. See . -

- -

- The second part is an archive containing the files and - directories to be installed. -

- -

- In the future binary packages may also contain other - components, such as checksums and digital signatures. The - format for the archive is described in full in the - deb(5) manpage. -

- - - Creating package files - - dpkg-deb - - -

- All manipulation of binary package files is done by - dpkg-deb; it's the only program that has - knowledge of the format. (dpkg-deb may be - invoked by calling dpkg, as dpkg - will spot that the options requested are appropriate to - dpkg-deb and invoke that instead with the same - arguments.) -

- -

- In order to create a binary package you must make a - directory tree which contains all the files and directories - you want to have in the filesystem data part of the package. - In Debian-format source packages this directory is usually - debian/tmp, relative to the top of the package's - source tree. -

- -

- They should have the locations (relative to the root of the - directory tree you're constructing) ownerships and - permissions which you want them to have on the system when - they are installed. -

- -

- With current versions of dpkg the uid/username - and gid/groupname mappings for the users and groups being - used should be the same on the system where the package is - built and the one where it is installed. -

- -

- You need to add one special directory to the root of the - miniature filesystem tree you're creating: - DEBIAN. It should contain the control - information files, notably the binary package control file - (see ). -

- -

- The DEBIAN directory will not appear in the - filesystem archive of the package, and so won't be installed - by dpkg when the package is installed. -

- -

- When you've prepared the package, you should invoke: - - dpkg --build directory - -

- -

- This will build the package in - directory.deb. (dpkg knows - that --build is a dpkg-deb option, so - it invokes dpkg-deb with the same arguments to - build the package.) -

- -

- See the manpage for details of how - to examine the contents of this newly-created file. You may find the - output of following commands enlightening: - - dpkg-deb --info filename.deb - dpkg-deb --contents filename.deb - dpkg --contents filename.deb - - To view the copyright file for a package you could use this command: - - dpkg --fsys-tarfile filename.deb | tar xof usr/doc/\*copyright | less - -

-
- - - - Package control information files - - -

- The control information portion of a binary package is a - collection of files with names known to dpkg. - It will treat the contents of these files specially - some - of them contain information used by dpkg when - installing or removing the package; others are scripts which - the package maintainer wants dpkg to run. -

- -

- It is possible to put other files in the package control - area, but this is not generally a good idea (though they - will largely be ignored). -

- -

- Here is a brief list of the control info files supported by - dpkg and a summary of what they're used for. -

- -

- - control - - -

- This is the key description file used by - dpkg. It specifies the package's name - and version, gives its description for the user, - states its relationships with other packages, and so - forth. See . -

- -

- It is usually generated automatically from information - in the source package by the - dpkg-gencontrol program, and with - assistance from dpkg-shlibdeps. See .

- - - postinst, preinst, postrm, - prerm - - - -

- These are exectuable files (usually scripts) which - dpkg runs during installation, upgrade - and removal of packages. They allow the package to - deal with matters which are particular to that package - or require more complicated processing than that - provided by dpkg. Details of when and - how they are called are in . -

- -

- It is very important to make these scripts - idempotent. - -

- That means that if it runs successfully or fails - and then you call it again it doesn't bomb out, - but just ensures that everything is the way it - ought to be. -

- This is so that if an error occurs, the - user interrupts dpkg or some other - unforeseen circumstance happens you don't leave the - user with a badly-broken package. -

- -

- The maintainer scripts are guaranteed to run with a - controlling terminal and can interact with the user. - If they need to prompt for passwords, do full-screen - interaction or something similar you should do these - things to and from /dev/tty, since - dpkg will at some point redirect scripts' - standard input and output so that it can log the - installation process. Likewise, because these scripts - may be executed with standard output redirected into a - pipe for logging purposes, Perl scripts should set - unbuffered output by setting $|=1 so that the - output is printed immediately rather than being - buffered. -

- -

- Each script should return a zero exit status for - success, or a nonzero one for failure.

-
- - conffiles - - - -

- This file contains a list of configuration files which - are to be handled automatically by dpkg - (see ). Note that not necessarily - every configuration file should be listed here.

-
- - shlibs - - - -

- This file contains a list of the shared libraries - supplied by the package, with dependency details for - each. This is used by dpkg-shlibdeps - when it determines what dependencies are required in a - package control file. The shlibs file format - is described on . -

-
- -

- - - - The main control information file: control - -

- The most important control information file used by - dpkg when it installs a package is - control. It contains all the package's `vital - statistics'. -

- -

- The binary package control files of packages built from - Debian sources are made by a special tool, - dpkg-gencontrol, which reads - debian/control and debian/changelog to - find the information it needs. See for - more details. -

- -

- The fields in binary package control files are: - - -

Package (mandatory)

- - -

Version (mandatory)

-
-

Architecture - (mandatory) - -

- This field should appear in all packages, though - dpkg doesn't require it yet so that - old packages can still be installed. -

- -

-
- -

Depends, - Provides et al.

-
- -

Essential

-
- -

Maintainer

-
- -

Section, - Priority

-
- -

Source

-
- -

Description

-
- -

- Installed-Size -

-
- - -

- A description of the syntax of control files and the purpose - of these fields is available in . -

-
- - Time Stamps -

- Maintainers are encouraged to preserve the modification - times of the upstream source files in a package, as far as - is reasonably possible. - -

- The rationale is that there is some information conveyed - by knowing the age of the file, for example, you could - recognize that some documentation is very old by looking - at the modification time, so it would be nice if the - modification time of the upstream source would be - preserved. -

- -

-
-
- - - Source packages - -

- The Debian binary packages in the distribution are generated - from Debian sources, which are in a special format to assist - the easy and automatic building of binaries. -

- -

- There was a previous version of the Debian source format, - which is now being phased out. Instructions for converting an - old-style package are given in the Debian policy manual. -

- - - Tools for processing source packages - -

- Various tools are provided for manipulating source packages; - they pack and unpack sources and help build of binary - packages and help manage the distribution of new versions. -

- -

- They are introduced and typical uses described here; see - for full - documentation about their arguments and operation. -

- -

- For examples of how to construct a Debian source package, - and how to use those utilities that are used by Debian - source packages, please see the hello example - package. -

- - - - dpkg-source - packs and unpacks Debian source - packages - - -

- This program is frequently used by hand, and is also - called from package-independent automated building scripts - such as dpkg-buildpackage. -

- -

- To unpack a package it is typically invoked with - - dpkg-source -x .../path/to/filename.dsc - -

- -

- with the filename.tar.gz and - filename.diff.gz (if applicable) in - the same directory. It unpacks into - package-version, and if - applicable - package-version.orig, in - the current directory. -

- -

- To create a packed source archive it is typically invoked: - - dpkg-source -b package-version - -

- -

- This will create the .dsc, .tar.gz and - .diff.gz (if appropriate) in the current - directory. dpkg-source does not clean the - source tree first - this must be done separately if it is - required. -

- -

- See also .

-
- - - - - dpkg-buildpackage - overall package-building - control script - - -

- dpkg-buildpackage is a script which invokes - dpkg-source, the debian/rules - targets clean, build and - binary, dpkg-genchanges and - pgp to build a signed source and binary - package upload. -

- -

- It is usually invoked by hand from the top level of the - built or unbuilt source directory. It may be invoked with - no arguments; useful arguments include: - - -uc, -us - -

- Do not PGP-sign the .changes file or the - source package .dsc file, respectively.

- - -ppgp-command - -

- Invoke pgp-command instead of finding - pgp on the PATH. - pgp-command must behave just like - pgp.

-
- -rroot-command - -

- When root privilege is required, invoke the command - root-command. root-command - should invoke its first argument as a command, from - the PATH if necessary, and pass its - second and subsequent arguments to the command it - calls. If no root-command is supplied - then dpkg-buildpackage will take no - special action to gain root privilege, so that for - most packages it will have to be invoked as root to - start with.

-
- -b, -B - -

- Two types of binary-only build and upload - see - . -

-
- -

-
- - - - dpkg-gencontrol - generates binary package - control files - - -

- This program is usually called from debian/rules - (see ) in the top level of the source - tree. -

- -

- This is usually done just before the files and directories in the - temporary directory tree where the package is being built have their - permissions and ownerships set and the package is constructed using - dpkg-deb/ - -

- This is so that the control file which is produced has - the right permissions -

- . -

- -

- dpkg-gencontrol must be called after all the - files which are to go into the package have been placed in - the temporary build directory, so that its calculation of - the installed size of a package is correct. -

- -

- It is also necessary for dpkg-gencontrol to - be run after dpkg-shlibdeps so that the - variable substitutions created by - dpkg-shlibdeps in debian/substvars - are available. -

- -

- For a package which generates only one binary package, and - which builds it in debian/tmp relative to the top - of the source package, it is usually sufficient to call - dpkg-gencontrol. -

- -

- Sources which build several binaries will typically need - something like: - - dpkg-gencontrol -Pdebian/tmp-pkg -ppackage - The -P tells - dpkg-gencontrol that the package is being - built in a non-default directory, and the -p - tells it which package's control file should be generated. -

- -

- dpkg-gencontrol also adds information to the - list of files in debian/files, for the benefit of - (for example) a future invocation of - dpkg-genchanges.

-
- - - - dpkg-shlibdeps - calculates shared library - dependencies - - -

- This program is usually called from debian/rules - just before dpkg-gencontrol (see ), in the top level of the source tree. -

- -

- Its arguments are executables. - -

- In a forthcoming dpkg version, - dpkg-shlibdeps would be required to be - called on shared libraries as well. -

-

- They may be specified either in the locations in the - source tree where they are created or in the locations - in the temporary build tree where they are installed - prior to binary package creation. -

- for which shared library dependencies should - be included in the binary package's control file. -

- -

- If some of the found shared libraries should only - warrant a Recommends or Suggests, or if - some warrant a Pre-Depends, this can be achieved - by using the -ddependency-field option - before those executable(s). (Each -d option - takes effect until the next -d.) -

- -

- dpkg-shlibdeps does not directly cause the - output control file to be modified. Instead by default it - adds to the debian/substvars file variable - settings like shlibs:Depends. These variable - settings must be referenced in dependency fields in the - appropriate per-binary-package sections of the source - control file. -

- -

- For example, the procps package generates two - kinds of binaries, simple C binaries like ps - which require a predependency and full-screen ncurses - binaries like top which require only a - recommendation. It can say in its debian/rules: - - dpkg-shlibdeps -dPre-Depends ps -dRecommends top - - and then in its main control file debian/control: - - ... - Package: procps - Pre-Depends: ${shlibs:Pre-Depends} - Recommends: ${shlibs:Recommends} - ... - -

- -

- Sources which produce several binary packages with - different shared library dependency requirements can use - the -pvarnameprefix option to override - the default shlib: prefix (one invocation of - dpkg-shlibdeps per setting of this option). - They can thus produce several sets of dependency - variables, each of the form - varnameprefix:dependencyfield, - which can be referred to in the appropriate parts of the - binary package control files. -

-
- - - - - dpkg-distaddfile - adds a file to - debian/files - - -

- Some packages' uploads need to include files other than - the source and binary package files. -

- -

- dpkg-distaddfile adds a file to the - debian/files file so that it will be included in - the .changes file when - dpkg-genchanges is run. -

- -

- It is usually invoked from the binary target of - debian/rules: - - dpkg-distaddfile filename section priority - - The filename is relative to the directory where - dpkg-genchanges will expect to find it - this - is usually the directory above the top level of the source - tree. The debian/rules target should put the - file there just before or just after calling - dpkg-distaddfile. -

- -

- The section and priority are passed - unchanged into the resulting .changes file. See - . -

-
- - - dpkg-genchanges - generates a .changes upload - control file - - -

- This program is usually called by package-independent - automatic building scripts such as - dpkg-buildpackage, but it may also be called - by hand. -

- -

- It is usually called in the top level of a built source - tree, and when invoked with no arguments will print out a - straightforward .changes file based on the - information in the source package's changelog and control - file and the binary and source packages which should have - been built. -

-
- - - dpkg-parsechangelog - produces parsed representation of - a changelog - - -

- This program is used internally by - dpkg-source et al. It may also occasionally - be useful in debian/rules and elsewhere. It - parses a changelog, debian/changelog by default, - and prints a control-file format representation of the - information in it to standard output. -

-
- - dpkg-architecture - - information about the build and host system - - -

- This program can be used manually, but is also invoked by - dpkg-buildpackage or debian/rules to set - to set environment or make variables which specify the build and - host architecture for the package building process. -

-
-
- - The Debianised source tree - - -

- The source archive scheme described later is intended to - allow a Debianised source tree with some associated control - information to be reproduced and transported easily. The - Debianised source tree is a version of the original program - with certain files added for the benefit of the - Debianisation process, and with any other changes required - made to the rest of the source code and installation - scripts. -

- -

- The extra files created for Debian are in the subdirectory - debian of the top level of the Debianised source - tree. They are described below. -

- - debian/rules - the main building - script - - -

- This file is an executable makefile, and contains the - package-specific recipies for compiling the package and - building binary package(s) out of the source. -

- -

- It must start with the line #!/usr/bin/make -f, - so that it can be invoked by saying its name rather than - invoking make explicitly. -

- -

- Since an interactive debian/rules script makes it - impossible to autocompile that package and also makes it - hard for other people to reproduce the same binary - package, all required targets have to be - non-interactive. At a minimul, required targets are the - ones called by dpkg-buildpackage, namely, - clean, binary, binary-arch, and - build. It also follows that any target that these - targets depend on must also be non-interactive. -

- -

- The targets which are required to be present are: - - build - -

- This should perform all non-interactive - configuration and compilation of the package. If a - package has an interactive pre-build configuration - routine, the Debianised source package should be - built after this has taken place, so that it can be - built without rerunning the configuration. -

- -

- For some packages, notably ones where the same - source tree is compiled in different ways to produce - two binary packages, the build target - does not make much sense. For these packages it is - good enough to provide two (or more) targets - (build-a and build-b or whatever) - for each of the ways of building the package, and a - build target that does nothing. The - binary target will have to build the - package in each of the possible ways and make the - binary package out of each. -

- -

- The build target must not do anything - that might require root privilege. -

- -

- The build target may need to run - clean first - see below. -

- -

- When a package has a configuration routine that - takes a long time, or when the makefiles are poorly - designed, or when build needs to run - clean first, it is a good idea to - touch build when the build process is - complete. This will ensure that if debian/rules - build is run again it will not rebuild the - whole program. -

- - - binary, binary-arch, - binary-indep - - -

- The binary target should be all that is - necessary for the user to build the binary - package. All these targets are required to be - non-interactive. It is split into two parts: - binary-arch builds the packages' output - files which are specific to a particular - architecture, and binary-indep builds - those which are not. -

- -

- binary should usually be a target with - no commands which simply depends on - binary-arch and - binary-indep. -

- -

- Both binary-* targets should depend on - the build target, above, so that the - package is built if it has not been already. It - should then create the relevant binary package(s), - using dpkg-gencontrol to make their - control files and dpkg-deb to build - them and place them in the parent of the top level - directory. -

- -

- If one of the binary-* targets has - nothing to do (this will be always be the case if - the source generates only a single binary package, - whether architecture-dependent or not) it - must still exist, but should always - succeed. -

- -

- describes how to construct - binary packages. -

- -

- The binary targets must be invoked as - root. -

-
- - clean - - -

- This should undo any effects that the - build and binary targets - may have had, except that it should leave alone any - output files created in the parent directory by a - run of binary. This target is required - to be non-interactive. -

- -

- If a build file is touched at the end - of the build target, as suggested - above, it must be removed as the first thing that - clean does, so that running - build again after an interrupted - clean doesn't think that everything is - already done. -

- -

- The clean target must be invoked as - root if binary has been invoked since - the last clean, or if - build has been invoked as root (since - build may create directories, for - example). -

-
- - get-orig-source (optional) - - -

- This target fetches the most recent version of the - original source package from a canonical archive - site (via FTP or WWW, for example), does any - necessary rearrangement to turn it into the original - source tarfile format described below, and leaves it - in the current directory. -

- -

- This target may be invoked in any directory, and - should take care to clean up any temporary files it - may have left. -

- -

- This target is optional, but providing it if - possible is a good idea. -

-
- - -

- The build, binary and - clean targets must be invoked with a current - directory of the package's top-level directory. -

- - -

- Additional targets may exist in debian/rules, - either as published or undocumented interfaces or for the - package's internal use. -

- -

- The architecture we build on and build for is determined by make - variables via dpkg-architecture (see ). You can - get the Debian architecture and the GNU style architecture - specification string for the build machine as well as the host - machine. Here is a list of supported make variables: - - -

DEB_*_ARCH (the Debian architecture)

- - -

DEB_*_GNU_TYPE (the GNU style architecture - specification string)

-
- -

DEB_*_GNU_CPU (the CPU part of DEB_*_GNU_TYPE)

-
- -

DEB_*_GNU_SYSTEM (the System part of - DEB_*_GNU_TYPE)

- -

- -

- where * is either BUILD for specification of - the build machine or HOST for specification of the machine - we build for. -

- -

- Backward compatibility can be provided in the rules file - by setting the needed variables to suitable default - values, please refer to the documentation of - dpkg-architecture for details. -

- -

- It is important to understand that the DEB_*_ARCH - string does only determine which Debian architecture we - build on resp. for. It should not be used to get the CPU - or System information, the GNU style variables should be - used for that. -

-
- - - debian/control - - -

- This file contains version-independent details about the - source package and about the binary packages it creates. -

- -

- It is a series of sets of control fields, each - syntactically similar to a binary package control file. - The sets are separated by one or more blank lines. The - first set is information about the source package in - general; each subsequent set describes one binary package - that the source tree builds. -

- -

- The syntax and semantics of the fields are described below - in . -

- -

- The general (binary-package-independent) fields are: - - -

Source (mandatory)

- - -

Maintainer

-
- -

- Section and - Priority - (classification, mandatory) -

-
- -

- Build-Depends et - al. (source package interrelationships) -

-
- -

- Standards-Version -

-
- - -

- The per-binary-package fields are: - - -

Package (mandatory)

- - -

- Architecture - (mandatory)

-
- -

Description

-
- -

- Section and - Priority (classification)

-
- -

Essential

-
- -

- Depends et - al. (binary package interrelationships) -

-
- - -

- These fields are used by dpkg-gencontrol to - generate control files for binary packages (see below), by - dpkg-genchanges to generate the - .changes file to accompany the upload, and by - dpkg-source when it creates the .dsc - source control file as part of a source archive. -

- -

- The fields here may contain variable references - their - values will be substituted by - dpkg-gencontrol, dpkg-genchanges - or dpkg-source when they generate output - control files. See for details. -

- -

User-defined fields - - -

- Additional user-defined fields may be added to the - source package control file. Such fields will be - ignored, and not copied to (for example) binary or - source package control files or upload control files. -

- -

- If you wish to add additional unsupported fields to - these output files you should use the mechanism - described here. -

- -

- Fields in the main source control information file with - names starting X, followed by one or more of - the letters BCS and a hyphen -, will - be copied to the output files. Only the part of the - field name after the hyphen will be used in the output - file. Where the letter B is used the field - will appear in binary package control files, where the - letter S is used in source package control - files and where C is used in upload control - (.changes) files. -

- -

- For example, if the main source information control file - contains the field - - XBS-Comment: I stand between the candle and the star. - - then the binary and source package control files will contain the - field - - Comment: I stand between the candle and the star. - -

- - -
- - debian/changelog - - -

- This file records the changes to the Debian-specific parts of the - package - -

- Though there is nothing stopping an author who is also - the Debian maintainer from using it for all their - changes, it will have to be renamed if the Debian and - upstream maintainers become different - people. -

- . -

- -

- It has a special format which allows the package building - tools to discover which version of the package is being - built and find out other release-specific information. -

- -

- That format is a series of entries like this: - - package (version) distribution(s); urgency=urgency - - * change details - more change details - * even more change details - - -- maintainer name and email address date - -

- -

- package and version are the source - package name and version number. -

- -

- distribution(s) lists the distributions where - this version should be installed when it is uploaded - it - is copied to the Distribution field in the - .changes file. See . -

- -

- urgency is the value for the Urgency - field in the .changes file for the upload. See - . It is not possible to specify an - urgency containing commas; commas are used to separate - keyword=value settings in - the dpkg changelog format (though there is - currently only one useful keyword, - urgency). -

- -

- The change details may in fact be any series of lines - starting with at least two spaces, but conventionally each - change starts with an asterisk and a separating space and - continuation lines are indented so as to bring them in - line with the start of the text above. Blank lines may be - used here to separate groups of changes, if desired. -

- -

- The maintainer name and email address should not - necessarily be those of the usual package maintainer. - They should be the details of the person doing - this version. The information here will be - copied to the .changes file, and then later used - to send an acknowledgement when the upload has been - installed. -

- -

- The date should be in RFC822 format - -

- This is generated by the 822-date - program. -

- ; it should include the timezone specified - numerically, with the timezone name or abbreviation - optionally present as a comment. -

- -

- The first `title' line with the package name should start - at the left hand margin; the `trailer' line with the - maintainer and date details should be preceded by exactly - one space. The maintainer details and the date must be - separated by exactly two spaces. -

- -

- An Emacs mode for editing this format is available: it is - called debian-changelog-mode. You can have this - mode selected automatically when you edit a Debian - changelog by adding a local variables clause to the end of - the changelog. -

- - Defining alternative changelog formats - - -

- It is possible to use a different format to the standard - one, by providing a parser for the format you wish to - use. -

- -

- In order to have dpkg-parsechangelog run your - parser, you must include a line within the last 40 lines - of your file matching the Perl regular expression: - \schangelog-format:\s+([0-9a-z]+)\W The part in - parentheses should be the name of the format. For - example, you might say: - - @@@ changelog-format: joebloggs @@@ - - Changelog format names are non-empty strings of alphanumerics. -

- -

- If such a line exists then dpkg-parsechangelog - will look for the parser as - /usr/lib/dpkg/parsechangelog/format-name - or - /usr/local/lib/dpkg/parsechangelog/format-name; - it is an error for it not to find it, or for it not to - be an executable program. The default changelog format - is dpkg, and a parser for it is provided with - the dpkg package. -

- -

- The parser will be invoked with the changelog open on - standard input at the start of the file. It should read - the file (it may seek if it wishes) to determine the - information required and return the parsed information - to standard output in the form of a series of control - fields in the standard format. By default it should - return information about only the most recent version in - the changelog; it should accept a - -vversion option to return changes - information from all versions present strictly - after version, and it should then be an - error for version not to be present in the - changelog. -

- -

- The fields are: - - -

Source

- - -

Version (mandatory)

-
- -

- Distribution - (mandatory) -

-
- -

Urgency (mandatory)

-
- -

- Maintainer - (mandatory) -

-
- -

Date

-
- -

- Changes - (mandatory) -

-
- - -

- If several versions are being returned (due to the use - of -v), the urgency value should be of the - highest urgency code listed at the start of any of the - versions requested followed by the concatenated - (space-separated) comments from all the versions - requested; the maintainer, version, distribution and - date should always be from the most recent version. -

- -

- For the format of the Changes field see . -

- -

- If the changelog format which is being parsed always or - almost always leaves a blank line between individual - change notes these blank lines should be stripped out, - so as to make the resulting output compact. -

- -

- If the changelog format does not contain date or package - name information this information should be omitted from - the output. The parser should not attempt to synthesise - it or find it from other sources. -

- -

- If the changelog does not have the expected format the - parser should exit with a nonzero exit status, rather - than trying to muddle through and possibly generating - incorrect output. -

- -

- A changelog parser may not interact with the user at - all.

-
- - debian/substvars - and variable substitutions - - -

- When dpkg-gencontrol, - dpkg-genchanges and dpkg-source - generate control files they do variable substitutions on - their output just before writing it. Variable - substitutions have the form - ${variable-name}. The optional file - debian/substvars contains variable substitutions - to be used; variables can also be set directly from - debian/rules using the -V option to the - source packaging commands, and certain predefined - variables are available. -

- -

- The is usually generated and modified dynamically by - debian/rules targets; in this case it must be - removed by the clean target. -

- -

- See for full - details about source variable substitutions, including the - format of debian/substvars.

-
- - debian/files - - -

- This file is not a permanent part of the source tree; it - is used while building packages to record which files are - being generated. dpkg-genchanges uses it - when it generates a .changes file. -

- -

- It should not exist in a shipped source package, and so it - (and any backup files or temporary files such as - files.new - -

- files.new is used as a temporary file by - dpkg-gencontrol and - dpkg-distaddfile - they write a new - version of files here before renaming it, - to avoid leaving a corrupted copy if an error - occurs -

- ) should be removed by the - clean target. It may also be wise to - ensure a fresh start by emptying or removing it at the - start of the binary target. -

- -

- dpkg-gencontrol adds an entry to this file - for the .deb file that will be created by - dpkg-deb from the control file that it - generates, so for most packages all that needs to be done - with this file is to delete it in clean. -

- -

- If a package upload includes files besides the source - package and any binary packages whose control files were - made with dpkg-gencontrol then they should be - placed in the parent of the package's top-level directory - and dpkg-distaddfile should be called to add - the file to the list in debian/files.

-
- - debian/tmp - - -

- This is the canonical temporary location for the - construction of binary packages by the binary - target. The directory tmp serves as the root of - the filesystem tree as it is being constructed (for - example, by using the package's upstream makefiles install - targets and redirecting the output there), and it also - contains the DEBIAN subdirectory. See . -

- -

- If several binary packages are generated from the same - source tree it is usual to use several - debian/tmpsomething directories, for - example tmp-a or tmp-doc. -

- -

- Whatever tmp directories are created and used by - binary must of course be removed by the - clean target.

-
- - - Source packages as archives - - -

- As it exists on the FTP site, a Debian source package - consists of three related files. You must have the right - versions of all three to be able to use them. -

- -

- - Debian source control file - .dsc - - -

- This file contains a series of fields, identified and - separated just like the fields in the control file of - a binary package. The fields are listed below; their - syntax is described above, in . - - -

Source

- - -

Version

-
- -

Maintainer

-
- -

Binary

-
- -

Architecture

-
- -

- Build-Depends et - al. (source package interrelationships) -

-
- -

- Standards-Version

-
- -

Files

-
- - -

- The source package control file is generated by - dpkg-source when it builds the source - archive, from other files in the source package, - described above. When unpacking it is checked against - the files and directories in the other parts of the - source package, as described below.

- - - - Original source archive - - - package_upstream-version.orig.tar.gz - - - - - -

- This is a compressed (with gzip -9) - tar file containing the source code from - the upstream authors of the program. The tarfile - unpacks into a directory - package-upstream-version.orig, - and does not contain files anywhere other than in - there or in its subdirectories.

-
- - - Debianisation diff - - - package_upstream_version-revision.diff.gz - - - - -

- This is a unified context diff (diff -u) - giving the changes which are required to turn the - original source into the Debian source. These changes - may only include editing and creating plain files. - The permissions of files, the targets of symbolic - links and the characteristics of special files or - pipes may not be changed and no files may be removed - or renamed. -

- -

- All the directories in the diff must exist, except the - debian subdirectory of the top of the source - tree, which will be created by - dpkg-source if necessary when unpacking. -

- -

- The dpkg-source program will - automatically make the debian/rules file - executable (see below).

- - - -

- If there is no original source code - for example, if the - package is specially prepared for Debian or the Debian - maintainer is the same as the upstream maintainer - the - format is slightly different: then there is no diff, and the - tarfile is named - package_version.tar.gz and - contains a directory - package-version. -

-
- - Unpacking a Debian source package without - dpkg-source - - -

- dpkg-source -x is the recommended way to unpack a - Debian source package. However, if it is not available it - is possible to unpack a Debian source archive as follows: - - -

- Untar the tarfile, which will create a .orig - directory.

- - -

Rename the .orig directory to - package-version.

-
- -

- Create the subdirectory debian at the top of - the source tree.

-
-

Apply the diff using patch -p0.

-
-

Untar the tarfile again if you want a copy of the original - source code alongside the Debianised version.

-
- - -

- It is not possible to generate a valid Debian source archive - without using dpkg-source. In particular, - attempting to use diff directly to generate the - .diff.gz file will not work. -

- - Restrictions on objects in source packages - - -

- The source package may not contain any hard links - -

- This is not currently detected when building source - packages, but only when extracting - them. -

- - -

- Hard links may be permitted at some point in the - future, but would require a fair amount of - work. -

-
, device special files, sockets or setuid or - setgid files. - -

- Setgid directories are allowed. -

-
-

- -

- The source packaging tools manage the changes between the - original and Debianised source using diff and - patch. Turning the original source tree as - included in the .orig.tar.gz into the debianised - source must not involve any changes which cannot be - handled by these tools. Problematic changes which cause - dpkg-source to halt with an error when - building the source package are: - -

Adding or removing symbolic links, sockets or pipes.

- -

Changing the targets of symbolic links.

-
-

Creating directories, other than debian.

-
-

Changes to the contents of binary files.

- Changes which cause dpkg-source to - print a warning but continue anyway are: - - -

- Removing files, directories or symlinks. - -

- Renaming a file is not treated specially - it is - seen as the removal of the old file (which - generates a warning, but is otherwise ignored), - and the creation of the new - one.

- -

-
- -

- Changed text files which are missing the usual final - newline (either in the original or the modified - source tree). -

-
-
- Changes which are not represented, but which are not detected by - dpkg-source, are: - -

Changing the permissions of files (other than - debian/rules) and directories.

-
-

- -

- The debian directory and debian/rules - are handled specially by dpkg-source - before - applying the changes it will create the debian - directory, and afterwards it will make - debian/rules world-exectuable. -

-
-
-
- - Control files and their fields - - -

- Many of the tools in the dpkg suite manipulate - data in a common format, known as control files. Binary and - source packages have control data as do the .changes - files which control the installation of uploaded files, and - dpkg's internal databases are in a similar - format. -

- - Syntax of control files - - -

- A file consists of one or more paragraphs of fields. The - paragraphs are separated by blank lines. Some control files - only allow one paragraph; others allow several, in which - case each paragraph often refers to a different package. -

- -

- Each paragraph is a series of fields and values; each field - consists of a name, followed by a colon and the value. It - ends at the end of the line. Horizontal whitespace (spaces - and tabs) may occur before or after the value and is ignored - there; it is conventional to put a single space after the - colon. -

- -

- Some fields' values may span several lines; in this case - each continuation line must start with a space or - tab. Any trailing spaces or tabs at the end of individual - lines of a field value are ignored. -

- -

- Except where otherwise stated only a single line of data is - allowed and whitespace is not significant in a field body. - Whitespace may never appear inside names (of packages, - architectures, files or anything else), version numbers or - in between the characters of multi-character version - relationships. -

- -

- Field names are not case-sensitive, but it is usual to - capitalise the field names using mixed case as shown below. -

- -

- Blank lines, or lines consisting only of spaces and tabs, - are not allowed within field values or between fields - that - would mean a new paragraph. -

- -

- It is important to note that there are several fields which - are optional as far as dpkg and the related - tools are concerned, but which must appear in every Debian - package, or whose omission may cause problems. When writing - the control files for Debian packages you must read - the Debian policy manual in conjuction with the details - below and the list of fields for the particular file.

-
- - List of fields - - - Package - - -

- The name of the binary package. Package names consist of - the alphanumerics and + - . - (plus, minus and full stop). - -

- The characters @ : = - % _ (at, colon, equals, percent - and underscore) used to be legal and are still - accepted when found in a package file, but may not be - used in new packages -

- -

- -

- They must be at least two characters and must start with - an alphanumeric. In current versions of dpkg they are - sort of case-sensitive

This is a - bug.

; use lowercase package names unless - the package you're building (or referring to, in other - fields) is already using uppercase.

-
- - Version - - -

- This lists the source or binary package's version number - - see . -

- -
- - Architecture - - -

- This is the architecture string; it is a single word for - the Debian architecture. -

- -

- dpkg will check the declared architecture of - a binary package against its own compiled-in value before - it installs it. -

- -

- The special value all indicates that the package - is architecture-independent. -

- -

- In the main debian/control file in the source - package, or in the source package control file - .dsc, a list of architectures (separated by - spaces) is also allowed, as is the special value - any. A list indicates that the source will build - an architecture-dependent package, and will only work - correctly on the listed architectures. any - indicates that though the source package isn't dependent - on any particular architecture and should compile fine on - any one, the binary package(s) produced are not - architecture-independent but will instead be specific to - whatever the current build architecture is. -

- -

- In a .changes file the Architecture - field lists the architecture(s) of the package(s) - currently being uploaded. This will be a list; if the - source for the package is being uploaded too the special - entry source is also present. -

- -

- See for information how to get the - architecture for the build process. -

-
- - Maintainer - - -

- The package maintainer's name and email address. The name - should come first, then the email address inside angle - brackets <> (in RFC822 format). -

- -

- If the maintainer's name contains a full stop then the - whole field will not work directly as an email address due - to a misfeature in the syntax specified in RFC822; a - program using this field as an address must check for this - and correct the problem if necessary (for example by - putting the name in round brackets and moving it to the - end, and bringing the email address forward). -

- -

- In a .changes file or parsed changelog data this - contains the name and email address of the person - responsible for the particular version in question - this - may not be the package's usual maintainer. -

- -

- This field is usually optional in as far as the - dpkg are concerned, but its absence when - building packages usually generates a warning.

-
- - Source - - -

- This field identifies the source package name. -

- -

- In a main source control information or a - .changes or .dsc file or parsed - changelog data this may contain only the name of the - source package. -

- -

- In the control file of a binary package (or in a - Packages file) it may be followed by a version - number in parentheses. - -

- It is usual to leave a space after the package name if - a version number is specified. -

- This version number may be omitted (and is, by - dpkg-gencontrol) if it has the same value as - the Version field of the binary package in - question. The field itself may be omitted from a binary - package control file when the source package has the same - name and version as the binary package. -

-
- - Package interrelationship fields: - Depends, Pre-Depends, - Recommends Suggests, Conflicts, - Provides, Replaces - - -

- These fields describe the package's relationships with - other packages. Their syntax and semantics are described - in .

-
- - Description - - -

- In a binary package Packages file or main source - control file this field contains a description of the - binary package, in a special format. See for details. -

- -

- In a .changes file it contains a summary of the - descriptions for the packages being uploaded. The part of - the field before the first newline is empty; thereafter - each line has the name of a binary package and the summary - description line from that binary package. Each line is - indented by one space.

-
- - Essential - - -

- This is a boolean field which may occur only in the - control file of a binary package (or in the - Packages file) or in a per-package fields - paragraph of a main source control data file. -

- -

- If set to yes then dpkg and - dselect will refuse to remove the package - (though it can be upgraded and/or replaced). The other - possible value is no, which is the same as not - having the field at all.

-
- - Section and - Priority - - -

- These two fields classify the package. The - Priority represents how important that it is that - the user have it installed; the Section - represents an application area into which the package has - been classified. -

- -

- When they appear in the debian/control file these - fields give values for the section and priority subfields - of the Files field of the .changes file, - and give defaults for the section and priority of the - binary packages. -

- -

- The section and priority are represented, though not as - separate fields, in the information for each file in the - -Filefield of a - .changes file. The section value in a - .changes file is used to decide where to install - a package in the FTP archive. -

- -

- These fields are not used by by dpkg proper, - but by dselect when it sorts packages and - selects defaults. See the Debian policy manual for the - priorities in use and the criteria for selecting the - priority for a Debian package, and look at the Debian FTP - archive for a list of currently in-use priorities. -

- -

- These fields may appear in binary package control files, - in which case they provide a default value in case the - Packages files are missing the information. - dpkg and dselect will only use - the value from a .deb file if they have no other - information; a value listed in a Packages file - will always take precedence. By default - dpkg-gencontrol does not include the section - and priority in the control file of a binary package - use - the -isp, -is or -ip options to - achieve this effect.

-
- - Binary - - -

- This field is a list of binary packages. -

- -

- When it appears in the .dsc file it is the list - of binary packages which a source package can produce. It - does not necessarily produce all of these binary packages - for every architecture. The source control file doesn't - contain details of which architectures are appropriate for - which of the binary packages. -

- -

- When it appears in a .changes file it lists the - names of the binary packages actually being uploaded. -

- -

- The syntax is a list of binary packages separated by - commas. - -

- A space after each comma is conventional. -

- Currently the packages must be separated using - only spaces in the .changes file.

-
- - Installed-Size - - -

- This field appears in the control files of binary - packages, and in the Packages files. It gives - the total amount of disk space required to install the - named package. -

- -

- The disk space is represented in kilobytes as a simple - decimal number.

-
- - Files - - -

- This field contains a list of files with information about - each one. The exact information and syntax varies with - the context. In all cases the the part of the field - contents on the same line as the field name is empty. The - remainder of the field is one line per file, each line - being indented by one space and containing a number of - sub-fields separated by spaces. -

- -

- In the .dsc (Debian source control) file each - line contains the MD5 checksum, size and filename of the - tarfile and (if applicable) diff file which make up the - remainder of the source package. - -

- That is, the parts which are not the - .dsc. -

- The exact forms of the filenames are described - in . -

- -

- In the .changes file this contains one line per - file being uploaded. Each line contains the MD5 checksum, - size, section and priority and the filename. The section - and priority are the values of the corresponding fields in - the main source control file - see . If no section or priority is - specified then - should be used, though section - and priority values must be specified for new packages to - be installed properly. -

- -

- The special value byhand for the section in a - .changes file indicates that the file in question - is not an ordinary package file and must by installed by - hand by the distribution maintainers. If the section is - byhand the priority should be -. -

- -

- If a new Debian revision of a package is being shipped and - no new original source archive is being distributed the - .dsc must still contain the Files field - entry for the original source archive - package-upstream-version.orig.tar.gz, - but the .changes file should leave it out. In - this case the original source archive on the distribution - site must match exactly, byte-for-byte, the original - source archive which was used to generate the - .dsc file and diff which are being uploaded.

-
- - - Standards-Version - - -

- The most recent version of the standards (the - dpkg programmers' and policy manuals and - associated texts) with which the package complies. This - is updated manually when editing the source package to - conform to newer standards; it can sometimes be used to - tell when a package needs attention. -

- -

- Its format is the same as that of a version number except - that no epoch or Debian revision is allowed - see .

-
- - - Distribution - - -

- In a .changes file or parsed changelog output - this contains the (space-separated) name(s) of the - distribution(s) where this version of the package should - be or was installed. Distribution names follow the rules - for package names. (See ). -

- -

- Current distribution values are: - - stable - -

- This is the current `released' version of Debian - GNU/Linux. A new version is released approximately - every 3 months after the development code has - been frozen for a month of testing. Once the - distribution is stable only major bug fixes - are allowed. When changes are made to this - distribution, the release number is increased - (for example: 1.2r1 becomes 1.2r2 then 1.2r3, etc). -

- - - unstable - -

- This distribution value refers to the - developmental part of the Debian distribution - tree. New packages, new upstream versions of packages - and bug fixes go into the unstable directory - tree. Download from this distribution at your own - risk.

-
- - contrib - -

- The packages with this distribution value do not meet - the criteria for inclusion in the main Debian - distribution as defined by the Policy Manual, but meet - the criteria for the contrib - Distribution. There is currently no distinction - between stable and unstable packages in the - contrib or non-free - distributions. Use your best judgement in downloading - from this Distribution.

-
- - non-free - -

- Like the packages in the contrib seciton, - the packages in non-free do not meet the - criteria for inclusion in the main Debian distribution - as defined by the Policy Manual. Again, use your best - judgement in downloading from this Distribution.

- - experimental - -

- The packages with this distribution value are deemed - by their maintainers to be high risk. Oftentimes they - represent early beta or developmental packages from - various sources that the maintainers want people to - try, but are not ready to be a part of the other parts - of the Debian distribution tree. Download at your own - risk.

-
- - frozen - -

- From time to time, (currently, every 3 months) the - unstable distribution enters a state of - `code-freeze' in anticipation of release as a - stable version. During this period of testing - (usually 4 weeks) only fixes for existing or - newly-discovered bugs will be allowed. -

-
- You should list all distributions that - the package should be installed into. Except in unusual - circumstances, installations to stable should also - go into frozen (if it exists) and - unstable. Likewise, installations into - frozen should also go into unstable.

-
- - Urgency - - -

- This is a description of how important it is to upgrade to - this version from previous ones. It consists of a single - keyword usually taking one of the values LOW, - MEDIUM or HIGH) followed by an optional - commentary (separated by a space) which is usually in - parentheses. For example: - - Urgency: LOW (HIGH for diversions users) - -

- -

- This field appears in the .changes file and in - parsed changelogs; its value appears as the value of the - urgency attribute in a dpkg-style - changelog (see ). -

- -

- Urgency keywords are not case-sensitive.

-
- - Date - - -

- In .changes files and parsed changelogs, this - gives the date the package was built or last edited.

-
- - Format - - -

- This field occurs in .changes files, and - specifies a format revision for the file. The format - described here is version 1.5. The syntax of the - format value is the same as that of a package version - number except that no epoch or Debian revision is allowed - - see .

-
- - Changes - - -

- In a .changes file or parsed changelog this field - contains the human-readable changes data, describing the - differences between the last version and the current one. -

- -

- There should be nothing in this field before the first - newline; all the subsequent lines must be indented by at - least one space; blank lines must be represented by a line - consiting only of a space and a full stop. -

- -

- Each version's change information should be preceded by a - `title' line giving at least the version, distribution(s) - and urgency, in a human-readable way. -

- -

- If data from several versions is being returned the entry - for the most recent version should be returned first, and - entries should be separated by the representation of a - blank line (the `title' line may also be followed by the - representation of blank line).

-
- - Filename and - MSDOS-Filename - - -

- These fields in Packages files give the - filename(s) of (the parts of) a package in the - distribution directories, relative to the root of the - Debian hierarchy. If the package has been split into - several parts the parts are all listed in order, separated - by spaces.

-
- - Size and MD5sum - - -

- These fields in Packages files give the size (in - bytes, expressed in decimal) and MD5 checksum of the - file(s) which make(s) up a binary package in the - distribution. If the package is split into several parts - the values for the parts are listed in order, separated by - spaces.

-
- - Status - - -

- This field in dpkg's status file records - whether the user wants a package installed, removed or - left alone, whether it is broken (requiring - reinstallation) or not and what its current state on the - system is. Each of these pieces of information is a - single word.

-
- - Config-Version - - -

- If a package is not installed or not configured, this - field in dpkg's status file records the last - version of the package which was successfully - configured.

-
- - Conffiles - - -

- This field in dpkg's status file contains - information about the automatically-managed configuration - files held by a package. This field should not - appear anywhere in a package!

-
- - Obsolete fields - - -

- These are still recognised by dpkg but should - not appear anywhere any more. - - - Revision - Package-Revision - Package_Revision - -

- The Debian revision part of the package version was - at one point in a separate control file field. This - field went through several names.

- - - Recommended -

Old name for Recommends

-
- - Optional -

Old name for Suggests.

-
- Class -

Old name for Priority.

-
- -

-
-
-
- - Version numbering - - -

- Every package has a version number, in its Version - control file field. -

- -

- dpkg imposes an ordering on version numbers, so - that it can tell whether packages are being up- or downgraded - and so that dselect can tell whether a package it - finds available is newer than the one installed on the system. - The version number format has the most significant parts (as - far as comparison is concerned) at the beginning. -

- -

- The version number format is: - &lsqbepoch/:]upstream-version[-/debian-revision]. -

- -

- The three components here are: - - epoch - - -

- This is a single unsigned integer, which should usually - be small. It may be omitted, in which case zero is - assumed. If it is omitted then the - upstream-version may not contain any colons. -

- -

- It is provided to allow mistakes in the version numbers - of older versions of a package, and also a package's - previous version numbering schemes, to be left behind. -

- -

- dpkg will not usually display the epoch - unless it is essential (non-zero, or if the - upstream-version contains a colon); - dselect does not display epochs at all in - the main part of the package selection display.

- - - upstream-version - - -

- This is the main part of the version. It is usually - version number of the original (`upstream') package of - which the .deb file has been made, if this is - applicable. Usually this will be in the same format as - that specified by the upstream author(s); however, it - may need to be reformatted to fit into - dpkg's format and comparison scheme. -

- -

- The comparison behaviour of dpkg with - respect to the upstream-version is described - below. The upstream-version portion of the - version number is mandatory. -

- -

- The upstream-version may contain only - alphanumerics and the characters . + - - : (full stop, plus, hyphen, colon) - and should start with a digit. If there is no - debian-revision then hyphens are not allowed; - if there is no epoch then colons are not - allowed.

-
- - debian-revision - - -

- This part of the version represents the version of the - modifications that were made to the package to make it a - Debian binary package. It is in the same format as the - upstream-version and dpkg - compares it in the same way. -

- -

- It is optional; if it isn't present then the - upstream-version may not contain a hyphen. - This format represents the case where a piece of - software was written specifically to be turned into a - Debian binary package, and so there is only one - `debianization' of it and therefore no revision - indication is required. -

- -

- It is conventional to restart the - debian-revision at 1 each time the - upstream-version is increased. -

- -

- dpkg will break the - upstream-version and - debian-revision apart at the last hyphen in - the string. The absence of a debian-revision - compares earlier than the presence of one (but note that - the debian-revision is the least significant - part of the version number). -

- -

- The debian-revision may contain only - alphanumerics and the characters + and - . (plus and full stop). -

-
- - The upstream-version and debian-revision parts are - compared by dpkg using the same algorithm: -

- -

- The strings are compared from left to right. -

- -

- First the initial part of each string consisting entirely of - non-digit characters is determined. These two parts (one of - which may be empty) are compared lexically. If a difference - is found it is returned. The lexical comparison is a - comparison of ASCII values modified so that all the letters - sort earlier than all the non-letters. -

- -

- Then the initial part of the remainder of each string which - consists entirely of digit characters is determined. The - numerical values of these two parts are compared, and any - difference found is returned as the result of the comparison. - For these purposes an empty string (which can only occur at - the end of one or both version strings being compared) counts - as zero. -

- -

- These two steps are repeated (chopping initial non-digit - strings and initial digit strings off from the start) until a - difference is found or both strings are exhausted. -

- -

- Note that the purpose of epochs is to allow us to leave behind - mistakes in version numbering, and to cope with situations - where the version numbering changes. It is not there - to cope with version numbers containing strings of letters - which dpkg cannot interpret (such as - ALPHA or pre-), or with silly orderings (the - author of this manual has heard of a package whose versions - went 1.1, 1.2, 1.3, 1, - 2.1, 2.2, 2 and so forth). -

- -

- If an upstream package has problematic version numbers they - should be converted to a sane form for use in the - Version field. -

- -

- If you need to compare version numbers in a script, you may use - dpkg --compare-versions .... Type dpkg - --help for details on arguments. -

- - - Version numbers based on dates -

- In general, Debian packages should use the same version - numbers as the upstream sources.

- -

- However, in some cases where the upstream version number is - based on a date (e.g., a development `snapshot' release) - dpkg cannot handle these version numbers currently, without - epochs. For example, dpkg will consider `96May01' to be - greater than `96Dec24'.

- -

- To prevent having to use epochs for every new upstream - version, the version number should be changed to the - following format in such cases: `19960501', `19961224'. It - is up to the maintainer whether he/she wants to bother the - upstream maintainer to change the version numbers upstream, - too.

- -

- Note, that other version formats based on dates which are - parsed correctly by dpkg should not be changed.

- -

- Native Debian packages (i.e., packages which have been - written especially for Debian) whose version numbers include - dates should always use the `YYYYMMDD' format.

-
-
- - Package maintainer scripts - and installation procedure - - - Introduction to package maintainer scripts - - -

- It is possible to supply scripts as part of a package which - dpkg will run for you when your package is - installed, upgraded or removed. -

- -

- These scripts should be the files preinst, - postinst, prerm and postrm in the - control area of the package. They must be proper exectuable - files; if they are scripts (which is recommended) they must - start with the usual #! convention. They should be - readable and executable to anyone, and not world-writeable. -

- -

- dpkg looks at the exit status from these - scripts. It is important that they exit with a non-zero - status if there is an error, so that dpkg can - stop its processing. For shell scripts this means that you - almost always need to use set -e (this is - usually true when writing shell scripts, in fact). It is - also important, of course, that they don't exit with a - non-zero status if everything went well. -

- -

- It is necessary for the error recovery procedures that the - scripts be idempotent: ie, invoking the same script several - times in the same situation should do no harm. If the first - call failed, or aborted half way through for some reason, - the second call should merely do the things that were left - undone the first time, if any, and exit with a success - status. -

- -

- When a package is upgraded a combination of the scripts from - the old and new packages is called in amongst the other - steps of the upgrade procedure. If your scripts are going - to be at all complicated you need to be aware of this, and - may need to check the arguments to your scripts. -

- -

- Broadly speaking the preinst is called before - (a particular version of) a package is installed, and the - postinst afterwards; the prerm - before (a version of) a package is removed and the - postrm afterwards. -

- - -

Programs called from maintainer scripts should not - normally have a path prepended to them. Before installation - is started dpkg checks to see if the programs - ldconfig, start-stop-daemon, - install-info, and update-rc.d can - be found via the PATH environment variable. Those - programs, and any other program that one would expect to on - the PATH, should thus be invoked without an - absolute pathname. Maintainer scripts should also not reset - the PATH, though they might choose to modify it by - pre- or appending package-specific directories. These - considerations really apply to all shell scripts.

-
- - Summary of ways maintainer - scripts are called - - -

- - -

new-preinst install

- - -

new-preinst install - old-version

-
- -

new-preinst upgrade - old-version

-
- -

old-preinst abort-upgrade - new-version -

-
- - -

- - -

postinst configure - most-recently-configured-version

- - -

old-postinst abort-upgrade - new version

-
- -

conflictor's-postinst abort-remove - in-favour package - new-version

-
- -

- deconfigured's-postinst - abort-deconfigure in-favour - failed-install-package version - removing conflicting-package - version -

-
- - -

- - -

prerm remove

- - -

old-prerm upgrade - new-version

-
- -

new-prerm failed-upgrade - old-version

-
- -

conflictor's-prerm remove - in-favour package - new-version

-
- -

- deconfigured's-prerm deconfigure - in-favour package-being-installed - version removing - conflicting-package - version -

-
- - -

- - -

postrm remove

- - -

postrm purge

-
- -

- old-postrm upgrade - new-version

-
- -

new-postrm failed-upgrade - old-version

-
- -

new-postrm abort-install

-
- -

new-postrm abort-install - old-version

-
- -

new-postrm abort-upgrade - old-version

-
- -

- disappearer's-postrm disappear - overwriter - overwriter-version

- -

- - - Details of unpack phase of - installation or upgrade - - -

- The procedure on installation/upgrade/overwrite/disappear - (ie, when running dpkg --unpack, or the unpack - stage of dpkg - --install) is as follows. In each case if an error occurs the - actions in are general run backwards - this means that the maintainer - scripts are run with different arguments in reverse order. These are - the `error unwind' calls listed below. - - - -

- - -

If a version the package is already - installed, call - - old-prerm upgrade new-version -

- - -

- If this gives an error (ie, a non-zero exit - status), dpkg will attempt instead: - - new-prerm failed-upgrade old-version - - Error unwind, for both the above cases: - - old-postinst abort-upgrade new-version - -

-
- -

- - -

If a `conflicting' package is being removed at the same time: - - -

- If any packages depended on that conflicting - package and --auto-deconfigure is - specified, call, for each such package: - - deconfigured's-prerm deconfigure \ - in-favour package-being-installed version \ - removing conflicting-package version - - Error unwind: - - deconfigured's-postinst abort-deconfigure \ - in-favour package-being-installed-but-failed version \ - removing conflicting-package version - - The deconfigured packages are marked as - requiring configuration, so that if - --install is used they will be - configured again if possible.

-
- -

To prepare for removal of the conflicting package, call: - - conflictor's-prerm remove in-favour package new-version - - Error unwind: - - conflictor's-postinst abort-remove \ - in-favour package new-version - -

-
- -

- - -

- - -

If the package is being upgraded, call: - - new-preinst upgrade old-version -

-
- -

- Otherwise, if the package had some configuration - files from a previous version installed (ie, it - is in the `configuration files only' state): - - new-preinst install old-version -

- - -

Otherwise (ie, the package was completely purged): - - new-preinst install - - Error unwind versions, respectively: - - new-postrm abort-upgrade old-version - new-postrm abort-install old-version - new-postrm abort-install - -

-
- -

-
- - -

- The new package's files are unpacked, overwriting any - that may be on the system already, for example any - from the old version of the same package or from - another package (backups of the old files are left - around, and if anything goes wrong dpkg will attempt - to put them back as part of the error unwind). -

- -

- It is an error for a package to contains files which - are on the system in another package, unless - Replaces is used (see ). - Currently the --force-overwrite flag is - enabled, downgrading it to a warning, but this may not - always be the case. -

- -

- It is a more serious error for a package to contain a - plain file or other kind of nondirectory where another - package has a directory (again, unless - Replaces is used). This error can be - overridden if desired using - --force-overwrite-dir, but this is not - advisable. -

- -

- Packages which overwrite each other's files produce - behaviour which though deterministic is hard for the - system administrator to understand. It can easily - lead to `missing' programs if, for example, a package - is installed which overwrites a file from another - package, and is then removed again. - -

- Part of the problem is due to what is arguably a - bug in dpkg. -

- -

- -

- A directory will never be replaced by a symbolic links - to a directory or vice versa; instead, the existing - state (symlink or not) will be left alone and - dpkg will follow the symlink if there is - one.

-
- - - -

- -

If the package is being upgraded, call - - old-postrm upgrade new-version -

-
- -

If this fails, dpkg will attempt: - - new-postrm failed-upgrade old-version - - Error unwind, for both cases: - - old-preinst abort-upgrade new-version - -

-
- - This is the point of no return - if dpkg - gets this far, it won't back off past this point if an - error occurs. This will leave the package in a fairly - bad state, which will require a successful - reinstallation to clear up, but it's when - dpkg starts doing things that are - irreversible.

- - -

- Any files which were in the old version of the package - but not in the new are removed.

-
- -

The new file list replaces the old.

-
- -

The new maintainer scripts replace the old.

-
- - -

Any packages all of whose files have been overwritten during the - installation, and which aren't required for - dependencies, are considered to have been removed. - For each such package, - - -

dpkg calls: - - disappearer's-postrm disappear \ - overwriter overwriter-version - -

-
- -

The package's maintainer scripts are removed. -

-
- -

- It is noted in the status database as being in a - sane state, namely not installed (any conffiles - it may have are ignored, rather than being - removed by dpkg). Note that - disappearing packages do not have their prerm - called, because dpkg doesn't know - in advance that the package is going to - vanish. -

-
- -

- - -

- Any files in the package we're unpacking that are also - listed in the file lists of other packages are removed - from those lists. (This will lobotomise the file list - of the `conflicting' package if there is one.) -

-
- -

- The backup files made during installation, above, are - deleted. -

-
- - -

- The new package's status is now sane, and recorded as - `unpacked'. Here is another point of no return - if - the conflicting package's removal fails we do not - unwind the rest of the installation; the conflicting - package is left in a half-removed limbo. -

-
- -

- If there was a conflicting package we go and do the - removal actions (described below), starting with the - removal of the conflicting package's files (any that - are also in the package being installed have already - been removed from the conflicting package's file list, - and so do not get removed now). -

-
- -

-
- - Details of configuration - - -

- When we configure a package (this happens with dpkg - --install, or with --configure), we first - update the conffiles and then call: - - postinst configure most-recently-configured-version - -

- -

- No attempt is made to unwind after errors during - configuration. -

- -

- If there is no most recently configured version - dpkg will pass a null argument; older versions - of dpkg may pass <unknown> (including the - angle brackets) in this case. Even older ones do not pass a - second argument at all, under any circumstances. -

-
- - Details of removal and/or configuration purging - - -

- - -

- - prerm remove - -

- - -

- The package's files are removed (except conffiles). -

-
- -

- postrm remove -

-
- -

All the maintainer scripts except the postrm are removed. -

- -

- If we aren't purging the package we stop here. Note - that packages which have no postrm and no conffiles - are automatically purged when removed, as there is no - difference except for the dpkg - status.

-
- -

- The conffiles and any backup files (~-files, - #*# files, %-files, - .dpkg-{old,new,tmp}, etc.) are removed.

-
- -

- postrm purge -

-
- -

The package's file list is removed.

-
- - No attempt is made to unwind after errors during - removal.

-
-
- - Descriptions of packages - the - Description field - - -

- The Description control file field is used by - dselect when the user is selecting which packages - to install and by dpkg when it displays - information about the status of packages and so forth. It is - included on the FTP site in the Packages files, - and may also be used by the Debian WWW pages. -

- -

- The description is intended to describe the program to a user - who has never met it before so that they know whether they - want to install it. It should also give information about the - significant dependencies and conflicts between this package - and others, so that the user knows why these dependencies and - conflicts have been declared. -

- -

- The field's format is as follows: - - Description: single line synopsis - extended description over several lines - -

- -

- The synopsis is often printed in lists of packages and so - forth, and should be as informative as possible. Every - package should also have an extended description. -

- - Types of formatting line in the extended - description - - -

- - -

- Those starting with a single space are part of a - paragraph. Successive lines of this form will be - word-wrapped when displayed. The leading space will - usually be stripped off. -

- - - -

- Those starting with two or more spaces. These will be - displayed verbatim. If the display cannot be panned - horizontally the displaying program will linewrap them - `hard' (ie, without taking account of word breaks). - If it can they will be allowed to trail off to the - right. None, one or two initial spaces may be - deleted, but the number of spaces deleted from each - line will be the same (so that you can have indenting - work correctly, for example). -

-
- - -

Those containing a single space followed by a single full stop - character. These are rendered as blank lines. This - is the only way to get a blank line - see - below.

-
- - -

- Those containing a space, a full stop and some more - characters. These are for future expansion. Do not - use them.

-
- -

-
- - Notes about writing descriptions - - -

- Always start extended description lines with at least one - whitespace character. Fields in the control file and in the Packages - file are separated by field names starting in the first column, just - as message header fields are in RFC822. Forgetting the whitespace - will cause dpkg-deb - -

- Version 0.93.23 or later. -

- to produce a syntax error when trying to build - the package. If you force it to build anyway - dpkg will refuse to install the resulting - mess. -

- -

- Do not include any completely empty - lines. These separate different records in the Packages file - and different packages in the debian/control file, - and are forbidden in package control files. See the - previous paragraph for what happens if you get this wrong. -

- -

- The single line synopsis should be kept brief - certainly - under 80 characters. dselect displays between - 25 and 49 characters without panning if you're using an - 80-column terminal, depending on what display options are in - effect. -

- -

- Do not include the package name in the synopsis line. The - display software knows how to display this already, and you - do not need to state it. Remember that in many situations - the user may only see the synopsis line - make it as - informative as you can. -

- -

- The extended description should describe what the package - does and how it relates to the rest of the system (in terms - of, for example, which subsystem it is which part of). -

- -

- The blurb that comes with a program in its announcements - and/or README files is rarely suitable for use - in a description. It is usually aimed at people who are - already in the community where the package is used. The - description field needs to make sense to anyone, even people - who have no idea about any of the things the package deals - with. -

- -

- Put important information first, both in the synopis and - extended description. Sometimes only the first part of the - synopsis or of the description will be displayed. You can - assume that there will usually be a way to see the whole - extended description. -

- -

- You may include information about dependencies and so forth - in the extended description, if you wish. -

- -

- Do not use tab characters. Their effect is not predictable. -

- -

- Do not try to linewrap the summary (the part on the same - line as the field name Description) into the - extended description. This will not work correctly when the - full description is displayed, and makes no sense where only - the summary is available.

-
- - Example description in control file for Smail - - -

- - Package: smail - Version: 3.1.29.1-13 - Maintainer: Ian Jackson <iwj10@cus.cam.ac.uk> - Recommends: pine | mailx | elm | emacs | mail-user-agent - Suggests: metamail - Depends: cron, libc5 - Conflicts: sendmail - Provides: mail-transport-agent - Description: Electronic mail transport system. - Smail is the recommended mail transport agent (MTA) for Debian. - . - An MTA is the innards of the mail system - it takes messages from - user-friendly mailer programs and arranges for them to be delivered - locally or passed on to other systems as required. - . - In order to make use of it you must have one or more user level - mailreader programs such as elm, pine, mailx or Emacs (which has Rmail - and VM as mailreaders) installed. If you wish to send messages other - than just to other users of your system you must also have appropriate - networking support, in the form of IP or UUCP. - -

-
-
- - Declaring relationships between - packages - - -

- Packages can declare in their control file that they have - certain relationships to other packages - for example, that - they may not be installed at the same time as certain other - packages, and/or that they depend on the presence of others, - or that they should overwrite files in certain other packages - if present. -

- -

- This is done using the Depends, Recommends, - Suggests, Conflicts, Provides and - Replaces control file fields. -

- -

- Source packages may declare relationships to binary packages, - saying that they require certain binary packages being - installed or absent at the time of building the package. -

- -

- This is done using the Build-Depends, - Build-Depends-Indep, Build-Conflicts, and - Build-Conflicts-Indep control file fields. -

- - Syntax of relationship fields - - -

- These fields all have a uniform syntax. They are a list of - package names separated by commas. -

- -

- In Depends, Recommends, Suggests, - Pre-Depends, Build-Depends and - Build-Depends-Indep(the fields which declare - dependencies of the package in which they occur on other - packages) these package names may also be lists of - alternative package names, separated by vertical bar symbols - | (pipe symbols). -

- -

- All the fields except Provides may restrict their - applicability to particular versions of each named package. - This is done in parentheses after each individual package - name; the parentheses should contain a relation from the - list below followed by a version number, in the format - described in . -

- -

- The relations allowed are <<, <=, - =, >= and >> for - strictly earlier, earlier or equal, exactly equal, later or - equal and strictly later, respectively. The forms - < and > were used to mean - earlier/later or equal, rather than strictly earlier/later, - so they should not appear in new packages (though - dpkg still supports them). -

- -

- Whitespace may appear at any point in the version - specification, and must appear where it's necessary to - disambiguate; it is not otherwise significant. For - consistency and in case of future changes to - dpkg it is recommended that a single space be - used after a version relationship and before a version - number; it is usual also to put a single space after each - comma, on either side of each vertical bar, and before each - open parenthesis. -

- -

- For example: - - Package: metamail - Version: 2.7-3 - Depends: libc5 (>= 5.2.18-4), mime-support, csh | tcsh - -

- -

- All fields that specify build-time relationships - (Build-Depends, Build-Depends-Indep, - Build-Conflicts and Build-Conflicts-Indep) - may be restricted to a certain set of architectures. This - is done in brackets after each individual package name and - the optional version specification. The brackets enclose a - list of Debian architecture names separated by whitespace. - An exclamation mark may be prepended to each name. If the - current Debian host architecture is not in this list and - there are no exclamation marks in the list, or it is in the - list with a prepended exclamation mark, the package name and - the associated version specification are ignored completely - for the purposes of defining the relationships. -

- -

- For example: - - Source: glibc - Build-Depends-Indep: texinfo - Build-Depends: kernel-headers-2.2.10 [!hurd-i386], - hurd-dev [hurd-i386], gnumach-dev [hurd-i386] - -

-
- - - Binary Dependencies - Depends, - Recommends, Suggests, Pre-Depends - - -

- These four fields are used to declare a dependency by one - package on another. They appear in the depending package's - control file. -

- -

- All but Pre-Depends (discussed below) take effect - only when a package is to be configured. They do - not prevent a package being on the system in an unconfigured - state while its dependencies are unsatisfied, and it is - possible to replace a package whose dependencies are - satisfied and which is properly installed with a different - version whose dependencies are not and cannot be satisfied; - when this is done the depending package will be left - unconfigured (since attempts to configure it will give - errors) and will not function properly. -

- -

- For this reason packages in an installation run are usually - all unpacked first and all configured later; this gives - later versions of packages with dependencies on later - versions of other packages the opportunity to have their - dependencies satisfied. -

- -

- Thus Depends allows package maintainers to impose - an order in which packages should be configured. - - Depends - - -

This declares an absolute dependency. -

- -

- dpkg will not configure packages whose - dependencies aren't satisfied. If it is asked to make - an installation which would cause an installed - package's dependencies to become unsatisfied it will - complain - -

- Current versions (1.2.4) of dpkg have - a bug in this area which will cause some of these - problems to be ignored. -

- , unless --auto-deconfigure is - specified, in which case those packages will be - deconfigured before the installation proceeds. -

- -

- dselect makes it hard for the user to - select packages for installation, removal or upgrade - in a way that would mean that packages' - Depends fields would be unsatisfied. The - user can override this if they wish, for example if - they know that dselect has an out-of-date - view of the real package relationships. -

- -

- The Depends field should be used if the - depended-on package is required for the depending - package to provide a significant amount of - functionality.

- - - Recommends - -

This declares a strong, but not absolute, dependency. -

- -

- Recommends is ignored by dpkg, - so that users using the command-line (who are presumed - to know what they're doing) will not be impeded. -

- -

- It is treated by dselect exactly as - Depends is; this makes it hard for the user - to select things so as to leave Recommends - fields unsatisfied, but they are able to do so by - being persistent. -

- -

- The Recommends field should list packages - that would be found together with this one in all but - unusual installations.

-
- - Suggests - - -

- This is used to declare that one package may be more - useful with one or more others. Using this field - tells the packaging system and the user that the - listed packages are related to this one and can - perhaps enhance its usefulness, but that installing - this one without them is perfectly reasonable. -

- -

- dselect will offer suggsted packages to - the system administrator when they select the - suggesting package, but the default is not to install - the suggested package.

-
- - Pre-Depends - - -

This field is like Depends, except that it also forces - dpkg to complete installation of the - packages named before even starting the installation - of the package which declares the predependency. -

- -

- dselect checks for predependencies when - it is doing an installation run, and will attempt to - find the packages which are required to be installed - first and do so in the right order. -

- -

- However, this process is slow (because it requires - repeated invocations of dpkg) and - troublesome (because it requires guessing where to - find the appropriate files). -

- -

- For these reasons, and because this field imposes - restrictions on the order in which packages may be - unpacked (which can be difficult for installations - from multipart media, for example), - Pre-Depends should be used sparingly, - preferably only by packages whose premature upgrade or - installation would hamper the ability of the system to - continue with any upgrade that might be in progress. -

- -

- When the package declaring it is being configured, a - Pre-Dependency will be considered satisfied - only if the depending package has been correctly - configured, just as if an ordinary Depends - had been used. -

- -

- However, when a package declaring a predependency is - being unpacked the predependency can be satisfied even - if the depended-on package(s) are only unpacked or - half-configured, provided that they have been - configured correctly at some point in the past (and - not removed or partially removed since). In this case - both the previously-configured and currently unpacked - or half-configured versions must satisfy any version - clause in the Pre-Depends field. -

-
- -

-

- When selecting which level of dependency to use you should - consider how important the depended-on package is to the - functionality of the one declaring the dependency. Some - packages are composed of components of varying degrees of - importance. Such a package should list using - Depends the package(s) which are required by the - more important components. The other components' - requirements may be mentioned as Suggestions or - Recommendations, as appropriate to the components' relative - importance. -

- - Dependencies on shared libraries - - -

- The dependency fields listed above are used by packages - which need shared libraries to declare dependencies on the - appropriate packages. -

- -

- These dependencies are usually determined automatically - using dpkg-shlibdeps and inserted in the - package control file using the control file substitution - variables mechanism; see and - . -

-
- - Deconfiguration due to removal during bulk - installations - - -

- If dpkg would like to remove a package due to a - conflict, as described above, but this would violate a - dependency of some other package on the system, - dpkg will usually not remove the conflicting - package and halt with an error. -

- -

- However, if the --auto-deconfigure (-B) - option is used dpkg will automatically - `deconfigure' the package with the problematic dependency, - so that the conflicting package can be removed and the - package we're trying to install can be installed. If - dpkg is being asked to install packages (rather - than just unpacking them) it will try to reconfigure the - package when it has unpacked all its arguments, in the hope - that one of the other packages it is installing will satisfy - the problematic dependency. -

- -

- dselect supplies this argument to - dpkg when it invokes it, so that bulk - installations proceed smoothly. -

-
- - Alternative binary packages - - Conflicts and Replaces - - -

- When one binary package declares a conflict with another - dpkg will refuse to allow them to be installed - on the system at the same time. -

- -

- If one package is to be installed, the other must be removed - first - if the package being installed is marked as - replacing () the one on the system, or - the one on the system is marked as deselected, or both - packages are marked Essential, then - dpkg will automatically remove the package - which is causing the conflict, otherwise it will halt the - installation of the new package with an error. This - mechanism specifically doesn't work when the installed - package is Essential, but the new package is not. -

- -

- dselect makes it hard to select conflicting - packages, though the user can override this if they wish. - If they do not override it then dselect will - select one of the packages for removal, and the user must - make sure it is the right one. In the future - dselect will look for the presence of a - Replaces field to help decide which package should - be installed and which removed. -

- -

- A package will not cause a conflict merely because its - configuration files are still installed; it must be at least - half-installed. -

- -

- A special exception is made for packages which declare a - conflict with their own package name, or with a virtual - package which they provide (see below): this does not - prevent their installation, and allows a package to conflict - with others providing a replacement for it. You use this - feature when you want the package in question to be the only - package providing something. -

- -

- A Conflicts entry should almost never have an - `earlier than' version clause. This would prevent - dpkg from upgrading or installing the package - which declared such a conflict until the upgrade or removal - of the conflicted-with package had been completed. This - aspect of installation ordering is not handled by - dselect, so that the use Conflicts in - this way is likely to cause problems for `bulk run' upgrades - and installations. -

-
- - Virtual packages - Provides - - -

- As well as the names of actual (`concrete') packages, the - package relationship fields Depends, - Build-Depends, Build-Depends-Indep, - Recommends, Suggests, Conflicts, - Build-Conflicts and Build-Conflicts-Indep may - mention virtual packages. -

- -

- A virtual package is one which appears in the - Provides control file field of another package. - The effect is as if the package(s) which provide a - particular virtual package name had been listed by name - everywhere the virtual package name appears. -

- -

- If there are both a real and a virtual package of the same - name then the dependency may be satisfied (or the conflict - caused) by either the real package or any of the virtual - packages which provide it. This is so that, for example, - supposing we have - - Package: vm - Depends: emacs - - and someone else releases an xemacs package they can say - - Package: xemacs - Provides: emacs - and all will work in the interim (until a purely - virtual package name is decided on and the emacs - and vm packages are changed to use it). -

- -

- If a dependency or a conflict has a version number attached - then only real packages will be considered to see whether - the relationship is satisfied (or the prohibition violated, - for a conflict) - it is assumed that a real package which - provides virtual package is not of the `right' version. So, - a Provides field may not contain version numbers, - and the version number of the concrete package which - provides a particular virtual package will not be looked at - when considering a dependency on or conflict with the - virtual package name. -

- -

- It is likely that the ability will be added in a future - release of dpkg to specify a version number for - each virtual package it provides. This feature is not yet - present, however, and is expected to be used only - infrequently. -

- -

- If you want to specify which of a set of real packages should be the - default to satisfy a particular dependency on a virtual package, you - should list the real package as an alternative before the virtual. -

-
- - - Replaces - overwriting - files and replacing packages - - -

- The Replaces control file field has two purposes, - which come into play in different situations. -

- -

- Virtual packages () are not considered - when looking at a Replaces field - the packages - declared as being replaced must be mentioned by their real - names. -

- - Overwriting files in other packages - - -

- Firstly, as mentioned before, it is usually an error for a - package to contains files which are on the system in - another package, though currently the - --force-overwrite flag is enabled by default, - downgrading the error to a warning, -

- -

- If the overwriting package declares that it replaces the - one containing the file being overwritten then - dpkg will proceed, and replace the file from - the old package with that from the new. The file will no - longer be listed as `owned' by the old package. -

- -

- If a package is completely replaced in this way, so that - dpkg does not know of any files it still - contains, it is considered to have disappeared. It will - be marked as not wanted on the system (selected for - removal) and not installed. Any conffiles details noted - in the package will be ignored, as they will have been - taken over by the replacing package(s). The package's - postrm script will be run to allow the - package to do any final cleanup required. See . -

- -

- In the future dpkg will discard files which - overwrite those from another package which declares that - it replaces the one being installed (so that you can - install an older version of a package without problems). -

- -

- This usage of Replaces only takes effect when - both packages are at least partially on the system at - once, so that it can only happen if they do not conflict - or if the conflict has been overridden.

-
- - Replacing whole packages, forcing their - removal - - -

- Secondly, Replaces allows dpkg and - dselect to resolve which package should be - removed when there is a conflict - see . This - usage only takes effect when the two packages do - conflict, so that the two effects do not interfere with - each other. -

-
-
- - Defaults for satisfying dependencies - ordering - - -

- Ordering is significant in dependency fields. -

- -

- Usually dselect will suggest to the user that they select - the package with the most `fundamental' class (eg, it will - prefer Base packages to Optional ones), or the one that they - `most wanted' to select in some sense. -

- -

- In the absence of other information dselect - will offer a default selection of the first named package in - a list of alternatives. -

- -

- However, there is no way to specify the `order' of several - packages which all provide the same thing, when that thing - is listed as a dependency. -

- -

- Therefore a dependency on a virtual package should contain a - concrete package name as the first alternative, so that this - is the default. -

- -

- For example, consider the set of packages: - - Package: glibcdoc - Recommends: info-browser - - Package: info - Provides: info-browser - - Package: emacs - Provides: info-browser - -

- -

- If emacs and info both have the - same priority then dselect's choice is - essentially random. Better would be - - Package: glibcdoc - Recommends: info | info-browser - - so that dselect defaults to selecting the - lightweight standalone info browser. -

-
- - - Relationships between source and binary packages - - Build-Depends, Build-Depends-Indep, - Build-Conflicts, Build-Conflicts-Indep - - -

- A source package may declare a dependency or a conflict on a - binary package. This is done with the control file fields - Build-Depends, Build-Depends-Indep, - Build-Conflicts, and Build-Conflicts-Indep. Their - semantics is that the dependencies and conflicts they define - must be satisfied (as defined earlier for binary packages), - when one of the targets in debian/rules that the - particular field applies to is invoked. - - - Build-Depends, Build-Conflicts - -

- The Build-Depends and - Build-Conflicts fields apply to the targets - build, binary, binary-arch - and binary-indep. -

- - Build-Depends-Indep, Build-Conflicts-Indep - -

- The Build-Depends-Indep and - Build-Conflicts-Indep fields apply to the - targets binary and binary-indep. -

-
- - -

- -
-
- - - Configuration file handling - - -

- dpkg can do a certain amount of automatic - handling of package configuration files. -

- -

- Whether this mechanism is appropriate depends on a number of - factors, but basically there are two approaches to any - particular configuration file. -

- -

- The easy method is to ship a best-effort configuration in the - package, and use dpkg's conffile mechanism to - handle updates. If the user is unlikely to want to edit the - file, but you need them to be able to without losing their - changes, and a new package with a changed version of the file - is only released infrequently, this is a good approach. -

- -

- The hard method is to build the configuration file from - scratch in the postinst script, and to take the - responsibility for fixing any mistakes made in earlier - versions of the package automatically. This will be - appropriate if the file is likely to need to be different on - each system. -

- - Automatic handling of configuration files by - dpkg - - -

- A package may contain a control area file called - conffiles. This file should be a list of filenames - of configuration files needing automatic handling, separated - by newlines. The filenames should be absolute pathnames, - and the files referred to should actually exist in the - package. -

- -

- When a package is upgraded dpkg will process - the configuration files during the configuration stage, - shortly before it runs the package's postinst - script, -

- -

- For each file it checks to see whether the version of the - file included in the package is the same as the one that was - included in the last version of the package (the one that is - being upgraded from); it also compares the version currently - installed on the system with the one shipped with the last - version. -

- -

- If neither the user nor the package maintainer has changed - the file, it is left alone. If one or the other has changed - their version, then the changed version is preferred - i.e., - if the user edits their file, but the package maintainer - doesn't ship a different version, the user's changes will - stay, silently, but if the maintainer ships a new version - and the user hasn't edited it the new version will be - installed (with an informative message). If both have - changed their version the user is prompted about the problem - and must resolve the differences themselves. -

- -

- The comparisons are done by calculating the MD5 message - digests of the files, and storing the MD5 of the file as it - was included in the most recent version of the package. -

- -

- When a package is installed for the first time - dpkg will install the file that comes with it, - unless that would mean overwriting a file already on the - filesystem. -

- -

- However, note that dpkg will not - replace a conffile that was removed by the user (or by a - script). This is necessary because with some programs a - missing file produces an effect hard or impossible to - achieve in another way, so that a missing file needs to be - kept that way if the user did it. -

- -

- Note that a package should not modify a - dpkg-handled conffile in its maintainer - scripts. Doing this will lead to dpkg giving - the user confusing and possibly dangerous options for - conffile update when the package is upgraded.

-
- - Fully-featured maintainer script configuration - handling - - -

- For files which contain site-specific information such as - the hostname and networking details and so forth, it is - better to create the file in the package's - postinst script. -

- -

- This will typically involve examining the state of the rest - of the system to determine values and other information, and - may involve prompting the user for some information which - can't be obtained some other way. -

- -

- When using this method there are a couple of important - issues which should be considered: -

- -

- If you discover a bug in the program which generates the - configuration file, or if the format of the file changes - from one version to the next, you will have to arrange for - the postinst script to do something sensible - usually this - will mean editing the installed configuration file to remove - the problem or change the syntax. You will have to do this - very carefully, since the user may have changed the file, - perhaps to fix the very problem that your script is trying - to deal with - you will have to detect these situations and - deal with them correctly. -

- -

- If you do go down this route it's probably a good idea to - make the program that generates the configuration file(s) a - separate program in /usr/sbin, by convention called - packageconfig and then run that if - appropriate from the post-installation script. The - packageconfig program should not - unquestioningly overwrite an existing configuration - if its - mode of operation is geared towards setting up a package for - the first time (rather than any arbitrary reconfiguration - later) you should have it check whether the configuration - already exists, and require a --force flag to - overwrite it.

-
- - - - Alternative versions of an interface - - update-alternatives - - -

- When several packages all provide different versions of the - same program or file it is useful to have the system select a - default, but to allow the system administrator to change it - and have their decisions respected. -

- -

- For example, there are several versions of the vi - editor, and there is no reason to prevent all of them from - being installed at once, each under their own name - (nvi, vim or whatever). - Nevertheless it is desirable to have the name vi - refer to something, at least by default. -

- -

- If all the packages involved cooperate, this can be done with - update-alternatives. -

- -

- Each package provides its own version under its own name, and - calls update-alternatives in its postinst to - register its version (and again in its prerm to deregister - it). -

- -

- See the manpage for details. -

- -

- If update-alternatives does not seem appropriate - you may wish to consider using diversions instead.

-
- - - Diversions - overriding a - package's version of a file - - -

- It is possible to have dpkg not overwrite a file - when it reinstalls the package it belongs to, and to have it - put the file from the package somewhere else instead. -

- -

- This can be used locally to override a package's version of a - file, or by one package to override another's version (or - provide a wrapper for it). -

- -

- Before deciding to use a diversion, read to see if you really want a diversion - rather than several alternative versions of a program. -

- -

- There is a diversion list, which is read by dpkg, - and updated by a special program dpkg-divert. - Please see for full - details of its operation. -

- -

- When a package wishes to divert a file from another, it should - call dpkg-divert in its preinst to add the - diversion and rename the existing file. For example, - supposing that a smailwrapper package wishes to - install a wrapper around /usr/sbin/smail: - - if [ install = "$1" -o upgrade = "$1" ]; then - dpkg-divert --package smailwrapper --add --rename \ - --divert /usr/sbin/smail.real /usr/sbin/smail - fi - Testing $1 is necessary so that the script - doesn't try to add the diversion again when - smailwrapper is upgraded. The --package - smailwrapper ensures that smailwrapper's - copy of /usr/sbin/smail can bypass the diversion and - get installed as the true version. -

- -

- The postrm has to do the reverse: - - if [ remove = "$1" ]; then - dpkg-divert --package smailwrapper --remove --rename \ - --divert /usr/sbin/smail.real /usr/sbin/smail - fi - -

- -

- Do not attempt to divert a file which is vitally important for - the system's operation - when using dpkg-divert - there is a time, after it has been diverted but before - dpkg has installed the new version, when the file - does not exist.

-
- - - Shared libraries - - -

- Packages containing shared libraries must be constructed with - a little care to make sure that the shared library is always - available. This is especially important for packages whose - shared libraries are vitally important, such as the libc. -

- -

- Firstly, your package should install the shared libraries - under their normal names. For example, the - libgdbm1 package should install - libgdbm.so.1.7.3 as - /usr/lib/libgdbm.so.1.7.3. The files should not be - renamed or relinked by any prerm or postrm scripts; - dpkg will take care of renaming things safely - without affecting running programs, and attempts to interfere - with this are likely to lead to problems. -

- -

- Secondly, your package should include the symlink that - ldconfig would create for the shared libraries. - For example, the libgdbm1 package should include - a symlink from /usr/lib/libgdbm.so.1 to - libgdbm.so.1.7.3. This is needed so that - ld.so can find the library in between the time - dpkg installs it and ldconfig is run - in the postinst script. Futhermore, older - versions of the package management system required the library - must be placed before the symlink pointing to it in the - .deb file. This is so that by the time - dpkg comes to install the symlink (overwriting - the previous symlink pointing at an older version of the - library) the new shared library is already in place. - Unfortunately, this was not not always possible, since it - highly depends on the behaviour of the filesystem. Some - filesystems (such as reisefs) will reorder the files so it - doesn't matter in what order you create them. Starting with - release 1.7.0 dpkg will reorder the - files itself when building a package. -

- - - -

- Thirdly, the development package should contain a symlink for - the shared library without a version number. For example, the - libgdbm1-dev package should include a symlink from - /usr/lib/libgdm.so to libgdm.so.1.7.3. This - symlink is needed by ld when compiling packages - as it will only look for libgdm.so and - libgdm.a when compiling dynamically or statically, - respectively. -

- - - -

- Any package installing shared libraries in a directory that's listed - in /etc/ld.so.conf or in one of the default library - directories of ld.so (currently, these are /usr/lib - and /lib) must call ldconfig in its postinst - script if and only if the first argument is `configure'. However, it - is important not to call ldconfig in the postrm or preinst - scripts in the case where the package is being upgraded (see ), as ldconfig will see the temporary names - that dpkg uses for the files while it is - installing them and will make the shared library links point - to them, just before dpkg continues the - installation and removes the links! -

- - - - The shlibs File Format - - -

- This file is for use by dpkg-shlibdeps and is - required when your package provides shared libraries. -

- -

- Each line is of the form: - - library-name version-or-soname dependencies ... - -

- -

- library-name is the name of the shared library, - for example libc5. -

- -

- version-or-soname is the soname of the library - - ie, the thing that must exactly match for the library to be - recognised by ld.so. Usually this is major - version number of the library. -

- -

- dependencies has the same syntax as a dependency - field in a binary package control file. It should give - details of which package(s) are required to satisfy a binary - built against the version of the library contained in the - package. See . -

- -

- For example, if the package foo contains - libfoo.so.1.2.3, where the soname of the library is - libfoo.so.1, and the first version of the package - which contained a minor number of at least 2.3 was - 1.2.3-1, then the package's shlibs - could say: - - libfoo 1 foo (>= 1.2.3-1) - -

- -

- The version-specific dependency is to avoid warnings from - ld.so about using older shared libraries with - newer binaries.

-
- - Further Technical information on - shlibs - - - - - What are the shlibs files? - - -

- The debian/shlibs file provides a way of checking - for shared library dependencies on packaged binaries. - They are intended to be used by package maintainers to - make their lives easier. -

- -

- Other shlibs files that exist on a Debian system are - -

/etc/dpkg/shlibs.default

-

/etc/dpkg/shlibs.override

-

/var/lib/dpkg/info/*.shlibs

-

debian/shlibs.local

- - These files are used by dpkg-shlibdeps when - creating a binary package.

-
- - How does dpkg-shlibdeps - work? - -

- dpkg-shlibdeps - determines the shared libraries directly - -

- Currently, it calls ldd, but in a - forthcoming version it shall call objdump - to to this. This however changes will need a couple of - changes in the way that packages are build. -

-

- Suppose a binary foo directly use a library - libbar if it is linked with that - library. Other libraries that are needed by - libbar are linked indirectly to foo, - and the dynamic linker will load the automatically - when it loads libbar. Using ldd - lists all the libraries, used direcly and indirectly; - but objdump only lists the directly - linked libraries. A package only needs to depend on - the libraries it is directly linked to, since the - dependencies for those libraries should automatically - pull in the other libraries.

- -

- This change does mean a change in the way packages are - build though: currently dpkg-shlibdeps is only run on - binaries. But since we will now depend on the - libraries to depend on the libraries they need the - packages containing those libraries will need to run - dpkg-shlibdeps on the libraries. -

-

- A good example where this would help us is the current - mess with multiple version of the mesa library. With - the ldd-based system every package that uses mesa need - to add a dependency on svgalib|svgalib-dummy in order - to handle the glide mesa variant. With an - objdump-based system this isn't necessary anymore and - would have saved everyone a lot of work. -

-

- Another example: we could update libimlib with a new - version that supports a new graphics format called - dgf. If we use the old ldd method every package that - uses libimlib would need to be recompiled so it would - also depend on libdgf or it wouldn't run due to - missing symbols. However with the new system packages - using libimlib can depend on libimlib itself having - the dependency on libgdh and wouldn't need to be - updated. -

- - used by the compiled binaries (and libraries, in a version - of dpkg-shlibdeps coming soon) passed through - on its command line. -

- -

- For each shared library, dpkg-shlibdeps needs to know - -

the package containing the library, and

-

the library version number,

- -

- it scans the following files in this order. - -

debian/shlibs.local

-

/etc/dpkg/shlibs.override

-

/var/lib/dpkg/info/*.shlibs

-

/etc/dpkg/shlibs.default

-

-
- - Who maintains the various - shlibs files? - - -

- - -

/etc/dpkg/shlibs.default - the maintainer - of dpkg

- - -

- /var/lib/dpkg/info/package.shlibs - - the maintainer of each package

-
- -

- /etc/dpkg/shlibs.override - the local - system administrator

-
- -

debian/shlibs.local - the maintainer of - the package -

-
- - The shlibs.default file is managed by - dpkg. The entries in shlibs.default - that are provided by dpkg are just there to - fix things until the shared library packages all have - shlibs files. -

-
- - How to use dpkg-shlibdeps and - the shlibs files? - - - If your package doesn't provide a shared - library - - -

- Put a call to dpkg-shlibdeps into your - debian/rules file. If your package contains - only binaries (e.g. no scripts) use: - - dpkg-shlibdeps debian/tmp/usr/bin/* debian/tmp/usr/sbin/* - - If dpkg-shlibdeps doesn't complain, you're - done. If it does complain you might need to create your - own debian/shlibs.local file.

-
- - If your package provides a shared library - - -

- Create a debian/shlibs file and let - debian/rules install it in the control area: - - install -m644 debian/shlibs debian/tmp/DEBIAN - - If your package contains additional binaries see above. -

-
-
- - How to write - debian/shlibs.local - - -

- This file is intended only as a temporary fix if - your binaries depend on a library which doesn't provide - its own /var/lib/dpkg/info/*.shlibs file yet. -

- -

- Let's assume you are packaging a binary foo. Your - output in building the package might look like this. - - $ ldd foo - libbar.so.1 => /usr/X11R6/lib/libbar.so.1.0 - libc.so.5 => /lib/libc.so.5.2.18 - libX11.so.6 => /usr/X11R6/lib/libX11.so.6.0 - - And when you ran dpkg-shlibdeps - - $ dpkg-shlibdeps -o foo - dpkg-shlibdeps: warning: unable to find dependency information - for shared library libbar - (soname 1, path /usr/X11R6/lib/libbar.so.1.0, dependency field Depends) - shlibs:Depends=elf-x11r6lib, libc5 (>= 5.2.18) - - The foo binary depends on the - libbar shared library, but no package seems - to provide a *.shlibs file in - var/lib/dpkg/info/. Let's determine the package - responsible: -

- -

- - $ dpkg -S /usr/X11R6/lib/libbar.so.1.0 - bar1: /usr/X11R6/lib/libbar.so.1.0 - $ dpkg -s bar1 | grep Version - Version: 1.0-1 - - This tells us that the bar1 package, version - 1.0-1 is the one we are using. Now we can create our own - debian/shlibs.local to temporarly fix the above - problem. Include the following line into your - debian/shlibs.local file. - - libbar 1 bar1 (>= 1.0-1) - - Now your package build should work. As soon as the - maintainer of libbar1 provides a - shlibs file, you can remove your - debian/shlibs.local file. -

-
-
-
- - dselect's interface to - its installation methods - - -

- dselect calls scripts from its installation - methods when it needs to actually access data from the - distribution. The core program dselect itself - just calls these scripts and provides the package and access - method selection interfaces. The installation methods are - responsible for invoking dpkg as appropriate. -

- -

- Each installation method has three scripts: - -

Setup installation parameters.

-

Update list of available packages.

-

Install.

- - -

- dselect searches for methods in - /usr/lib/dpkg/methods and - /usr/local/lib/dpkg/methods. -

- - Functions of the method scripts - - -

- The setup script is run just after the user has chosen an - installation method. It should prompt the user for - parameters like the site to NFS-mount or FTP from, the - directory to use, or the directory or filesystem where the - .deb files can be found, or the tape or floppy - device to install from. It should store the responses under - /var/lib/dpkg/methods - see below. If no available - packages list is available it should perhaps offer to scan - the available packages. -

- -

- The update script should obtain a list of available packages - if possible, and run dpkg --update-avail, dpkg - --merge-avail and/or dpkg --forget-old-unavail - to load it into dpkg and dselect's - database of available packages. If no packages list was - available and the user was offered and accepted the option - of scanning the actual files available this scan should be - done here, using dpkg --record-avail. -

- -

- The install script should feed all the available - .deb files to dpkg --iGOEB (this is - equivalent to dpkg --install - --refuse-downgrade --selected-only --skip-same-version - --auto-deconfigure). The -R - (--recursive) option for traversing subdirectories - may also be useful here). -

- -

- If any of these scripts needs to display a message for the - user, it should wait for the user to hit `return' before - exiting so that dselect doesn't immediately rewrite the - screen. -

- -

- If a method script succeeds (returns a zero exit status) - dselect will return immediately to the main - menu, with the `next' option highlighted ready for the user - to select it. If it fails dselect will display - a message and wait for the user to hit return.

-
- - Location and arguments of the method scripts - - -

- A set of scripts (henceforth known as a group) may provide - several methods on the `main menu' with different behaviour. - For example, there might be a generic get-packages-by-FTP - group which might provide methods in the main menu for - installation directly from one of the Debian mirror sites as - well as for installation from a user-specified site. -

- -

- Each group of methods implemented by the same set of scripts - should have a subdirectory - /usr/lib/dpkg/methods/group or - /usr/local/lib/dpkg/methods/group, - containing: - - names -

a list of user-visible methods provided by these scripts.

- - setup - update - install -

executable programs, the scripts themselves.

-
- desc.option -

description file.

- -

- -

- names will be formatted as a list of lines, each containing: - - sequence method summary - -

-

- sequence is a two-digit number that will be used - much like rc.d prefixes to control the order in the - main menu. If in doubt use 50. -

- -

- method is a name which is displayed by - dselect as the name of the method, and which - will be passed to setup, update and - unpack as their first argument. -

- -

- summary is the brief description string for - dselect's menu. -

- -

- Each of the three scripts gets the same three arguments: - vardir, group and method. - vardir is the base directory for storing - dpkg and dselect's state, usually - /var/lib/dpkg; this is passed in so that the - --admindir option to dselect is - honoured). -

- -

- Each option may have an extended description in - desc.option. This should be formatted - like the extended description part of a Description - field entry shifted one character to the left. -

- -

- vardir/methods will exist, and a method - group may use a - vardir/methods/group - directory to store its state. -

- -

- The group name and method name must follow the rules for C - identifiers. -

-
-
- - Conversion procedure from old - source packages - - -

- This is a brief summary of the procedure for converting a - pre-2.0.0.0-format source package into the new format. -

- -

- You are strongly advised to download and examine the hello - package, and to read the section in the dpkg programmers' - manual describing the source packaging tools. More detail about the - exact functionality of these tools is available in - . -

- -

- - -

- Download the original source code from wherever it can - be found and do any rearrangement required to make it - look like the original tree of the Debian source. Put - it in - package-upstream-version.orig/ - or - package_upstream-version.orig.tar.gz. -

- - - -

- Rename all files debian.* to debian/*. - There may be some exceptions to this, but this is a good - start.

-
- - -

- Edit the debian/changelog - create or rename it - if necessary. Add a new revision to the top with the - appropriate details, and a local variables entry to the - bottom to set Emacs to the right mode: - - Local variables: - mode: debian-changelog - End: - -

-
- - -

- Edit/create debian/control: - - -

- Remove the Version field. If it is - generated unusually (not equal to the source - version) you must use the -v option to - dpkg-gencontrol (see below). Section, - Priority, Maintainer go above - the first blank line, most of the rest - below. -

-
- - -

- Reorder the fields and add a blank line at an - appropriate point, separating the source package - fields from the binary package fields. -

-
- - -

Add the Source field.

- - -

- Add the Standards-Version field. (Please - check out the Debian Policy Manual for details - about this field.)

-
- - -

- Change the Architecture field for each - package to any, all or whatever. - If there isn't an Architecture field add - one.

-
- - -

- If any other use of sed or things used to happen - to make the binary control files use - dpkg-gencontrol's variable - substitution features to achieve the same effect. - Use debian/substvars if you need to put - unusally-generated information (apart from details - of .deb files) in the .changes - file too.

-
- -

- - - -

Edit the debian/rules: - - -

- Remove the source and - diff and any changes and - dist targets. These things now - happen in a package-independent way and are not - done by debian/rules.

-
- -

- Split the binary target into - binary-arch and - binary-indep; in many cases all of - binary should go into - binary-arch. Create the - binary target and the unused of the - two other binary-* targets if there - is one - you can copy the ones from the - hello package.

-
- -

- Change the binary target to use - dpkg-gencontrol to make the package - control file(s). Move it to after all the files - have been installed but just before the last - chown and chmod in the - target.

-
- -

- Change occurrences of debian-tmp to - debian/tmp.

-
- -

- Change occurrences of - debian.{post,pre}{inst,rm} to - debian/*.

-
- -

- Remove the version number setting at the top, if - there is one.

-
- -

- Ensure that the package's Debian-specific and - upstream changelogs are installed.

-
- -

- - - -

- Change the package to use dpkg-shlibdeps to - determine its shared library dependencies and substitute - them in. Shared library dependencies should no longer - be hardwired in the source package.

-
- - -

- Check that the debian/README is really the - copyright file, and if so rename it to - debian/copyright and edit debian/rules - to cope with this and to change the installation of the - copyright file from - /usr/doc/package/copyright to - /usr/doc/copyright/package. If it - isn't then find debian/copyright and decide - what to do with the README.

-
- - -

Check for various other anachronisms and problems: - - -

- Remove any Package_Revision, - Package-Revision or Revision - fields.

-
- -

- Rename Optional to Suggests, - Recommended to - Recommends.

-
- -

- Change - /usr/doc/examples/package to - /usr/doc/package/examples.

-
- -

- Make sure that manpages are installed - compressed.

-
- -

- Check that the description has an extended - description, is well-formatted and meaningful and - helpful to people wanting to know whether to - install a package.

-
- -

- - - -

Look everything over.

- - -

- Do a test build using dpkg-buildpackage -us -uc -sa - -rwhatever. Check the permissions and - locations of files in the resulting package by examining - the output of dpkg-deb --contents, and check - that the source build happened OK. Test install the - binary package(s) and test extract the source - package(s).

-
- - -

- Sign the release: either rebuild everything with - dpkg-buildpackage -sa, or PGP-sign the - .dsc, rebuild the .changes using - dpkg-genchanges -sa, and then PGP-sign the - .changes.

-
- - -

- -

- The use of -sa on dpkg-buildpackage and - dpkg-genchanges is important when doing the first - build/uploading of a new-format source package. Unless this - happens to be Debian revision 0 or 1 by - default the original source tarfile will not be included in - the uploaded files listed in the .changes file, and - so it won't be installed on the FTP site. -sa - requests that the original source be included - regardless.

-
- -
-
diff --git a/policy.sgml b/policy.sgml index acaf2b8..ba7c08c 100644 --- a/policy.sgml +++ b/policy.sgml @@ -95,7 +95,7 @@ /usr/share/common-licences/GPL in the Debian GNU/Linux distribution or on the World Wide Web at . You can also obtain it by writing to the + name="The GNU Public Licence">. You can also obtain it by writing to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

@@ -115,10 +115,61 @@ operating system, as well as technical requirements that each package must satisfy to be included in the distribution. -

+

+ + +

+ This manual also describes Debian policy as it relates to + creating Debian packages. It is not a tutorial on how to build + packages, nor is it exhaustive where it comes to describing + the behavior of the packaging system. Instead, this manual + attempts to define the interface to the package management + system that the developers have to be conversant with. + +

+ Informally, the criteria used for inclusion is that the + material meet one of the following requirements: + + Standard interfaces + +

+ The material presented represents an interface to + the packaging system that is mandated for use, and + is used by, a significant number of packages, and + should not be changed without peer review. Package + maintainers can then rely on this interfaces not + changing, and the package management software + authors need to ensure compatibility with these + interface definitions. (control file and and + changelog file formats are one example) +

+ + Chosen Convention + +

+ If there are a number of technically viable choices + that can be made, but one needs to select one of + these options for inter-operability. The version + number format is one example. +

+
+ + Please note that these are not mutually exclusive; + selected conventions often become parts of standard + interfaces. +

+ +

+ +

+ Please note that the footnotes present in this manual are + merely informative, and are not part of Debian policy itself. +

+ +

In this manual, the words must, should and - may, and the adjectives required>, + may, and the adjectives required, recommended and optional, are used to distinguish the significance of the various guidelines in this policy document. Packages that do not conform the the @@ -141,20 +192,6 @@

Also see RFC 2119.

-

- This manual does not describe the technical - mechanisms involved in package creation, installation, and - removal. This information can be found in the Debian - Packaging Manual and the Debian System - Administrators' Manual. Please note that the - footnotes present in this manual are merely informative, - and are not part of Debian policy itself. -

-

- This document assumes familiarity with these other two - manuals. Unfortunately, the System Administrators' - Manual does not exist yet. -

Much of the information presented in this manual will be useful even when building a package which is to be @@ -169,7 +206,7 @@ /debian/doc/package-developer/debian-policy.html.tar.gz or from the Debian WWW server at .

+ name="The Debian Policy Manual">.

In addition, this manual is distributed via the Debian package @@ -199,7 +236,7 @@

The Debian GNU/Linux system is maintained and distributed as a collection of packages. Since there are so many of them (over - 2600) they are split into sections and priorities to + 5000) they are split into sections and priorities to simplify handling of them.

@@ -208,9 +245,9 @@ free in our sense (see Debian Free Software Guidelines, below), or may be imported/exported without restrictions. Thus, the archive is split into the sections - main, non-free, contrib, - non-US/main, non-US/non-free, and - non-US/contrib.

+ main, non-free, contrib, + non-US/main, non-US/non-free, and + non-US/contrib.

The main and the non-US/main sections form @@ -238,316 +275,341 @@

We want to encourage everyone to write free software.

-

We want to make it easy for people to produce +

We want to make it easy for people to produce CD-ROMs of our system without violating any licenses, import/export restrictions, or any other laws.

- - The Debian Free Software Guidelines -

- The Debian Free Software Guidelines (DFSG) is our - definition of `free' software. - - Free Redistribution - - -

- The license of a Debian component may not restrict any - party from selling or giving away the software as a - component of an aggregate software distribution - containing programs from several different - sources. The license may not require a royalty or - other fee for such sale. -

- - Source Code - - -

- The program must include source code, and must allow - distribution in source code as well as compiled form. -

-
- Derived Works - - -

- The license must allow modifications and derived - works, and must allow them to be distributed under the - same terms as the license of the original software. -

-
- Integrity of The Author's Source Code - - -

- The license may restrict source-code from being - distributed in modified form only if the - license allows the distribution of ``patch files'' - with the source code for the purpose of modifying the - program at build time. The license must explicitly - permit distribution of software built from modified - source code. The license may require derived works to - carry a different name or version number from the - original software. (This is a compromise. The Debian - group encourages all authors to not restrict any - files, source or binary, from being modified.) -

-
- No Discrimination Against Persons or Groups - - -

- The license must not discriminate against any person - or group of persons. -

-
- No Discrimination Against Fields of Endeavor - - -

- The license must not restrict anyone from making use - of the program in a specific field of endeavor. For - example, it may not restrict the program from being - used in a business, or from being used for genetic - research. -

-
- Distribution of License - - -

- The rights attached to the program must apply to all - to whom the program is redistributed without the need - for execution of an additional license by those - parties. -

-
- License Must Not Be Specific to Debian - - -

- The rights attached to the program must not depend on - the program's being part of a Debian system. If the - program is extracted from Debian and used or - distributed without Debian but otherwise within the - terms of the program's license, all parties to whom - the program is redistributed must have the same - rights as those that are granted in conjunction with - the Debian system. -

-
- License Must Not Contaminate Other Software - - -

- The license must not place restrictions on other - software that is distributed along with the licensed - software. For example, the license must not insist - that all other programs distributed on the same medium - must be free software. -

-
- Example Licenses - - -

- The ``GPL,'' ``BSD,'' and ``Artistic'' licenses are - examples of licenses that we consider free. -

-
- -

-
- - The main section -

- Every package in "main" must comply with the DFSG (Debian - Free Software Guidelines).

- -

- In addition, the packages in "main" - - -

- must not require a package outside of "main" for - compilation or execution (thus, the package must not - declare a "Depends" or "Recommends" relationship on a - non-main package), -

- - -

- should not be so buggy that we refuse to support them, -

-
- -

- should meet all policy requirements presented in this - manual. -

-
- -

-
- - The contrib section -

- Every package in "contrib" must comply with the DFSG. -

+ + The Debian Free Software Guidelines +

+ The Debian Free Software Guidelines (DFSG) is our + definition of `free' software. + + Free Redistribution + + +

+ The license of a Debian component may not restrict any + party from selling or giving away the software as a + component of an aggregate software distribution + containing programs from several different + sources. The license may not require a royalty or + other fee for such sale. +

+ + Source Code + + +

+ The program must include source code, and must allow + distribution in source code as well as compiled form. +

+
+ Derived Works + + +

+ The license must allow modifications and derived + works, and must allow them to be distributed under the + same terms as the license of the original software. +

+
+ Integrity of The Author's Source Code + + +

+ The license may restrict source-code from being + distributed in modified form only if the + license allows the distribution of ``patch files'' + with the source code for the purpose of modifying the + program at build time. The license must explicitly + permit distribution of software built from modified + source code. The license may require derived works to + carry a different name or version number from the + original software. (This is a compromise. The Debian + group encourages all authors to not restrict any + files, source or binary, from being modified.) +

+
+ No Discrimination Against Persons or Groups + + +

+ The license must not discriminate against any person + or group of persons. +

+
+ No Discrimination Against Fields of Endeavor + + +

+ The license must not restrict anyone from making use + of the program in a specific field of endeavor. For + example, it may not restrict the program from being + used in a business, or from being used for genetic + research. +

+
+ Distribution of License + + +

+ The rights attached to the program must apply to all + to whom the program is redistributed without the need + for execution of an additional license by those + parties. +

+
+ License Must Not Be Specific to Debian + + +

+ The rights attached to the program must not depend on + the program's being part of a Debian system. If the + program is extracted from Debian and used or + distributed without Debian but otherwise within the + terms of the program's license, all parties to whom + the program is redistributed must have the same + rights as those that are granted in conjunction with + the Debian system. +

+
+ License Must Not Contaminate Other Software + + +

+ The license must not place restrictions on other + software that is distributed along with the licensed + software. For example, the license must not insist + that all other programs distributed on the same medium + must be free software. +

+
+ Example Licenses + + +

+ The ``GPL,'' ``BSD,'' and ``Artistic'' licenses are + examples of licenses that we consider free. +

+
+ +

+
+ + The main section +

+ Every package in "main" and "non-US/main" must comply with + the DFSG (Debian Free Software Guidelines).

+ +

+ In addition, the packages in "main" + + +

+ must not require a package outside of "main" for + compilation or execution (thus, the package must not + declare a "Depends", "Recommends", or "Build-Depends" + relationship on a non-main package), +

+ + +

+ must not be so buggy that we refuse to support them, +

+
+ +

+ must meet all policy requirements presented in this + manual. +

+
+ +

+

+ Similarly, the packages in "non-US/main" + + +

+ must not require a package outside of "main" or + "non-US/main" for compilation or execution, +

+ + +

+ must not be so buggy that we refuse to support them, +

+
+ +

+ must meet all policy requirements presented in this + manual. +

+
+ +

+
+ + The contrib section +

+ Every package in "contrib" and "non-US/contrib" must + comply with the DFSG. +

-

- Examples of packages which would be included in "contrib" are - - -

- free packages which require "contrib", "non-free", or - "non-US" packages or packages which are not in our - archive at all for compilation or execution, -

- - -

- wrapper packages or other sorts of free accessories for - non-free programs, -

-
- -

-
- - The non-free section -

- `Non-free' contains packages which are not compliant with - the DFSG.

-

- All packages in `non-free' must be electronically - distributable across international borders. -

-
- - The non-us server -

- Some programs with cryptographic program code need to be stored - on the "non-us" server because of export restrictions of the - U.S.

-

- This applies only to packages which contain cryptographic - code. A package containing a program with an interface to a - cryptographic program or a program that's dynamically linked - against a cryptographic library should not be distributed - via the non-us server if it is capable of running without the - cryptography library or program. -

-
- - Further copyright considerations -

- Every package must be accompanied by a verbatim copy of its - copyright and distribution license in the file - /usr/share/doc/<package-name>/copyright (see for details).

-

- We reserve the right to restrict files from being included - anywhere in our archives if - - -

- their use or distribution would break a law, -

- - -

- there is an ethical conflict in their distribution or - use, -

-
- -

- we would have to sign a license for them, or -

-
- -

- their distribution would conflict with other project - policies. -

-
- -

+

+ Examples of packages which would be included in "contrib" + or "non-US/contrib" are + + +

+ free packages which require "contrib", "non-free" + packages or packages which are not in our + archive at all for compilation or execution, +

+ + +

+ wrapper packages or other sorts of free accessories for + non-free programs, +

+
+ +

+
+ + The non-free section and non-US/non-free +

+ Packages must be placed in "non-free" or "non-US/non-free" + if they are not compliant with the DFSG or are encumbered + by patents or other legal issues that make their + distribution problematic. +

+
+ + The non-US sections +

+ Some programs with cryptographic program code need to be stored + on the "non-US" server because of export restrictions of the + U.S. Such programs must be distributed in the appropriate + non-US section, either non-US/main, non-US/contrib or + non-US/non-free.

+

+ This applies only to packages which contain cryptographic + code. A package containing a program with an interface to a + cryptographic program or a program that's dynamically linked + against a cryptographic library should not be distributed + via the non-us server if it is capable of running without the + cryptography library or program. +

+
+ + Further copyright considerations +

+ Every package must be accompanied by a verbatim copy of its + copyright and distribution license in the file + /usr/share/doc/<package-name>/copyright (see + for details).

+

+ We reserve the right to restrict files from being included + anywhere in our archives if + + +

+ their use or distribution would break a law, +

+ + +

+ there is an ethical conflict in their distribution or + use, +

+
+ +

+ we would have to sign a license for them, or +

+
+ +

+ their distribution would conflict with other project + policies. +

+
+ +

-

- Programs whose authors encourage the user to make donations - are fine for the main distribution, provided that the - authors do not claim that not donating is immoral, - unethical, illegal or something similar; otherwise they must - go in non-free.

+

+ Programs whose authors encourage the user to make donations + are fine for the main distribution, provided that the + authors do not claim that not donating is immoral, + unethical, illegal or something similar; otherwise they must + go in non-free.

-

- Packages whose copyright permission notices (or patent - problems) do not allow redistribution even of only binaries, - and where no special permission has been obtained, must not be - placed on the Debian FTP site and its mirrors at all.

+

+ Packages whose copyright permission notices (or patent + problems) do not allow redistribution even of only binaries, + and where no special permission has been obtained, must not be + placed on the Debian FTP site and its mirrors at all.

-

- Note, that under international copyright law (this applies - in the United States, too) no distribution or - modification of a work is allowed without an explicit notice - saying so. Therefore a program without a copyright notice - is copyrighted and you may not do anything to it - without risking being sued! Likewise if a program has a - copyright notice but no statement saying what is permitted - then nothing is permitted.

+

+ Note, that under international copyright law (this applies + in the United States, too) no distribution or + modification of a work is allowed without an explicit notice + saying so. Therefore a program without a copyright notice + is copyrighted and you may not do anything to it + without risking being sued! Likewise if a program has a + copyright notice but no statement saying what is permitted + then nothing is permitted.

-

- Many authors are unaware of the problems that restrictive - copyrights (or lack of copyright notices) can cause for the - users of their supposedly-free software. It is often - worthwhile contacting such authors diplomatically to ask - them to modify their license terms. However, this is a - politically difficult thing to do and you should ask for - advice on debian-legal first.

+

+ Many authors are unaware of the problems that restrictive + copyrights (or lack of copyright notices) can cause for the + users of their supposedly-free software. It is often + worthwhile contacting such authors diplomatically to ask + them to modify their license terms. However, this is a + politically difficult thing to do and you should ask for + advice on debian-legal first.

-

- When in doubt, send mail to - debian-legal@lists.debian.org. Be prepared - to provide us with the copyright statement. Software - covered by the GPL, public domain software and BSD-like - copyrights are safe; be wary of the phrases `commercial use - prohibited' and `distribution restricted'.

-
- - Subsections +

+ When in doubt, send mail to + debian-legal@lists.debian.org. Be prepared + to provide us with the copyright statement. Software + covered by the GPL, public domain software and BSD-like + copyrights are safe; be wary of the phrases `commercial use + prohibited' and `distribution restricted'.

+
+ + Subsections -

- The packages in all the sections (main, - contrib, non-US/main, non-free, - non-US/contrib, and non-US/non-free) are - grouped further into subsections to simplify - handling.

+

+ The packages in all the sections (main, + contrib, non-US/main, non-free, + non-US/contrib, and non-US/non-free) are + grouped further into subsections to simplify + handling.

-

- The section for each package should be specified in the - package's control record. However, the maintainer of - the Debian archive may override this selection to assure the - consistency of the Debian distribution.

+

+ The section for each package should be specified in the + package's control record. However, the maintainer of + the Debian archive may override this selection to assure the + consistency of the Debian distribution.

-

- Please check the current Debian distribution to see which - sections are available.

-
+

+ Please check the current Debian distribution to see which + sections are available.

+
Priorities - +

Each package should have a priority value, which is included in the package's control - record. This information is used in the Debian package + record. This information is used in the Debian package management tool to separate high-priority packages from less-important packages.

- +

The following priority levels are supported by the Debian package management system, dpkg. @@ -618,7 +680,7 @@

- +

Packages must not depend on packages with lower priority values (excluding build-time dependencies). In order to @@ -626,44 +688,44 @@ be adjusted.

- + Binary packages - +

The Debian GNU/Linux distribution is based on the Debian package management system, called dpkg. Thus, all packages in the Debian distribution must be provided in the .deb file format.

- + The package name - +

Every package must have a name that's unique within the Debian archive.

- +

Package names must only consist of lower case letters, digits (0-9), plus (+) or minus (-) signs, and periods (.).

- +

The package name is part of the file name of the .deb file and is included in the control field information.

- + The maintainer of a package - +

Every package should have exactly one maintainer at a time. This person is responsible that the license of the package's software complies with the policy of the distribution this package is included in.

- +

The maintainer must be specified in the Maintainer control field with the correct name @@ -672,7 +734,7 @@ he/she should try to avoid having different forms of their name and email address in different Maintainer fields.

- +

If the maintainer of a package quits from the Debian project the Debian QA Group @@ -682,15 +744,15 @@ orphaned packages.

- - + + The description of a package - +

Every Debian package must have an extended description stored in the appropriate field of the control record.

- +

The description should be written so that it tells the user what they need to know to decide whether to install the @@ -702,43 +764,43 @@ not be included -- that is what the copyright file is for.

- - + + Dependencies - +

Every package must specify the dependency information about other packages that are required for the first to work correctly.

- +

For example, a dependency entry must be provided for any shared libraries required by a dynamically-linked executable binary in a package.

- +

Packages are not required to declare any dependencies they have on other packages which are marked Essential (see below), and should not do so unless they depend on a particular version of that package.

- +

Sometimes, a package requires another package to be installed and configured before it can be installed. In this case, you must specify a Pre-Depends entry for the package.

- +

You should not specify a Pre-Depends entry for a package before this has been discussed on the debian-devel mailing list and a consensus about doing that has been reached.

- - + + Virtual packages - +

Sometimes, there are several packages doing more-or-less the same job. In this case, it's useful to define a @@ -750,7 +812,7 @@ package. Thus, any other package requiring that function can simply depend on the virtual package without having to specify all possible packages individually.

- +

All packages should use virtual package names where appropriate, and arrange to create new ones if necessary. @@ -758,7 +820,7 @@ amongst a cooperating group of packages) unless they have been agreed upon and appear in the list of virtual package names.

- +

The latest version of the authoritative list of virtual package names can be found on @@ -767,11 +829,11 @@ or your local mirror. In addition, it is included in the debian-policy package. The procedure for updating the list is described at the top of the file.

- - + + Base packages - +

The packages included in the base section have a special function. They form a minimum subset of the Debian @@ -779,28 +841,28 @@ on a new system. Thus, only very few packages are allowed to go into the base section to keep the required disk usage very small.

- +

Most of these packages will have the priority value required or at least important, and many of them will be tagged essential (see below).

- +

You must not place any packages into the base section before this has been discussed on the debian-devel mailing list and a consensus about doing that has been reached.

- - + + Essential packages - +

Some packages are tagged essential. (They have Essential: yes in their package control record.) This flag is used for packages that are essential for a system.

- +

Since these packages can not easily be removed (you'll have to specify an extra force option to @@ -810,7 +872,7 @@ prevent its premature removal, and we need to be able to remove it when it has been superseded.

- +

Since dpkg will not prevent upgrading of other packages while an essential package is in an unconfigured @@ -827,11 +889,11 @@ this has been discussed on the debian-devel mailing and a consensus about doing that has been reached.

- - + + Maintainer scripts - +

The package installation scripts should avoid producing output which it is unnecessary for the user to see and @@ -839,7 +901,7 @@ the part of a user installing many packages. This means, amongst other things, using the --quiet option on install-info.

- +

Packages should try to minimize the amount of prompting they need to do, and they should ensure that the user will @@ -848,16 +910,16 @@ configuration files (such as /etc/papersize and /etc/news/server), rather than each prompting for their own list of required pieces of information.

- +

It also means that an upgrade should not ask the same questions again, unless the user has used dpkg - --purge to remove the package's configuration. The + --purge to remove the package's configuration. The answers to configuration questions should be stored in an appropriate place in /etc so that the user can modify them, and how this has been done should be documented.

- +

If a package has a vitally important piece of information to pass to the user (such as "don't run me as I am, you @@ -871,7 +933,7 @@ do instructions on how to use a program (these should be in on line documentation, where all the users can see them).

- +

Any necessary prompting should almost always be confined to the post-installation script, and should be protected @@ -880,21 +942,21 @@ postinst is called with abort-upgrade, abort-remove or abort-deconfigure.

- +

Errors which occur during the execution of an installation script should be checked and the installation should not continue after an error.

- +

Note, that , in general applies to package maintainer scripts, too.

- +

You should not use dpkg-divert on a file belonging to another package without consulting the maintainer of that package first.

- +

All packages which supply an instance of a common command name (or, in general, filename) should generally use @@ -911,24 +973,24 @@ Source packages - + Standards conformance - +

You should specify the most recent version of the packaging standards with which your package complies in the source package's Standards-Version field.

- +

This value will be used to file bug reports automatically if your package becomes too much out of date.

- +

The value corresponds to a version of the Debian manuals, as can be found on the title page or page headers and footers (depending on the format).

- +

The version number has four components--major and minor number and major and minor patch level. When the @@ -942,237 +1004,2718 @@ which do not change the meaning are made, or changes which do not affect the contents of packages.

-

- For package maintainers, only the first 3 digits of the - manual version are significant in representing the - Standards-Version, and either these 3 digits or - the complete 4 digits may be specified. - +

+ For package maintainers, only the first 3 digits of the + manual version are significant in representing the + Standards-Version, and either these 3 digits or + the complete 4 digits may be specified. + +

+ In the past, people specified 4 digits in the + Standards-Version field, like `2.3.0.0'. Since any + `patch-level changes' don't introduce new policy, it + was thought it would be better to relax policy and + only require that the first 3 digits are specified. (4 + digits may still be used if someone wants to do so.) +

+ +

+ +

+ You should regularly, and especially if your package has + become out of date, check for the newest Policy Manual + available and update your package, if necessary. When your + package complies with the new standards you should update the + Standards-Version source package field and + release it.

+ + + + Package relationships + +

+ Source packages should specify which binary packages they + require to be installed or not to be installed in order to + build correctly. For example, if building a package + requires a certain compiler, then the compiler should be + specified as a build-time dependency. +

+ +

+ It is not necessary to explicitly specify build-time + relationships on a minimal set of packages that are always + needed to compile, link and put in a Debian package a + standard "Hello World!" program written in C or C++. The + required packages are called build-essential, and + an informational list can be found in + /usr/share/doc/build-essential/list (which is + contained in the build-essential + package). + +

Rationale: + + +

This allows maintaining the list separately + from the policy documents (the list does not + need the kind of control that the policy + documents do) +

+ + +

+ Having a separate package allows one to nistall + the build essential packages on a machine, as + well as allowing other packages (think task + packages) to bring in the build-essential + packages using the depends relation +

+
+ +

+ The separate package allows bug reports against + the package to be categorized separately from + the policy management process that uses the BTS +

+
+ +

+ + +

+ +

+ When specifying the set of build-time dependencies, one + should list only those packages explicitly required by the + build. It is not necessary to list packages which are + required merely because some other package in the list of + build-time dependencies depends on them. The reason is + that dependencies change, and you should list only those + you need. What others need is their business. +

+ +

+ If build-time dependencies are specified, it must be + possible to build the package and produce working binaries + on a system with the build-essential packages installed + and satisfying the build-time relationships (including any + implied relationships). This + means in particular that version clauses should be used + rigorously in build-time relationships so that one cannot + produce bad or inconsistently configured packages when the + relationships are properly satisfied. +

+ + + Changes to the upstream sources + +

+ If changes to the source code are made that are generally + applicable, they should be sent to the upstream authors + in whatever form they prefer so as to be included in the + upstream version of the package.

+ +

+ If you need to configure the package differently for + Debian or for Linux, and the upstream source doesn't + provide a way to configure it the way you need to, you + should add such configuration facilities (for example, a new + autoconf test or #define) and send + the patch to the upstream authors, with the default set to + the way they originally had it. You can then easily + override the default in your debian/rules or + wherever is appropriate.

+ +

+ You should make sure that the configure utility + detects the correct architecture specification string + (refer to for details).

+ +

+ If you need to edit a Makefile where + GNU-style configure scripts are used, you + should edit the .in files rather than editing the + Makefile directly. This allows the user to + reconfigure the package if necessary. You should + not configure the package and edit the generated + Makefile! This makes it impossible for + someone else to later reconfigure the package.

+ + + + Documenting your changes + +

+ You should document your changes and updates to the source + package properly in the debian/changelog file. (Note + that mistakes in changelogs are usually best rectified by + making a new changelog entry rather than "rewriting history" + by editing old changelog entries)

+ +

+ A copy of the file which will be installed in + /usr/share/doc/package/copyright should be + in debian/copyright.

+ +

+ In non-experimental packages you must only use a format for + debian/changelog which is supported by the most + recent released version of dpkg. If your + format is not supported and there is general support for + it you should contact the dpkg maintainer to + have the parser script for your format included in the + dpkg package. (You will need to agree that + the parser and its manpage may be distributed under the + GNU GPL, just as the rest of dpkg + is.)

+ + + + Error trapping in makefiles + +

+ When make invokes a command in a makefile + (including your package's upstream makefiles and the + debian/rules) it does so using sh. This + means that sh's usual bad error handling + properties apply: if you include a miniature script as one + of the commands in your makefile you'll find that if you + don't do anything about it then errors are not detected + and make will blithely continue after + problems.

+ +

+ Every time you put more than one shell command (this + includes using a loop) in a makefile command you + must make sure that errors are trapped. For + simple compound commands, such as changing directory and + then running a program, using && rather + than semicolon as a command separator is sufficient. For + more complex commands including most loops and + conditionals you should include a separate set -e + command at the start of every makefile command that's + actually one of these miniature shell scripts.

+ + + + Obsolete constructs and libraries + +

+ The include file <varargs.h> is + provided to support end-users compiling very old software; + the library libtermcap is provided to support the + execution of software which has been linked against it + (either old programs or those such as Netscape which are + only available in binary form).

+ +

+ Debian packages should be ported to include + <stdarg.h> and ncurses when + they are built.

+
+
+ + + Control files and their fields + +

+ Many of the tools in the package management suite manipulate + data in a common format, known as control files. Binary and + source packages have control data as do the .changes + files which control the installation of uploaded files, and + dpkg's internal databases are in a similar + format. +

+ + Syntax of control files + +

+ A file consists of one or more paragraphs of fields. The + paragraphs are separated by blank lines. Some control files + only allow one paragraph; others allow several, in which + case each paragraph often refers to a different package. +

+ +

+ Each paragraph is a series of fields and values; each field + consists of a name, followed by a colon and the value. It + ends at the end of the line. Horizontal whitespace (spaces + and tabs) may occur immediately before or after the value + and is ignored there; it is conventional to put a single + space after the colon. +

+ +

+ Some fields' values may span several lines; in this case + each continuation line must start with a space or + tab. Any trailing spaces or tabs at the end of individual + lines of a field value are ignored. +

+ +

+ Except where otherwise stated only a single line of data is + allowed and whitespace is not significant in a field body. + Whitespace may never appear inside names (of packages, + architectures, files or anything else), version numbers or + in between the characters of multi-character version + relationships. +

+ +

+ Field names are not case-sensitive, but it is usual to + capitalize the field names using mixed case as shown below. +

+ +

+ Blank lines, or lines consisting only of spaces and tabs, + are not allowed within field values or between fields - that + would mean a new paragraph. +

+ +

+ It is important to note that there are several fields which + are optional as far as dpkg and the related + tools are concerned, but which must appear in every Debian + package, or whose omission may cause problems. When writing + the control files for Debian packages you must read + the Debian policy manual in conjunction with the details + below and the list of fields for the particular file.

+
+ + List of fields +

+ This list here is not supposed to be exhaustive. Typically + only fields for whom policy exists are mentioned here. +

+ Package + + +

+ The name of the binary package. Package names consist of + the alphanumerics and + - . + (plus, minus and full stop). +

+ +

+ They must be at least two characters long and must start + with an alphanumeric character. The use lowercase package + names is strongly recommended unless the package you're + building (or referring to, in other fields) is already + using uppercase.

+
+ + Version + + +

+ This lists the source or binary package's version number - + see . +

+ +
+ + Standards-Version + + +

+ The most recent version of the standards (the packaging + and policy manuals and associated texts) with which the + package complies. This is updated manually when editing + the source package to conform to newer standards; it can + sometimes be used to tell when a package needs attention. +

+ +

+ Its format is the same as that of a version number except + that no epoch or Debian revision is allowed - see .

+
+ + + Distribution + + +

+ In a .changes file or parsed changelog output + this contains the (space-separated) name(s) of the + distribution(s) where this version of the package should + be or was installed. Distribution names follow the rules + for package names. (See ). +

+ +

+ + Current distribution values are: + + stable + +

+ This is the current `released' version of Debian + GNU/Linux. Once the + distribution is stable only major bug fixes + are allowed. When changes are made to this + distribution, the release number is increased + (for example: 1.2r1 becomes 1.2r2 then 1.2r3, etc). +

+ + + unstable + +

+ This distribution value refers to the + developmental part of the Debian + distribution tree. New packages, new upstream + versions of packages and bug fixes go into the + unstable directory tree. Download from + this distribution at your own risk. +

+
+ + frozen + +

+ From time to time, the unstable + distribution enters a state of `code-freeze' in + anticipation of release as a stable + version. During this period of testing only + fixes for existing or newly-discovered bugs will + be allowed. +

+
+ + experimental + +

+ The packages with this distribution value are deemed + by their maintainers to be high risk. Oftentimes they + represent early beta or developmental packages from + various sources that the maintainers want people to + try, but are not ready to be a part of the other parts + of the Debian distribution tree. Download at your own + risk. +

+
+ + There are several sections in each + distribution. Currently, these sections are: + + + contrib + +

+ The packages in this section do not meet the + criteria for inclusion in the main Debian + distribution as defined by the Policy Manual, + but are otherwise free, as defined by the Debian + free software guidelines.

+
+ + non-free + +

+ Packages in non-free do not meet the + criteria of free software, as defined by the + Debian free software guidelines. Again, use your + best judgment in downloading from this + Distribution.

+
+ +
You should list all distributions that + the package should be installed into. Except in unusual + circumstances, installations to stable should also + go into frozen (if it exists) and + unstable. Likewise, installations into + frozen should also go into unstable. + +

+
+ + +
+
+ + Version numbering + +

+ Every package has a version number, in its Version + control file field. +

+ +

+ The package management system imposes an ordering on version + numbers, so that it can tell whether packages are being up- or + downgraded and so that package system front end applications + can tell whether a package it finds available is newer than + the one installed on the system. The version number format + has the most significant parts (as far as comparison is + concerned) at the beginning. +

+ +

+ The version number format is: + &lsqbepoch:]upstream-version[-/debian-revision]. +

+ +

+ The three components here are: + + epoch + + +

+ This is a single (generally small) unsigned integer. It + may be omitted, in which case zero is assumed. If it is + omitted then the upstream-version may not + contain any colons. +

+ +

+ It is provided to allow mistakes in the version numbers + of older versions of a package, and also a package's + previous version numbering schemes, to be left behind. +

+ + + + upstream-version + + +

+ This is the main part of the version. It is usually + version number of the original (`upstream') package of + which the .deb file has been made, if this is + applicable. Usually this will be in the same format as + that specified by the upstream author(s); however, it + may need to be reformatted to fit into the package + management system's format and comparison scheme. +

+ +

+ The comparison behavior of the package management system + with respect to the upstream-version is + described below. The upstream-version + portion of the version number is mandatory. +

+ +

+ The upstream-version may contain only + alphanumerics and the characters . + + - : (full stop, plus, hyphen, colon) + and should start with a digit. If there is no + debian-revision then hyphens are not allowed; + if there is no epoch then colons are not + allowed.

+
+ + debian-revision + + +

+ This part of the version represents the version of the + modifications that were made to the package to make it a + Debian binary package. It is in the same format as the + upstream-version and is compared in the same + way. +

+ +

+ It is optional; if it isn't present then the + upstream-version may not contain a hyphen. + This format represents the case where a piece of + software was written specifically to be turned into a + Debian binary package, and so there is only one + `debianization' of it and therefore no revision + indication is required. +

+ +

+ It is conventional to restart the + debian-revision at 1 each time the + upstream-version is increased. +

+ +

+ The package management system will break the + upstream-version and + debian-revision apart at the last hyphen in + the string. The absence of a debian-revision + compares earlier than the presence of one (but note that + the debian-revision is the least significant + part of the version number). +

+ +

+ The debian-revision may contain only + alphanumerics and the characters + and + . (plus and full stop). +

+
+ + The upstream-version and debian-revision + parts are compared by the package management system using the + same algorithm: +

+ +

+ The strings are compared from left to right. +

+ +

+ First the initial part of each string consisting entirely of + non-digit characters is determined. These two parts (one of + which may be empty) are compared lexically. If a difference + is found it is returned. The lexical comparison is a + comparison of ASCII values modified so that all the letters + sort earlier than all the non-letters. +

+ +

+ Then the initial part of the remainder of each string which + consists entirely of digit characters is determined. The + numerical values of these two parts are compared, and any + difference found is returned as the result of the comparison. + For these purposes an empty string (which can only occur at + the end of one or both version strings being compared) counts + as zero. +

+ +

+ These two steps are repeated (chopping initial non-digit + strings and initial digit strings off from the start) until a + difference is found or both strings are exhausted. +

+ +

+ Note that the purpose of epochs is to allow us to leave behind + mistakes in version numbering, and to cope with situations + where the version numbering changes. It is not there + to cope with version numbers containing strings of letters + which the package management system cannot interpret (such as + ALPHA or pre-), or with silly orderings (the + author of this manual has heard of a package whose versions + went 1.1, 1.2, 1.3, 1, + 2.1, 2.2, 2 and so forth). +

+ +

+ If an upstream package has problematic version numbers they + should be converted to a sane form for use in the + Version field. +

+ + + Version numbers based on dates +

+ In general, Debian packages should use the same version + numbers as the upstream sources.

+ +

+ However, in some cases where the upstream version number is + based on a date (e.g., a development `snapshot' release) the + package management system cannot handle these version + numbers without epochs. For example, dpkg will consider + `96May01' to be greater than `96Dec24'.

+ +

+ To prevent having to use epochs for every new upstream + version, the version number should be changed to the + following format in such cases: `19960501', `19961224'. It + is up to the maintainer whether he/she wants to bother the + upstream maintainer to change the version numbers upstream, + too.

+ +

+ Note, that other version formats based on dates which are + parsed correctly by the package management system should + not be changed.

+ +

+ Native Debian packages (i.e., packages which have been + written especially for Debian) whose version numbers include + dates should always use the `YYYYMMDD' format.

+
+
+ + Packaging Considerations + + Time Stamps +

+ Maintainers are encouraged to preserve the modification + times of the upstream source files in a package, as far as + is reasonably possible. Even though this is optional, this + is still a good idea. + +

+ The rationale is that there is some information conveyed + by knowing the age of the file, for example, you could + recognize that some documentation is very old by looking + at the modification time, so it would be nice if the + modification time of the upstream source would be + preserved. +

+ +

+
+ + debian/rules - the + main building script + +

+ This file must be an executable makefile, and contains the + package-specific recipes for compiling the package and + building binary package(s) out of the source. +

+ +

+ It must start with the line #!/usr/bin/make -f, + so that it can be invoked by saying its name rather than + invoking make explicitly. +

+ +

+ Since an interactive debian/rules script makes it + impossible to auto-compile that package and also makes it + hard for other people to reproduce the same binary + package, all required targets MUST be + non-interactive. At a minimum, required targets are the + ones called by dpkg-buildpackage, namely, + clean, binary, binary-arch, and + build. It also follows that any target that these + targets depend on must also be non-interactive. +

+ +

+ The targets which must be present are: + + build + +

+ This should perform all non-interactive + configuration and compilation of the package. If a + package has an interactive pre-build configuration + routine, the Debianised source package should be + built after this has taken place, so that it can be + built without rerunning the configuration. +

+ +

+ For some packages, notably ones where the same + source tree is compiled in different ways to produce + two binary packages, the build target + does not make much sense. For these packages it is + good enough to provide two (or more) targets + (build-a and build-b or whatever) + for each of the ways of building the package, and a + build target that does nothing. The + binary target will have to build the + package in each of the possible ways and make the + binary package out of each. +

+ +

+ The build target must not do anything + that might require root privilege. +

+ +

+ The build target may need to run + clean first - see below. +

+ +

+ When a package has a configuration routine that + takes a long time, or when the makefiles are poorly + designed, or when build needs to run + clean first, it is a good idea to + touch build when the build process is + complete. This will ensure that if debian/rules + build is run again it will not rebuild the + whole program. +

+ + + binary, binary-arch, + binary-indep + + +

+ The binary target must be all that is + necessary for the user to build the binary + package. All these targets are required to be + non-interactive. It is split into two parts: + binary-arch builds the packages' output + files which are specific to a particular + architecture, and binary-indep builds + those which are not. +

+ +

+ binary may be (and commonly is) a target + with no commands which simply depends on + binary-arch and + binary-indep. +

+ +

+ Both binary-* targets should depend on + the build target, above, so that the + package is built if it has not been already. It + should then create the relevant binary package(s), + using dpkg-gencontrol to make their + control files and dpkg-deb to build + them and place them in the parent of the top level + directory. +

+ +

+ If one of the binary-* targets has + nothing to do (this will be always be the case if + the source generates only a single binary package, + whether architecture-dependent or not) it + must still exist, and must always + succeed. +

+ +

+ The binary targets must be invoked as + root. +

+
+ + clean + + +

+ This must undo any effects that the + build and binary targets + may have had, except that it should leave alone any + output files created in the parent directory by a + run of binary. This target must be + non-interactive. +

+ +

+ If a build file is touched at the end + of the build target, as suggested + above, it should be removed as the first thing that + clean does, so that running + build again after an interrupted + clean doesn't think that everything is + already done. +

+ +

+ The clean target may need to be + invoked as root if binary has been + invoked since the last clean, or if + build has been invoked as root (since + build may create directories, for + example). +

+
+ + get-orig-source (optional) + + +

+ This target fetches the most recent version of the + original source package from a canonical archive site + (via FTP or WWW, for example), does any necessary + rearrangement to turn it into the original source + tar file format described below, and leaves it in the + current directory. +

+ +

+ This target may be invoked in any directory, and + should take care to clean up any temporary files it + may have left. +

+ +

+ This target is optional, but providing it if + possible is a good idea. +

+
+ + +

+ The build, binary and + clean targets must be invoked with a current + directory of the package's top-level directory. +

+ + +

+ Additional targets may exist in debian/rules, + either as published or undocumented interfaces or for the + package's internal use. +

+ +

+ The architecture we build on and build for is determined by + make variables via dpkg-architecture. You can get the Debian + architecture and the GNU style architecture specification + string for the build machine as well as the host + machine. Here is a list of supported make variables: + + +

DEB_*_ARCH (the Debian architecture)

+ + +

DEB_*_GNU_TYPE (the GNU style architecture + specification string)

+
+ +

DEB_*_GNU_CPU (the CPU part of DEB_*_GNU_TYPE)

+
+ +

DEB_*_GNU_SYSTEM (the System part of + DEB_*_GNU_TYPE)

+ +

+ +

+ where * is either BUILD for specification of + the build machine or HOST for specification of the machine + we build for. +

+ +

+ Backward compatibility can be provided in the rules file + by setting the needed variables to suitable default + values, please refer to the documentation of + dpkg-architecture for details. +

+ +

+ It is important to understand that the DEB_*_ARCH + string does only determine which Debian architecture we + build on resp. for. It should not be used to get the CPU + or System information, the GNU style variables should be + used for that. +

+
+ + debian/changelog + + +

+ This file records the changes to the Debian-specific parts of the + package + +

+ Though there is nothing stopping an author who is also + the Debian maintainer from using it for all their + changes, it will have to be renamed if the Debian and + upstream maintainers become different + people. +

+ . +

+ +

+ It has a special format which allows the package building + tools to discover which version of the package is being + built and find out other release-specific information. +

+ +

+ That format is a series of entries like this: + + package (version) distribution(s); urgency=urgency + + * change details + more change details + * even more change details + + -- maintainer name and email address date + +

+ +

+ package and version are the source + package name and version number. +

+ +

+ distribution(s) lists the distributions where + this version should be installed when it is uploaded - it + is copied to the Distribution field in the + .changes file. See . +

+ +

+ urgency is the value for the Urgency + field in the .changes file for the upload. It is + not possible to specify an urgency containing commas; commas + are used to separate + keyword=value settings in the + dpkg changelog format (though there is + currently only one useful keyword, + urgency). +

+ +

+ The change details may in fact be any series of lines + starting with at least two spaces, but conventionally each + change starts with an asterisk and a separating space and + continuation lines are indented so as to bring them in + line with the start of the text above. Blank lines may be + used here to separate groups of changes, if desired. +

+ +

+ The maintainer name and email address need not + necessarily be those of the usual package maintainer. + They should be the details of the person doing + this version. The information here will be + copied to the .changes file, and then later used + to send an acknowledgement when the upload has been + installed. +

+ +

+ The date should be in RFC822 format + +

+ This is generated by the 822-date + program. +

+ ; it should include the time zone specified + numerically, with the time zone name or abbreviation + optionally present as a comment. +

+ +

+ The first `title' line with the package name should start + at the left hand margin; the `trailer' line with the + maintainer and date details should be preceded by exactly + one space. The maintainer details and the date must be + separated by exactly two spaces. +

+ + Defining alternative changelog formats + +

+ It is possible to use a different format to the standard + one, by providing a parser for the format you wish to + use. +

+

+ A changelog parser must not interact with the user at + all. +

+
+
+ + debian/substvars + and variable substitutions + +

+ When dpkg-gencontrol, + dpkg-genchanges and dpkg-source + generate control files they do variable substitutions on + their output just before writing it. Variable + substitutions have the form + ${variable-name}. The optional file + debian/substvars contains variable substitutions + to be used; variables can also be set directly from + debian/rules using the -V option to the + source packaging commands, and certain predefined + variables are available. +

+ +

+ The is usually generated and modified dynamically by + debian/rules targets; in this case it must be + removed by the clean target. +

+ +

+ See for full + details about source variable substitutions, including the + format of debian/substvars.

+
+ + debian/files + + +

+ This file is not a permanent part of the source tree; it + is used while building packages to record which files are + being generated. dpkg-genchanges uses it + when it generates a .changes file. +

+ +

+ It should not exist in a shipped source package, and so it + (and any backup files or temporary files such as + files.new + +

+ files.new is used as a temporary file by + dpkg-gencontrol and + dpkg-distaddfile - they write a new + version of files here before renaming it, + to avoid leaving a corrupted copy if an error + occurs +

+ ) should be removed by the + clean target. It may also be wise to + ensure a fresh start by emptying or removing it at the + start of the binary target. +

+ +

+ dpkg-gencontrol adds an entry to this file + for the .deb file that will be created by + dpkg-deb from the control file that it + generates, so for most packages all that needs to be done + with this file is to delete it in clean. +

+ +

+ If a package upload includes files besides the source + package and any binary packages whose control files were + made with dpkg-gencontrol then they should be + placed in the parent of the package's top-level directory + and dpkg-distaddfile should be called to add + the file to the list in debian/files.

+
+ + Restrictions on objects in source packages + + +

+ The source package may not contain any hard links + +

+ This is not currently detected when building source + packages, but only when extracting + them. +

+ + +

+ Hard links may be permitted at some point in the + future, but would require a fair amount of + work. +

+
, device special files, sockets or setuid or + setgid files. + +

+ Setgid directories are allowed. +

+
+

+
+ Descriptions of packages - the + Description field + +

+ The description is intended to describe the program to a user + who has never met it before so that they know whether they + want to install it. It should also give information about the + significant dependencies and conflicts between this package + and others, so that the user knows why these dependencies and + conflicts have been declared. +

+ + Notes about writing descriptions + + +

+ The single line synopsis should be kept brief - certainly + under 80 characters. +

+ +

+ Do not include the package name in the synopsis line. The + display software knows how to display this already, and you + do not need to state it. Remember that in many situations + the user may only see the synopsis line - make it as + informative as you can. +

+ +

+ Do not try to continue the single line synopsis into the + extended description. This will not work correctly when + the full description is displayed, and makes no sense + where only the summary (the single line synopsis) is + available. +

+ +

+ The extended description should describe what the package + does and how it relates to the rest of the system (in terms + of, for example, which subsystem it is which part of). +

+ +

+ The description field needs to make sense to anyone, even + people who have no idea about any of the things the + package deals with. + +

+ The blurb that comes with a program in its + announcements and/or README files is + rarely suitable for use in a description. It is + usually aimed at people who are already in the + community where the package is used. +

+ +

+ +

+ Put important information first, both in the synopsis and + extended description. Sometimes only the first part of the + synopsis or of the description will be displayed. You can + assume that there will usually be a way to see the whole + extended description. +

+ +

+ You may include information about dependencies and so forth + in the extended description, if you wish. +

+ +

+ Do not use tab characters. Their effect is not predictable. +

+ +
+
+
+ + + Package maintainer scripts + and installation procedure + + + Introduction to package maintainer scripts + + +

+ It is possible to supply scripts as part of a package which + the package management system will run for you when your + package is installed, upgraded or removed. +

+ +

+ These scripts should be the files preinst, + postinst, prerm and postrm in the + control area of the package. They must be proper executable + files; if they are scripts (which is recommended) they must + start with the usual #! convention. They should be + readable and executable to anyone, and not world-writable. +

+ +

+ the package management system looks at the exit status from + these scripts. It is important that they exit with a + non-zero status if there is an error, so that the package + management system can stop its processing. For shell + scripts this means that you almost always need to + use set -e (this is usually true when writing shell + scripts, in fact). It is also important, of course, that + they don't exit with a non-zero status if everything went + well. +

+ +

+ It is necessary for the error recovery procedures that the + scripts be idempotent: i.e., invoking the same script several + times in the same situation should do no harm. If the first + call failed, or aborted half way through for some reason, + the second call should merely do the things that were left + undone the first time, if any, and exit with a success + status. +

+ +

+ When a package is upgraded a combination of the scripts from + the old and new packages is called in amongst the other + steps of the upgrade procedure. If your scripts are going + to be at all complicated you need to be aware of this, and + may need to check the arguments to your scripts. +

+ +

+ Broadly speaking the is called before + (a particular version of) a package is installed, and the + postinst afterwards; the prerm + before (a version of) a package is removed and the + postrm afterwards. +

+ + +

Programs called from maintainer scripts should not + normally have a path prepended to them. Before installation + is started the package management system checks to see if + the programs ldconfig, + start-stop-daemon, install-info, + and update-rc.d can be found via the + PATH environment variable. Those programs, and any + other program that one would expect to on the PATH, + should thus be invoked without an absolute + pathname. Maintainer scripts should also not reset the + PATH, though they might choose to modify it by pre- + or appending package-specific directories. These + considerations really apply to all shell scripts.

+
+ + Maintainer scripts Idempotency + +

+ It is very important to make maintainer scripts + idempotent. + +

+ That means that if it runs successfully or fails + and then you call it again it doesn't bomb out, + but just ensures that everything is the way it + ought to be. +

+ This is so that if an error occurs, the + user interrupts dpkg or some other + unforeseen circumstance happens you don't leave the + user with a badly-broken package. +

+
+ + Controlling terminal for maintainer scripts + +

+ The maintainer scripts are guaranteed to run with a + controlling terminal and can interact with the user. + If they need to prompt for passwords, do full-screen + interaction or something similar you should do these + things to and from /dev/tty, since + dpkg will at some point redirect scripts' + standard input and output so that it can log the + installation process. Likewise, because these scripts + may be executed with standard output redirected into a + pipe for logging purposes, Perl scripts should set + unbuffered output by setting $|=1 so that the + output is printed immediately rather than being + buffered. +

+ +

+ Each script should return a zero exit status for + success, or a nonzero one for failure. +

+
+ + Summary of ways maintainer + scripts are called + + +

+ + +

new-preinst install

+ + +

new-preinst install + old-version

+
+ +

new-preinst upgrade + old-version

+
+ +

old-preinst abort-upgrade + new-version +

+
+ + +

+ + +

postinst configure + most-recently-configured-version

+ + +

old-postinst abort-upgrade + new version

+
+ +

conflictor's-postinst abort-remove + in-favour package + new-version

+
+ +

+ deconfigured's-postinst + abort-deconfigure in-favour + failed-install-package version + removing conflicting-package + version +

+
+ + +

+ + +

prerm remove

+ + +

old-prerm upgrade + new-version

+
+ +

new-prerm failed-upgrade + old-version

+
+ +

conflictor's-prerm remove + in-favour package + new-version

+
+ +

+ deconfigured's-prerm deconfigure + in-favour package-being-installed + version removing + conflicting-package + version +

+
+ + +

+ + +

postrm remove

+ + +

postrm purge

+
+ +

+ old-postrm upgrade + new-version

+
+ +

new-postrm failed-upgrade + old-version

+
+ +

new-postrm abort-install

+
+ +

new-postrm abort-install + old-version

+
+ +

new-postrm abort-upgrade + old-version

+
+ +

+ disappearer's-postrm disappear + overwriter + overwriter-version

+ +

+ + + Details of unpack phase of + installation or upgrade + + +

+ The procedure on installation/upgrade/overwrite/disappear + (i.e., when running dpkg --unpack, or the unpack + stage of dpkg + --install) is as follows. In each case if an error occurs the + actions in are general run backwards - this means that the maintainer + scripts are run with different arguments in reverse order. These are + the `error unwind' calls listed below. + + + +

+ + +

If a version the package is already + installed, call + + old-prerm upgrade new-version +

+ + +

+ If this gives an error (i.e., a non-zero exit + status), dpkg will attempt instead: + + new-prerm failed-upgrade old-version + + Error unwind, for both the above cases: + + old-postinst abort-upgrade new-version + +

+
+ +

+ + +

If a `conflicting' package is being removed at the same time: + + +

+ If any packages depended on that conflicting + package and --auto-deconfigure is + specified, call, for each such package: + + deconfigured's-prerm deconfigure \ + in-favour package-being-installed version \ + removing conflicting-package version + + Error unwind: + + deconfigured's-postinst abort-deconfigure \ + in-favour package-being-installed-but-failed version \ + removing conflicting-package version + + The deconfigured packages are marked as + requiring configuration, so that if + --install is used they will be + configured again if possible.

+
+ +

To prepare for removal of the conflicting package, call: + + conflictor's-prerm remove in-favour package new-version + + Error unwind: + + conflictor's-postinst abort-remove \ + in-favour package new-version + +

+
+ +

+ + +

+ + +

If the package is being upgraded, call: + + new-preinst upgrade old-version +

+
+ +

+ Otherwise, if the package had some configuration + files from a previous version installed (i.e., it + is in the `configuration files only' state): + + new-preinst install old-version +

+ + +

Otherwise (i.e., the package was completely purged): + + new-preinst install + + Error unwind versions, respectively: + + new-postrm abort-upgrade old-version + new-postrm abort-install old-version + new-postrm abort-install + +

+
+ +

+
+ + +

+ The new package's files are unpacked, overwriting any + that may be on the system already, for example any + from the old version of the same package or from + another package (backups of the old files are left + around, and if anything goes wrong the package + management system will attempt to put them back as + part of the error unwind). +

+ +

+ It is an error for a package to contains files which + are on the system in another package, unless + Replaces is used (see ). + Currently the --force-overwrite flag is + enabled, downgrading it to a warning, but this may not + always be the case. +

+ +

+ It is a more serious error for a package to contain a + plain file or other kind of non-directory where another + package has a directory (again, unless + Replaces is used). This error can be + overridden if desired using + --force-overwrite-dir, but this is not + advisable. +

+ +

+ Packages which overwrite each other's files produce + behavior which though deterministic is hard for the + system administrator to understand. It can easily + lead to `missing' programs if, for example, a package + is installed which overwrites a file from another + package, and is then removed again. + +

+ Part of the problem is due to what is arguably a + bug in dpkg. +

+ +

+ +

+ A directory will never be replaced by a symbolic links + to a directory or vice versa; instead, the existing + state (symlink or not) will be left alone and + dpkg will follow the symlink if there is + one.

+
+ + + +

+ +

If the package is being upgraded, call + + old-postrm upgrade new-version +

+
+ +

If this fails, dpkg will attempt: + + new-postrm failed-upgrade old-version + + Error unwind, for both cases: + + old-preinst abort-upgrade new-version + +

+
+ +

+ This is the point of no return - if + dpkg gets this far, it won't back off + past this point if an error occurs. This will + leave the package in a fairly bad state, which + will require a successful re-installation to clear + up, but it's when dpkg starts doing + things that are irreversible. +

+ + +

+ Any files which were in the old version of the package + but not in the new are removed.

+
+ +

The new file list replaces the old.

+
+ +

The new maintainer scripts replace the old.

+
+ + +

Any packages all of whose files have been overwritten during the + installation, and which aren't required for + dependencies, are considered to have been removed. + For each such package, + + +

dpkg calls: + + disappearer's-postrm disappear \ + overwriter overwriter-version + +

+
+ +

The package's maintainer scripts are removed. +

+
+ +

+ It is noted in the status database as being in a + sane state, namely not installed (any conffiles + it may have are ignored, rather than being + removed by dpkg). Note that + disappearing packages do not have their prerm + called, because dpkg doesn't know + in advance that the package is going to + vanish. +

+
+ +

+ + +

+ Any files in the package we're unpacking that are also + listed in the file lists of other packages are removed + from those lists. (This will lobotomize the file list + of the `conflicting' package if there is one.) +

+
+ +

+ The backup files made during installation, above, are + deleted. +

+
+ + +

+ The new package's status is now sane, and recorded as + `unpacked'. Here is another point of no return - if + the conflicting package's removal fails we do not + unwind the rest of the installation; the conflicting + package is left in a half-removed limbo. +

+
+ +

+ If there was a conflicting package we go and do the + removal actions (described below), starting with the + removal of the conflicting package's files (any that + are also in the package being installed have already + been removed from the conflicting package's file list, + and so do not get removed now). +

+
+ +

+
+ + Details of configuration + +

+ When we configure a package (this happens with dpkg + --install, or with --configure), we first + update the conffiles and then call: + + postinst configure most-recently-configured-version + +

+ +

+ No attempt is made to unwind after errors during + configuration. +

+ +

+ If there is no most recently configured version + dpkg will pass a null argument; older versions + of dpkg may pass <unknown> (including the + angle brackets) in this case. Even older ones do not pass a + second argument at all, under any circumstances. +

+
+ + Details of removal and/or configuration purging + + +

+ + +

+ + prerm remove + +

+ + +

+ The package's files are removed (except conffiles). +

+
+ +

+ postrm remove +

+
+ +

All the maintainer scripts except the postrm are removed. +

+ +

+ If we aren't purging the package we stop here. Note + that packages which have no postrm and no conffiles + are automatically purged when removed, as there is no + difference except for the dpkg + status.

+
+ +

+ The conffiles and any backup files (~-files, + #*# files, %-files, + .dpkg-{old,new,tmp}, etc.) are removed.

+
+ +

+ postrm purge +

+
+ +

The package's file list is removed.

+
+ + No attempt is made to unwind after errors during + removal.

+
+
+ + + Declaring relationships between + packages + +

+ Packages can declare in their control file that they have + certain relationships to other packages - for example, that + they may not be installed at the same time as certain other + packages, and/or that they depend on the presence of others, + or that they should overwrite files in certain other packages + if present. +

+ +

+ This is done using the Depends, Recommends, + Suggests, Conflicts, Provides and + Replaces control file fields. +

+ +

+ Source packages may declare relationships to binary packages, + saying that they require certain binary packages being + installed or absent at the time of building the package. +

+ +

+ This is done using the Build-Depends, + Build-Depends-Indep, Build-Conflicts, and + Build-Conflicts-Indep control file fields. +

+ + Syntax of relationship fields + + +

+ These fields all have a uniform syntax. They are a list of + package names separated by commas. +

+ +

+ In Depends, Recommends, Suggests, + Pre-Depends, Build-Depends and + Build-Depends-Indep(the fields which declare + dependencies of the package in which they occur on other + packages) these package names may also be lists of + alternative package names, separated by vertical bar symbols + | (pipe symbols). +

+ +

+ All the fields except Provides may restrict their + applicability to particular versions of each named package. + This is done in parentheses after each individual package + name; the parentheses should contain a relation from the + list below followed by a version number, in the format + described in . +

+ +

+ The relations allowed are <<, <=, + =, >= and >> for + strictly earlier, earlier or equal, exactly equal, later or + equal and strictly later, respectively. The forms + < and > were used to mean + earlier/later or equal, rather than strictly earlier/later, + so they should not appear in new packages (though + dpkg still supports them). +

+ +

+ Whitespace may appear at any point in the version + specification, and must appear where it's necessary to + disambiguate; it is not otherwise significant. For + consistency and in case of future changes to + dpkg it is recommended that a single space be + used after a version relationship and before a version + number; it is usual also to put a single space after each + comma, on either side of each vertical bar, and before each + open parenthesis. +

+ +

+ For example: + + Package: metamail + Version: 2.7-3 + Depends: libc5 (>= 5.2.18-4), mime-support, csh | tcsh + +

+ +

+ All fields that specify build-time relationships + (Build-Depends, Build-Depends-Indep, + Build-Conflicts and Build-Conflicts-Indep) + may be restricted to a certain set of architectures. This + is done in brackets after each individual package name and + the optional version specification. The brackets enclose a + list of Debian architecture names separated by whitespace. + An exclamation mark may be prepended to each name. If the + current Debian host architecture is not in this list and + there are no exclamation marks in the list, or it is in the + list with a prepended exclamation mark, the package name and + the associated version specification are ignored completely + for the purposes of defining the relationships. +

+ +

+ For example: + + Source: glibc + Build-Depends-Indep: texinfo + Build-Depends: kernel-headers-2.2.10 [!hurd-i386], + hurd-dev [hurd-i386], gnumach-dev [hurd-i386] + +

+
+ + + Binary Dependencies - Depends, + Recommends, Suggests, Pre-Depends + + +

+ These four fields are used to declare a dependency by one + package on another. They appear in the depending package's + control file. +

+ +

+ All but Pre-Depends and Conflicts + (discussed below) take effect only when a package + is to be configured. They do not prevent a package being on + the system in an unconfigured state while its dependencies + are unsatisfied, and it is possible to replace a package + whose dependencies are satisfied and which is properly + installed with a different version whose dependencies are + not and cannot be satisfied; when this is done the depending + package will be left unconfigured (since attempts to + configure it will give errors) and will not function + properly. +

+ +

+ For this reason packages in an installation run are usually + all unpacked first and all configured later; this gives + later versions of packages with dependencies on later + versions of other packages the opportunity to have their + dependencies satisfied. +

+ +

+ Thus Depends allows package maintainers to impose + an order in which packages should be configured. + + Depends + + +

This declares an absolute dependency. +

+ +

+ The Depends field should be used if the + depended-on package is required for the depending + package to provide a significant amount of + functionality.

+ + + Recommends + +

This declares a strong, but not absolute, dependency. +

+ +

+ The Recommends field should list packages + that would be found together with this one in all but + unusual installations.

+
+ + Suggests + + +

+ This is used to declare that one package may be more + useful with one or more others. Using this field + tells the packaging system and the user that the + listed packages are related to this one and can + perhaps enhance its usefulness, but that installing + this one without them is perfectly reasonable. +

+ +
+ + Pre-Depends + + +

+ This field is like Depends, except that it + also forces dpkg to complete installation + of the packages named before even starting the + installation of the package which declares the + Pre-dependency. +

+ +

+ Pre-Depends should be used sparingly, + preferably only by packages whose premature upgrade or + installation would hamper the ability of the system to + continue with any upgrade that might be in progress. +

+ +

+ When the package declaring it is being configured, a + Pre-Dependency will be considered satisfied + only if the depending package has been correctly + configured, just as if an ordinary Depends + had been used. +

+ +

+ However, when a package declaring a Pre-dependency is + being unpacked the predependency can be satisfied even + if the depended-on package(s) are only unpacked or + half-configured, provided that they have been + configured correctly at some point in the past (and + not removed or partially removed since). In this case + both the previously-configured and currently unpacked + or half-configured versions must satisfy any version + clause in the Pre-Depends field. +

+
+ +

+

+ When selecting which level of dependency to use you should + consider how important the depended-on package is to the + functionality of the one declaring the dependency. Some + packages are composed of components of varying degrees of + importance. Such a package should list using + Depends the package(s) which are required by the + more important components. The other components' + requirements may be mentioned as Suggestions or + Recommendations, as appropriate to the components' relative + importance. +

+ + + Alternative binary packages - + Conflicts and Replaces + + +

+ When one binary package declares a conflict with another + dpkg will refuse to allow them to be installed + on the system at the same time. +

+ +

+ If one package is to be installed, the other must be removed + first - if the package being installed is marked as + replacing () the one on the system, or + the one on the system is marked as deselected, or both + packages are marked Essential, then + dpkg will automatically remove the package + which is causing the conflict, otherwise it will halt the + installation of the new package with an error. This + mechanism specifically doesn't work when the installed + package is Essential, but the new package is not. +

+ + +

+ A package will not cause a conflict merely because its + configuration files are still installed; it must be at least + half-installed. +

+ +

+ A special exception is made for packages which declare a + conflict with their own package name, or with a virtual + package which they provide (see below): this does not + prevent their installation, and allows a package to conflict + with others providing a replacement for it. You use this + feature when you want the package in question to be the only + package providing something. +

+ +

+ A Conflicts entry should almost never have an + `earlier than' version clause. This would prevent + dpkg from upgrading or installing the package + which declared such a conflict until the upgrade or removal + of the conflicted-with package had been completed. +

+
+ + Virtual packages - Provides + + +

+ As well as the names of actual (`concrete') packages, the + package relationship fields Depends, + Build-Depends, Build-Depends-Indep, + Recommends, Suggests, Conflicts, + Build-Conflicts and Build-Conflicts-Indep may + mention virtual packages. +

+ +

+ A virtual package is one which appears in the + Provides control file field of another package. + The effect is as if the package(s) which provide a + particular virtual package name had been listed by name + everywhere the virtual package name appears. +

+ +

+ If there are both a real and a virtual package of the same + name then the dependency may be satisfied (or the conflict + caused) by either the real package or any of the virtual + packages which provide it. This is so that, for example, + supposing we have + + Package: vm + Depends: emacs + + and someone else releases an xemacs package they can say + + Package: xemacs + Provides: emacs + and all will work in the interim (until a purely + virtual package name is decided on and the emacs + and vm packages are changed to use it). +

+ +

+ If a dependency or a conflict has a version number attached + then only real packages will be considered to see whether + the relationship is satisfied (or the prohibition violated, + for a conflict) - it is assumed that a real package which + provides virtual package is not of the `right' version. So, + a Provides field may not contain version numbers, + and the version number of the concrete package which + provides a particular virtual package will not be looked at + when considering a dependency on or conflict with the + virtual package name. +

+ +

+ It is likely that the ability will be added in a future + release of dpkg to specify a version number for + each virtual package it provides. This feature is not yet + present, however, and is expected to be used only + infrequently. +

+ +

+ If you want to specify which of a set of real packages should be the + default to satisfy a particular dependency on a virtual package, you + should list the real package as an alternative before the virtual. +

+
+ + + Replaces - overwriting + files and replacing packages + + +

+ The Replaces control file field has two purposes, + which come into play in different situations. +

+ +

+ Virtual packages () are not considered + when looking at a Replaces field - the packages + declared as being replaced must be mentioned by their real + names. +

+ + Overwriting files in other packages + + +

+ Firstly, as mentioned before, it is usually an error for a + package to contains files which are on the system in + another package, though currently the + --force-overwrite flag is enabled by default, + downgrading the error to a warning, +

+ +

+ If the overwriting package declares that it replaces the + one containing the file being overwritten then + dpkg will proceed, and replace the file from + the old package with that from the new. The file will no + longer be listed as `owned' by the old package. +

+ +

+ If a package is completely replaced in this way, so that + dpkg does not know of any files it still + contains, it is considered to have disappeared. It will + be marked as not wanted on the system (selected for + removal) and not installed. Any conffiles details noted + in the package will be ignored, as they will have been + taken over by the replacing package(s). The package's + postrm script will be run to allow the + package to do any final cleanup required. See . +

+ +

+ In the future dpkg will discard files which + overwrite those from another package which declares that + it replaces the one being installed (so that you can + install an older version of a package without problems). +

+ +

+ This usage of Replaces only takes effect when + both packages are at least partially on the system at + once, so that it can only happen if they do not conflict + or if the conflict has been overridden.

+
+ + Replacing whole packages, forcing their + removal + + +

+ Secondly, Replaces allows the packaging system to + resolve which package should be removed when there is a + conflict - see . This usage only + takes effect when the two packages do conflict, + so that the two effects do not interfere with each other. +

+
+
+ + Relationships between source and binary packages - + Build-Depends, Build-Depends-Indep, + Build-Conflicts, Build-Conflicts-Indep + + +

+ A source package may declare a dependency or a conflict on a + binary package. This is done with the control file fields + Build-Depends, Build-Depends-Indep, + Build-Conflicts, and Build-Conflicts-Indep. Their + semantics is that the dependencies and conflicts they define + must be satisfied (as defined earlier for binary packages), + when one of the targets in debian/rules that the + particular field applies to is invoked. + + + Build-Depends, Build-Conflicts + +

+ The Build-Depends and + Build-Conflicts fields apply to the targets + build, binary, binary-arch + and binary-indep. +

+ + Build-Depends-Indep, Build-Conflicts-Indep + +

+ The Build-Depends-Indep and + Build-Conflicts-Indep fields apply to the + targets binary and binary-indep. +

+
+ + +

+ +
+
+ + + Configuration file handling + + +

+ dpkg can do a certain amount of automatic + handling of package configuration files. +

+ +

+ Whether this mechanism is appropriate depends on a number of + factors, but basically there are two approaches to any + particular configuration file. +

+ +

+ The easy method is to ship a best-effort configuration in the + package, and use dpkg's conffile mechanism to + handle updates. If the user is unlikely to want to edit the + file, but you need them to be able to without losing their + changes, and a new package with a changed version of the file + is only released infrequently, this is a good approach. +

+ +

+ The hard method is to build the configuration file from + scratch in the postinst script, and to take the + responsibility for fixing any mistakes made in earlier + versions of the package automatically. This will be + appropriate if the file is likely to need to be different on + each system. +

+ + + Shared libraries + + +

+ Packages containing shared libraries must be constructed with + a little care to make sure that the shared library is always + available. This is especially important for packages whose + shared libraries are vitally important, such as the libc. +

+ +

+ Firstly, your package should install the shared libraries + under their normal names. For example, the + libgdbm1 package should install + libgdbm.so.1.7.3 as + /usr/lib/libgdbm.so.1.7.3. The files should not be + renamed or re-linked by any prerm or postrm scripts; + dpkg will take care of renaming things safely + without affecting running programs, and attempts to interfere + with this are likely to lead to problems. +

+ +

+ Secondly, your package should include the symlink that + ldconfig would create for the shared libraries. + For example, the libgdbm1 package should include + a symlink from /usr/lib/libgdbm.so.1 to + libgdbm.so.1.7.3. This is needed so that + ld.so can find the library in between the time + dpkg installs it and ldconfig is run + in the postinst script. Furthermore, older + versions of the package management system required the library + must be placed before the symlink pointing to it in the + .deb file. This is so that by the time + dpkg comes to install the symlink (overwriting + the previous symlink pointing at an older version of the + library) the new shared library is already in place. + Unfortunately, this was not not always possible, since it + highly depends on the behavior of the file system. Some + file systems (such as reiserfs) will reorder the files so it + doesn't matter in what order you create them. Starting with + release 1.7.0 dpkg will reorder the + files itself when building a package. +

+ + + +

+ Thirdly, the development package should contain a symlink for + the shared library without a version number. For example, the + libgdbm1-dev package should include a symlink from + /usr/lib/libgdm.so to libgdm.so.1.7.3. This + symlink is needed by ld when compiling packages + as it will only look for libgdm.so and + libgdm.a when compiling dynamically or statically, + respectively. +

+ + + +

+ Any package installing shared libraries in a directory that's listed + in /etc/ld.so.conf or in one of the default library + directories of ld.so (currently, these are /usr/lib + and /lib) must call ldconfig in its postinst + script if and only if the first argument is `configure'. However, it + is important not to call ldconfig in the postrm or preinst + scripts in the case where the package is being upgraded (see ), as ldconfig will see the temporary names + that dpkg uses for the files while it is + installing them and will make the shared library links point + to them, just before dpkg continues the + installation and removes the links! +

+ + + + The shlibs File Format + + +

+ This file is for use by dpkg-shlibdeps and is + required when your package provides shared libraries. +

+ +

+ Each line is of the form: + + library-name version-or-soname dependencies ... + +

+ +

+ library-name is the name of the shared library, + for example libc5. +

+ +

+ version-or-soname is the soname of the library - + i.e., the thing that must exactly match for the library to be + recognized by ld.so. Usually this is major + version number of the library. +

+ +

+ dependencies has the same syntax as a dependency + field in a binary package control file. It should give + details of which package(s) are required to satisfy a binary + built against the version of the library contained in the + package. See . +

+ +

+ For example, if the package foo contains + libfoo.so.1.2.3, where the soname of the library is + libfoo.so.1, and the first version of the package + which contained a minor number of at least 2.3 was + 1.2.3-1, then the package's shlibs + could say: + + libfoo 1 foo (>= 1.2.3-1) + +

+ +

+ The version-specific dependency is to avoid warnings from + ld.so about using older shared libraries with + newer binaries.

+
+ + Further Technical information on + shlibs + + + + + What are the shlibs files? + + +

+ The debian/shlibs file provides a way of checking + for shared library dependencies on packaged binaries. + They are intended to be used by package maintainers to + make their lives easier. +

+ +

+ Other shlibs files that exist on a Debian system are + +

/etc/dpkg/shlibs.default

+

/etc/dpkg/shlibs.override

+

/var/lib/dpkg/info/*.shlibs

+

debian/shlibs.local

+ + These files are used by dpkg-shlibdeps when + creating a binary package.

+
+ + How does dpkg-shlibdeps + work? + +

+ dpkg-shlibdeps + determines the shared libraries directly + +

+ Currently, it calls ldd, but in a + forthcoming version it shall call objdump + to to this. This however changes will need a couple of + changes in the way that packages are build. +

- In the past, people specified 4 digits in the - Standards-Version field, like `2.3.0.0'. Since any - `patch-level changes' don't introduce new policy, it - was thought it would be better to relax policy and - only require that the first 3 digits are specified. (4 - digits may still be used if someone wants to do so.) + Suppose a binary foo directly use a library + libbar if it is linked with that + library. Other libraries that are needed by + libbar are linked indirectly to foo, + and the dynamic linker will load the automatically + when it loads libbar. Using ldd + lists all the libraries, used directly and indirectly; + but objdump only lists the directly + linked libraries. A package only needs to depend on + the libraries it is directly linked to, since the + dependencies for those libraries should automatically + pull in the other libraries.

+ +

+ This change does mean a change in the way packages are + build though: currently dpkg-shlibdeps is only run on + binaries. But since we will now depend on the + libraries to depend on the libraries they need the + packages containing those libraries will need to run + dpkg-shlibdeps on the libraries.

- +

+ A good example where this would help us is the current + mess with multiple version of the mesa library. With + the ldd-based system every package that uses mesa need + to add a dependency on svgalib|svgalib-dummy in order + to handle the glide mesa variant. With an + objdump-based system this isn't necessary anymore and + would have saved everyone a lot of work. +

+

+ Another example: we could update libimlib with a new + version that supports a new graphics format called + dgf. If we use the old ldd method every package that + uses libimlib would need to be recompiled so it would + also depend on libdgf or it wouldn't run due to + missing symbols. However with the new system packages + using libimlib can depend on libimlib itself having + the dependency on libgdh and wouldn't need to be + updated. +

+ + used by the compiled binaries (and libraries, in a version + of dpkg-shlibdeps coming soon) passed through + on its command line.

- -

- You should regularly, and especially if your package has - become out of date, check for the newest Policy Manual - available and update your package, if necessary. When your - package complies with the new standards you should update the - Standards-Version source package field and - release it.

- - - - Package relationships - -

- Source packages should specify which binary packages they - require to be installed or not to be installed in order to - build correctly. For example, if building a package - requires a certain compiler, then the compiler should be - specified as a build-time dependency. -

- -

- It is not be necessary to explicitly specify build-time - relationships on a minimal set of packages that are always - needed to compile, link and put in a Debian package a - standard "Hello World!" program written in C or C++. The - required packages are called build-essential, and - an informational list can be found in - /usr/share/doc/build-essential/list (which is - contained in the build-essential package). -

- -

- When specifying the set of build-time dependencies, one - should list only those packages explicitly required by the - build. It is not necessary to list packages which are - required merely because some other package in the list of - build-time dependencies depends on them. The reason is - that dependencies change, and you should list only those - you need. What others need is their business. -

- -

- If build-time dependencies are specified, it must be - possible to build the package and produce working binaries - on a system with the build-essential packages installed - and satisfying the build-time relationships (including any - implied relationships). This - means in particular that version clauses should be used - rigorously in build-time relationships so that one cannot - produce bad or inconsistently configured packages when the - relationships are properly satisfied. -

- - - Changes to the upstream sources - -

- If changes to the source code are made that are generally - applicable, they should be sent to the upstream authors - in whatever form they prefer so as to be included in the - upstream version of the package.

- -

- If you need to configure the package differently for - Debian or for Linux, and the upstream source doesn't - provide a way to configure it the way you need to, you - should add such configuration facilities (for example, a new - autoconf test or #define) and send - the patch to the upstream authors, with the default set to - the way they originally had it. You can then easily - override the default in your debian/rules or - wherever is appropriate.

- -

- You should make sure that the configure utility - detects the correct architecture specification string - (refer to for details).

- -

- If you need to edit a Makefile where - GNU-style configure scripts are used, you - should edit the .in files rather than editing the - Makefile directly. This allows the user to - reconfigure the package if necessary. You should - not configure the package and edit the generated - Makefile! This makes it impossible for - someone else to later reconfigure the package.

- - - - Documenting your changes - -

- You should document your changes and updates to the source - package properly in the debian/changelog file. (Note - that mistakes in changelogs are usually best rectified by - making a new changelog entry rather than "rewriting history" - by editing old changelog entries)

- -

- A copy of the file which will be installed in - /usr/share/doc/package/copyright should be - in debian/copyright.

- -

- In non-experimental packages you must only use a format for - debian/changelog which is supported by the most - recent released version of dpkg. If your - format is not supported and there is general support for - it you should contact the dpkg maintainer to - have the parser script for your format included in the - dpkg package. (You will need to agree that - the parser and its manpage may be distributed under the - GNU GPL, just as the rest of dpkg - is.)

- - - - Error trapping in makefiles - -

- When make invokes a command in a makefile - (including your package's upstream makefiles and the - debian/rules) it does so using sh. This - means that sh's usual bad error handling - properties apply: if you include a miniature script as one - of the commands in your makefile you'll find that if you - don't do anything about it then errors are not detected - and make will blithely continue after - problems.

- -

- Every time you put more than one shell command (this - includes using a loop) in a makefile command you - must make sure that errors are trapped. For - simple compound commands, such as changing directory and - then running a program, using && rather - than semicolon as a command separator is sufficient. For - more complex commands including most loops and - conditionals you should include a separate set -e - command at the start of every makefile command that's - actually one of these miniature shell scripts.

- - - - Obsolete constructs and libraries - -

- The include file <varargs.h> is - provided to support end-users compiling very old software; - the library libtermcap is provided to support the - execution of software which has been linked against it - (either old programs or those such as Netscape which are - only available in binary form).

- + +

+ For each shared library, dpkg-shlibdeps needs to know + +

the package containing the library, and

+

the library version number,

+ +

+ it scans the following files in this order. + +

debian/shlibs.local

+

/etc/dpkg/shlibs.override

+

/var/lib/dpkg/info/*.shlibs

+

/etc/dpkg/shlibs.default

+

+
+ + Who maintains the various + shlibs files? + + +

+ + +

/etc/dpkg/shlibs.default - the maintainer + of dpkg

+ + +

+ /var/lib/dpkg/info/package.shlibs + - the maintainer of each package

+
+ +

+ /etc/dpkg/shlibs.override - the local + system administrator

+
+ +

debian/shlibs.local - the maintainer of + the package +

+
+ + The shlibs.default file is managed by + dpkg. The entries in shlibs.default + that are provided by dpkg are just there to + fix things until the shared library packages all have + shlibs files. +

+
+ + How to use dpkg-shlibdeps and + the shlibs files? + + + If your package doesn't provide a shared + library + + +

+ Put a call to dpkg-shlibdeps into your + debian/rules file. If your package contains + only binaries (e.g. no scripts) use: + + dpkg-shlibdeps debian/tmp/usr/bin/* debian/tmp/usr/sbin/* + + If dpkg-shlibdeps doesn't complain, you're + done. If it does complain you might need to create your + own debian/shlibs.local file.

+
+ + If your package provides a shared library + + +

+ Create a debian/shlibs file and let + debian/rules install it in the control area: + + install -m644 debian/shlibs debian/tmp/DEBIAN + + If your package contains additional binaries see above. +

+
+
+ + How to write + debian/shlibs.local + + +

+ This file is intended only as a temporary fix if + your binaries depend on a library which doesn't provide + its own /var/lib/dpkg/info/*.shlibs file yet. +

+ +

+ Let's assume you are packaging a binary foo. Your + output in building the package might look like this. + + $ ldd foo + libbar.so.1 => /usr/X11R6/lib/libbar.so.1.0 + libc.so.5 => /lib/libc.so.5.2.18 + libX11.so.6 => /usr/X11R6/lib/libX11.so.6.0 + + And when you ran dpkg-shlibdeps + + $ dpkg-shlibdeps -o foo + dpkg-shlibdeps: warning: unable to find dependency information + for shared library libbar + (soname 1, path /usr/X11R6/lib/libbar.so.1.0, dependency field Depends) + shlibs:Depends=elf-x11r6lib, libc5 (>= 5.2.18) + + The foo binary depends on the + libbar shared library, but no package seems + to provide a *.shlibs file in + var/lib/dpkg/info/. Let's determine the package + responsible: +

+

- Debian packages should be ported to include - <stdarg.h> and ncurses when - they are built.

+ + $ dpkg -S /usr/X11R6/lib/libbar.so.1.0 + bar1: /usr/X11R6/lib/libbar.so.1.0 + $ dpkg -s bar1 | grep Version + Version: 1.0-1 + + This tells us that the bar1 package, version + 1.0-1 is the one we are using. Now we can create our own + debian/shlibs.local to temporarily fix the above + problem. Include the following line into your + debian/shlibs.local file. + + libbar 1 bar1 (>= 1.0-1) + + Now your package build should work. As soon as the + maintainer of libbar1 provides a + shlibs file, you can remove your + debian/shlibs.local file. +

-
- + +
+ The Operating System - + File system hierarchy - + Linux File system Structure - +

The location of all installed files and directories must comply with the Linux File system Hierarchy Standard (FHS). The latest version of this document can be found alongside this manual or on - . -

The Debian distribution currently distributes a draft - version of FHS 2.1 because several significant details - have changed between the currently released 2.0 - version and the to-be-released 2.1 version.

- + . Specific questions about following the standard may be asked on debian-devel, or referred to Daniel Quinlan, the FHS coordinator, at quinlan@pathname.com.

- - + + Site-specific programs - +

As mandated by the FHS, packages must not place any files in /usr/local, either by putting them in the file system archive to be unpacked by dpkg or by manipulating them in their maintainer scripts.

- +

However, the package may create empty directories below /usr/local so that the system administrator knows where to place site-specific files. These directories should be removed on package removal if they are empty.

- +

Note, that this applies only to directories below /usr/local, not in /usr/local. Packages must not create sub-directories in the directory /usr/local itself, except those listed in - FHS, section 4.6. However, you may create directories + FHS, section 4.5. However, you may create directories below them as you wish. You must not remove any of the - directories listed in 4.6, even if you created them.

- + directories listed in 4.5, even if you created them.

+

Since /usr/local can be mounted read-only from a remote server, these directories must be created and @@ -1184,7 +3727,7 @@ included in the .deb packages and system administrators who do not wish these directories in /usr/local do not need to have them.)

- +

For example, the emacs package will contain @@ -1197,7 +3740,7 @@ true in the prerm script.

- +

If you do create a directory in /usr/local for local additions to a package, you should ensure that @@ -1209,7 +3752,7 @@ exclusive use of the local administrator, a package must not rely on the presence or absence of files or directories in '/usr/local' for normal operation.

- +

The /usr/local directory itself and all the subdirectories created by the package should (by default) have @@ -1217,14 +3760,14 @@ owned by root.staff.

- + Users and groups - +

The Debian system can be configured to use either plain or shadow passwords.

- +

Some user ids (UIDs) and group ids (GIDs) are reserved globally for use by certain packages. Because some packages @@ -1235,17 +3778,17 @@ we should avoid getting in the way of local administration policies. In particular, many sites allocate users and/or local system groups starting at 100.

- +

Apart from this we should have dynamically allocated ids, which should by default be arranged in some sensible order--but the behavior should be configurable.

- +

Packages other than base-passwd must not modify /etc/passwd, /etc/shadow, /etc/group or /etc/gshadow.

- +

The UID and GID ranges are as follows: @@ -1258,14 +3801,14 @@ Debian systems, new ids in this range being added automatically as the base-passwd package is updated.

- +

Packages which need a single statically allocated uid or gid should use one of these; their maintainers should ask the base-passwd maintainer for ids.

- + 100-999:

@@ -1277,8 +3820,8 @@ will check for the existence of the user or group, and if necessary choose an unused id based on the ranged specified in adduser.conf.

- - + + 1000-29999:

@@ -1288,12 +3831,12 @@ adduser.conf may be used to modify this behavior.

- + 30000-59999:

Reserved.

- - + + 60000-64999:

@@ -1301,7 +3844,7 @@ created on demand. The ids are allocated centrally and statically, but the actual accounts are only created on users' systems on demand.

- +

These ids are for packages which are obscure or which require many statically-allocated ids. These packages @@ -1312,18 +3855,18 @@ further allocations should have a `hole' left after them in the allocation, to give them room to grow.

- - + + 65000-65533:

Reserved.

- - + + 65534:

User `nobody.'

- - + + 65535:

@@ -1335,16 +3878,16 @@ System run levels - + Introduction - +

The /etc/init.d directory contains the scripts executed by init at boot time and when init state (or `runlevel') is changed (see ).

+ section="8">).

There are at least two different, yet functionally @@ -1366,7 +3909,7 @@ directory /etc/rcn.d for the scripts it should execute, where n is the runlevel that is being changed to, or `S' for the boot-up scripts.

- +

The names of the links all have the form Smmscript or @@ -1374,7 +3917,7 @@ mm is a two-digit number and script is the name of the script (this should be the same as the name of the actual script in /etc/init.d.

- +

When init changes runlevel first the targets of the links whose names starting with a K are @@ -1384,7 +3927,7 @@ links are responsible for killing services and the S link for starting services upon entering the runlevel.

- +

For example, if we are changing from runlevel 2 to runlevel 3, init will first execute all of the K @@ -1393,7 +3936,7 @@ starting with K will cause the referred-to file to be executed with an argument of stop, and the S links with an argument of start.

- +

The two-digit number mm is used to decide which order to start and stop things in--low-numbered links have @@ -1412,10 +3955,10 @@

- + Writing the scripts - +

Packages that include daemons for system services should place scripts in /etc/init.d to start or stop @@ -1427,20 +3970,20 @@ start

start the service,

- + stop

stop the service,

- + restart

stop and restart the service,

- + reload

cause the configuration of the service to be reloaded without actually stopping and restarting the service,

- + force-reload

cause the - configuration to be reloaded if the service supports + configuration to be reloaded if the service supports this, otherwise restart the service.

@@ -1448,7 +3991,7 @@ force-reload options should be supported by all scripts in /etc/init.d, the reload option is optional.

- +

The init.d scripts should ensure that they will behave sensibly if invoked with start when the @@ -1456,14 +3999,14 @@ isn't, and that they don't kill unfortunately-named user processes. The best way to achieve this is usually to use start-stop-daemon.

- +

If a service reloads its configuration automatically (as in the case of cron, for example), the reload option of the init.d script should behave as if the configuration has been reloaded successfully.

- +

These scripts should not fail obscurely when the configuration files remain but the package has been @@ -1477,13 +4020,13 @@ should include a test statement at the top of the script, like this: - test -f program-executed-later-in-script || exit 0 + test -f program-executed-later-in-script || exit 0

- + Managing the links - +

The program update-rc.d is provided to make it easier for package maintainers to arrange for the @@ -1492,7 +4035,7 @@ functional equivalent if another method is being used. This may be used by maintainers in their packages' postinst and postrm scripts.

- +

You must use this script to make changes to /etc/rcn.d and never either @@ -1501,7 +4044,7 @@ symbolic links in maintainer scripts. (The latter will fail if an alternative method of maintaining runlevel information is being used.)

- +

By default update-rc.d will start services in each of the multi-user state runlevels (2, 3, 4, and 5) @@ -1513,7 +4056,7 @@ /etc/rcn.d if symbolic links are being used, or by modifying /etc/runlevel.conf if the file-rc method is being used.

- +

To get the default behavior for your package, put in your postinst script @@ -1526,7 +4069,7 @@ update-rc.d package remove >/dev/null fi

- +

This will use a default sequence number of 20. If it does not matter when or in which order the script is run, use @@ -1534,16 +4077,16 @@ maintainer of the sysvinit package or post to debian-devel, and they will help you choose a number.

- +

For more information about using update-rc.d, please consult its manpage .

- - + section="8">.

+ + Boot-time initialization - +

There used to be another directory, /etc/rc.boot, which contained scripts which were run once per machine @@ -1554,19 +4097,19 @@ Notes - +

Do not include the /etc/rcn.d/* symbolic links in the .deb file system archive! This will cause - problems! You must create them with + problems! You must create them with update-rc.d, as above.

- +

Do not include the /etc/rcn.d/* symbolic links in dpkg's conffiles list! This will cause - problems! You should, however, treat the + problems! You should, however, treat the /etc/init.d scripts as configuration files, either by marking them as conffiles or managing them correctly in the maintainer scripts (see @@ -1578,10 +4121,10 @@ service--while making sure her changes aren't lost during the next package upgrade.)

- + Example - +

The bind DNS (nameserver) package wants to make sure that the nameserver is running in multiuser @@ -1593,7 +4136,7 @@ configuration); this way the user can say /etc/init.d/bind reload to reload the name server.

- +

#!/bin/sh @@ -1636,11 +4179,11 @@ exit 0

- +

Another example on which to base your /etc/init.d scripts is in /etc/init.d/skeleton.

- +

If this package is happy with the default setup from update-rc.d, namely an ordering number of 20 @@ -1657,15 +4200,15 @@ fi

- + Cron jobs - +

Packages must not modify the configuration file /etc/crontab, and they must not modify the files in /var/spool/cron/crontabs.

- +

If a package wants to install a job that has to be executed via cron, it should place a file with the name if the @@ -1708,32 +4251,32 @@ Console messages - +

This section describes different formats for messages written to standard output by the /etc/init.d scripts. The intent is to improve the consistency of Debian's startup and shutdown look and feel.

- +

Please look very careful at the details. We want to get the messages to look exactly the same way concerning spaces, punctuation, and case of letters.

- +

Here is a list of overall rules that you should use when you create output messages. They can be useful if you have a non-standard message that isn't covered in the sections below.

- +

Every message should cover one line, start with a capital letter and end with a period `.'.

- - + +

If you want to express that the computer is working on @@ -1742,8 +4285,8 @@ three dots `...'. Note that we don't insert spaces in front of or behind the dots. If the task has been completed we write `done.' and a line feed.

- - + +

Design your messages as if the computer is telling you @@ -1758,15 +4301,15 @@ Starting network daemons: nfsd mountd.

- +

The following formats should be used

- +

when daemons get started.

- +

Use this format if your script starts one or more daemons. The output should look like this (a single @@ -1779,13 +4322,13 @@ <daemon-1> up to <daemon-n> denote each daemon's name (typically the file name of the program).

- +

For example, the output of /etc/init.d/lpd would look like: Starting printer spooler: lpd.

- +

This can be achieved by saying @@ -1809,45 +4352,45 @@ comment out a line if he don't wants to start a specific daemon, while the displayed message still looks good.

- - + +

when something needs to be configured.

- +

If you have to set up different parameters of the system upon boot up, you should use this format: Setting <parameter> to `<value>'.

- +

You can use the following echo statement to get the quotes right: echo "Setting DNS domainname to \`"value"'."

- +

Note that the left quotation mark (`) is different from the right (').

- +

when a daemon is stopped.

- +

When you stop a daemon you should issue a message similar to the startup message, except that `Starting' is replaced with `Stopping'.

- +

So stopping the printer daemon will like like this: Stopping printer spooler: lpd.

- +

when something is executed.

- +

There are several examples where you have to run a program at system startup or shutdown to perform a @@ -1866,28 +4409,28 @@ echo "done." in your script.

- +

when the configuration is reloaded.

- +

When a daemon is forced to reload its configuration files you should use the following format: Reloading <daemon's-name> configuration...done.

- +

when none of the above rules apply.

- +

If you have to print a message that doesn't fit into the styles described above, you can use something appropriate, but please have a look at the overall rules listed above.

- - + + Menus @@ -1905,7 +4448,7 @@ documents, and menu programs (either X window managers or text-based menu programs as pdmenu).

- +

All packages that provide applications that need not be passed any special command line arguments for normal @@ -1913,15 +4456,15 @@ applications, so that users of the menu package will automatically get menu entries in their window managers, as well in shells like pdmenu.

- +

Please refer to the Debian Menu System document that comes with the menu package for information about how to register your applications and web documents.

- - + + Multimedia handlers @@ -1952,23 +4495,23 @@ Keyboard configuration - +

To achieve a consistent keyboard configuration (i.e., all applications interpret a keyboard event the same way) all programs in the Debian distribution must be configured to comply with the following guidelines.

- +

Here is a list that contains certain keys and their interpretation: <--

delete the character to the left of the cursor

- + Delete

delete the character to the right of the cursor

- + Control+H

emacs: the help prefix

@@ -1976,18 +4519,18 @@ The interpretation of any keyboard events should be independent of the terminal that's used, be it a virtual console, an X terminal emulator, an rlogin/telnet session, etc.

- +

The following list explains how the different programs should be set up to achieve this:

- +

`<--' generates KB_Backspace in X.

- +

`Delete' generates KB_Delete in X.

- +

X translations are set up to make KB_Backspace @@ -1998,42 +4541,42 @@ displays, not using the application defaults, so that the translation resources used correspond to the xmodmap settings.

- +

The Linux console is configured to make `<--' generate DEL, and `Delete' generate ESC [ 3 ~ (this is the case at the moment).

- +

X applications are configured so that Backspace deletes left, and Delete deletes right. Motif applications already work like this.

- +

stty erase ^? .

- +

The `xterm' terminfo entry should have ESC [ 3 - ~ for kdch1, just like TERM=linux and + ~ for kdch1, just like TERM=linux and TERM=vt220.

- +

Emacs is programmed to map KB_Backspace or the `stty erase' character to delete-backward-char, and KB_Delete or kdch1 to delete-forward-char, and ^H to help as always.

- +

Other applications use the `stty erase' character and kdch1 for the two delete keys, with ASCII DEL being `delete previous character' and kdch1 being `delete character under cursor'.

- +

This will solve the problem except for:

- +

@@ -2044,7 +4587,7 @@ takes precedence in Emacs, and has been set correctly). M-x help or F1 (if available) can be used instead.

- +

Some operating systems use ^H for stty erase. However, modern telnet versions and all rlogin @@ -2052,7 +4595,7 @@ versions honour stty erase. Where the stty settings are not propagated correctly things can be made to work by using stty manually.

- +

Some systems (including previous Debian versions) use xmodmap to arrange for both <-- and Delete @@ -2063,7 +4606,7 @@ other way around. On displays configured like this Delete will not work, but <-- will.

- +

Some operating systems have different kdch1 settings in their terminfo for xterm and others. On these @@ -2073,18 +4616,18 @@

- - + + Environment variables - +

A program must not depend on environment variables to get reasonable defaults. (That's because these environment variables would have to be set in a system-wide configuration file like /etc/profile, which is not supported by all shells.)

- +

If a program usually depends on environment variables for its configuration, the program should be changed to fall back to @@ -2094,7 +4637,7 @@ available), the program must be replaced by a small `wrapper' shell script which sets the environment variables if they are not already defined, and calls the original program.

- +

Here is an example of a wrapper script for this purpose: @@ -2104,7 +4647,7 @@ export BAR exec /usr/lib/foo/foo "$@"

- +

Furthermore, as /etc/profile is a configuration file of the base-files package, other packages must not @@ -2152,7 +4695,7 @@ The -N flag should not be used. On a.out systems it may have been useful for some very small binaries, but for ELF it has no good effect.

- +

Debugging symbols are useful for error diagnosis, investigation of core dumps (which may be submitted by users @@ -2203,62 +4746,62 @@

- - CFLAGS = -O2 -Wall - INSTALL = install - - ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) - CFLAGS += -g - endif - ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) - INSTALL += -s - endif -

- -

- It is up to the package maintainer to decide what - compilation options are best for the package. Certain - binaries (such as computationally-intensive programs) will - function better with certain flags (-O3, for - example); feel free to use them. Please use good judgment - here. Don't use flags for the sake of it; only use them - if there is good reason to do so. Feel free to override - the upstream author's ideas about which compilation - options are best--they are often inappropriate for our - environment.

- - - - Libraries - -

- All libraries must have a shared version in the lib - package and a static version in the lib-dev package. The - shared version must be compiled with -fPIC, and - the static version must not be. In other words, each - *.c file will need to be compiled twice.

- -

- You must specify the gcc option -D_REENTRANT - when building a library (either static or shared) to make - the library compatible with LinuxThreads.

- -

- Note that all installed shared libraries should be - stripped with - - strip --strip-unneeded <your-lib> - - (The option `--strip-unneeded' makes strip remove - only the symbols which aren't needed for relocation - processing.) Shared libraries can function perfectly well - when stripped, since the symbols for dynamic linking are - in a separate part of the ELF object file.

- -

- Note that under some circumstances it may be useful to - install a shared library unstripped, for example when - building a separate package to support debugging. + + CFLAGS = -O2 -Wall + INSTALL = install + + ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) + CFLAGS += -g + endif + ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) + INSTALL += -s + endif +

+ +

+ It is up to the package maintainer to decide what + compilation options are best for the package. Certain + binaries (such as computationally-intensive programs) will + function better with certain flags (-O3, for + example); feel free to use them. Please use good judgment + here. Don't use flags for the sake of it; only use them + if there is good reason to do so. Feel free to override + the upstream author's ideas about which compilation + options are best--they are often inappropriate for our + environment.

+ + + + Libraries + +

+ All libraries must have a shared version in the lib + package and a static version in the lib-dev package. The + shared version must be compiled with -fPIC, and + the static version must not be. In other words, each + *.c file will need to be compiled twice.

+ +

+ You must specify the gcc option -D_REENTRANT + when building a library (either static or shared) to make + the library compatible with LinuxThreads.

+ +

+ Note that all installed shared libraries should be + stripped with + + strip --strip-unneeded <your-lib> + + (The option `--strip-unneeded' makes strip remove + only the symbols which aren't needed for relocation + processing.) Shared libraries can function perfectly well + when stripped, since the symbols for dynamic linking are + in a separate part of the ELF object file.

+ +

+ Note that under some circumstances it may be useful to + install a shared library unstripped, for example when + building a separate package to support debugging.

@@ -2305,57 +4848,57 @@ idea.

- - - - Shared libraries - -

- Packages involving shared libraries should be split up - into several binary packages.

- -

- For a straightforward library which has a development - environment and a runtime kit including just shared - libraries you need to create two packages: - librarynamesoname - (soname is the shared object name of the shared - library--it's the thing that has to match exactly between - building an executable and running it for the dynamic - linker to be able run the program; usually the - soname is the major number of the library) and - librarynamesoname-dev.

- -

- If you prefer only to support one development version at a - time you may name the development package - libraryname-dev; otherwise you may - wish to use dpkg's conflicts mechanism to - ensure that the user only installs one development version - at a time (after all, different development versions are - likely to have the same header files in them, causing a - filename clash if both are installed). Typically the - development version should also have an exact version - dependency on the runtime library, to make sure that - compilation and linking happens correctly.

- -

- Packages which use the shared library should have a - dependency on the name of the shared library package, - librarynamesoname. When - the soname changes you can have both versions - of the library installed while moving from the old library - to the new.

- + + + + Shared libraries + +

+ Packages involving shared libraries should be split up + into several binary packages.

+ +

+ For a straightforward library which has a development + environment and a runtime kit including just shared + libraries you need to create two packages: + librarynamesoname + (soname is the shared object name of the shared + library--it's the thing that has to match exactly between + building an executable and running it for the dynamic + linker to be able run the program; usually the + soname is the major number of the library) and + librarynamesoname-dev.

+ +

+ If you prefer only to support one development version at a + time you may name the development package + libraryname-dev; otherwise you may + wish to use dpkg's conflicts mechanism to + ensure that the user only installs one development version + at a time (after all, different development versions are + likely to have the same header files in them, causing a + filename clash if both are installed). Typically the + development version should also have an exact version + dependency on the runtime library, to make sure that + compilation and linking happens correctly.

+ +

+ Packages which use the shared library should have a + dependency on the name of the shared library package, + librarynamesoname. When + the soname changes you can have both versions + of the library installed while moving from the old library + to the new.

+

If your package has some run-time support programs which use the shared library you must not put them in the shared library package. If you do that then you won't - be able to install several versions of the shared library - without getting filename clashes. Instead, either create - a third package for the runtime binaries (this package - might typically be named - libraryname-runtime--note the absence + be able to install several versions of the shared library + without getting filename clashes. Instead, either create + a third package for the runtime binaries (this package + might typically be named + libraryname-runtime--note the absence of the soname in the package name) or if the development package is small include them in there.

@@ -2367,14 +4910,14 @@ clashes if you try to install different versions of the combined shared libraries package).

-

+

You should follow the directions in the Debian Packaging Manual for putting the shared library in its package, and you must include a shlibs control area file with details of the dependencies for packages which use the library.

-

+

Shared libraries should not be installed executable, since ld.so does not require this and trying to execute a shared library results in a core @@ -2390,7 +4933,7 @@ should have a #! line naming the shell to be used to interpret them.

-

+

In the case of Perl scripts this should be #!/usr/bin/perl.

@@ -2400,7 +4943,7 @@ errors are detected. Every script should use set -e or check the exit status of every command.

- +

The standard shell interpreter `/bin/sh' can be a symbolic link to any POSIX compatible shell, if echo @@ -2454,89 +4997,89 @@ c-shell virtual package.

- Any scripts which create files in world-writeable - directories (e.g., in /tmp) must use a - mechanism which will fail if a file with the same name - already exists.

+ Any scripts which create files in world-writeable + directories (e.g., in /tmp) must use a + mechanism which will fail if a file with the same name + already exists.

+ +

+ The Debian base distribution provides the + tempfile and mktemp utilities + for use by scripts for this purpose.

+ + + + Symbolic links + +

+ In general, symbolic links within a top-level directory + should be relative, and symbolic links pointing from one + top-level directory into another should be absolute. (A + top-level directory is a sub-directory of the root + directory `/'.)

+ +

+ In addition, symbolic links should be specified as short + as possible, i.e., link targets like `foo/../bar' are + deprecated.

+ +

+ Note that when creating a relative link using + ln it is not necessary for the target of the + link to exist relative to the working directory you're + running ln from; nor is it necessary to + change directory to the directory where the link is to be + made. Simply include the string that should appear as the + target of the link (this will be a pathname relative to + the directory in which the link resides) as the first + argument to ln.

-

- The Debian base distribution provides the - tempfile and mktemp utilities - for use by scripts for this purpose.

+

+ For example, in your Makefile or + debian/rules, do things like: + + ln -fs gcc $(prefix)/bin/cc + ln -fs gcc debian/tmp/usr/bin/cc + ln -fs ../sbin/sendmail $(prefix)/bin/runq + ln -fs ../sbin/sendmail debian/tmp/usr/bin/runq +

+ +

+ A symbolic link pointing to a compressed file should + always have the same file extension as the referenced + file. (For example, if a file `foo.gz' is + referenced by a symbolic link, the filename of the link + has to end with `.gz' too, as in + `bar.gz.')

- - Symbolic links - -

- In general, symbolic links within a top-level directory - should be relative, and symbolic links pointing from one - top-level directory into another should be absolute. (A - top-level directory is a sub-directory of the root - directory `/'.)

- -

- In addition, symbolic links should be specified as short - as possible, i.e., link targets like `foo/../bar' are - deprecated.

- -

- Note that when creating a relative link using - ln it is not necessary for the target of the - link to exist relative to the working directory you're - running ln from; nor is it necessary to - change directory to the directory where the link is to be - made. Simply include the string that should appear as the - target of the link (this will be a pathname relative to - the directory in which the link resides) as the first - argument to ln.

- -

- For example, in your Makefile or - debian/rules, do things like: - - ln -fs gcc $(prefix)/bin/cc - ln -fs gcc debian/tmp/usr/bin/cc - ln -fs ../sbin/sendmail $(prefix)/bin/runq - ln -fs ../sbin/sendmail debian/tmp/usr/bin/runq -

- -

- A symbolic link pointing to a compressed file should - always have the same file extension as the referenced - file. (For example, if a file `foo.gz' is - referenced by a symbolic link, the filename of the link - has to end with `.gz' too, as in - `bar.gz.')

- - - - Device files - -

- Packages must not include device files in the package file - tree.

- -

- If a package needs any special device files that are not - included in the base system, it must call - makedev in the postinst script, - after asking the user for permission to do so.

- -

- Packages must not remove any device files in the - postrm or any other script. This is left to the - system administrator.

- -

- Debian uses the serial devices - /dev/ttyS*. Programs using the old - /dev/cu* devices should be changed to use - /dev/ttyS*.

+ + Device files + +

+ Packages must not include device files in the package file + tree.

+ +

+ If a package needs any special device files that are not + included in the base system, it must call + makedev in the postinst script, + after asking the user for permission to do so.

+ +

+ Packages must not remove any device files in the + postrm or any other script. This is left to the + system administrator.

+ +

+ Debian uses the serial devices + /dev/ttyS*. Programs using the old + /dev/cu* devices should be changed to use + /dev/ttyS*.

- + - Configuration files + Configuration files Definitions

@@ -2818,14 +5361,14 @@ file (for more information see ): - /var/log/foo/* { - rotate 12 - weekly - compress - postrotate - /etc/init.d/foo force-reload - endscript - } + /var/log/foo/* { + rotate 12 + weekly + compress + postrotate + /etc/init.d/foo force-reload + endscript + } Which rotates all files under `/var/log/foo', saves 12 compressed generations, and sends a HUP signal at the end of @@ -2837,118 +5380,118 @@ Log files should be removed when the package is purged (but not when it is only removed), by checking the argument to the postrm script (see the Debian - Packaging Manual for details).

+ Packaging Manual for details).

+
+ + + + Permissions and owners + +

+ The rules in this section are guidelines for general use. + If necessary you may deviate from the details below. + However, if you do so you must make sure that what is done + is secure and you should try to be as consistent as possible + with the rest of the system. You should probably also + discuss it on debian-devel first.

+ +

+ Files should be owned by root.root, and made + writable only by the owner and universally readable (and + executable, if appropriate).

+ +

+ Directories should be mode 755 or (for group-writability) + mode 2775. The ownership of the directory should be + consistent with its mode--if a directory is mode 2775, it + should be owned by the group that needs write access to + it.

+ +

+ Setuid and setgid executables should be mode 4755 or 2755 + respectively, and owned by the appropriate user or group. + They should not be made unreadable (modes like 4711 or + 2711 or even 4111); doing so achieves no extra security, + because anyone can find the binary in the freely available + Debian package--it is merely inconvenient. For the same + reason you should not restrict read or execute permissions + on non-set-id executables.

+ +

+ Some setuid programs need to be restricted to particular + sets of users, using file permissions. In this case they + should be owned by the uid to which they are set-id, and + by the group which should be allowed to execute them. + They should have mode 4754; there is no point in making + them unreadable to those users who must not be allowed to + execute them.

+ +

+ You must not arrange that the system administrator can only + reconfigure the package to correspond to their local + security policy by changing the permissions on a binary. + Ordinary files installed by dpkg (as opposed + to conffiles and other similar objects) have their + permissions reset to the distributed permissions when the + package is reinstalled. Instead you should consider (for + example) creating a group for people allowed to use the + program(s) and making any setuid executables executable + only by that group.

+ +

+ If you need to create a new user or group for your package + there are two possibilities. Firstly, you may need to + make some files in the binary package be owned by this + user or group, or you may need to compile the user or + group id (rather than just the name) into the binary + (though this latter should be avoided if possible, as in + this case you need a statically allocated id).

+ +

+ If you need a statically allocated id, you must ask for a + user or group id from the base system + maintainer, and must not release the package until you + have been allocated one. Once you have been allocated one + you must make the package depend on a version of the base + system with the id present in /etc/passwd or + /etc/group, or alternatively arrange for your + package to create the user or group itself with the + correct id (using adduser) in its pre- or + post-installation script (the latter is to be preferred if + it is possible).

+ +

+ On the other hand, the program might be able to determine the + uid or gid from the group name at runtime, so that a + dynamic id can be used. In this case you should choose an + appropriate user or group name, discussing this on + debian-devel and checking with the base + system maintainer that it is unique and that they do not + wish you to use a statically allocated id instead. When + this has been checked you must arrange for your package to + create the user or group if necessary using + adduser in the pre- or post-installation + script (again, the latter is to be preferred if it is + possible).

+ +

+ Note that changing the numeric value of an id associated with a name + is very difficult, and involves searching the file system for all + appropriate files. You need to think carefully whether a static or + dynamic id is required, since changing your mind later will cause + problems.

- - - - Permissions and owners - -

- The rules in this section are guidelines for general use. - If necessary you may deviate from the details below. - However, if you do so you must make sure that what is done - is secure and you should try to be as consistent as possible - with the rest of the system. You should probably also - discuss it on debian-devel first.

- -

- Files should be owned by root.root, and made - writable only by the owner and universally readable (and - executable, if appropriate).

- -

- Directories should be mode 755 or (for group-writability) - mode 2775. The ownership of the directory should be - consistent with its mode--if a directory is mode 2775, it - should be owned by the group that needs write access to - it.

- -

- Setuid and setgid executables should be mode 4755 or 2755 - respectively, and owned by the appropriate user or group. - They should not be made unreadable (modes like 4711 or - 2711 or even 4111); doing so achieves no extra security, - because anyone can find the binary in the freely available - Debian package--it is merely inconvenient. For the same - reason you should not restrict read or execute permissions - on non-set-id executables.

- -

- Some setuid programs need to be restricted to particular - sets of users, using file permissions. In this case they - should be owned by the uid to which they are set-id, and - by the group which should be allowed to execute them. - They should have mode 4754; there is no point in making - them unreadable to those users who must not be allowed to - execute them.

- -

- You must not arrange that the system administrator can only - reconfigure the package to correspond to their local - security policy by changing the permissions on a binary. - Ordinary files installed by dpkg (as opposed - to conffiles and other similar objects) have their - permissions reset to the distributed permissions when the - package is reinstalled. Instead you should consider (for - example) creating a group for people allowed to use the - program(s) and making any setuid executables executable - only by that group.

- -

- If you need to create a new user or group for your package - there are two possibilities. Firstly, you may need to - make some files in the binary package be owned by this - user or group, or you may need to compile the user or - group id (rather than just the name) into the binary - (though this latter should be avoided if possible, as in - this case you need a statically allocated id).

- -

- If you need a statically allocated id, you must ask for a - user or group id from the base system - maintainer, and must not release the package until you - have been allocated one. Once you have been allocated one - you must make the package depend on a version of the base - system with the id present in /etc/passwd or - /etc/group, or alternatively arrange for your - package to create the user or group itself with the - correct id (using adduser) in its pre- or - post-installation script (the latter is to be preferred if - it is possible).

- -

- On the other hand, the program might be able to determine the - uid or gid from the group name at runtime, so that a - dynamic id can be used. In this case you should choose an - appropriate user or group name, discussing this on - debian-devel and checking with the base - system maintainer that it is unique and that they do not - wish you to use a statically allocated id instead. When - this has been checked you must arrange for your package to - create the user or group if necessary using - adduser in the pre- or post-installation - script (again, the latter is to be preferred if it is - possible).

- -

- Note that changing the numeric value of an id associated with a name - is very difficult, and involves searching the file system for all - appropriate files. You need to think carefully whether a static or - dynamic id is required, since changing your mind later will cause - problems.

-
Customized programs - + Architecture specification strings - +

If a program needs to specify an architecture specification - string in some place, the following format should be used: + string in some place, the following format should be used: <arch>-<os> @@ -2963,30 +5506,30 @@ distributions. Also note, that we don't use `<arch>-unknown-linux', since the `unknown' does not look very good.

- - + + Daemons - +

The configuration files /etc/services, /etc/protocols, and /etc/rpc are managed by the netbase package and may not be modified by other packages.

- +

If a package requires a new entry in one of these files, the maintainer should get in contact with the netbase maintainer, who will add the entries and release a new version of the netbase package.

- +

The configuration file /etc/inetd.conf must not be modified by the package's scripts except via the update-inetd script or the DebianNet.pm Perl module.

- +

If a package wants to install an example entry into /etc/inetd.conf, the entry must be preceded with @@ -2994,11 +5537,11 @@ treated as `commented out by user' by the update-inetd script and are not changed or activated during a package updates.

- - + + Using pseudo-ttys and modifying wtmp, utmp and lastlog - +

Some programs need to create pseudo-ttys. This should be done using Unix98 ptys if the C library supports it. The resulting @@ -3016,7 +5559,7 @@ Editors and pagers - +

Some programs have the ability to launch an editor or pager program to edit or display a text document. Since there are @@ -3024,25 +5567,25 @@ distribution, the system administrator and each user should have the possibility to choose his/her preferred editor and pager.

- +

In addition, every program should choose a good default editor/pager if none is selected by the user or system administrator.

- +

Thus, every program that launches an editor or pager must use the EDITOR or PAGER environment variables to determine the editor/pager the user wants to get started. If these variables are not set, the programs /usr/bin/editor and /usr/bin/pager should be used, respectively.

- +

These two files are managed through `alternatives.' That is, every package providing an editor or pager must call the update-alternatives script to register these programs.

- +

If it is very hard to adapt a program to make us of the EDITOR and PAGER variables, that program may be configured @@ -3053,7 +5596,7 @@ launch the appropriate program or fall back to /usr/bin/editor and /usr/bin/pager, automatically.

- +

A program may also use the VISUAL environment variable to determine the user's choice of editor. If it exists, it @@ -3065,16 +5608,16 @@ a pager program, it is not required for a package to depend on `editor' and `pager', nor is it required for a package to provide such virtual packages.

- - + + Web servers and applications - +

This section describes the locations and URLs that should be used by all web servers and web application in the Debian system.

- +

@@ -3087,24 +5630,24 @@ http://localhost/cgi-bin/<cgi-bin-name>

- - + +

Access to html documents

- +

Html documents for a package are stored in /usr/share/doc/package but should be accessed via symlinks as /usr/doc/package for - backward compatibility, see + backward compatibility, see and can be referred to as http://localhost/doc/<package>/<filename>

- - + +

Web Document Root

- +

Web Applications should try to avoid storing files in the Web Document Root. Instead they should use the @@ -3120,11 +5663,11 @@

- - + + Mail transport agents - +

Debian packages which process electronic mail, whether mail-user-agents (MUAs) or mail-transport-agents (MTAs), @@ -3132,13 +5675,13 @@ configuration decisions below. Failure to do this may result in lost mail, broken From: lines, and other serious brain damage!

- +

The mail spool is /var/spool/mail and the interface to send a mail message is /usr/sbin/sendmail (as per the FHS). The mail spool is part of the base system and not part of the MTA package.

- +

All Debian MUAs, MTAs, MDAs and other mailbox accessing programs (like IMAP daemons) must lock the mailbox in an @@ -3159,20 +5702,20 @@ liblockfile version >>1.01

packages is the recommended way to realize this.

- +

Mailboxes are generally 660 user.mail unless the user has chosen otherwise. A MUA may remove a mailbox (unless it has nonstandard permissions) in which case the MTA or another MUA must recreate it if needed. Mailboxes must be writable by group mail.

- +

The mail spool is 2775 root.mail, and MUAs should be setgid mail to do the locking mentioned above (and must obviously avoid accessing other users' mailboxes using this privilege).

- +

/etc/aliases is the source file for the system mail aliases (e.g., postmaster, usenet, etc.)--it is the one @@ -3183,19 +5726,19 @@ even if it does nothing, but older MTA packages do not do this so programs should not fail if newaliases cannot be found.

- +

The convention of writing forward to - address in the mailbox itself is not + address in the mailbox itself is not supported. Use a .forward file instead.

- +

The rmail program used by UUCP - for incoming mail should be /usr/sbin/rmail, as per the - FHS. Likewise, rsmtp, for receiving + for incoming mail should be /usr/sbin/rmail. + Likewise, rsmtp, for receiving batch-SMTP-over-UUCP, should be /usr/sbin/rsmtp if it is supported.

- +

If you need to know what name to use (for example) on outgoing news and mail messages which are generated locally, @@ -3203,7 +5746,7 @@ contain the portion after the username and @ (at) sign for email addresses of users on the machine (followed by a newline).

- +

A package should check for the existence of this file. If it exists it should use it without comment. (An MTA's @@ -3223,16 +5766,16 @@ where syshostname is the output of hostname --fqdn.

- - + + News system configuration - +

All the configuration files related to the NNTP (news) servers and clients should be located under /etc/news.

- +

There are some configuration issues that apply to a number of news clients and server packages on the machine. These @@ -3243,7 +5786,7 @@

A string which should appear as the organization header for all messages posted by NNTP clients on the machine

- + /etc/news/server

Contains the FQDN of the upstream NNTP server, or localhost if the local machine is @@ -3252,11 +5795,11 @@ Other global files may be added as required for cross-package news configuration.

- - + + Programs for the X Window System - +

Programs that may be configured with support for the X Window System must be configured to do so and must declare any @@ -3289,12 +5832,12 @@

- - + +

- Packages which provide an X server that, directly or - indirectly, communicates with real input and display hardware - should declare in their control data that they provide the + Packages which provide an X server that, directly or + indirectly, communicates with real input and display hardware + should declare in their control data that they provide the virtual package xserver.

@@ -3309,7 +5852,7 @@ change this drastically.

-

+

Packages that provide a terminal emulator for the X @@ -3342,17 +5885,17 @@ (without killing the X server) in its default configuration, add 10 points; otherwise add none. - -

+ +

- Packages that provide fonts for the X Window System - must do a number of things to ensure that they are both - available without modification of the X or font server - configuration, and that they do not corrupt files used by - other font packages to register information about themselves. - - + Packages that provide fonts for the X Window System + must do a number of things to ensure that they are both + available without modification of the X or font server + configuration, and that they do not corrupt files used by + other font packages to register information about themselves. + + Fonts of any type supported by the X Window System should be be in a separate binary package from any executables, libraries, or documentation (except that @@ -3362,7 +5905,7 @@ library should declare a dependency on the package(s) containing the font(s) it requires. - + BDF fonts should be converted to PCF fonts with the bdftopcf utility (available in the xbase-clients package, gzipped, and @@ -3469,7 +6012,7 @@ Font packages that provide one or more fonts.alias files as described above must declare a versioned dependency on xbase-clients - (>= 3.3.3.1-5) and, in the package + (>= 3.3.3.1-5) and, in the package post-installation and post-removal scripts, invoke update-fonts-alias on each directory into which they installed fonts. @@ -3511,9 +6054,9 @@ administrator, as to how to manage /etc/X11/Xresources.

-

+

- +

Packages using the X Window System should abide by the FHS standard whenever possible; they should install binaries, @@ -3545,7 +6088,7 @@ /usr/X11R6/include/X11/, and /usr/X11R6/lib/X11/, if the resources being referred to have not been moved to FHS-compliant locations. -

+

Programs that require the non-DFSG-compliant OSF/Motif @@ -3570,28 +6113,28 @@ his or her possession.

- - + + Emacs lisp programs - +

Please refer to the `Debian Emacs Policy' (documented in debian-emacs-policy.gz of the emacsen-common package) for details of how to package emacs lisp programs.

- - + + Games - +

The permissions on /var/games are 755 root.root.

- +

Each game decides on its own security policy.

- +

Games which require protected, privileged access to high-score files, savegames, etc., may be made @@ -3607,7 +6150,7 @@ important game data, and if they can get at the other players' accounts at all it will take considerably more effort.)

- +

Some packages, for example some fortune cookie programs, are configured by the upstream authors to install with their @@ -3619,7 +6162,7 @@ making the files unreadable also means that you don't have to make so many programs set-id, which reduces the risk of a security hole.

- +

As described in the FHS, binaries of games should be installed in the directory /usr/games. This also @@ -3628,27 +6171,27 @@ /usr/share/man/man6.

- + Documentation - + Manual pages - +

You should install manual pages in nroff source form, in appropriate places under /usr/share/man. You should only use sections 1 to 9 (see the FHS for more details). You must not install a preformatted `cat page'.

- +

- Each program, utiltiy, and function should have an + Each program, utility, and function should have an associated manpage included in the same package. It is suggested that all configuration files also have a manual page included as well.

- +

If no manual page is available for a particular program, utility, function or configuration file and this is reported as a bug on @@ -3664,7 +6207,7 @@ reported as a bug, so you may only do this if it really has (you can report it yourself, if you like). Do not close the bug report until a proper manpage is available.

- +

You may forward a complaint about a missing manpage to the upstream authors, and mark the bug as forwarded in the @@ -3673,11 +6216,11 @@ we do--if they tell you that they don't consider it a bug you should leave the bug in our bug tracking system open anyway.

- +

Manual pages should be installed compressed using gzip - -9.

- + -9.

+

If one manpage needs to be accessible via several names it is better to use a symbolic link than the .so @@ -3689,15 +6232,15 @@ in a .so in a manpage should be relative to the base of the manpage tree (usually /usr/share/man).

- - + + Info documents - +

Info documents should be installed in /usr/share/info. They should be compressed with gzip -9.

- +

Your package should call install-info to update the Info dir @@ -3706,7 +6249,7 @@ install-info --quiet --section Development Development \ /usr/share/info/foobar.info

- +

It is a good idea to specify a section for the location of your program; this is done with the --section @@ -3717,17 +6260,17 @@ flag takes two arguments; the first is a regular expression to match (case-insensitively) against an existing section, the second is used when creating a new one.

- +

You should remove the entries in the pre-removal script: install-info --quiet --remove /usr/share/info/foobar.info

- +

If install-info cannot find a description entry in the Info file you must supply one. See for details.

+ name="install-info" section="8"> for details.

@@ -3756,44 +6299,44 @@ the instructions for building and installing the package, of course!

- + - Accessing the documentation - -

- Former Debian releases placed all additional documentation - in /usr/doc/package. To realize a - smooth migration to - /usr/share/doc/package, each package - must maintain a symlink /usr/doc/package - that points to the new location of its documentation in - /usr/share/doc/packageThese - symlinks will be removed in the future, but they have to be - there for compatibility reasons until all packages have - moved and the policy is changed accordingly.. - The symlink must be created when the package is installed; - it cannot be contained in the package itself due to problems - with dpkg. One reasonable way to accomplish - this is to put the following in the package's - postinst: + Accessing the documentation + +

+ Former Debian releases placed all additional documentation + in /usr/doc/package. To realize a + smooth migration to + /usr/share/doc/package, each package + must maintain a symlink /usr/doc/package + that points to the new location of its documentation in + /usr/share/doc/packageThese + symlinks will be removed in the future, but they have to be + there for compatibility reasons until all packages have + moved and the policy is changed accordingly.. + The symlink must be created when the package is installed; + it cannot be contained in the package itself due to problems + with dpkg. One reasonable way to accomplish + this is to put the following in the package's + postinst: - if [ "$1" = "configure" ]; then - if [ -d /usr/doc -a ! -e /usr/doc/#PACKAGE# \ + if [ "$1" = "configure" ]; then + if [ -d /usr/doc -a ! -e /usr/doc/#PACKAGE# \ -a -d /usr/share/doc/#PACKAGE# ]; then - ln -sf ../share/doc/#PACKAGE# /usr/doc/#PACKAGE# - fi - fi + ln -sf ../share/doc/#PACKAGE# /usr/doc/#PACKAGE# + fi + fi And the following in the package's prerm: - if [ \( "$1" = "upgrade" -o "$1" = "remove" \) \ - -a -L /usr/doc/#PACKAGE# ]; then - rm -f /usr/doc/#PACKAGE# - fi + if [ \( "$1" = "upgrade" -o "$1" = "remove" \) \ + -a -L /usr/doc/#PACKAGE# ]; then + rm -f /usr/doc/#PACKAGE# + fi

- + Preferred documentation formats diff --git a/upgrading-checklist.html b/upgrading-checklist.html index 84c9881..8784dbe 100644 --- a/upgrading-checklist.html +++ b/upgrading-checklist.html @@ -82,7 +82,7 @@ Manual. Packaging Manual: - Noted that newer dpkg versions do not require extreme care in - always creating theshared lib before the symlink, so the unpack + always creating the shared lib before the symlink, so the unpack order be correct. 3.1.1.0 Nov 99 @@ -155,7 +155,7 @@ Manual. - Use logrotate to rotate log files - section 5.8 has been rewritten (Programs for the X Window System) - - There is now anassi=ociated menu policy, in a separate document, + - There is now anassociated menu policy, in a separate document, that carries the full weight of Debian policy. - The files `/var/run/utmp', `/var/log/wtmp' and `/var/log/lastlog' must be installed writeable by group diff --git a/virtual-package-names-list.txt b/virtual-package-names-list.txt index 88612d9..34dde65 100644 --- a/virtual-package-names-list.txt +++ b/virtual-package-names-list.txt @@ -89,10 +89,12 @@ pdf-viewer Anything that can display PDF files postscript-preview Any preprocessor that creates Postscript output postscript-viewer Anything that can display Postscript files rsh-client Any package that provides an rsh client +rsh-server Any package that provides an rsh server system-log-daemon A daemon that provides a logging facility for other applications tclsh Anything that provides /usr/bin/tclsh (*) telent-client Any package that provides a telnet client +telent-server Any package that provides a telnet server time-daemon Anything that servers as a time daemon ups-monitor Anything that is capable of controlling an UPS wish Anything that provides /usr/bin/wish (*) @@ -187,6 +189,9 @@ Manoj Srivastava Added time-daemon Added rsh-client Added telnet-client +Manoj Srivastava + 16 January 1001 Added rsh server + Added telnet-server