chiark / gitweb /
Use po4a --previous option (store previous string version in the po)
[developers-reference.git] / best-pkging-practices.dbk
index f1130c201501d35ba885d879ae58665001d8cb50..32d5115f885ef7133b7b27c8a5a2e3d6f37e432d 100644 (file)
@@ -1,11 +1,13 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
-    "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
+    "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
+  <!ENTITY % commondata SYSTEM "common.ent" > %commondata;
+]>
 <chapter id="best-pkging-practices">
 <title>Best Packaging Practices</title>
 <para>
 Debian's quality is largely due to the <ulink
-url="http://www.debian.org/doc/debian-policy/">Debian Policy</ulink>, which
+url="&url-debian-policy;">Debian Policy</ulink>, which
 defines explicit baseline requirements which all Debian packages must fulfill.
 Yet there is also a shared history of experience which goes beyond the Debian
 Policy, an accumulation of years of experience in packaging.  Many very
@@ -32,7 +34,7 @@ usually the file maintainers spend the most time on.
 The rationale for using helper scripts in <filename>debian/rules</filename> is
 that they let maintainers use and share common logic among many packages.  Take
 for instance the question of installing menu entries: you need to put the file
-into <filename>/usr/lib/menu</filename> (or <filename>/usr/lib/menu</filename>
+into <filename>/usr/share/menu</filename> (or <filename>/usr/lib/menu</filename>
 for executable binary menufiles, if this is needed), and add commands to the
 maintainer scripts to register and unregister the menu entries.  Since this is
 a very common thing for packages to do, why should each maintainer rewrite all
@@ -78,7 +80,7 @@ Some people feel that vanilla <filename>debian/rules</filename> files are
 better, since you don't have to learn the intricacies of any helper system.
 This decision is completely up to you.  Use what works for you.  Many examples
 of vanilla <filename>debian/rules</filename> files are available at <ulink
-url="http://arch.debian.org/arch/private/srivasta/"></ulink>.
+url="&url-rules-files;"></ulink>.
 </para>
 </section>
 
@@ -94,27 +96,35 @@ diffs (e.g., from <filename>.diff.gz</filename>) and work out which patch sets
 to back out as a unit as bugs are fixed upstream.
 </para>
 <para>
-Unfortunately, the packaging system as such currently doesn't provide for
-separating the patches into several files.  Nevertheless, there are ways to
-separate patches: the patch files are shipped within the Debian patch file
-(<filename>.diff.gz</filename>), usually within the
-<filename>debian/</filename> directory.  The only difference is that they
-aren't applied immediately by dpkg-source, but by the <literal>build</literal>
-rule of <filename>debian/rules</filename>.  Conversely, they are reverted in
-the <literal>clean</literal> rule.
+Fortunately, with the source format “3.0 (quilt)” it is now possible to
+keep patches separate without having to modify <filename>debian/rules</filename>
+to setup a patch system. Patches are stored in <filename>debian/patches/</filename>
+and when the source package is unpacked patches listed in
+<filename>debian/patches/series</filename> are automatically applied.
+As the name implies, patches can be managed with <command>quilt</command>.
 </para>
 <para>
-<command>dbs</command> is one of the more popular approaches to this.  It does
-all of the above, and provides a facility for creating new and updating old
-patches.  See the package <systemitem role="package">dbs</systemitem> for more
-information and <systemitem role="package">hello-dbs</systemitem> for an
-example.
+When using the older source “1.0”, it's also possible to separate patches
+but a dedicated patch system must be used: the patch files are shipped
+within the Debian patch file (<filename>.diff.gz</filename>), usually
+within the <filename>debian/</filename> directory. The only difference is
+that they aren't applied immediately by <command>dpkg-source</command>,
+but by the <literal>build</literal> rule of
+<filename>debian/rules</filename>, through a dependency on the
+<literal>patch</literal> rule.  Conversely, they are reverted in the
+<literal>clean</literal> rule, through a dependency on the
+<literal>unpatch</literal> rule.
 </para>
 <para>
-<command>dpatch</command> also provides these facilities, but it's intended to
-be even easier to use.  See the package <systemitem
-role="package">dpatch</systemitem> for documentation and examples (in
-<filename>/usr/share/doc/dpatch</filename>).
+<command>quilt</command> is the recommended tool for this.
+It does all of the above, and also allows to manage patch series.
+See the 
+<systemitem role="package">quilt</systemitem> package for more information.
+</para>
+<para>
+There are other tools to manage patches, like <command>dpatch</command>,
+and the patch system integrated with
+<systemitem role="package">cdbs</systemitem>.
 </para>
 </section>
 
@@ -142,6 +152,8 @@ the same software but with different configuration options.  The <systemitem
 role="package">vim</systemitem> source package is an example of how to manage
 this using an hand-crafted <filename>debian/rules</filename> file.
 </para>
+<!-- FIXME: Find a good debhelper example with multiple configure/make
+     cycles -->
 </section>
 
 </section>
@@ -151,7 +163,7 @@ this using an hand-crafted <filename>debian/rules</filename> file.
 <para>
 The following practices are relevant to the <filename>debian/control</filename>
 file.  They supplement the <ulink
-url="http://www.debian.org/doc/debian-policy/ch-binary.html#s-descriptions">Policy
+url="&url-debian-policy;ch-binary.html#s-descriptions">Policy
 on package descriptions</ulink>.
 </para>
 <para>
@@ -199,49 +211,57 @@ Postscript or postscript.
 </para>
 <para>
 If you are having problems writing your description, you may wish to send it
-along to <email>debian-l10n-english@lists.debian.org</email> and request
-feedback.
+along to &email-debian-l10n-english; and request feedback.
 </para>
 </section>
 
 <section id="bpp-pkg-synopsis">
 <title>The package synopsis, or short description</title>
 <para>
-The synopsis line (the short description) should be concise.  It must not
-repeat the package's name (this is policy).
-</para>
-<para>
-It's a good idea to think of the synopsis as an appositive clause, not a full
-sentence.  An appositive clause is defined in WordNet as a grammatical relation
-between a word and a noun phrase that follows, e.g., Rudolph the red-nosed
-reindeer.  The appositive clause here is red-nosed reindeer.  Since the
-synopsis is a clause, rather than a full sentence, we recommend that it neither
-start with a capital nor end with a full stop (period).  It should also not
-begin with an article, either definite (the) or indefinite (a or an).
+Policy says the synopsis line (the short description) must be concise, not
+repeating the package name, but also informative.
 </para>
 <para>
-It might help to imagine that the synopsis is combined with the package name in
-the following way:
+The synopsis functions as a phrase describing the package, not a complete
+sentence, so sentential punctuation is inappropriate: it does not need extra
+capital letters or a final period (full stop). It should also omit any initial
+indefinite or definite article - "a", "an", or "the". Thus for instance:
 </para>
 <screen>
-<replaceable>package-name</replaceable> is a <replaceable>synopsis</replaceable>.
+Package: libeg0
+Description: exemplification support library
 </screen>
 <para>
-Alternatively, it might make sense to think of it as
+Technically this is a noun phrase minus articles, as opposed to a verb phrase.
+A good heuristic is that it should be possible to substitute the package name
+and synopsis into this formula:
+</para>
+<para>
+The package <replaceable>name</replaceable> provides {a,an,the,some}
+<replaceable>synopsis</replaceable>.
 </para>
-<screen>
-<replaceable>package-name</replaceable> is <replaceable>synopsis</replaceable>.
-</screen>
 <para>
-or, if the package name itself is a plural (such as developers-tools)
+Sets of related packages may use an alternative scheme that divides the
+synopsis into two parts, the first a description of the whole suite and the
+second a summary of the package's role within it:
 </para>
 <screen>
-<replaceable>package-name</replaceable> are <replaceable>synopsis</replaceable>.
+Package: eg-tools
+Description: simple exemplification system (utilities)
+                                     
+Package: eg-doc
+Description: simple exemplification system - documentation
 </screen>
 <para>
-This way of forming a sentence from the package name and synopsis should be
-considered as a heuristic and not a strict rule.  There are some cases where it
-doesn't make sense to try to form a sentence.
+These synopses follow a modified formula. Where a package
+"<replaceable>name</replaceable>" has a synopsis
+"<replaceable>suite</replaceable> (<replaceable>role</replaceable>)" or
+"<replaceable>suite</replaceable> - <replaceable>role</replaceable>", the
+elements should be phrased so that they fit into the formula:
+</para>
+<para>
+The package <replaceable>name</replaceable> provides {a,an,the}
+<replaceable>role</replaceable> for the <replaceable>suite</replaceable>.
 </para>
 </section>
 
@@ -276,10 +296,10 @@ it.  Both <command>ispell</command> and <command>aspell</command> have special
 modes for checking <filename>debian/control</filename> files:
 </para>
 <screen>
- -d american -g debian/control
+ispell -d american -g debian/control
 </screen>
 <screen>
- -d en -D -c debian/control
+aspell -d en -D -c debian/control
 </screen>
 <para>
 Users usually expect these questions to be answered in the package description:
@@ -306,9 +326,9 @@ package, this should be mentioned.
 </listitem>
 <listitem>
 <para>
-If the package is experimental, or there are other reasons it should not be
-used, if there are other packages that should be used instead, it should be
-here as well.
+If the package is <literal>experimental</literal>, or there are other reasons
+it should not be used, if there are other packages that should be used instead,
+it should be here as well.
 </para>
 </listitem>
 <listitem>
@@ -318,36 +338,20 @@ implementation?  more features?  different features?  Why should I choose this
 package.
 </para>
 </listitem>
+<!-- FIXME: what's this?
+(the second questions is about the class of packages, and
+this about this particular package, if you have information related to both).
+-->
 </itemizedlist>
 </section>
 
 <section id="bpp-upstream-info">
 <title>Upstream home page</title>
 <para>
-We recommend that you add the URL for the package's home page to the package
-description in <filename>debian/control</filename>.  This information should be
-added at the end of description, using the following format:
-</para>
-<screen>
- .
-  Homepage: http://some-project.some-place.org/
-</screen>
-<para>
-Note the spaces prepending the line, which serves to break the lines correctly.
-To see an example of how this displays, see <ulink
-url="http://packages.debian.org/unstable/web/wml"></ulink>.
-</para>
-<para>
-If there is no home page for the software, this should naturally be left out.
-</para>
-<para>
-Note that we expect this field will eventually be replaced by a proper
-<filename>debian/control</filename> field understood by <command>dpkg</command>
-and <literal>packages.debian.org</literal>.  If you don't want to bother
-migrating the home page from the description to this field, you should probably
-wait until that is available.  Please make sure that this line matches the
-regular expression <literal>/^ Homepage: [^ ]*$/</literal>, as this allows
-<filename>packages.debian.org</filename> to parse it correctly.
+We recommend that you add the URL for the package's home page in the
+<literal>Homepage</literal> field of the <literal>Source</literal> section
+in <filename>debian/control</filename>.  Adding this information in the
+package description itself is considered deprecated.
 </para>
 </section>
 
@@ -358,7 +362,7 @@ There are additional fields for the location of the Version Control System in
 <filename>debian/control</filename>.
 </para>
 <section id="s6.2.5.1">
-<title>XS-Vcs-Browser</title>
+<title>Vcs-Browser</title>
 <para>
 Value of this field should be a <literal>http://</literal> URL pointing to a
 web-browsable copy of the Version Control System repository used to maintain
@@ -372,7 +376,7 @@ tagged as <literal>pending</literal> in the bug tracking system).
 </section>
 
 <section id="s6.2.5.2">
