X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=developers-reference.git;a=blobdiff_plain;f=developers-reference.sgml;h=a469ad2e47c21626364587401609d24b4c41cdd4;hp=e7a4eb2fd7b44e6dd1de746f345d5d5797948e43;hb=390dc188cb8982985775fbb9434f4111f6613a62;hpb=c0019387ff81023dfee67f09bcb2f0f5106629a6 diff --git a/developers-reference.sgml b/developers-reference.sgml index e7a4eb2..a469ad2 100644 --- a/developers-reference.sgml +++ b/developers-reference.sgml @@ -6,7 +6,7 @@ %commondata; - + + + + + + Best practices for maintainer scripts +

+Maintainer scripts include the files debian/postinst, +debian/preinst, debian/prerm and +debian/postrm. These scripts take care of any package +installation or deinstallation setup which isn't handled merely by the +creation or removal of files and directories. The following +instructions supplement the . +

+Maintainer scripts must be idempotent. That means that you need to +make sure nothing bad will happen if the script is called twice where +it would usually be called once. +

+Standard input and output may be redirected (e.g. into pipes) for +logging purposes, so don't rely on them being a tty. +

+All prompting or interactive configuration should be kept to a +minimum. When it is necessary, you should use the +debconf package for the interface. Remember that +prompting in any case can only be in the configure stage of +the postinst script. +

+Keep the maintainer scripts as simple as possible. We suggest you use +pure POSIX shell scripts. Remember, if you do need any bash features, +the maintainer script must have a bash shbang line. Posix shell or +Bash are preferred to Perl, since they enable +debhelper to easily add bits to the scripts. +

+If you change your maintainer scripts, be sure to test package +removal, double installation, and purging. Be sure that a purged +package is completely gone, that is, it must remove any files created, +directly or indirectly, in any maintainer script. +

+If you need to check for the existance of a command, you should use +something like +if [ -x /usr/sbin/install-docs ]; then ... + +If you don't wish to hardcode the path of the command in your +maintainer script, the following POSIX-compliant shell function may +help: + +&example-pathfind; + +You can use this function to search $PATH for a command name, +passed as an argument. It returns true (zero) if the command was +found, and false if not. This is really the most portable way, since +command -v, type, and which are not +POSIX. While which is an acceptable alternative, since +it is from the required debianutils package, it's +not on the root partition, although that is probably not something +that will cause a problem. + + + + Best practices for debian/control +

+The following practices supplement the .

+ + + Writing useful descriptions +

+The description of the package (as defined by the corresponding field +in the control file) is the primary information available +to the user about a package before they install it. It should provide +all the required information to let the user decide whether to install +the package. +

+For consistency and aesthetics, you should capitalize the first letter +of the Synopsis. Don't put a full stop (period) at the end. The +description itself should consist of full sentences. +

+Since the first user impression is based on the description, be +careful to avoid spelling and grammar mistakes. Ensure that you +spell-check it. ispell has a special -g option +for debian/control files: + +ispell -d american -g debian/control + +If you want someone to proofread the description that you +intend to use you may ask on &email-debian-l10n-english;. + + + + Upstream home page +

+We recommend that you add the URL for the package's homepage to the +package description in debian/control, and a link to a +screenshot, if one is handy. This information should be added at the +end of description, using the following format: + + . + Homepage: http://some-project.some-place.org/ + Screenshot: http://some-project.some-place.org/ + +Note the spaces prepending the line, which serves to break the lines +correctly. To see an example of how this displays, see . +

+If there is no home page for the software, this should naturally be +left empty. + + - Package with multiple patches -

-Big packages tend to have many upstream bugs that you want to fix within -the Debian package. If you just correct the bug in the source, all the -fixes are directly integrated in the .diff.gz file and you -can't easily differentiate the various patches that you applied. It gets -very messy when you have to update the package to a new upstream version -which integrates some of the fixes (but not all). -

-The good solution is to keep separate patches within the -debian/patches directory and to apply them on the fly at -build time. The package dbs provides an -implementation of such a system, you just have to build-depend on dbs to -be able to use its functionalities. The package -hello-dbs is a simple example that demonstrates how to -use dbs. -

-Additionally, dbs provides facilities to create the patches and to keep -track of what they are for. - Multiple binary packages -

-A single source package will often build several binary packages, either -to provide several flavors of the same software (examples are the -vim-* packages) or to make several small packages instead of a big one -(it's interesting if the user doesn't need all the packages and can thus -save some disk space). + + Configuration management with debconf +

-The second case can be easily managed by dh_install (from -debhelper) to move files from the build directory to -the package's temporary trees. +Debconf is a configuration management system which +can be used by all the various packaging scripts +(postinst mainly) to request feedback from the user +concerning how to configure the package. Direct user interactions must +now be avoided in favor of debconf +interaction. This will enable non-interactive installations in the +future.

