X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=policy.sgml;h=28a3399c89c1ad4a1cb5335b6dca62ff6bf9a33e;hb=3ff9de8ac6937c1a9dacd50c40f1aed4a7ce2beb;hp=3bcf273d609571cce33a108561b024dbbc2ef7a7;hpb=54bd10b727e58b30ad9227f25336aa47a7c182ce;p=debian%2Fdebian-policy.git diff --git a/policy.sgml b/policy.sgml index 3bcf273..28a3399 100644 --- a/policy.sgml +++ b/policy.sgml @@ -60,6 +60,9 @@

Philip Hands phil@hands.com

+ +

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

+

Manoj Srivastava srivasta@debian.org

@@ -85,13 +88,14 @@ 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/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 + . You can also obtain it by writing to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

@@ -117,7 +121,9 @@ mechanisms involved in package creation, installation, and removal. This information can be found in the Debian Packaging Manual and the Debian System - Administrators' Manual. + 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 @@ -134,16 +140,15 @@ New versions of this document

The current version of this document is always accessible from the - Debian FTP server at - + Debian FTP server ftp.debian.org at + /debian/doc/package-developer/debian-policy.html.tar.gz or from the Debian WWW server at -

+ .

In addition, this manual is distributed via the Debian package - debian-policy + debian-policy.

@@ -380,18 +385,6 @@ non-free programs,

- -

- packages which we don't want to support because they are too - buggy, and -

-
- -

- packages which fail to meet some other policy requirements in - a serious way. -

-

@@ -502,9 +495,11 @@ Subsections

- The packages in the main, contrib, and - non-free sections are grouped further into - subsections to simplify handling of them.

+ 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 is specified in the package's @@ -585,10 +580,11 @@ extra -

- This contains packages that conflict with others with - higher priorities, or are only likely to be useful if - you already know what they are or have specialized +

+ This contains all packages that conflict with others + with required, important, standard or optional + priorities, or are only likely to be useful if you + already know what they are or have specialised requirements.

@@ -596,8 +592,9 @@

Packages may not depend on packages with lower priority - values. If this does happen, one of the priority values - will have to be adapted. + values (excluding build-time dependencies). In order to + ensure this, the priorities of one or more packages may have + to be adjusted.

@@ -649,10 +646,11 @@

If the maintainer of a package quits from the Debian - project the Debian QA Group takes over the maintainership - of the package until someone else volunteers for that - task. These packages are called orphaned - packages. + project the Debian QA Group + debian-qa@lists.debian.org takes over the + maintainership of the package until someone else + volunteers for that task. These packages are called + orphaned packages.

@@ -714,7 +712,7 @@

Sometimes, there are several packages doing more-or-less the same job. In this case, it's useful to define a - virtual package who's name describes the function + virtual package whose name describes the function the packages have. (The virtual packages just exist logically, not physically--that's why they are called virtual.) The packages with this particular @@ -865,7 +863,7 @@ De-installation of other packages supplying it which do not (yet) use update-alternatives. It may in this case be appropriate to specify a conflict on earlier - versions on something--this is an exception to the usual + versions of something--this is an exception to the usual rule that this is not allowed.

@@ -929,6 +927,53 @@ release it.

+ + Package relationships + +

+ Source packages must 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 must be + specified as a build-time dependency. +

+ +

+ It will 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. +

+ +

+ It is a bug if, after unpacking a source package on a + system with the build-essential packages installed and + satisfying the build-time relationships (including the + implied relationships), one cannot build the package and + produce a working binary package suitable for installation + into the binary distribution corresponding to the source + distribution which contained the source package. 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 @@ -1047,22 +1092,15 @@

The location of all installed files and directories must - comply (with some exceptions - -

In an as yet unreleased version of the standard, the - location of the mail spool and state information - directories has changed; and we propose to follow the - latter, since that would mean that we do not have to - move things around again when the new version of the - FHS comes around). The changes are, amongst others, - s%/var/mail%/var/spool/mail% and - s%/var/state%/var/lib%

- - ) with the Linux File system Hierarchy Standard + comply with the Linux File system Hierarchy Standard (FHS). The latest version of this document can be found alongside this manual or on - tsx-11.mit.edu in - /pub/linux/docs/linux-standards/fsstnd/. + . +

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 @@ -1124,11 +1162,18 @@ local additions to a package, you must ensure that settings in /usr/local take precedence over the equivalents in /usr.

- +

- The /usr/local directory itself and all the subdirectories - created by the package should have permissions 2775 (group-writable - and set-group-id) and be owned by root.staff.

+ However, because '/usr/local' and its contents are for + 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 have + permissions 2775 (group-writable and set-group-id) and be + owned by root.staff.

@@ -1251,30 +1296,45 @@ 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 ).