-<title>XS-Vcs-*</title>
+<title>Vcs-*</title>
 <para>
 Value of this field should be a string identifying unequivocally the location
 of the Version Control System repository used to maintain the given package, if
@@ -401,15 +405,17 @@ of the <systemitem role="package">vim</systemitem> package is shown.  Note how
 the URL is in the <literal>svn://</literal> scheme (instead of
 <literal>svn+ssh://</literal>) and how it points to the
 <filename>trunk/</filename> branch.  The use of the
-<literal>XS-Vcs-Browser</literal> field described above is also shown.
+<literal>Vcs-Browser</literal> and <literal>Homepage</literal> fields
+described above is also shown.
 </para>
 <screen>
   Source: vim
   Section: editors
   Priority: optional
   &lt;snip&gt;
-  XS-Vcs-Svn: svn://svn.debian.org/svn/pkg-vim/trunk/packages/vim
-  XS-Vcs-Browser: http://svn.debian.org/wsvn/pkg-vim/trunk/packages/vim
+  Vcs-Svn: svn://svn.debian.org/svn/pkg-vim/trunk/packages/vim
+  Vcs-Browser: http://svn.debian.org/wsvn/pkg-vim/trunk/packages/vim
+  Homepage: http://www.vim.org
 </screen>
 </section>
 
