X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=developers-reference.git;a=blobdiff_plain;f=best-pkging-practices.dbk;h=32d5115f885ef7133b7b27c8a5a2e3d6f37e432d;hp=a3852bbf30e71970276a6ba42ed62ceea381e993;hb=f67750abdac139d21380c34ca0ba540e09e03153;hpb=ff731cb8519b2869aaf388e037c04ca15943cd1e diff --git a/best-pkging-practices.dbk b/best-pkging-practices.dbk index a3852bb..32d5115 100644 --- a/best-pkging-practices.dbk +++ b/best-pkging-practices.dbk @@ -96,27 +96,35 @@ diffs (e.g., from .diff.gz) and work out which patch sets to back out as a unit as bugs are fixed upstream. -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 -(.diff.gz), usually within the -debian/ directory. The only difference is that they -aren't applied immediately by dpkg-source, but by the build -rule of debian/rules. Conversely, they are reverted in -the clean rule. +Fortunately, with the source format “3.0 (quilt)” it is now possible to +keep patches separate without having to modify debian/rules +to setup a patch system. Patches are stored in debian/patches/ +and when the source package is unpacked patches listed in +debian/patches/series are automatically applied. +As the name implies, patches can be managed with quilt. -dbs 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 dbs for more -information and hello-dbs 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 (.diff.gz), usually +within the debian/ directory. The only difference is +that they aren't applied immediately by dpkg-source, +but by the build rule of +debian/rules, through a dependency on the +patch rule. Conversely, they are reverted in the +clean rule, through a dependency on the +unpatch rule. -dpatch also provides these facilities, but it's intended to -be even easier to use. See the package dpatch for documentation and examples (in -/usr/share/doc/dpatch). +quilt is the recommended tool for this. +It does all of the above, and also allows to manage patch series. +See the +quilt package for more information. + + +There are other tools to manage patches, like dpatch, +and the patch system integrated with +cdbs. @@ -210,41 +218,50 @@ along to &email-debian-l10n-english; and request feedback.
The package synopsis, or short description -The synopsis line (the short description) should be concise. It must not -repeat the package's name (this is policy). +Policy says the synopsis line (the short description) must be concise, not +repeating the package name, but also informative. -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). - - -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: -package-name is a synopsis. +Package: libeg0 +Description: exemplification support library -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: + + +The package name provides {a,an,the,some} +synopsis. - -package-name is synopsis. - -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: -package-name are synopsis. +Package: eg-tools +Description: simple exemplification system (utilities) + +Package: eg-doc +Description: simple exemplification system - documentation -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 +"name" has a synopsis +"suite (role)" or +"suite - role", the +elements should be phrased so that they fit into the formula: + + +The package name provides {a,an,the} +role for the suite.
@@ -755,30 +772,49 @@ documentation (man po-debconf is a good start). 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 +fuzzy. + + +If you plan to do changes +to your original templates, please use the notification system provided with +the po-debconf package, namely the +podebconf-report-po, 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 +podebconf-report-po. + + +A recommended use of that utility is: + +cd debian/po && podebconf-report-po --languageteam --withtranslators --call --deadline="+10 days" + +This command will first synchronize the PO and POT files in debian/po with +the templates files listed in debian/po/POTFILES.in. +Then, it will send a call for translation updates to the language team +(mentioned in the Language-Team field of each PO file) +as well as the last translator (mentioned in +Last-translator). Finally, it will also send a call for +new translations, in the &email-debian-i18n; mailing list. -The use of the podebconf-report-po from the po-debconf package is highly recommended to warn -translators which have incomplete translations and request them for updates. +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. 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. - -Calls for translations posted to &email-debian-i18n; with the -debian/po/templates.pot 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. -
@@ -787,15 +823,89 @@ work. When the text of a debconf template is corrected and you are sure that the change does not affect translations, please be kind to translators -and unfuzzy their translations. +and unfuzzy their translations. If you don't do so, the whole template will not be translated as long as a translator will send you an update. -To unfuzzy translations, you can proceed the -following way: +To unfuzzy translations, you can use two methods. The first +method does preventive search and replace actions in the +PO files. The latter uses gettext utilities to unfuzzy +strings. + + +Preventive unfuzzy method: + + + + +Try finding a complete translation file before +the change: + +for i in debian/po/*po; do echo -n $i: ; msgfmt -o /dev/null +--statistics $i; done + +The file only showing translated 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. + + + + +Identify the needed change. In this example, let's assume the change is about +fixing a typo in the word typo which was inadvertently +written as tpyo. Therefore, the change is +s/tpyo/typo. + + + + +Check that this change is only applied to the place where you really intend +to make it and not in any other place +where the original string is appropriate. This specifically applies to +change in punctuation, for instance. + + + + +Modify all PO files by using sed. 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. + + +cd debian/po +for i in *.po; do sed -i 's/tpyo/typo/g' $i; done + + + + +Change the debconf template file to fix the typo. + + + + +Run debconf-updatepo + + + + +Check the foo.po reference file. Its statistics should +not be changed: + + +msgfmt -o /dev/null --statistics debian/po/foo.po + + + +If the file's statistics changed, you did something wrong. Try again +or ask for help on the &email-debian-i18n; mailing list. + + + +Gettext utilities method: @@ -850,7 +960,7 @@ run debconf-updatepo again Do not make assumptions about interfaces 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 If you answer Yes... have no meaning for users of graphical interfaces which use checkboxes for boolean questions. @@ -868,12 +978,12 @@ facts.
Do not use first person -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 (I will do this... or We +recommend...). 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 Enable this if ... instead of This can be enabled if....
@@ -925,7 +1035,36 @@ yes/no... 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: Choices: yes, no, maybe. + + +If choices are translatable strings, the 'Choices' field may be marked as +translatable by using __Choices. The double underscore will split out +each choice in a separate string. + + +The po-debconf system also offers interesting possibilities +to only mark some choices as translatable. +Example: + + +Template: foo/bar +Type: Select +#flag:translate:3 +__Choices: PAL, SECAM, Other +_Description: TV standard: + Please choose the TV standard used in your country. + + +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. + + +The debconf templates flag system offers many such possibilities. The + +po-debconf 7 + manual page lists all these possibilities.
@@ -1168,7 +1307,7 @@ the _DefaultChoice trick. 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. @@ -1351,6 +1490,20 @@ role="package">doc-base on installation. See the doc-base package documentation for more information. + +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. + + +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 +xsltproc, pod2man and +rst2man respectively. To a lesser extent, the +help2manprogram can also be used to write a stub. +
@@ -1514,7 +1667,7 @@ upstream source. Pristine source The defining characteristic of a pristine source tarball is that the -.orig.tar.gz file is byte-for-byte identical to a tarball officially +.orig.tar.{gz,bz2} file is byte-for-byte identical to a tarball officially distributed by the upstream author. 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 @@ -1524,7 +1677,7 @@ identical to something that upstream once did distribute. If a difference arises later (say, if upstream notices that he wasn't using maximal compression in his original distribution and then re-gzips 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 +way to upload a new .orig.tar.{gz,bz2} for the same version, there is not even any point in treating this situation as a bug. 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 @@ -1578,11 +1731,11 @@ gzipped tar at all, or if upstream's tarball contains non-DFSG-free material that you must remove before uploading. -In these cases the developer must construct a suitable .orig.tar.gz +In these cases the developer must construct a suitable .orig.tar.{gz,bz2} 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 .diff.gz and still has a version +changes in a separate .diff.gz or .debian.tar.{gz,bz2} and still has a version number composed of <upstream-version> and <debian-revision>. @@ -1596,14 +1749,14 @@ archive. Use your own discretion here, but be prepared to defend your decision if you repackage source that could have been pristine. -A repackaged .orig.tar.gz +A repackaged .orig.tar.{gz,bz2} -must be documented in the resulting source package. +should be documented in the resulting source package. Detailed information on how the repackaged source was obtained, -and on how this can be reproduced must be provided in +and on how this can be reproduced should be provided in debian/copyright. It is also a good idea to provide a get-orig-source target in your debian/rules file that repeats the process, as described @@ -1619,8 +1772,7 @@ come from the upstream author(s), or whose contents has been changed by you. 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. @@ -1652,47 +1804,24 @@ distinguish pristine tarballs from repackaged ones. -should be gzipped with maximal compression. +should be gzipped or bzipped with maximal compression. - -The canonical way to meet the latter two points is to let dpkg-source --b construct the repackaged tarball from an unpacked directory. -
-Changing binary files in <literal>diff.gz</literal> +Changing binary files 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, -dpkg-source 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 orig.tar.gz. Instead, -include the file in the debian directory in -uuencoded (or similar) form 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 sharutils to get the uudecode -program if you use perl's pack function. -The code could look like - -&example-uu; -. The file would then be -decoded and copied to its place during the build process. Thus the change will -be visible quite easy. - - -Some packages use dbs to manage patches to their upstream -source, and always create a new orig.tar.gz file that -contains the real orig.tar.gz 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 orig.tar.gz 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 +dpkg-source1 +manual page for details. When using the older format “1.0”, binary files +can't be stored in the .diff.gz so you must store +an uuencoded (or similar) version of the file(s) +and decode it at build time in debian/rules (and move +it in its official location).