- - These scripts are being referenced by symbolic links in + section="8">).

+ +

+ There are at least two different, yet functionally + equivalent, ways of handling these scripts. For the sake + of simplicity, this document describes only the symbolic + link method. However, it may not be assumed that this + method is being used, and any manipulation of the various + runlevel behaviours must be performed using + update-rc.d as described below and not by + manually installing symlinks. For information on the + implementation details of the other method, implemented in + the file-rc package, please refer to the + documentation of that package.

+ +

+ These scripts are referenced by symbolic links in the /etc/rcn.d directories. When changing runlevels, init looks in the 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 - Smm/script or - Kmm/script where + Smmscript or + Kmmscript where 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. + 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 executed, each with the single argument stop, @@ -1365,31 +1425,40 @@

These scripts should not fail obscurely when the configuration files remain but the package has been - removed, as the default in dpkg is to leave - configuration files on the system after the package has - been removed. Only when it is executed with the - --purge option will dpkg remove configuration - files. Therefore, you should include a test - statement at the top of the script, like this: + removed, as configuration files remain on the system after + the package has been removed. Only when dpkg + is executed with the --purge option will + configuration files be removed. In particular, the init + script itself is usually a configuration file (see + ), and will remain on the system if + the package is removed but not purged. Therefore, you + 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

- A program is provided, update-rc.d, to make - it easier for package maintainers to arrange for the + A program is provided, update-rc.d, to handle + the it easier for package maintainers to arrange for the proper creation and removal of - /etc/rcn.d symbolic links from their + /etc/rcn.d symbolic links, or their + functional equivalent if another method is being used. + This may be used by maintainers in their packages' postinst and postrm scripts.

You should use this script to make changes to - /etc/rcn.d and never include - any /etc/rcn.d symbolic links in the - actual archive.

+ /etc/rcn.d and never either + include any /etc/rcn.d symbolic links + in the actual archive or manually create or remove the + 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 @@ -1397,8 +1466,11 @@ and stop them in the halt runlevel (0), the single-user runlevel (1) and the reboot runlevel (6). The system administrator will have the opportunity to customize - runlevels by simply adding, moving, or removing the - symbolic links in /etc/rcn.d.

+ runlevels by either running update-rc.d, by + simply adding, moving, or removing the symbolic links in + /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 @@ -1430,32 +1502,15 @@ Boot-time initialization -

- There is another directory, /etc/rc.boot, which - contains scripts which are run once per machine boot. - This facility is provided for initialization of hardware - devices, cleaning up of leftover files, and so forth.

- -

- For example, the kbd package provides a - script here for initializing the keyboard layout and - console font and mode.

- -

- The files in /etc/rc.boot should not be - links into /etc/init.d--they should be the - scripts themselves.

- -

- rc.boot should not be used for starting - general-purpose daemons and similar activities. This - should be done using the rcn.d scheme, - above, so that the services can be started and stopped - cleanly when the runlevel changes or the machine is to be - shut down or rebooted.

- - - +

+ There used to be another directory, /etc/rc.boot, + which contained scripts which were run once per machine + boot. This has been deprecated in favour of links from + /etc/rcS.d to files in /etc/init.d as + described in . No packages may + place files in /etc/rc.boot.

+ + Notes

@@ -1464,19 +1519,23 @@ .deb file system archive! This will cause problems! You should create them with update-rc.d, as above.

- +