@@ -421,7 +427,7 @@ the URL is in the <literal>svn://</literal> scheme (instead of
 <title>Best practices for <filename>debian/changelog</filename></title>
 <para>
 The following practices supplement the <ulink
-url="http://www.debian.org/doc/debian-policy/ch-docs.html#s-changelogs">Policy
+url="&url-debian-policy;ch-docs.html#s-changelogs">Policy
 on changelog files</ulink>.
 </para>
 <section id="bpp-changelog-do">
@@ -559,24 +565,27 @@ inserting the title of each different bug.
 <section id="bpp-news-debian">
 <title>Supplementing changelogs with NEWS.Debian files</title>
 <para>
-Important news about changes in a package can also be put in NEWS.Debian files.
+Important news about changes in a package can also be put in <filename>
+NEWS.Debian</filename> files.
 The news will be displayed by tools like apt-listchanges, before all the rest
 of the changelogs.  This is the preferred means to let the user know about
 significant changes in a package.  It is better than using debconf notes since
-it is less annoying and the user can go back and refer to the NEWS.Debian file
-after the install.  And it's better than listing major changes in
-README.Debian, since the user can easily miss such notes.
+it is less annoying and the user can go back and refer to the <filename>
+NEWS.Debian</filename> file after the install.  And it's better than listing
+major changes in <filename>README.Debian</filename>, since the user can easily
+miss such notes.
 </para>
 <para>
 The file format is the same as a debian changelog file, but leave off the
 asterisks and describe each news item with a full paragraph when necessary
 rather than the more concise summaries that would go in a changelog.  It's a
-good idea to run your file through dpkg-parsechangelog to check its formatting
-as it will not be automatically checked during build as the changelog is.  Here
-is an example of a real NEWS.Debian file:
+good idea to run your file through <literal>dpkg-parsechangelog</literal> to
+check its formatting as it will not be automatically checked during build as
+the changelog is.  Here is an example of a real <filename>NEWS.Debian
+</filename> file:
 </para>
 <screen>
- (3.0pl1-74) unstable; urgency=low
+cron (3.0pl1-74) unstable; urgency=low
 
     The checksecurity script is no longer included with the cron package:
     it now has its own package, checksecurity. If you liked the
@@ -586,21 +595,34 @@ is an example of a real NEWS.Debian file:
  -- Steve Greenland &lt;stevegr@debian.org&gt;  Sat,  6 Sep 2003 17:15:03 -0500
 </screen>
 <para>
-The NEWS.Debian file is installed as
-/usr/share/doc/&lt;package&gt;/NEWS.Debian.gz.  It is compressed, and always
-has that name even in Debian native packages.  If you use debhelper,
-dh_installchangelogs will install debian/NEWS files for you.
+The <filename>NEWS.Debian</filename> file is installed as <filename>
+/usr/share/doc/<replaceable>package</replaceable>/NEWS.Debian.gz</filename>.
+It is compressed, and always has that name even in Debian native packages.
+If you use <literal>debhelper</literal>, <literal>dh_installchangelogs
+</literal> will install <filename>debian/NEWS</filename> files for you.
 </para>
 <para>
-Unlike changelog files, you need not update NEWS.Debian files with every
-release.  Only update them if you have something particularly newsworthy that
-user should know about.  If you have no news at all, there's no need to ship a
-NEWS.Debian file in your package.  No news is good news!
+Unlike changelog files, you need not update <filename>NEWS.Debian</filename>
+files with every release.  Only update them if you have something particularly
+newsworthy that user should know about.  If you have no news at all, there's no
+need to ship a <filename>NEWS.Debian</filename> file in your package.  No news
+is good news!
 </para>
 </section>
 
 </section>
 
+<!--
+<section id="pkg-mgmt-cvs">
+<title>Managing a package with CVS</title>
+<para>
+FIXME: presentation of cvs-buildpackage, updating sources
+via CVS (debian/rules refresh).
+<ulink url="&url-devel-docs;cvs_packages">"&url-devel-docs;cvs_packages"</ulink>
+</para>
+</section>
+-->
+
 <section id="bpp-debian-maint-scripts">
 <title>Best practices for maintainer scripts</title>
 <para>
@@ -609,7 +631,7 @@ Maintainer scripts include the files <filename>debian/postinst</filename>,
 <filename>debian/postrm</filename>.  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
-<ulink url="http://www.debian.org/doc/debian-policy/">Debian Policy</ulink>.
+<ulink url="&url-debian-policy;">Debian Policy</ulink>.
 </para>
 <para>
 Maintainer scripts must be idempotent.  That means that you need to make sure
@@ -644,27 +666,12 @@ maintainer script.
 If you need to check for the existence of a command, you should use something
 like
 </para>
-<screen>
- [ -x /usr/sbin/install-docs ]; then ...
-</screen>
+<programlisting>if [ -x /usr/sbin/install-docs ]; then ...</programlisting>
 <para>
 If you don't wish to hard-code the path of a command in your maintainer script,
 the following POSIX-compliant shell function may help:
 </para>