-The first case is a bit more difficult since it involves multiple recompiles -of the same software but with different configure options. The -vim is an example of how to manage this with an -hand crafted rules file. - +Debconf is a great tool but it is often poorly used. Many common mistakes +are listed in the man page. +It is something that you must read if you decide to use debconf. + - Handling debconf translations -

-Like porters, translators have a difficult task. Since they work on many -packages, they cannot keep track of every change in packages in order to -be informed when a translated string is outdated. Fortunately -debconf can automatically report outdated translations, -if package maintainers follow some basic guidelines described below. -

-Translators can use debconf-getlang (package -debconf-utils) to write a templates.xx -file containing both English and localized fields (where xx is -the language code, may be followed by a country code). This file can be -put into the debian subdirectory without any change. -

-When building a binary package, debian/templates.xx files are -merged along with debian/templates to generate the -templates file contained in the binary package. This is -automatically done by dh_installdebconf (package -debhelper). If you do not use debhelper, you can -do the same with debconf-mergetemplate -(package debconf-utils). -

-When the package maintainer needs to update the templates file, they only -change debian/templates. When English strings in this file -and in debian/templates.xx differ, translators do know that -their translation is outdated. -

-Please see the page about - -at the Debian web site, it contains more detailed instructions, including a -full example. + + Internationalization - - Specific packaging practices + + Handling debconf translations +

+Like porters, translators have a difficult task. They work on many +packages and must collaborate with many different +maintainers. Moreover, most of the time, they are not native English +speakers, so you may need to be particularly patient with them. +

+The goal of debconf was to make packages +configuration easier for maintainers and for users. Originally, +translation of debconf templates was handled with +debconf-mergetemplate. However, that technique is now +deprecated; the best way to accomplish debconf +internationalization is by using the po-debconf +package. This method is easier both for maintainer and translators; +transition scripts are provided. +

+Using po-debconf, the translation is stored in +po files (drawing from gettext translation +techniques). Special template files contain the original messages and +mark which fields are translatable. When you change the value of a +translatable field, by calling debconf-updatepo, the +translation is marked as needing attention from the translators. Then, +at build time, the dh_installdebconf program takes care +of all the needed magic to add the template along with the up-to-date +translations into the binary packages. Refer to the manual page for details. + + + + Internationalized documentation +

+Internationalizing documentation is crucial for users, but a lot of +labor. There's no way to eliminate all that work, but you can make things +easier for translators. +

+If you maintain documentation of any size, its easier for translators +if they have access to a source control system. That lets translators +see the differences between two versions of the documentation, so, for +instance, they can see what needs to be retranslated. It is +recommended that the translated documentation maintain a note about +what source control revision the translation is based on. An +interesting system is provided by in the boot-floppies package, +which shows an overview of the translation status for any given +language, using structured comments for the current revision of the +file to be translated and, for a translated file, the revision of the +original file the translation is based on. You might wish to adapt +and provide that in your CVS area. +

+If you maintain XML or SGML documentation, we suggest that you isolate +any language-independant information and define those as entities in a +separate file which is included by all the different +translations. This makes it much easier, for instance, to keep URLs +up-to-date across multiple files. + + + + + Common packaging situations - - Miscellaneous advice - - - Writing useful descriptions -

-The description of the package (as defined by the corresponding field -in the control file) is usually the first information -available to the user before they install it. As such, it should -provide all the required information to let him decide whether -to install the package. -

-For example, apart from the usual description that you adapt from the -upstream README, you should include the URL of the -web site if there's any. If the package is not yet considered stable -by the author, you may also want to warn the user that the -package is not ready for production use. -

-For consistency and for an aesthetic concern, you should capitalize the -first letter of the description. -

-Last but not least, since the first user impression is based on -that description, you should be careful to avoid English -mistakes. Ensure that you spell check it. -ispell has a special option (-g) for that: -ispell -d american -g debian/control. -If you want someone to proofread the description that you -intend to use you may ask on &email-debian-l10n-english;. @@ -3116,7 +3326,7 @@ members in choosing what they want to work on and in choosing the most critical thing to spend their time on. - Bug Reporting + Bug reporting

We encourage you to file bugs as you find them in Debian packages. In fact, Debian developers are often the first line testers. Finding and @@ -3170,7 +3380,7 @@ list. Even though there is a dedicated group of people for Quality Assurance, QA duties are not reserved solely for them. You can participate in this effort by keeping your packages as bug-free as -possible, and as lintian-clean (see ) as +possible, and as lintian-clean (see ) as possible. If you do not find that possible, then you should consider orphaning some of your packages (see ). Alternatively, you may ask the help of other people @@ -3178,7 +3388,7 @@ in order to catch up the backlog of bugs that you have (you can ask for help on &email-debian-qa; or &email-debian-devel;). At the same time, you can look for co-maintainers (see ). - Bug Squashing Parties + Bug squashing parties