- Do not include the /etc/rcn.d/* symbolic links in + Do not include the + /etc/rcn.d/* symbolic links in dpkg's conffiles list! This will cause - problems! Do, - however, include the /etc/init.d scripts in - conffiles. (This is important since we want to give the - local system administrator the chance to adapt the scripts - to the local system--e.g., to disable a service without - De-installing the package, or to specify some special - command line options when starting a service--while making - sure her changes aren't lost during the next package - upgrade.)

+ problems! Do, 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 + ). (This is important since we want + to give the local system administrator the chance to adapt + the scripts to the local system--e.g., to disable a + service without de-installing the package, or to specify + some special command line options when starting a + service--while making sure her changes aren't lost during + the next package upgrade.)

+
Example @@ -1561,7 +1620,7 @@ Cron jobs

- Packages may not touch the configuration file + Packages may not modify the configuration file /etc/crontab, nor may they modify the files in /var/spool/cron/crontabs.

@@ -1574,36 +1633,37 @@ /etc/cron.weekly /etc/cron.monthly - As these directory names say, the files within them are executed on - a daily, weekly, or monthly basis, respectively.

- + As these directory names imply, the files within them are + executed on a daily, weekly, or monthly basis, + respectively. The exact times are listed in + /etc/crontab.

+ +

+ All files installed in any of these directories have to be + scripts (shell scripts, Perl scripts, etc.) so that they can + easily be modified by the local system administrator. In + addition, they must be treated as configuration files.

+

If a certain job has to be executed more frequently than - `daily,' the package should install a file - /etc/cron.d/<package-name> tagged as - configuration file. This file uses the same syntax as - /etc/crontab and is processed by cron - automatically. (Note, that scripts in the + daily, the package should install a file + /etc/cron.d/package-name. This file uses + the same syntax as /etc/crontab and is processed by + cron automatically. The file must also be + treated as a configuration file. (Note, that entries in the /etc/cron.d directory are not handled by anacron. Thus, you should only use this directory for jobs which may be skipped if the system is not running.)

- -

- All files installed in any of these directories have to be - scripts (shell scripts, Perl scripts, etc.) so that they can - easily be modified by the local system administrator. In - addition, they have to be registered as configuration - file.

- +

- The scripts in these directories have to check, if all - necessary programs are installed before they try to execute - them. Otherwise, problems will arise when a package was - removed (but not purged), since the configuration files are - kept on the system in this situation.

- - + The scripts or crontab entries in these directories should + check if all necessary programs are installed before they + try to execute them. Otherwise, problems will arise when a + package was removed but not purged since configuration files + are kept on the system in this situation.

+ + Console messages @@ -1792,8 +1852,9 @@

Menu entries should follow the current menu policy as defined in the file ftp.debian.org in - /debian/doc/package-developer/menu_policy.txt - or your local mirror. + /debian/doc/package-developer/menu-policy.txt + or your local mirror. In addition, it is included in the + debian-policy package.

@@ -1815,9 +1876,38 @@ 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.

- + documents.

+ + + + Multimedia handlers + +

+ Packages which provide the ability to view/show/play, + compose, edit or print MIME types should register themselves + as such following the current MIME support policy as defined + in the file found on ftp.debian.org in + /debian/doc/package-developer/mime_policy.txt + or your local mirror. In addition, it is included in the + debian-policy package. +

+ +

+ MIME (Multipurpose Internet Mail Extensions, RFC 1521) is a + mechanism for encoding files and data streams and providing + meta-information about them, in particular their type (e.g. + audio or video) and format (e.g. PNG, HTML, MP3). +

+ +

+ Registration of MIME type handlers allows programs like mail + user agents and web browsers to to invoke these handlers to + view, edit or display MIME types they don't support + directly. +

+
+ Keyboard configuration @@ -1924,7 +2014,7 @@

Some systems (including previous Debian versions) use xmodmap to arrange for both <-- and Delete - to generate KB_Delete). We can change the behavior + to generate KB_Delete. We can change the behavior of their X clients via the same X resources that we use to do it for our own, or have our clients be configured via their resources when things are the @@ -1981,53 +2071,109 @@ - Files - + Files + + + + Binaries - - Binaries - -

- It is not allowed that two packages install programs with - different functionality but with the same filenames. (The - case of two programs having the same functionality but - different implementations is handled via `alternatives.') - If this case happens, one of the programs has to be - renamed. The maintainers should report this to the - developers' mailing and try to find a consensus about - which package will have to be renamed. If a consensus can - not be reached, both programs must be - renamed.

- -

- Generally the following compilation parameters should be used: - - CC = gcc - CFLAGS = -O2 -g -Wall # sane warning options vary between programs - LDFLAGS = # none - install -s # (or use strip on the files in debian/tmp) -

- -

- Note that all installed binaries should be stripped, - either by using the -s flag to - install, or by calling strip on - the binaries after they have been copied into - debian/tmp but before the tree is made into a - package.

- -

- The -g flag is useful on compilation so that you - have available a full set of debugging symbols in your - built source tree, in case anyone should file a bug report - involving (for example) a core dump.

- -

- 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.

- -

+

+ It is not allowed that two packages install programs with + different functionality but with the same filenames. (The + case of two programs having the same functionality but + different implementations is handled via `alternatives.') + If this case happens, one of the programs has to be + renamed. The maintainers should report this to the + developers' mailing and try to find a consensus about + which package will have to be renamed. If a consensus can + not be reached, both programs must be + renamed.

+ +

+ Generally the following compilation parameters should be used: + + CC = gcc + CFLAGS = -O2 -Wall # sane warning options vary between programs + LDFLAGS = # none + install -s # (or use strip on the files in debian/tmp) +

+ +

+ Note that by default all installed binaries should be stripped, + either by using the -s flag to + install, or by calling strip on + the binaries after they have been copied into + debian/tmp but before the tree is made into a + package.

+ +

+ 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 in bug reports), + or testing and developing the software. Therefore it is + recommended to support building the package with + debugging information through the following interface: + If the environment variable DEB_BUILD_OPTIONS + contains the string debug, compile the software with + debugging information (usually this involves adding the + -g flag to CFLAGS). This allows to generate + a build tree with debugging information. If the environment + variable DEB_BUILD_OPTIONS contains the + string nostrip, do not strip the files at installation + time. This allows to generate a package with debugging + information included. The following makefile snippet + is only an example how to test for either + condition: + +

+ Rationale: Building by default with -g causes more + wasted CPU cycles since the information is stripped away + anyway. The package can by default build without -g if + it also provides a mechanism to easily be rebuilt with + debugging information. This can be done by providing a + "build-debug" make target, or allowing the user to + specify "BUILD_DEBUG=yes" in the environment while + compiling that package. +

+

Now this has several added benefits: + + +

+ It is actually easier to build debugging bins and + libraries this way (no more editing debian/rules + or similar) since it provides a documented way of + getting this type of build.

+
+ +

+ There will be much less wasted cpu time for the + autobuilders since not having debugging + information (and hence also not having to strip + it) will increase the speed of compiles. This + skips an entire pass of the compiler, +

+
+ +

+ + + + CFLAGS = -O2 -Wall + INSTALL = install + + ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) + CFLAGS += -g + ifneq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) + INSTALL += -s + endif + 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) may @@ -2076,14 +2222,14 @@

An ever increasing number of packages are using libtool to do their linking. The latest GNU libtools (>= 1.3a) can take - advantage of installed libtool archive files (`*.la'). The - main advantage of libtool's .la files is that it allows - libtool to store and subsequently access metadata with - respect to the libraries it builds. libtool will search for - those files, which contain a lot of useful information about - a library (e.g. dependency libraries for static - linking). Also, they're essential for programs using - libltdl. + advantage of the metadata in the installed libtool archive + files (`*.la'). The main advantage of libtool's .la files is + that it allows libtool to store and subsequently access + metadata with respect to the libraries it builds. libtool + will search for those files, which contain a lot of useful + information about a library (e.g. dependency libraries for + static linking). Also, they're essential for + programs using libltdl.

@@ -2101,8 +2247,11 @@

Packages that use libtool to create shared libraries must include the .la files in the -dev - packages. This is a good idea in general, and especially - for static linking issues. + packages, with the exception that if the package relies on + libtool's libltdl library, in which case the .la + files must go in the run-time library package. This is a + good idea in general, and especially for static linking + issues.

@@ -2327,90 +2476,252 @@ Debian uses the serial devices /dev/tty*. Programs using the old /dev/cu* devices should be changed to use - /dev/tty*.

- + /dev/tty*.

+ - + Configuration files - + + Definitions +

+ + configuration file +

+ A file that affects the operation of program, or + provides site- or host-specific information, or + otherwise customizes the behavior of program. + Typically, configuration files are intended to be + modified by the system administrator (if needed or + desired) to conform to local policy or provide more + useful site-specific behavior.

+ + + conffile +

+ A file listed in a package's conffiles + file, and is treated specially by dpkg + (see the Debian Packaging Manual).

+
+ +

+ +

+ The distinction between these two is important; they are + not interchangeable concepts. Almost all + conffiles are configuration files, but many + configuration files are not conffiles.

+ +

+ Note that a script that embeds configuration information + (such as most of the files in /etc/init.d and + /etc/cron.{daily,weekly,monthly}) is de-facto a + configuration file and should be treated as such.

+
+ + + Location

Any configuration files created or used by your package - should reside in /etc. If there are several you - should consider creating a subdirectory named after your - package.

- + should reside in /etc. If there are several you + should consider creating a subdirectory of /etc + named after your package.

+

- It is almost certain that any file in /etc that - is in your package's file system archive should be listed - in dpkg's conffiles control area - file. (See the Debian Packaging - Manual).

- + If your packages creates or uses configuration files + outside of /etc, and it is not feasible to modify + the package to use the /etc, you should still put + the files in /etc and create symbolic links to + those files from the location that the package + requires.

+
+ + + Behavior +

+ Configuration file handling must conform to the following + behavior: + + +

local changes must be preserved during a package + upgrade

+ + +

configuration files should be preserved when the + package is removed, and only deleted when the + package is purged.

+
+

+ +

+ The easy way to achieve this behavior is to make the + configuration file a conffile. This is + appropriate if it is possible to distribute a default + version that will work for most installations, although + some system administrators may choose to modify it. This + implies that the default version will be part of the + package distribution, and must not be modified by the + maintainer scripts during installation (or at any other + time).

+ +

+ In order to ensure that local changes are preserved + correctly, no package may contain or make hard links to + conffiles. + +

+ Rationale: There are two problems with hard links. + The first is that some editors break the link while + editing one of the files, so that the two files may + unwittingly become different. The second is that + dpkg might break the hard link while + upgrading conffiles. +

+ + +

+ The other way to do it is to via the maintainer scripts. + In this case, the configuration file must not be listed as + a conffile and must not be part of the package + distribution. If the existence of a file is required for + the package to be sensibly configured it is the + responsibility of the package maintainer to write scripts + which correctly create, update, maintain and + remove-on-purge the file. These scripts must be idempotent + (i.e. must work correctly if dpkg needs to + re-run them due to errors during installation or removal), + must cope with all the variety of ways dpkg + can call maintainer scripts, must not overwrite or + otherwise mangle the user's configuration without asking, + must not ask unnecessary questions (particularly during + upgrades), and otherwise be good citizens.

+ +

+ The scripts need not configure every possible option for + the package, but only those necessary to get the package + running on a given system. Ideally the sysadmin should not + have to do any configuration other than that done + (semi-)automatically by the postinst script.

+ +

+ A common practice is to create a script called + package-configure and have the + package's postinst call it if and only if the + configuration file does not already exist. In certain + cases it is useful for there to be an example or template + file which the maintainer scripts use. Such files should + be in /usr/share/doc if they are examples or + /usr/lib if they are templates, and should be + perfectly ordinary dpkg-handled files + (not conffiles).

+ +

+ These two styles of configuration file handling must + not be mixed, for that way lies madness: + dpkg will ask about overwriting the file + every time the package is upgraded.

+ +
+ + + Sharing configuration files

Only packages that are tagged conflicting with each other may specify the same file as - conffile. A package may not modify a - configuration file of another package.

- + conffile.

+

- If two or more packages use the same configuration file, - one of these packages has to be defined as owner - of the configuration file, i.e., it has to list the file - as conffile and has to provide a program that - modifies the configuration file.

- + The maintainer scripts should not alter the conffile of + any package, including the one the scripts belong + to.

+

- The other packages have to depend on the owner - package and use that program to update the configuration - file.

- + If two or more packages use the same configuration file + and it is reasonable for both to be installed at the same + time, one of these packages must be defined as + owner of the configuration file, i.e. it will be + the package to list that distributes the file and lists it + as a conffile. Other packages that use the + configuration file should depend on the owning package if + they require the configuration file to operate. If the + other package will use the configuration file if present, + but is capable of operating without it, no dependency need + be declared.

+

- Sometimes it's appropriate to build a new package, which - just provides the basic infrastructure for the - other packages and which manages the shared configuration - files. (Check out the sgml-base package as an - example.)

- + If it is desirable for two or more related packages to + share a configuration file and for all of the + related packages to be able to modify that configuration + file, then the following should done: + + +

+ have one of the related packages (the "core" + package) manage the configuration file with + maintainer scripts as described in the previous + section.

+
+

+ the core package should also provide a program that + the other packages may use to modify the + configuration file.

+
+ +

+ the related packages must use the provided program + to make any modifications to the configuration file. + They should either depend on the core package to + guarantee that the configuration modifier program is + available or accept gracefully that they cannot + modify the configuration file if it is not.

+
+

+ +

+ Sometimes it's appropriate to create a new package which + provides the basic infrastructure for the other packages + and which manages the shared configuration files. (Check + out the sgml-base package as an example.)

+
+ + + User configuration files ("dotfiles") +

Files in /etc/skel will automatically be copied - into new user accounts by adduser. They + into new user accounts by adduser. They should not be referenced there by any program.

- +

Therefore, if a program needs a dotfile to exist in advance in $HOME to work sensibly that dotfile should be installed in /etc/skel (and listed in conffiles, if it is not generated and modified dynamically by the package's installation scripts).

- +

However, programs that require dotfiles in order to operate sensibly (dotfiles that they do not create themselves automatically, that is) are a bad thing, and programs should be configured by the Debian default installation as close to normal as possible.

- +

Therefore, if a program in a Debian package needs to be configured in some way in order to operate sensibly that configuration should be done in a site-wide global - configuration file elsewhere in /etc. Only if - the program doesn't support a site-wide default - configuration and the package maintainer doesn't have time - to add it should a default per-user file be placed in + configuration file elsewhere in /etc. Only if the + program doesn't support a site-wide default configuration + and the package maintainer doesn't have time to add it + should a default per-user file be placed in /etc/skel.

- +

/etc/skel should be as empty as we can make it. This is particularly true because there is no easy mechanism for ensuring that the appropriate dotfiles are copied into the accounts of existing users when a package is installed.

- -

- Ideally the sysadmin should not have to do any - configuration other than that done (semi-)automatically by - the postinst script.

+
@@ -2428,8 +2739,8 @@

A better scheme is to use logrotate, a GPL'd program developed by Red Hat, which centralizes log management. It - has both a config file (/etc/logrotate.conf) and a - directory where packages can drop logrotation info + has both a configuration file (/etc/logrotate.conf) + and a directory where packages can drop logrotation info (/etc/logrotate.d).

@@ -2621,10 +2932,10 @@

If a package wants to install an example entry into /etc/inetd.conf, the entry has to be preceded with - exactly one hash character (#). Such lines are treated as - `commented out by user' by the update-inetd - script and are not changed or activated during a package - updates.

+ exactly one hash character (#). Such lines are + treated as `commented out by user' by the + update-inetd script and are not changed or + activated during a package updates.

@@ -2665,24 +2976,32 @@ Thus, every program that launches an editor or pager has to 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' have to be used, respectively.

+ variables are not set, the programs /usr/bin/editor + and /usr/bin/pager have to be used, respectively.

These two files are managed through `alternatives.' That is, every package providing an editor or pager has to call the - `update-alternatives' script to register these programs.

+ update-alternatives script to register these + programs.

If it is very hard to adapt a program to make us of the EDITOR and PAGER variable, that program should be configured - to use `/usr/bin/sensible-editor' and - `/usr/bin/sensible-pager' as editor or pager program, + to use /usr/bin/sensible-editor and + /usr/bin/sensible-pager as editor or pager program, respectively. These are two scripts provided in the Debian base system that check the EDITOR and PAGER variables and launches the appropriate program or falls back to - `/usr/bin/editor' and `/usr/bin/pager', automatically.

+ /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 + should take precedence over EDITOR. This is in fact what + /usr/bin/sensible-editor does.

+

Since the Debian base system already provides an editor and a pager program, there is no need for a package to depend on @@ -2716,7 +3035,11 @@

Html documents for a package are stored in - /usr/share/doc/package and can be referred to as + /usr/share/doc/package but should + be accessed via symlinks as + /usr/doc/package for + backward compatibility, see + and can be referred to as http://localhost/doc/<package>/<filename>

@@ -2759,14 +3082,26 @@ and not part of the MTA package.

- All Debian MUAs and MTAs have to use the maillock - and mailunlock functions provided by the - liblockfile packages to lock and unlock mail - boxes. These functions implement a NFS-safe locking - mechanism. (It is ok if MUAs and MTAs don't link against - liblockfile but use a compatible mechanism. Please - compare the mechanisms very carefully!)

- + All Debian MUAs, MTAs, MDAs and other mailbox accessing + programs (like IMAP daemons) have to lock the mailbox in a + NFS-safe way. This means that fcntl() locking has + to be combined with dot locking. To avoid dead locks, a + program has to use fcntl() first and dot locking + after this or alternatively implement the two locking + methods in a non blocking way +

+ If it is not possible to establish both locks, the + system shouldn't wait for the second lock to be + established, but remove the first lock, wait a (random) + time, and start over locking again.

+
. Using the functions maillock and + mailunlock provided by the + liblockfile* +

+ 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 @@ -2876,74 +3211,288 @@ contains X shared libraries). Users who wish to use the program can install just the relatively small xfree86-common and xlib6g packages, and do - not need to install the whole of X.

+ not need to install the whole of X. + +

Note: With the release of the new X window System + version (4.X), there probably shall be a sweeping change + in the X Window System Policy in the future.

+
+

Do not create two versions (one with X support and one without) of your package.

- Application defaults files have to be installed in - the directory /usr/X11R6/lib/X11/app-defaults/. - They are considered as part of the program code. Thus, they - should not be modified and should not be tagged as - conffiles. If the local system administrator wants - to customize X applications globally, a file with the same - name as that of the package should be placed in the - /etc/X11/Xresources/ directory instead. + 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. + +

+ Rationale: implement current practice, and provide an + actual policy for usage of the "xserver" virtual package + which appears in the virtual packages list. + In a nutshell, X servers that interface directly with + the display and input hardware or via another subsystem + (e.g., GGI) should provide xserver. Things like Xvfb, + Xnest, and Xprt should not. +

+ +

+ +

+ Packages that provide a terminal emulator for the X + Window System which support a terminal type with a terminfo + description provided in the ncurses-base package + should declare in their control data that they provide the + virtual package x-terminal-emulator. They should + also register themselves as an alternative for + /usr/bin/x-terminal-emulator, with a priority of + 20. +

+ +

+ Packages that provide window managers should declare in + their control data that they provide the virtual package + x-window-manager. They should also register themselves as an + alternative for /usr/bin/x-window-manager, with a priority + calculated as follows: + + Start with a priority of 20. + If the window manager supports the Debian menu system, + add 20 points if this support is available in the + package's default configuration (i.e., no + configuration files belonging to the system or user + have to be edited to activate the feature); if + configuration files must be modified, add only 10 + points. + If the window manager permits the X session to be + restarted using a different window manager + (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. + + + 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 + specific to the fonts shipped); if a program or + library is unusable without one or more + specific fonts, the package containing the program or + 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 + placed in a directory that corresponds to their + resolution: + + + 100 dpi fonts should be placed in + /usr/X11R6/lib/X11/fonts/100dpi/. + + + 75 dpi fonts should be placed in + /usr/X11R6/lib/X11/fonts/75dpi/. + + + Character-cell fonts, cursor fonts, and other + low-resolution fonts should be placed in + /usr/X11R6/lib/X11/fonts/misc/. + + + + + Speedo fonts should be placed in + /usr/X11R6/lib/X11/fonts/Speedo/. + + + Type 1 fonts should be placed in + /usr/X11R6/lib/X11/fonts/Type1/. If font + metric files are available, they may be placed here as + well. + + + Subdirectories of /usr/X11R6/lib/X11/fonts/ + other than those listed above should be neither created nor + used. (The PEX and cyrillic directories are + excepted for historical reasons, but installation of files into + these directories remains discouraged.) + + + Font packages may, instead of placing files directly in + the X font directories listed above, provide symbolic links in + the font directory which point to the files' actual location + in the filesystem. Such a location should comply with the + FHS. + + + Font packages should not contain both 75dpi and 100dpi + versions of a font. If both are available, they should be + provided in separate binary packages with "-75dpi" or "-100dpi" + appended to the names of the packages containing the + corresponding fonts. + + + Fonts destined for the misc subdirectory should + not be included in the same package as 75dpi or 100dpi fonts; + instead, they should be provided in a separate package with + "-misc" appended to its name. + + + Font packages must not provide the files + fonts.dir, fonts.alias, or + fonts.scale in a font directory. + + + fonts.dir files must not be provided at + all. + + + fonts.alias and fonts.scale + files, if needed, should be provided in the + directory + /etc/X11/fonts/fontdir/package.extension, + where fontdir is the name of the + subdirectory of + /usr/X11R6/lib/X11/fonts/ where the + package's corresponding fonts are stored (e.g., + 75dpi or misc), + package is the name of the package that + provides these fonts, and extension is + either scale or alias, + whichever corresponds to the file + contents. + + + + + Font packages must declare a dependency on + xbase-clients and, in the package + post-installation and post-removal scripts, invoke the + mkfontdir command on each directory into + which they installed fonts. + + + Font packages that provide one or more + fonts.scale files as described above must declare a + versioned dependency on xbase-clients (>= + 3.3.3.1-5) and invoke update-fonts-scale on each + directory into which they installed fonts + before invoking mkfontdir on that + directory. This invocation must occur in both the + post-installation and post-removal scripts. + + + 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 + post-installation and post-removal scripts, invoke + update-fonts-alias on each directory into + which they installed fonts. + + + Font packages must not provide alias names for the + fonts they include which collide with alias names already in + use by fonts already packaged. + + + Font packages must not provide fonts with the same XLFD + registry name as another font already packaged. + + +

+ +

+ Application defaults files must be installed in the + directory /usr/X11R6/lib/X11/app-defaults/. They should + not be registered as conffiles or otherwise treated as + configuration files. Customization of programs' X resources may + be supported with the provision of a file with the same name as + that of the package placed in the /etc/X11/Xresources/ + directory, which should be registered as a conffile. Important: packages that install files into the - /etc/X11/Xresources/ directory must - declare a conflict with xbase (<< - 3.3.2.3a-2); if this is not done it is possible for the - package to destroy a previously-existing - /etc/X11/Xresources file.

- -

- No package should ever install files into the directories - /usr/bin/X11/, /usr/doc/X11/, - /usr/include/X11/, or /usr/lib/X11/; these - directories are actually symbolic links, which dpkg - does not follow when unpacking a package. Instead, use - /usr/X11R6/bin/, /usr/doc/package/ (i.e., - place files with the rest of your package's documentation), - /usr/X11R6/include/, and - /usr/X11R6/lib/. This restriction governs only the - paths used by the package as it is unpacked onto the system; it - is permissible, and even preferable, for files within a package - (shell scripts, for instance) to refer to the - /usr/{bin,include,lib}/X11/ directories rather than - their /usr/X11R6/ counterparts -- this way they do not - have to be modified in the event that the X Window System - packages install their files into a different directory in the - future.

+ /etc/X11/Xresources/ directory must declare a + conflict with xbase (<< 3.3.2.3a-2); if this is + not done it is possible for the installing package to destroy a + previously-existing /etc/X11/Xresources file + which had been customized by the system administrator. + +

Rationale: clarifies the language to properly + address the package maintainer, not the system + administrator, as to how to manage + /etc/X11/Xresources.

+
+

-

- If you package a program that requires the (non-free) - OSF/Motif library, you should try to determine whether the - programs works reasonably well with the free - re-implementation of Motif called LessTif. If so, build the - package using the LessTif libraries; it can then go into the - main section of the package repository and become an - official part of the Debian distribution.

- -

- If however, the Motif-based program works insufficiently - well with LessTif, you should instead provide "-smotif" and "-dmotif" - versions (appending these identifiers to the name of the - package), which are statically and dynamically linked - against the Motif libraries, respectively. (All known - versions of OSF/Motif permit redistribution of - statically-linked binaries using the library, but check the - license on your copy of Motif to be sure.) This two-package - approach allows users without Motif to use the package, - whereas users with Motif installed can enjoy the advantages - of the dynamically-linked version (a considerable savings in - disk space usage, download time, etc.). Neither "-smotif" - nor "-dmotif" packages can go into the main section; if the - licensing on the package is compatible with the Debian Free - Software Guidelines, it may go into the contrib section; - otherwise it must go into the non-free section. + +

+ Packages using the X Window System should abide by the FHS + standard whenever possible; they should install binaries, + libraries, manual pages, and other files in FHS-mandated + locations wherever possible. This means that files should + not be installed into /usr/X11R6/bin/, + /usr/X11R6/lib/, or /usr/X11R6/man/ unless + this is necessary for the package to operate properly. + Configuration files for window managers and display managers + should be placed in a subdirectory of /etc/X11/ + corresponding to the package name due to these programs' + tight integration with the mechanisms of the X Window + System. Application-level programs should use the + /etc/ directory unless otherwise mandated by + policy. The installation of files into subdirectories of + /usr/X11R6/include/X11/ and + /usr/X11R6/lib/X11/ is permitted but discouraged; + package maintainers should determine if subdirectories of + /usr/lib/ and /usr/share/ can be used + instead (symlinks from the X11R6 directories to + FHS-compliant locations is encouraged if the program is not + easily configured to look elsewhere for its files). + Packages must not provide -- or install files into -- the + directories /usr/bin/X11/, + /usr/include/X11/, or /usr/lib/X11/. + Files within a package should, however, make reference to + these directories, rather than their X11R6-named + counterparts /usr/X11R6/bin/, + /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 + library should be compiled against and tested with + LessTif (a free re-implementation of Motif) instead. If the + maintainer judges that the program or programs do not work + sufficiently well with LessTif to be distributed and + supported, but do so when compiled against Motif, then two + versions of the package should be created; one linked + statically against Motif and with -smotif appended + to the package name, and one linked dynamically against + Motif and with -dmotif appended to the package + name. Both Motif-linked versions are dependent upon + non-DFSG-compliant software and thus cannot be uploaded to + the main distribution; if the software is itself + DFSG-compliant it may be uploaded to the contrib + distribution. While known existing versions of OSF/Motif + permit unlimited redistribution of binaries linked against + the library (whether statically or dynamically), it is the + package maintainer's responsibility to determine whether + this is permitted by the license of the copy of OSF/Motif in + his or her possession.

@@ -2962,7 +3511,7 @@ Games

- The permissions on /var/lib/games are 755 + The permissions on /var/games are 755 root.root.

@@ -2999,7 +3548,7 @@

As described in the FHS, binaries of games should be installed in the directory /usr/games. This also - applies to games that use the X Window system. Manual pages + applies to games that use the X Window System. Manual pages for games (X and non-X games) should be installed in /usr/share/man/man6.

@@ -3125,7 +3674,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: + + 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 + + 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 + +

+
+ Preferred documentation formats @@ -3219,10 +3805,15 @@

Any examples (configurations, source files, whatever), should be installed in a directory - /usr/share/doc/package/examples. These files - should not be referenced by any program--they're there for - the benefit of the system administrator and users, as - documentation only.

+ /usr/share/doc/package/examples. These + files should not be referenced by any program--they're there + for the benefit of the system administrator and users, as + documentation only. Architecture-specific example files + should be installed in a directory + /usr/lib/package/examples, and files in + /usr/share/doc/package/examples symlink + to files in it. Or the latter directory may be a symlink to + the former.

@@ -3240,10 +3831,21 @@ the upstream changelog file is HTML formatted, it must be accessible as /usr/share/doc/package/changelog.html.gz. - If the upstream changelog files do not already conform to - this naming convention, then this may be achieved by either - renaming the files or adding a symbolic link at the - packaging developer's discretion.

+ A plain text version of the changelog must be accessible as + /usr/doc/package/changelog.gz (this can + be created by lynx -dump -nolist). If the upstream + changelog files do not already conform to this naming + convention, then this may be achieved by either renaming the + files or adding a symbolic link at the packaging developer's + discretion. + +

+ Rationale: People should not have to look into two + places ofr upstream changelogs merely because they are + in HTML format. +

+
+

Both should be installed compressed using gzip -9,