-<screen>
-() {
-    OLDIFS=$IFS
-    IFS=:
-    for p in $PATH; do
-        if [ -x $p/$* ]; then
-            IFS=$OLDIFS
-            return 0
-        fi
-    done
-    IFS=$OLDIFS
-    return 1
-}
-</screen>
+&example-pathfind;
 <para>
 You can use this function to search <literal>$PATH</literal> for a command
 name, passed as an argument.  It returns true (zero) if the command was found,
@@ -736,8 +743,8 @@ Most Debian package maintainers are not native English speakers.  So, writing
 properly phrased templates may not be easy for them.
 </para>
 <para>
-Please use (and abuse) <email>debian-l10n-english@lists.debian.org</email>
-mailing list.  Have your templates proofread.
+Please use (and abuse) &email-debian-l10n-english; mailing
+list.  Have your templates proofread.
 </para>
 <para>
 Badly written templates give a poor image of your package, of your work...or
@@ -761,33 +768,52 @@ translated by translation teams or even individuals.
 <para>
 Please use gettext-based templates.  Install <systemitem
 role="package">po-debconf</systemitem> on your development system and read its
-documentation (man po-debconf is a good start).
+documentation (<literal>man po-debconf</literal> is a good start).
 </para>
 <para>
 Avoid changing templates too often.  Changing templates text induces more work
-to translators which will get their translation fuzzied.  If you plan changes
-to your original templates, please contact translators.  Most active
+to translators which will get their translation fuzzied.  A fuzzy translation is
+a string for which the original changed since it was translated, therefore
+requiring some update by a translator to be usable.  When changes are small
+enough, the original translation is kept in PO files but marked as
+<literal>fuzzy</literal>.
+</para>
+<para>
+If you plan to do changes
+to your original templates, please use the notification system provided with
+the <systemitem
+role="package">po-debconf</systemitem> package, namely the <command>
+podebconf-report-po</command>, to contact translators.  Most active
 translators are very responsive and getting their work included along with your
 modified templates will save you additional uploads.  If you use gettext-based
-templates, the translator's name and e-mail addresses are mentioned in the po
-files headers.
+templates, the translator's name and e-mail addresses are mentioned in the PO
+files headers and will be used by <command>
+podebconf-report-po</command>.
 </para>
 <para>
-The use of the <command>podebconf-report-po</command> from the po-debconf
-package is highly recommended to warn translators which have incomplete
-translations and request them for updates.
+A recommended use of that utility is:
 </para>
+<programlisting>cd debian/po &amp;&amp; podebconf-report-po --languageteam --withtranslators --call --deadline="+10 days"</programlisting>
 <para>
-If in doubt, you may also contact the translation team for a given language
-(debian-l10n-xxxxx@lists.debian.org), or the
-<email>debian-i18n@lists.debian.org</email> mailing list.
+This command will first synchronize the PO and POT files in debian/po with
+the templates files listed in <filename>debian/po/POTFILES.in</filename>.
+Then, it will send a call for translation updates to the language team
+(mentioned in the <literal>Language-Team</literal> field of each PO file)
+as well as the last translator (mentioned in
+<literal>Last-translator</literal>). Finally, it will also send a call for
+new translations, in the &email-debian-i18n; mailing list.
 </para>
 <para>
-Calls for translations posted to <email>debian-i18n@lists.debian.org</email>
-with the <filename>debian/po/templates.pot</filename> file attached or
-referenced in a URL are encouraged.  Be sure to mentions in these calls for new
-translations which languages you have existing translations for, in order to
-avoid duplicate work.
+Giving a deadline to translators is always appreciated, so that they can
+organize their work. Please remember that some translation teams have a
+formalized translate/review process and a delay lower than 10 days is
+considered as unreasonable. A shorter delay puts too much pressure on translation
+teams and should be kept for very minor changes.
+</para>
+<para>
+If in doubt, you may also contact the translation team for a given language
+(debian-l10n-xxxxx@&lists-host;), or the
+&email-debian-i18n; mailing list.
 </para>
 </section>
 
@@ -797,15 +823,89 @@ avoid duplicate work.
 When the text of a debconf template is corrected and you are <emphasis
 role="strong">sure</emphasis> that the change does <emphasis
 role="strong">not</emphasis> affect translations, please be kind to translators
-and unfuzzy their translations.
+and <emphasis>unfuzzy</emphasis> their translations.
 </para>
 <para>
 If you don't do so, the whole template will not be translated as long as a
 translator will send you an update.
 </para>
 <para>