From time to time the QA group organizes bug squashing parties to get rid of as many problems as possible. They are announced on &email-debian-devel-announce; @@ -3285,7 +3495,7 @@ the package meets minimum Debian standards. That implies that you must build and test the package on your own system before uploading.

You can not simply upload a binary .deb from the sponsoree. In -theory, you should only ask only for the diff file and the location of the +theory, you should only ask for the diff file and the location of the original source tarball, and then you should download the source and apply the diff yourself. In practice, you may want to use the source package built by your sponsoree. In that case, you have to check that they haven't @@ -3299,7 +3509,7 @@ means being a mentor.

Once the package meets Debian standards, build the package with dpkg-buildpackage -us -uc and sign it -with debsign -m <your-email-addr> <changes-file> +with debsign -m"FULLNAME email-addr" changes-file before uploading it to the incoming directory.

The Maintainer field of the control file and the @@ -3345,10 +3555,14 @@ endorse any particular tool to the exclusion of a competing tool. Most of the descriptions of these packages come from the actual package descriptions themselves. Further information can be found in the package documentation itself. You can also see more info with the -command apt-cache show <package-name>. +command apt-cache show <package-name>.

+ + Core tools +

+The following tools are pretty much required for any maintainer.

- + dpkg-dev

dpkg-dev contains the tools (including @@ -3357,18 +3571,7 @@ source packages. These utilities contain the fundamental, low-level functionality required to create and manipulated packages; as such, they are required for any Debian maintainer. - - - lintian -

-Lintian dissects Debian packages and reports bugs -and policy violations. It contains automated checks for many aspects -of Debian policy as well as some checks for common errors. The use of -lintian has already been discussed in and . - - - + debconf

debconf provides a consistent interface to @@ -3381,14 +3584,71 @@ You can find documentation for this package in the debconf-doc package.

Many feel that this system should be used for all packages requiring -interactive configuration. debconf is not -currently required by Debian Policy, however, that may change in the -future. +interactive configuration; see . +debconf is not currently required by Debian Policy, +but that may change in the future. + + + + fakeroot +

+fakeroot simulates root privileges. This enables +you to build packages without being root (packages usually want to +install files with root ownership). If you have +fakeroot installed, you can build packages as a +user: dpkg-buildpackage -rfakeroot. + + + + + Package lint tools

+According to the Free On-line Dictionary of Computing (FOLDOC), `lint' +is "a Unix C language processor which carries out more thorough checks +on the code than is usual with C compilers." Package lint tools help +package maintainers by automatically finding common problems and +policy violations with their packages.

+ + + lintian +

+lintian dissects Debian packages and emits +information on bugs +and policy violations. It contains automated checks for many aspects +of Debian policy as well as some checks for common errors. +

+You should periodically get the newest lintian from +`unstable' and check over all your packages. Notice that the -i +option provides detailed explanations of what each error or warning means, +what is its basis in Policy, and commonly how you can fix the problem. +

+Refer to for more information on how and when +to use Lintian. +

+You can also see a summary of all problems reported by Lintian on your +packages at . Those reports contain the latest +lintian output on the whole development distribution +("unstable"). + + + linda +

+linda is another package linter. It is similar to +lintian but has a different set of checks. Its +written in Python rather than Perl.

+
+
+ + + Helpers for debian/rules +

+Package building tools make the process of writing +debian/rules files easier. See +for more information on why these might or might not be desired. - - debhelper + + debhelper

debhelper is a collection of programs that can be used in debian/rules to automate common tasks related to @@ -3404,10 +3664,10 @@ other "debian/rules tools". There are a number of little debhelper add-on packages, too transient to document. You can see the list of most of them by doing apt-cache search ^dh-. + - - - debmake + + debmake

debmake, a pre-cursor to debhelper, is a less granular @@ -3421,10 +3681,25 @@ sort of automated functions that one finds in The consensus is that debmake is now deprecated in favor of debhelper. However, it's not a bug to use debmake. + + + dh-make +

+The +While the rules files generated by - - yada + + yada

yada is another packaging helper tool. It uses a debian/packages file to auto-generate @@ -3434,20 +3709,30 @@ favor of debhelper. However, it's not a bug to use Note that yada is called "essentially unmaintained" by it's own maintainer, Charles Briscoe-Smith. As such, it can be considered deprecated. + - - - equivs + + equivs

equivs is another package for making packages. It is often suggested for local use if you need to make a package simply to fulfill dependencies. It is also sometimes used when making ``meta-packages'', which are packages whose only purpose is to depend -on other packages. +on other packages.

+
+
+ + + + Package builders +

+The following packages help with the package building process, general +driving dpkg-buildpackage as well as handling supporting +tasks.

- - cvs-buildpackage + + cvs-buildpackage

cvs-buildpackage provides the capability to inject or import Debian source packages into a CVS repository, build a Debian @@ -3459,105 +3744,166 @@ by Debian maintainers. This allows one to keep separate CVS branches of a package for stable, unstable and possibly experimental distributions, along with the other benefits of a version control system. + - - - dupload + + debootstrap +

+The debootstrap package and script allows you to +"bootstrap" a Debian base system into any part of your file-system. +By "base system", we mean the bare minimum of packages required to +operate and install the rest of the system.

+Having a system like this can be useful in many ways. For instance, +you can chroot into it if you want to test your build +depends. Or, you can test how your package behaves when installed +into a bare base system. Chroot builders use this package, see below. + + + + pbuilder +

+pbuilder constructs a chrooted system, and builds a +package inside the chroot. It is very useful to check that a package's +build-dependencies are correct, and to be sure that unnecessary and +wrong build dependencies will not exist in the resulting package.

+

+A related package is pbuilder-uml, which goes even +further build doing the build within User-mode-linux.

+
+ + + sbuild +

+sbuild is another automated builder. It can use +chrooted environments as well. It can be used stand-alone, or as part +of a networked, distributed build environment. As the latter, it is +part of the system used by porters to build binary packages for all +the available architectures. See for more +information, and to see the system in +action.

+
+
+ + + Package uploaders +

+The following packages help automate or simplify the process of +uploading packages into the official archive.

+ + + dupload +

dupload is a package and a script to automatically upload Debian packages to the Debian archive, to log the upload, and to send mail about the upload of a package. You can configure it for new upload locations or methods. + - - - dput -

+ + dput +

The dput package and script does much the same thing as dupload, but in a different way. It has some features over dupload, such as the ability to check the GnuPG signature and checksums before uploading, and the possibility of running dinstall in dry-run mode after the upload. + + - - - fakeroot -

-fakeroot simulates root privileges. This enables -you to build packages without being root (packages usually want to -install files with root ownership). If you have -fakeroot installed, you can build packages as a -user: dpkg-buildpackage -rfakeroot. - - - - debootstrap -

-The debootstrap package and script allows you to -"bootstrap" a Debian base system into any part of your file-system. -By "base system", we mean the bare minimum of packages required to -operate and install the rest of the system. -

-Having a system like this can be useful in many ways. For instance, -you can chroot into it if you want to test your build -depends. Or, you can test how your package behaves when installed -into a bare base system. - - - - pbuilder + + Maintenance automation

-pbuilder constructs a chrooted system, and builds -a package inside the chroot. It is very useful to check that -a package's build-dependencies are correct, and to be sure that -unnecessary and wrong build dependencies will not exist in the -resulting package. +The following tools help automate different maintenance tasks, from +adding changelog entries or signature lines, looking up bugs in Emacs, +to making use of the newest and official use of +config.sub.

- - - devscripts -

-devscripts is a package containing a few wrappers + + devscripts +

+devscripts is a package containing wrappers and tools which are very helpful for maintaining your Debian packages. Example scripts include debchange and dch, which manipulate your debian/changelog file from the command-line, and debuild, which is a wrapper around dpkg-buildpackage. The bts utility is also very helpful to update the state of bug reports on the -command line, as is uscan to watch for new upstream -versions of your packages. Check the devscripts(1) manual -page for a complete list of available scripts. - +command line. uscan can be used to watch for new upstream +versions of your packages. The debrsign can be used to +remotely sign a package prior to upload, which is nice when the +machine you build the package on is different from where your GPG keys +are.

+

+See the manual page for a +complete list of available scripts.

+
- - dpkg-dev-el -

+ + dpkg-dev-el +

dpkg-dev-el is an Emacs lisp package which provides assistance when editing some of the files in the debian directory of your package. For instance, when editing debian/changelog, there are handy functions for -finalizing a version and listing the package's current bugs. +finalizing a version and listing the package's current bugs.

+ +
- - debget -

-debget is a package containing a convenient script -which can be helpful in downloading files from the Debian archive. -You can use it to download source packages, for instance (although -apt-get source <package-name> does pretty much the same -thing). + + Porting tools +

+The following tools are helpful for porters and for +cross-compilation.

+ + quinn-diff +

+quinn-diff is used to locate the differences from +one architecture to another. For instance, it could tell you which +packages need to be ported for architecture Y, based on +architecture X. + + + dpkg-cross +

+dpkg-cross is a tool for installing libraries and +headers for cross-compiling in a way similar to +dpkg. Furthermore, the functionality of +dpkg-buildpackage and dpkg-shlibdeps is +enhanced to support cross-compiling. + + - +