chiark / gitweb /
Use dblatex instead of fop, as long fop is in contrib.
[developers-reference.git] / best-pkging-practices.dbk
index 63b7f87c44284a764154b18c8d440ce5e4c2e8f6..ca1bfb38ffe1ee40eb9538d01e66b17c364f11ab 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
@@ -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>
 
@@ -153,7 +155,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>
@@ -201,8 +203,7 @@ 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>
 
@@ -278,10 +279,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:
@@ -341,7 +342,7 @@ added at the end of description, using the following format:
 <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>.
+url="&url-eg-desc-upstream-info;"></ulink>.
 </para>
 <para>
 If there is no home page for the software, this should naturally be left out.
@@ -349,11 +350,11 @@ If there is no home page for the software, this should naturally be left out.
 <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
+and <literal>&packages-host;</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.
+<filename>&packages-host;</filename> to parse it correctly.
 </para>
 </section>
 
@@ -427,7 +428,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">
@@ -582,7 +583,7 @@ as it will not be automatically checked during build as the changelog is.  Here
 is an example of a real NEWS.Debian 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
@@ -613,7 +614,7 @@ NEWS.Debian file in your package.  No news is good news!
 <para>
 FIXME: presentation of cvs-buildpackage, updating sources
 via CVS (debian/rules refresh).
-<ulink url="http://www.debian.org/devel/cvs_packages">"http://www.debian.org/devel/cvs_packages"</ulink>
+<ulink url="&url-devel-docs;cvs_packages">"&url-devel-docs;cvs_packages"</ulink>
 </para>
 </section>
 -->
@@ -626,7 +627,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
@@ -661,27 +662,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,
@@ -753,8 +739,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
@@ -796,15 +782,15 @@ translations and request them for updates.
 </para>
 <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.
+(debian-l10n-xxxxx@&lists-host;), or 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.
+Calls for translations posted to &email-debian-i18n; 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.
 </para>
 </section>
 
@@ -831,10 +817,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>
@@ -860,9 +844,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>
@@ -1206,7 +1188,7 @@ using English.
 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
@@ -1300,13 +1282,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
@@ -1337,7 +1318,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>
@@ -1353,7 +1334,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>
@@ -1362,7 +1343,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>
@@ -1395,7 +1376,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).
@@ -1404,30 +1385,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>
@@ -1440,7 +1421,7 @@ 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 -->
@@ -1495,12 +1476,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
 
@@ -1530,18 +1511,8 @@ description.
 <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>
 
@@ -1585,7 +1556,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>
@@ -1648,7 +1619,7 @@ repackaged source was obtained, and how this can be reproduced in the
 <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>
@@ -1718,9 +1689,10 @@ 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
+The code could look like
+</para>
+&example-uu;
+</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>
@@ -1788,7 +1760,7 @@ Note that the Debian 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-dbg (= ${binary:Version})
 </screen>
 </section>