-To <emphasis role="strong">unfuzzy</emphasis> translations, you can proceed the
-following way:
+To <emphasis>unfuzzy</emphasis> translations, you can use two methods. The first
+method does <emphasis>preventive</emphasis> search and replace actions in the
+PO files. The latter uses <command>gettext</command> utilities to <emphasis>unfuzzy</emphasis>
+strings.
+</para>
+<para>
+<emphasis>Preventive unfuzzy</emphasis> method:
+</para>
+<orderedlist numeration="arabic">
+<listitem>
+<para>
+Try finding a complete translation file <emphasis role="strong"> before</emphasis>
+the change:
+</para>
+<programlisting>for i in debian/po/*po; do echo -n $i: ; msgfmt -o /dev/null
+--statistics $i; done</programlisting>
+<para>
+The file only showing <emphasis>translated</emphasis> items will be used
+as the reference file. If there is none (which should not happen if you take
+care to properly interact with translators), you should use the file
+with the most translated strings.
+</para>
+</listitem>
+<listitem>
+<para>
+Identify the needed change. In this example, let's assume the change is about
+fixing a typo in the word <literal>typo</literal> which was inadvertently
+written as <literal>tpyo</literal>. Therefore, the change is
+<command>s/tpyo/typo</command>.
+</para>
+</listitem>
+<listitem>
+<para>
+Check that this change is only applied to the place where you really intend
+to make it and <emphasis role="strong">not</emphasis> in any other place
+where the original string is appropriate. This specifically applies to
+change in punctuation, for instance.
+</para>
+</listitem>
+<listitem>
+<para>
+Modify all PO files by using <command>sed</command>. The use of that command
+is recommended over any text editor to guarantee that the files encoding will
+not be broken by the edit action.
+</para>
+<programlisting>
+cd debian/po
+for i in *.po; do sed -i 's/tpyo/typo/g' $i; done
+</programlisting>
+</listitem>
+<listitem>
+<para>
+Change the debconf template file to fix the typo.
+</para>
+</listitem>
+<listitem>
+<para>
+Run <command>debconf-updatepo</command>
+</para>
+</listitem>
+<listitem>
+<para>
+Check the <filename>foo.po</filename> reference file. Its statistics should
+not be changed:
+</para>
+<programlisting>
+msgfmt -o /dev/null --statistics debian/po/foo.po
+</programlisting>
+</listitem>
+<listitem>
+If the file's statistics changed, you did something wrong. Try again
+or ask for help on the &email-debian-i18n; mailing list.
+</listitem>
+</orderedlist>
+<para>
+Gettext utilities method:
 </para>
 <orderedlist numeration="arabic">
 <listitem>
@@ -814,10 +914,8 @@ Put all incomplete PO files out of the way.  You can check the completeness by
 using (needs the <systemitem role="package">gettext</systemitem> package
 installed):
 </para>
-<screen>
- i in debian/po/*po; do echo -n $i: ; msgfmt -o /dev/null
---statistics $i; done
-</screen>
+<programlisting>for i in debian/po/*po; do echo -n $i: ; msgfmt -o /dev/null
+--statistics $i; done</programlisting>
 </listitem>
 <listitem>
 <para>
@@ -843,9 +941,7 @@ modified in translations.  You can see this by running the above again
 <para>
 use the following command:
 </para>
-<screen>
- i in debian/po/*po; do msgattrib --output-file=$i --clear-fuzzy $i; done
-</screen>
+<programlisting>for i in debian/po/*po; do msgattrib --output-file=$i --clear-fuzzy $i; done</programlisting>
 </listitem>
 <listitem>
 <para>
@@ -864,7 +960,7 @@ run <command>debconf-updatepo</command> again
 <title>Do not make assumptions about interfaces</title>
 <para>
 Templates text should not make reference to widgets belonging to some debconf
-interfaces.  Sentences like If you answer Yes...  have no meaning for users of
+interfaces.  Sentences like <emphasis>If you answer Yes...</emphasis> have no meaning for users of
 graphical interfaces which use checkboxes for boolean questions.
 </para>
 <para>
@@ -882,12 +978,12 @@ facts.
 <section id="s6.5.2.5">
 <title>Do not use first person</title>
 <para>
-You should avoid the use of first person (I will do this...  or We
-recommend...).  The computer is not a person and the Debconf templates do not
+You should avoid the use of first person (<emphasis>I will do this...</emphasis> or <emphasis>We
+recommend...</emphasis>).  The computer is not a person and the Debconf templates do not
 speak for the Debian developers.  You should use neutral construction.  Those
 of you who already wrote scientific publications, just write your templates
-like you would write a scientific paper.  However, try using action voice if
-still possible, like Enable this if ...  instead of This can be enabled if ....
+like you would write a scientific paper.  However, try using active voice if
+still possible, like <emphasis>Enable this if ...</emphasis> instead of <emphasis>This can be enabled if...</emphasis>.
 </para>
 </section>
 
@@ -939,7 +1035,36 @@ yes/no</emphasis>...
 <para>
 A choice between one of a number of values.  The choices must be specified in a
 field named 'Choices'.  Separate the possible values with commas and spaces,
-like this: Choices: yes, no, maybe
+like this: <literal>Choices: yes, no, maybe</literal>.
+</para>
+<para>
+If choices are translatable strings, the 'Choices' field may be marked as
+translatable by using <literal>__Choices</literal>. The double underscore will split out
+each choice in a separate string.
+</para>
+<para>
+The <command>po-debconf</command> system also offers interesting possibilities
+to only mark <emphasis role="strong">some</emphasis> choices as translatable.
+Example:
+</para>
+<programlisting>
+Template: foo/bar
+Type: Select
+#flag:translate:3
+__Choices: PAL, SECAM, Other
+_Description: TV standard:
+ Please choose the TV standard used in your country.
+</programlisting>
+<para>
+In that example, only the 'Other' string is translatable while others
+are acronyms that should not be translated. The above allows only
+'Other' to be included in PO and POT files.
+</para>
+<para>
+The debconf templates flag system offers many such possibilities. The
+<citerefentry>
+<refentrytitle>po-debconf</refentrytitle> <manvolnum>7</manvolnum>
+</citerefentry> manual page lists all these possibilities.
 </para>
 </section>
 
@@ -1182,14 +1307,14 @@ the _DefaultChoice trick.
 <para>
 This special field allow translators to put the most appropriate choice
 according to their own language.  It will become the default choice when their
-language is used while your own mentioned Default Choice will be used chan
+language is used while your own mentioned Default Choice will be used when
 using English.
 </para>
 <para>
 Example, taken from the geneweb package templates:
 </para>
 <screen>
-: geneweb/lang
+Template: geneweb/lang
 Type: select
 __Choices: Afrikaans (af), Bulgarian (bg), Catalan (ca), Chinese (zh), Czech (cs), Danish (da), Dutch (nl), English (en), Esperanto (eo), Estonian (et), Finnish (fi), French (fr), German (de), Hebrew (he), Icelandic (is), Italian (it), Latvian (lv), Norwegian (no), Polish (pl), Portuguese (pt), Romanian (ro), Russian (ru), Spanish (es), Swedish (sv)
 # This is the default choice. Translators may put their own language here
@@ -1283,13 +1408,12 @@ 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 <ulink
-url="http://cvs.debian.org/boot-floppies/documentation/doc-check?rev=HEAD\|[amp
-]\|content-type=text/vnd.viewcvs-markup">doc-check</ulink> in the <systemitem
-role="package">boot-floppies</systemitem> 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.
+url="&url-i18n-doc-check;">doc-check</ulink> in the
+<systemitem role="package">boot-floppies</systemitem> 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.
 </para>
 <para>
 If you maintain XML or SGML documentation, we suggest that you isolate any
@@ -1303,6 +1427,15 @@ easier, for instance, to keep URLs up to date across multiple files.
 
 <section id="bpp-common-situations">
 <title>Common packaging situations</title>
+<!--
+<section id="bpp-kernel">
+<title>Kernel modules/patches</title>
+<para>
+FIXME: Heavy use of kernel-package. provide files in
+/etc/modutils/ for module configuration.
+</para>
+</section>
+-->
 <section id="bpp-autotools">
 <title>Packages using <command>autoconf</command>/<command>automake</command></title>
 <para>
@@ -1311,7 +1444,7 @@ Keeping <command>autoconf</command>'s <filename>config.sub</filename> and
 especially on more volatile architectures.  Some very good packaging practices
 for any package using <command>autoconf</command> and/or
 <command>automake</command> have been synthesized in
-<filename>/usr/share/doc/autotools-dev/README.Debian.gz</filename> from the
+&file-bpp-autotools; from the
 <systemitem role="package">autotools-dev</systemitem> package.  You're strongly
 encouraged to read this file and to follow the given recommendations.
 </para>
@@ -1327,7 +1460,7 @@ library can result in dozens of dependent packages breaking.
 </para>
 <para>
 Good practices for library packaging have been grouped in <ulink
-url="http://www.netfort.gr.jp/~dancer/column/libpkg-guide/">the library
+url="&url-libpkg-guide;">the library
 packaging guide</ulink>.
 </para>
 </section>
@@ -1336,7 +1469,7 @@ packaging guide</ulink>.
 <title>Documentation</title>
 <para>
 Be sure to follow the <ulink
-url="http://www.debian.org/doc/debian-policy/ch-docs.html">Policy on
+url="&url-debian-policy;ch-docs.html">Policy on
 documentation</ulink>.
 </para>
 <para>
@@ -1357,6 +1490,20 @@ role="package">doc-base</systemitem> on installation.  See the <systemitem
 role="package">doc-base</systemitem> package documentation for more
 information.
 </para>
+<para>
+Debian policy (section 12.1) directs that manual pages should accompany every
+program, utility, and function, and suggests them for other objects like
+configuration files. If the work you are packaging does not have such manual
+pages, consider writing them for inclusion in your package, and submitting them
+upstream.
+</para>
+<para>
+The manpages do not need to be written directly in the troff format.  Popular
+source formats are Docbook, POD and reST, which can be converted using
+<command>xsltproc</command>, <command>pod2man</command> and
+<command>rst2man</command> respectively. To a lesser extent, the <command>
+help2man</command>program can also be used to write a stub.
+</para>
 </section>
 
 <section id="bpp-other">
@@ -1369,7 +1516,7 @@ packaging rules and practices:
 <listitem>
 <para>
 Perl related packages have a <ulink
-url="http://www.debian.org/doc/packaging-manuals/perl-policy/">Perl
+url="&url-perl-policy;">Perl
 policy</ulink>, some examples of packages following that policy are <systemitem
 role="package">libdbd-pg-perl</systemitem> (binary perl module) or <systemitem
 role="package">libmldbm-perl</systemitem> (arch independent perl module).
@@ -1378,30 +1525,30 @@ role="package">libmldbm-perl</systemitem> (arch independent perl module).
 <listitem>
 <para>
 Python related packages have their python policy; see
-<filename>/usr/share/doc/python/python-policy.txt.gz</filename> in the
-<systemitem role="package">python</systemitem> package.
+&file-python-policy; in the <systemitem
+role="package">python</systemitem> package.
 </para>
 </listitem>
 <listitem>
 <para>
 Emacs related packages have the <ulink
-url="http://www.debian.org/doc/packaging-manuals/debian-emacs-policy">emacs
+url="&url-emacs-policy;">emacs
 policy</ulink>.
 </para>
 </listitem>
 <listitem>
 <para>
 Java related packages have their <ulink
-url="http://www.debian.org/doc/packaging-manuals/java-policy/">java
+url="&url-java-policy;">java
 policy</ulink>.
 </para>
 </listitem>
 <listitem>
 <para>
 Ocaml related packages have their own policy, found in
-<filename>/usr/share/doc/ocaml/ocaml_packaging_policy.gz</filename> from the
-<systemitem role="package">ocaml</systemitem> package.  A good example is the
-<systemitem role="package">camlzip</systemitem> source package.
+&file-ocaml-policy; from the <systemitem
+role="package">ocaml</systemitem> package.  A good example is the <systemitem
+role="package">camlzip</systemitem> source package.
 </para>
 </listitem>
 <listitem>
@@ -1414,12 +1561,33 @@ in the <systemitem role="package">sgml-base-doc</systemitem> package.
 <para>
 Lisp packages should register themselves with <systemitem
 role="package">common-lisp-controller</systemitem>, about which see
-<filename>/usr/share/doc/common-lisp-controller/README.packaging</filename>.
+&file-lisp-controller;.
 </para>
 </listitem>
+<!-- TODO: mozilla extension policy, once that becomes available -->
 </itemizedlist>
 </section>
 
+<!--
+<section id="custom-config-files">
+<title>Custom configuration files</title>
+<para>
+FIXME: speak of "ucf", explain solution with a template,
+explain conf.d directories
+</para>
+</section>
+<section id="config-with-db">
+<title>Use of an external database</title>
+<para>
+FIXME: The software may require a database that you need to setup.
+But the database may be local or distant. Thus you can't depend
+on a database server but just on the corresponding library.
+
+sympa may be an example package
+</para>
+</section>
+-->
+
 <section id="bpp-archindepdata">
 <title>Architecture-independent data</title>
 <para>
@@ -1436,7 +1604,7 @@ you avoid needless duplication of the same data into eleven or more .debs, one
 per each architecture.  While this adds some extra overhead into the
 <filename>Packages</filename> files, it saves a lot of disk space on Debian
 mirrors.  Separating out architecture-independent data also reduces processing
-time of <command>lintian</command> or <command>linda</command> (see <xref
+time of <command>lintian</command> (see <xref
 linkend="tools-lint"/> ) when run over the entire Debian archive.
 </para>
 </section>
@@ -1448,12 +1616,12 @@ If you need a certain locale during build, you can create a temporary file via
 this trick:
 </para>
 <para>
-If you set LOCPATH to the equivalent of /usr/lib/locale, and LC_ALL to the name
+If you set <varname>LOCPATH</varname> to the equivalent of <filename>/usr/lib/locale</filename>, and <varname>LC_ALL</varname> to the name
 of the locale you generate, you should get what you want without being root.
 Something like this:
 </para>
 <screen>
-=debian/tmpdir/usr/lib/locale
+LOCALE_PATH=debian/tmpdir/usr/lib/locale
 LOCALE_NAME=en_IN
 LOCALE_CHARSET=UTF-8
 
@@ -1475,26 +1643,17 @@ sections, to hunt down unused libraries.  But when passed the right argument,
 it tries to catch other useless packages.
 </para>
 <para>
-For example, with --guess-dummy, deborphan tries to search all transitional
-packages which were needed for upgrade but which can now safely be removed.
+For example, with <literal>--guess-dummy</literal>, <command>deborphan</command>
+tries to search all transitional packages which were needed for upgrade but
+which can now safely be removed.
 For that, it looks for the string dummy or transitional in their short
 description.
 </para>
 <para>
 So, when you are creating such a package, please make sure to add this text to
 your short description.  If you are looking for examples, just run:
-</para>
-<screen>
--cache search .|grep dummy
-</screen>
-<para>
-or
-</para>
-<screen>
--cache search .|grep transitional
-</screen>
-<para>
-.
+<command>apt-cache search .|grep dummy</command> or
+<command>apt-cache search .|grep transitional</command>.
 </para>
 </section>
 
@@ -1508,7 +1667,7 @@ upstream source.
 <title>Pristine source</title>
 <para>
 The defining characteristic of a pristine source tarball is that the
-.orig.tar.gz file is byte-for-byte identical to a tarball officially
+<literal>.orig.tar.{gz,bz2}</literal> file is byte-for-byte identical to a tarball officially
 distributed by the upstream author.  <footnote><para> We cannot prevent
 upstream authors from changing the tarball they distribute without also
 incrementing the version number, so there can be no guarantee that a pristine
@@ -1516,9 +1675,9 @@ tarball is identical to what upstream <emphasis>currently</emphasis>
 distributing at any point in time.  All that can be expected is that it is
 identical to something that upstream once <emphasis>did</emphasis> distribute.
 If a difference arises later (say, if upstream notices that he wasn't using
-maximal comression in his original distribution and then
-re-<literal>gzip</literal>s it), that's just too bad.  Since there is no good
-way to upload a new .orig.tar.gz for the same version, there is not even any
+maximal compression in his original distribution and then
+re-<command>gzip</command>s it), that's just too bad.  Since there is no good
+way to upload a new <literal>.orig.tar.{gz,bz2}</literal> for the same version, there is not even any
 point in treating this situation as a bug.  </para> </footnote> This makes it
 possible to use checksums to easily verify that all changes between Debian's
 version and upstream's are contained in the Debian diff.  Also, if the original
@@ -1538,7 +1697,7 @@ tarballs as pristine source.  Its strategy is equivalent to the following:
 It unpacks the tarball in an empty temporary directory by doing
 </para>
 <screen>
- path/to/&lt;packagename&gt;_&lt;upstream-version&gt;.orig.tar.gz | tar xf -
+zcat path/to/&lt;packagename&gt;_&lt;upstream-version&gt;.orig.tar.gz | tar xf -
 </screen>
 </listitem>
 <listitem>
@@ -1572,12 +1731,12 @@ gzipped tar at all, or if upstream's tarball contains non-DFSG-free material
 that you must remove before uploading.
 </para>
 <para>
-In these cases the developer must construct a suitable .orig.tar.gz file
-himself.  We refer to such a tarball as a repackaged upstream source.  Note
-that a repackaged upstream source is different from a Debian-native package.  A
-repackaged source still comes with Debian-specific changes in a separate
-<literal>.diff.gz</literal> and still has a version number composed of
-<literal>&lt;upstream-version&gt;</literal> and
+In these cases the developer must construct a suitable <literal>.orig.tar.{gz,bz2}
+</literal> file himself.  We refer to such a tarball as a repackaged upstream 
+source.  Note that a repackaged upstream source is different from a 
+Debian-native package.  A repackaged source still comes with Debian-specific
+changes in a separate <literal>.diff.gz</literal> or <literal>.debian.tar.{gz,bz2}</literal> and still has a version
+number composed of <literal>&lt;upstream-version&gt;</literal> and
 <literal>&lt;debian-revision&gt;</literal>.
 </para>
 <para>
@@ -1590,18 +1749,19 @@ archive.  Use your own discretion here, but be prepared to defend your decision
 if you repackage source that could have been pristine.
 </para>
 <para>
-A repackaged .orig.tar.gz
+A repackaged <literal>.orig.tar.{gz,bz2}</literal>
 </para>
 <orderedlist numeration="arabic">
 <listitem>
 <para>
-<emphasis role="strong">must</emphasis> contain detailed information how the
-repackaged source was obtained, and how this can be reproduced in the
+should be documented in the resulting source package.
+Detailed information on how the repackaged source was obtained,
+and on how this can be reproduced should be provided in
 <filename>debian/copyright</filename>.  It is also a good idea to provide a
 <literal>get-orig-source</literal> target in your
 <filename>debian/rules</filename> file that repeats the process, as described
 in the Policy Manual, <ulink
-url="http://www.debian.org/doc/debian-policy/ch-source.html#s-debianrules">Main
+url="&url-debian-policy;ch-source.html#s-debianrules">Main
 building script: debian/rules</ulink>.
 </para>
 </listitem>
@@ -1612,7 +1772,7 @@ come from the upstream author(s), or whose contents has been changed by you.
 <footnote><para> As a special exception, if the omission of non-free files
 would lead to the source failing to build without assistance from the Debian
 diff, it might be appropriate to instead edit the files, omitting only the
-non-free parts of them, and/or explain the situation in a README.Debian-source
+non-free parts of them, and/or explain the situation in a README.source
 file in the root of the source tree.  But in that case please also urge the
 upstream author to make the non-free components easier seperable from the rest
 of the source.  </para> </footnote>
@@ -1644,46 +1804,24 @@ distinguish pristine tarballs from repackaged ones.
 </listitem>
 <listitem>
 <para>
-<emphasis role="strong">should</emphasis> be gzipped with maximal compression.
+<emphasis role="strong">should</emphasis> be gzipped or bzipped with maximal compression.
 </para>
 </listitem>
 </orderedlist>
-<para>
-The canonical way to meet the latter two points is to let <literal>dpkg-source
--b</literal> construct the repackaged tarball from an unpacked directory.
-</para>
 </section>
 
 <section id="changed-binfiles">
-<title>Changing binary files in <literal>diff.gz</literal></title>
+<title>Changing binary files</title>
 <para>
 Sometimes it is necessary to change binary files contained in the original
-tarball, or to add binary files that are not in it.  If this is done by simply
-copying the files into the debianized source tree,
-<command>dpkg-source</command> will not be able to handle this.  On the other
-hand, according to the guidelines given above, you cannot include such a
-changed binary file in a repackaged <filename>orig.tar.gz</filename>.  Instead,
-include the file in the <filename>debian</filename> directory in
-<command>uuencode</command>d (or similar) form <footnote><para> The file should
-have a name that makes it clear which binary file it encodes.  Usually, some
-postfix indicating the encoding should be appended to the original filename.
-Note that you don't need to depend on <systemitem
-role="package">sharutils</systemitem> to get the <command>uudecode</command>
-program if you use <command>perl</command>'s <literal>pack</literal> function.
-The code could look like </para> <screen> -file: perl -ne 'print(pack u, $$_);'
-$(file) &gt; $(file).uuencoded uudecode-file: perl -ne 'print(unpack u, $$_);'
-$(file).uuencoded &gt; $(file) </screen> </footnote>.  The file would then be
-decoded and copied to its place during the build process.  Thus the change will
-be visible quite easy.
-</para>
-<para>
-Some packages use <command>dbs</command> to manage patches to their upstream
-source, and always create a new <literal>orig.tar.gz</literal> file that
-contains the real <literal>orig.tar.gz</literal> in its toplevel directory.
-This is questionable with respect to the preference for pristine source.  On
-the other hand, it is easy to modify or add binary files in this case: Just put
-them into the newly created <literal>orig.tar.gz</literal> file, besides the
-real one, and copy them to the right place during the build process.
+tarball, or to add binary files that are not in it. This is fully supported
+when using source packages in “3.0 (quilt)” format, see the
+<citerefentry><refentrytitle>dpkg-source</refentrytitle><manvolnum>1</manvolnum></citerefentry>
+manual page for details. When using the older format “1.0”, binary files
+can't be stored in the <filename>.diff.gz</filename> so you must store
+an <command>uuencode</command>d (or similar) version of the file(s)
+and decode it at build time in <filename>debian/rules</filename> (and move
+it in its official location).
 </para>
 </section>
 
@@ -1714,33 +1852,34 @@ Some debug packages may contain an entire special debugging build of a library
 or other binary, but most of them can save space and build time by instead
 containing separated debugging symbols that gdb can find and load on the fly
 when debugging a program or library.  The convention in Debian is to keep these
-symbols in <filename>/usr/lib/debug/path</filename>, where
-<emphasis>path</emphasis> is the path to the executable or library.  For
+symbols in <filename>/usr/lib/debug/<replaceable>path</replaceable></filename>, where
+<replaceable>path</replaceable> is the path to the executable or library.  For
 example, debugging symbols for <filename>/usr/bin/foo</filename> go in
 <filename>/usr/lib/debug/usr/bin/foo</filename>, and debugging symbols for
 <filename>/usr/lib/libfoo.so.1</filename> go in
 <filename>/usr/lib/debug/usr/lib/libfoo.so.1</filename>.
 </para>
 <para>
-The debugging symbols can be extracted from an object file using objcopy
---only-keep-debug.  Then the object file can be stripped, and objcopy
---add-gnu-debuglink used to specify the path to the debugging symbol file.
+The debugging symbols can be extracted from an object file using <command>
+objcopy --only-keep-debug</command>.  Then the object file can be stripped,
+and <command>objcopy --add-gnu-debuglink</command> used to specify the path
+to the debugging symbol file. 
 <citerefentry> <refentrytitle>objcopy</refentrytitle> <manvolnum>1</manvolnum>
 </citerefentry> explains in detail how this works.
 </para>
 <para>
-The dh_strip command in debhelper supports creating debug packages, and can
-take care of using objcopy to separate out the debugging symbols for you.  If
-your package uses debhelper, all you need to do is call dh_strip
---dbg-package=libfoo-dbg, and add an entry to debian/control for the debug
-package.
+The <command>dh_strip</command> command in debhelper supports creating debug
+packages, and can take care of using <command>objcopy</command> to separate
+out the debugging symbols for you.  If your package uses debhelper, all you
+need to do is call <command>dh_strip --dbg-package=libfoo-dbg</command>, and
+add an entry to <filename>debian/control</filename> for the debug package.
 </para>
 <para>
-Note that the Debian package should depend on the package that it provides
+Note that the debug package should depend on the package that it provides
 debugging symbols for, and this dependency should be versioned.  For example:
 </para>
 <screen>
-: libfoo-dbg (= ${binary:Version})
+Depends: libfoo (= ${binary:Version})
 </screen>
 </section>