1 # SOME DESCRIPTIVE TITLE
2 # Copyright (C) YEAR Free Software Foundation, Inc.
3 # This file is distributed under the same license as the PACKAGE package.
4 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
9 "Project-Id-Version: PACKAGE VERSION\n"
10 "POT-Creation-Date: 2011-03-03 11:18-0400\n"
11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 "Language-Team: LANGUAGE <LL@li.org>\n"
16 "Content-Type: text/plain; charset=UTF-8\n"
17 "Content-Transfer-Encoding: 8bit\n"
19 #. type: Content of: <chapter><title>
20 #: best-pkging-practices.dbk:7
21 msgid "Best Packaging Practices"
24 #. type: Content of: <chapter><para>
25 #: best-pkging-practices.dbk:9
27 "Debian's quality is largely due to the <ulink url=\"&url-debian-policy;"
28 "\">Debian Policy</ulink>, which defines explicit baseline requirements which "
29 "all Debian packages must fulfill. Yet there is also a shared history of "
30 "experience which goes beyond the Debian Policy, an accumulation of years of "
31 "experience in packaging. Many very talented people have created great "
32 "tools, tools which help you, the Debian maintainer, create and maintain "
36 #. type: Content of: <chapter><para>
37 #: best-pkging-practices.dbk:18
39 "This chapter provides some best practices for Debian developers. All "
40 "recommendations are merely that, and are not requirements or policy. These "
41 "are just some subjective hints, advice and pointers collected from Debian "
42 "developers. Feel free to pick and choose whatever works best for you."
45 #. type: Content of: <chapter><section><title>
46 #: best-pkging-practices.dbk:24
47 msgid "Best practices for <filename>debian/rules</filename>"
50 #. type: Content of: <chapter><section><para>
51 #: best-pkging-practices.dbk:26
53 "The following recommendations apply to the <filename>debian/rules</filename> "
54 "file. Since <filename>debian/rules</filename> controls the build process "
55 "and selects the files which go into the package (directly or indirectly), "
56 "it's usually the file maintainers spend the most time on."
59 #. type: Content of: <chapter><section><section><title>
60 #: best-pkging-practices.dbk:32
61 msgid "Helper scripts"
64 #. type: Content of: <chapter><section><section><para>
65 #: best-pkging-practices.dbk:34
67 "The rationale for using helper scripts in <filename>debian/rules</filename> "
68 "is that they let maintainers use and share common logic among many "
69 "packages. Take for instance the question of installing menu entries: you "
70 "need to put the file into <filename>/usr/share/menu</filename> (or "
71 "<filename>/usr/lib/menu</filename> for executable binary menufiles, if this "
72 "is needed), and add commands to the maintainer scripts to register and "
73 "unregister the menu entries. Since this is a very common thing for packages "
74 "to do, why should each maintainer rewrite all this on their own, sometimes "
75 "with bugs? Also, supposing the menu directory changed, every package would "
79 #. type: Content of: <chapter><section><section><para>
80 #: best-pkging-practices.dbk:45
82 "Helper scripts take care of these issues. Assuming you comply with the "
83 "conventions expected by the helper script, the helper takes care of all the "
84 "details. Changes in policy can be made in the helper script; then packages "
85 "just need to be rebuilt with the new version of the helper and no other "
89 #. type: Content of: <chapter><section><section><para>
90 #: best-pkging-practices.dbk:52
92 "<xref linkend=\"tools\"/> contains a couple of different helpers. The most "
93 "common and best (in our opinion) helper system is <systemitem role=\"package"
94 "\">debhelper</systemitem>. Previous helper systems, such as <systemitem "
95 "role=\"package\">debmake</systemitem>, were monolithic: you couldn't pick "
96 "and choose which part of the helper you found useful, but had to use the "
97 "helper to do everything. <systemitem role=\"package\">debhelper</"
98 "systemitem>, however, is a number of separate little <command>dh_*</command> "
99 "programs. For instance, <command>dh_installman</command> installs and "
100 "compresses man pages, <command>dh_installmenu</command> installs menu files, "
101 "and so on. Thus, it offers enough flexibility to be able to use the little "
102 "helper scripts, where useful, in conjunction with hand-crafted commands in "
103 "<filename>debian/rules</filename>."
106 #. type: Content of: <chapter><section><section><para>
107 #: best-pkging-practices.dbk:66
109 "You can get started with <systemitem role=\"package\">debhelper</systemitem> "
110 "by reading <citerefentry> <refentrytitle>debhelper</refentrytitle> "
111 "<manvolnum>1</manvolnum> </citerefentry>, and looking at the examples that "
112 "come with the package. <command>dh_make</command>, from the <systemitem "
113 "role=\"package\">dh-make</systemitem> package (see <xref linkend=\"dh-make\"/"
114 ">), can be used to convert a vanilla source package to a <systemitem role="
115 "\"package\">debhelper</systemitem>ized package. This shortcut, though, "
116 "should not convince you that you do not need to bother understanding the "
117 "individual <command>dh_*</command> helpers. If you are going to use a "
118 "helper, you do need to take the time to learn to use that helper, to learn "
119 "its expectations and behavior."
122 #. type: Content of: <chapter><section><section><para>
123 #: best-pkging-practices.dbk:79
125 "Some people feel that vanilla <filename>debian/rules</filename> files are "
126 "better, since you don't have to learn the intricacies of any helper system. "
127 "This decision is completely up to you. Use what works for you. Many "
128 "examples of vanilla <filename>debian/rules</filename> files are available at "
129 "<ulink url=\"&url-rules-files;\"></ulink>."
132 #. type: Content of: <chapter><section><section><title>
133 #: best-pkging-practices.dbk:88
134 msgid "Separating your patches into multiple files"
137 #. type: Content of: <chapter><section><section><para>
138 #: best-pkging-practices.dbk:90
140 "Big, complex packages may have many bugs that you need to deal with. If you "
141 "correct a number of bugs directly in the source, and you're not careful, it "
142 "can get hard to differentiate the various patches that you applied. It can "
143 "get quite messy when you have to update the package to a new upstream "
144 "version which integrates some of the fixes (but not all). You can't take "
145 "the total set of diffs (e.g., from <filename>.diff.gz</filename>) and work "
146 "out which patch sets to back out as a unit as bugs are fixed upstream."
149 #. type: Content of: <chapter><section><section><para>
150 #: best-pkging-practices.dbk:99
152 "Fortunately, with the source format “3.0 (quilt)” it is now possible to keep "
153 "patches separate without having to modify <filename>debian/rules</filename> "
154 "to setup a patch system. Patches are stored in <filename>debian/patches/</"
155 "filename> and when the source package is unpacked patches listed in "
156 "<filename>debian/patches/series</filename> are automatically applied. As "
157 "the name implies, patches can be managed with <command>quilt</command>."
160 #. type: Content of: <chapter><section><section><para>
161 #: best-pkging-practices.dbk:107
163 "When using the older source “1.0”, it's also possible to separate patches "
164 "but a dedicated patch system must be used: the patch files are shipped "
165 "within the Debian patch file (<filename>.diff.gz</filename>), usually within "
166 "the <filename>debian/</filename> directory. The only difference is that they "
167 "aren't applied immediately by <command>dpkg-source</command>, but by the "
168 "<literal>build</literal> rule of <filename>debian/rules</filename>, through "
169 "a dependency on the <literal>patch</literal> rule. Conversely, they are "
170 "reverted in the <literal>clean</literal> rule, through a dependency on the "
171 "<literal>unpatch</literal> rule."
174 #. type: Content of: <chapter><section><section><para>
175 #: best-pkging-practices.dbk:119
177 "<command>quilt</command> is the recommended tool for this. It does all of "
178 "the above, and also allows to manage patch series. See the <systemitem role="
179 "\"package\">quilt</systemitem> package for more information."
182 #. type: Content of: <chapter><section><section><para>
183 #: best-pkging-practices.dbk:125
185 "There are other tools to manage patches, like <command>dpatch</command>, and "
186 "the patch system integrated with <systemitem role=\"package\">cdbs</"
190 #. type: Content of: <chapter><section><section><title>
191 #: best-pkging-practices.dbk:132
192 msgid "Multiple binary packages"
195 #. type: Content of: <chapter><section><section><para>
196 #: best-pkging-practices.dbk:134
198 "A single source package will often build several binary packages, either to "
199 "provide several flavors of the same software (e.g., the <systemitem role="
200 "\"package\">vim</systemitem> source package) or to make several small "
201 "packages instead of a big one (e.g., so the user can install only the subset "
202 "needed, and thus save some disk space)."
205 #. type: Content of: <chapter><section><section><para>
206 #: best-pkging-practices.dbk:141
208 "The second case can be easily managed in <filename>debian/rules</filename>. "
209 "You just need to move the appropriate files from the build directory into "
210 "the package's temporary trees. You can do this using <command>install</"
211 "command> or <command>dh_install</command> from <systemitem role=\"package"
212 "\">debhelper</systemitem>. Be sure to check the different permutations of "
213 "the various packages, ensuring that you have the inter-package dependencies "
214 "set right in <filename>debian/control</filename>."
217 #. type: Content of: <chapter><section><section><para>
218 #: best-pkging-practices.dbk:150
220 "The first case is a bit more difficult since it involves multiple recompiles "
221 "of the same software but with different configuration options. The "
222 "<systemitem role=\"package\">vim</systemitem> source package is an example "
223 "of how to manage this using an hand-crafted <filename>debian/rules</"
227 #. type: Content of: <chapter><section><title>
228 #: best-pkging-practices.dbk:162
229 msgid "Best practices for <filename>debian/control</filename>"
232 #. type: Content of: <chapter><section><para>
233 #: best-pkging-practices.dbk:164
235 "The following practices are relevant to the <filename>debian/control</"
236 "filename> file. They supplement the <ulink url=\"&url-debian-policy;ch-"
237 "binary.html#s-descriptions\">Policy on package descriptions</ulink>."
240 #. type: Content of: <chapter><section><para>
241 #: best-pkging-practices.dbk:170
243 "The description of the package, as defined by the corresponding field in the "
244 "<filename>control</filename> file, contains both the package synopsis and "
245 "the long description for the package. <xref linkend=\"bpp-desc-basics\"/> "
246 "describes common guidelines for both parts of the package description. "
247 "Following that, <xref linkend=\"bpp-pkg-synopsis\"/> provides guidelines "
248 "specific to the synopsis, and <xref linkend=\"bpp-pkg-desc\"/> contains "
249 "guidelines specific to the description."
252 #. type: Content of: <chapter><section><section><title>
253 #: best-pkging-practices.dbk:179
254 msgid "General guidelines for package descriptions"
257 #. type: Content of: <chapter><section><section><para>
258 #: best-pkging-practices.dbk:181
260 "The package description should be written for the average likely user, the "
261 "average person who will use and benefit from the package. For instance, "
262 "development packages are for developers, and can be technical in their "
263 "language. More general-purpose applications, such as editors, should be "
264 "written for a less technical user."
267 #. type: Content of: <chapter><section><section><para>
268 #: best-pkging-practices.dbk:188
270 "Our review of package descriptions lead us to conclude that most package "
271 "descriptions are technical, that is, are not written to make sense for non-"
272 "technical users. Unless your package really is only for technical users, "
276 #. type: Content of: <chapter><section><section><para>
277 #: best-pkging-practices.dbk:194
279 "How do you write for non-technical users? Avoid jargon. Avoid referring to "
280 "other applications or frameworks that the user might not be familiar with — "
281 "GNOME or KDE is fine, since users are probably familiar with these terms, "
282 "but GTK+ is probably not. Try not to assume any knowledge at all. If you "
283 "must use technical terms, introduce them."
286 #. type: Content of: <chapter><section><section><para>
287 #: best-pkging-practices.dbk:201
289 "Be objective. Package descriptions are not the place for advocating your "
290 "package, no matter how much you love it. Remember that the reader may not "
291 "care about the same things you care about."
294 #. type: Content of: <chapter><section><section><para>
295 #: best-pkging-practices.dbk:206
297 "References to the names of any other software packages, protocol names, "
298 "standards, or specifications should use their canonical forms, if one "
299 "exists. For example, use X Window System, X11, or X; not X Windows, X-"
300 "Windows, or X Window. Use GTK+, not GTK or gtk. Use GNOME, not Gnome. Use "
301 "PostScript, not Postscript or postscript."
304 #. type: Content of: <chapter><section><section><para>
305 #: best-pkging-practices.dbk:213
307 "If you are having problems writing your description, you may wish to send it "
308 "along to &email-debian-l10n-english; and request feedback."
311 #. type: Content of: <chapter><section><section><title>
312 #: best-pkging-practices.dbk:219
313 msgid "The package synopsis, or short description"
316 #. type: Content of: <chapter><section><section><para>
317 #: best-pkging-practices.dbk:221
319 "Policy says the synopsis line (the short description) must be concise, not "
320 "repeating the package name, but also informative."
323 #. type: Content of: <chapter><section><section><para>
324 #: best-pkging-practices.dbk:225
326 "The synopsis functions as a phrase describing the package, not a complete "
327 "sentence, so sentential punctuation is inappropriate: it does not need extra "
328 "capital letters or a final period (full stop). It should also omit any "
329 "initial indefinite or definite article — \"a\", \"an\", or \"the\". Thus for "
333 #. type: Content of: <chapter><section><section><screen>
334 #: best-pkging-practices.dbk:231
338 "Description: exemplification support library\n"
341 #. type: Content of: <chapter><section><section><para>
342 #: best-pkging-practices.dbk:235
344 "Technically this is a noun phrase minus articles, as opposed to a verb "
345 "phrase. A good heuristic is that it should be possible to substitute the "
346 "package <replaceable>name</replaceable> and <replaceable>synopsis</"
347 "replaceable> into this formula:"
350 #. type: Content of: <chapter><section><section><para>
351 #: best-pkging-practices.dbk:240
353 "The package <replaceable>name</replaceable> provides {a,an,the,some} "
354 "<replaceable>synopsis</replaceable>."
357 #. type: Content of: <chapter><section><section><para>
358 #: best-pkging-practices.dbk:244
360 "Sets of related packages may use an alternative scheme that divides the "
361 "synopsis into two parts, the first a description of the whole suite and the "
362 "second a summary of the package's role within it:"
365 #. type: Content of: <chapter><section><section><screen>
366 #: best-pkging-practices.dbk:249
369 "Package: eg-tools\n"
370 "Description: simple exemplification system (utilities)\n"
373 "Description: simple exemplification system - documentation\n"
376 #. type: Content of: <chapter><section><section><para>
377 #: best-pkging-practices.dbk:256
379 "These synopses follow a modified formula. Where a package "
380 "\"<replaceable>name</replaceable>\" has a synopsis \"<replaceable>suite</"
381 "replaceable> (<replaceable>role</replaceable>)\" or \"<replaceable>suite</"
382 "replaceable> - <replaceable>role</replaceable>\", the elements should be "
383 "phrased so that they fit into the formula:"
386 #. type: Content of: <chapter><section><section><para>
387 #: best-pkging-practices.dbk:263
389 "The package <replaceable>name</replaceable> provides {a,an,the} "
390 "<replaceable>role</replaceable> for the <replaceable>suite</replaceable>."
393 #. type: Content of: <chapter><section><section><title>
394 #: best-pkging-practices.dbk:269
395 msgid "The long description"
398 #. type: Content of: <chapter><section><section><para>
399 #: best-pkging-practices.dbk:271
401 "The long description is the primary information available to the user about "
402 "a package before they install it. It should provide all the information "
403 "needed to let the user decide whether to install the package. Assume that "
404 "the user has already read the package synopsis."
407 #. type: Content of: <chapter><section><section><para>
408 #: best-pkging-practices.dbk:277
409 msgid "The long description should consist of full and complete sentences."
412 #. type: Content of: <chapter><section><section><para>
413 #: best-pkging-practices.dbk:280
415 "The first paragraph of the long description should answer the following "
416 "questions: what does the package do? what task does it help the user "
417 "accomplish? It is important to describe this in a non-technical way, unless "
418 "of course the audience for the package is necessarily technical."
421 #. type: Content of: <chapter><section><section><para>
422 #: best-pkging-practices.dbk:286
424 "The following paragraphs should answer the following questions: Why do I as "
425 "a user need this package? What other features does the package have? What "
426 "outstanding features and deficiencies are there compared to other packages "
427 "(e.g., if you need X, use Y instead)? Is this package related to other "
428 "packages in some way that is not handled by the package manager (e.g., this "
429 "is the client for the foo server)?"
432 #. type: Content of: <chapter><section><section><para>
433 #: best-pkging-practices.dbk:294
435 "Be careful to avoid spelling and grammar mistakes. Ensure that you spell-"
436 "check it. Both <command>ispell</command> and <command>aspell</command> have "
437 "special modes for checking <filename>debian/control</filename> files:"
440 #. type: Content of: <chapter><section><section><screen>
441 #: best-pkging-practices.dbk:299
443 msgid "ispell -d american -g debian/control\n"
446 #. type: Content of: <chapter><section><section><screen>
447 #: best-pkging-practices.dbk:302
449 msgid "aspell -d en -D -c debian/control\n"
452 #. type: Content of: <chapter><section><section><para>
453 #: best-pkging-practices.dbk:305
455 "Users usually expect these questions to be answered in the package "
459 #. type: Content of: <chapter><section><section><itemizedlist><listitem><para>
460 #: best-pkging-practices.dbk:310
462 "What does the package do? If it is an add-on to another package, then the "
463 "short description of the package we are an add-on to should be put in here."
466 #. type: Content of: <chapter><section><section><itemizedlist><listitem><para>
467 #: best-pkging-practices.dbk:316
469 "Why should I want this package? This is related to the above, but not the "
470 "same (this is a mail user agent; this is cool, fast, interfaces with PGP and "
471 "LDAP and IMAP, has features X, Y, and Z)."
474 #. type: Content of: <chapter><section><section><itemizedlist><listitem><para>
475 #: best-pkging-practices.dbk:323
477 "If this package should not be installed directly, but is pulled in by "
478 "another package, this should be mentioned."
481 #. type: Content of: <chapter><section><section><itemizedlist><listitem><para>
482 #: best-pkging-practices.dbk:329
484 "If the package is <literal>experimental</literal>, or there are other "
485 "reasons it should not be used, if there are other packages that should be "
486 "used instead, it should be here as well."
489 #. type: Content of: <chapter><section><section><itemizedlist><listitem><para>
490 #: best-pkging-practices.dbk:336
492 "How is this package different from the competition? Is it a better "
493 "implementation? more features? different features? Why should I choose this "
497 #. type: Content of: <chapter><section><section><title>
498 #: best-pkging-practices.dbk:349
499 msgid "Upstream home page"
502 #. type: Content of: <chapter><section><section><para>
503 #: best-pkging-practices.dbk:351
505 "We recommend that you add the URL for the package's home page in the "
506 "<literal>Homepage</literal> field of the <literal>Source</literal> section "
507 "in <filename>debian/control</filename>. Adding this information in the "
508 "package description itself is considered deprecated."
511 #. type: Content of: <chapter><section><section><title>
512 #: best-pkging-practices.dbk:359
513 msgid "Version Control System location"
516 #. type: Content of: <chapter><section><section><para>
517 #: best-pkging-practices.dbk:361
519 "There are additional fields for the location of the Version Control System "
520 "in <filename>debian/control</filename>."
523 #. type: Content of: <chapter><section><section><section><title>
524 #: best-pkging-practices.dbk:365
528 #. type: Content of: <chapter><section><section><section><para>
529 #: best-pkging-practices.dbk:367
531 "Value of this field should be a <literal>http://</literal> URL pointing to a "
532 "web-browsable copy of the Version Control System repository used to maintain "
533 "the given package, if available."
536 #. type: Content of: <chapter><section><section><section><para>
537 #: best-pkging-practices.dbk:372
539 "The information is meant to be useful for the final user, willing to browse "
540 "the latest work done on the package (e.g. when looking for the patch fixing "
541 "a bug tagged as <literal>pending</literal> in the bug tracking system)."
544 #. type: Content of: <chapter><section><section><section><title>
545 #: best-pkging-practices.dbk:379
549 #. type: Content of: <chapter><section><section><section><para>
550 #: best-pkging-practices.dbk:381
552 "Value of this field should be a string identifying unequivocally the "
553 "location of the Version Control System repository used to maintain the given "
554 "package, if available. <literal>*</literal> identify the Version Control "
555 "System; currently the following systems are supported by the package "
556 "tracking system: <literal>arch</literal>, <literal>bzr</literal> (Bazaar), "
557 "<literal>cvs</literal>, <literal>darcs</literal>, <literal>git</literal>, "
558 "<literal>hg</literal> (Mercurial), <literal>mtn</literal> (Monotone), "
559 "<literal>svn</literal> (Subversion). It is allowed to specify different VCS "
560 "fields for the same package: they will all be shown in the PTS web interface."
563 #. type: Content of: <chapter><section><section><section><para>
564 #: best-pkging-practices.dbk:392
566 "The information is meant to be useful for a user knowledgeable in the given "
567 "Version Control System and willing to build the current version of a package "
568 "from the VCS sources. Other uses of this information might include "
569 "automatic building of the latest VCS version of the given package. To this "
570 "end the location pointed to by the field should better be version agnostic "
571 "and point to the main branch (for VCSs supporting such a concept). Also, "
572 "the location pointed to should be accessible to the final user; fulfilling "
573 "this requirement might imply pointing to an anonymous access of the "
574 "repository instead of pointing to an SSH-accessible version of the same."
577 #. type: Content of: <chapter><section><section><section><para>
578 #: best-pkging-practices.dbk:403
580 "In the following example, an instance of the field for a Subversion "
581 "repository of the <systemitem role=\"package\">vim</systemitem> package is "
582 "shown. Note how the URL is in the <literal>svn://</literal> scheme (instead "
583 "of <literal>svn+ssh://</literal>) and how it points to the <filename>trunk/</"
584 "filename> branch. The use of the <literal>Vcs-Browser</literal> and "
585 "<literal>Homepage</literal> fields described above is also shown."
588 #. type: Content of: <chapter><section><section><section><screen>
589 #: best-pkging-practices.dbk:412
593 " Section: editors\n"
594 " Priority: optional\n"
596 " Vcs-Svn: svn://svn.debian.org/svn/pkg-vim/trunk/packages/vim\n"
597 " Vcs-Browser: http://svn.debian.org/wsvn/pkg-vim/trunk/packages/vim\n"
598 " Homepage: http://www.vim.org\n"
601 #. type: Content of: <chapter><section><title>
602 #: best-pkging-practices.dbk:427
603 msgid "Best practices for <filename>debian/changelog</filename>"
606 #. type: Content of: <chapter><section><para>
607 #: best-pkging-practices.dbk:429
609 "The following practices supplement the <ulink url=\"&url-debian-policy;ch-"
610 "docs.html#s-changelogs\">Policy on changelog files</ulink>."
613 #. type: Content of: <chapter><section><section><title>
614 #: best-pkging-practices.dbk:434
615 msgid "Writing useful changelog entries"
618 #. type: Content of: <chapter><section><section><para>
619 #: best-pkging-practices.dbk:436
621 "The changelog entry for a package revision documents changes in that "
622 "revision, and only them. Concentrate on describing significant and user-"
623 "visible changes that were made since the last version."
626 #. type: Content of: <chapter><section><section><para>
627 #: best-pkging-practices.dbk:441
629 "Focus on <emphasis>what</emphasis> was changed — who, how and when are "
630 "usually less important. Having said that, remember to politely attribute "
631 "people who have provided notable help in making the package (e.g., those who "
632 "have sent in patches)."
635 #. type: Content of: <chapter><section><section><para>
636 #: best-pkging-practices.dbk:447
638 "There's no need to elaborate the trivial and obvious changes. You can also "
639 "aggregate several changes in one entry. On the other hand, don't be overly "
640 "terse if you have undertaken a major change. Be especially clear if there "
641 "are changes that affect the behaviour of the program. For further "
642 "explanations, use the <filename>README.Debian</filename> file."
645 #. type: Content of: <chapter><section><section><para>
646 #: best-pkging-practices.dbk:454
648 "Use common English so that the majority of readers can comprehend it. Avoid "
649 "abbreviations, tech-speak and jargon when explaining changes that close "
650 "bugs, especially for bugs filed by users that did not strike you as "
651 "particularly technically savvy. Be polite, don't swear."
654 #. type: Content of: <chapter><section><section><para>
655 #: best-pkging-practices.dbk:460
657 "It is sometimes desirable to prefix changelog entries with the names of the "
658 "files that were changed. However, there's no need to explicitly list each "
659 "and every last one of the changed files, especially if the change was small "
660 "or repetitive. You may use wildcards."
663 #. type: Content of: <chapter><section><section><para>
664 #: best-pkging-practices.dbk:466
666 "When referring to bugs, don't assume anything. Say what the problem was, "
667 "how it was fixed, and append the closes: #nnnnn string. See <xref linkend="
668 "\"upload-bugfix\"/> for more information."
671 #. type: Content of: <chapter><section><section><title>
672 #: best-pkging-practices.dbk:473
673 msgid "Common misconceptions about changelog entries"
676 #. type: Content of: <chapter><section><section><para>
677 #: best-pkging-practices.dbk:475
679 "The changelog entries should <emphasis role=\"strong\">not</emphasis> "
680 "document generic packaging issues (Hey, if you're looking for foo.conf, it's "
681 "in /etc/blah/.), since administrators and users are supposed to be at least "
682 "remotely acquainted with how such things are generally arranged on Debian "
683 "systems. Do, however, mention if you change the location of a configuration "
687 #. type: Content of: <chapter><section><section><para>
688 #: best-pkging-practices.dbk:483
690 "The only bugs closed with a changelog entry should be those that are "
691 "actually fixed in the same package revision. Closing unrelated bugs in the "
692 "changelog is bad practice. See <xref linkend=\"upload-bugfix\"/>."
695 #. type: Content of: <chapter><section><section><para>
696 #: best-pkging-practices.dbk:488
698 "The changelog entries should <emphasis role=\"strong\">not</emphasis> be "
699 "used for random discussion with bug reporters (I don't see segfaults when "
700 "starting foo with option bar; send in more info), general statements on "
701 "life, the universe and everything (sorry this upload took me so long, but I "
702 "caught the flu), or pleas for help (the bug list on this package is huge, "
703 "please lend me a hand). Such things usually won't be noticed by their "
704 "target audience, but may annoy people who wish to read information about "
705 "actual changes in the package. See <xref linkend=\"bug-answering\"/> for "
706 "more information on how to use the bug tracking system."
709 #. type: Content of: <chapter><section><section><para>
710 #: best-pkging-practices.dbk:499
712 "It is an old tradition to acknowledge bugs fixed in non-maintainer uploads "
713 "in the first changelog entry of the proper maintainer upload. As we have "
714 "version tracking now, it is enough to keep the NMUed changelog entries and "
715 "just mention this fact in your own changelog entry."
718 #. type: Content of: <chapter><section><section><title>
719 #: best-pkging-practices.dbk:507
720 msgid "Common errors in changelog entries"
723 #. type: Content of: <chapter><section><section><para>
724 #: best-pkging-practices.dbk:509
726 "The following examples demonstrate some common errors or examples of bad "
727 "style in changelog entries."
730 #. type: Content of: <chapter><section><section><screen>
731 #: best-pkging-practices.dbk:513
733 msgid " * Fixed all outstanding bugs.\n"
736 #. type: Content of: <chapter><section><section><para>
737 #: best-pkging-practices.dbk:516
738 msgid "This doesn't tell readers anything too useful, obviously."
741 #. type: Content of: <chapter><section><section><screen>
742 #: best-pkging-practices.dbk:519
744 msgid " * Applied patch from Jane Random.\n"
747 #. type: Content of: <chapter><section><section><para>
748 #: best-pkging-practices.dbk:522
749 msgid "What was the patch about?"
752 #. type: Content of: <chapter><section><section><screen>
753 #: best-pkging-practices.dbk:525
755 msgid " * Late night install target overhaul.\n"
758 #. type: Content of: <chapter><section><section><para>
759 #: best-pkging-practices.dbk:528
761 "Overhaul which accomplished what? Is the mention of late night supposed to "
762 "remind us that we shouldn't trust that code?"
765 #. type: Content of: <chapter><section><section><screen>
766 #: best-pkging-practices.dbk:532
768 msgid " * Fix vsync FU w/ ancient CRTs.\n"
771 #. type: Content of: <chapter><section><section><para>
772 #: best-pkging-practices.dbk:535
774 "Too many acronyms, and it's not overly clear what the, uh, fsckup (oops, a "
775 "curse word!) was actually about, or how it was fixed."
778 #. type: Content of: <chapter><section><section><screen>
779 #: best-pkging-practices.dbk:539
781 msgid " * This is not a bug, closes: #nnnnnn.\n"
784 #. type: Content of: <chapter><section><section><para>
785 #: best-pkging-practices.dbk:542
787 "First of all, there's absolutely no need to upload the package to convey "
788 "this information; instead, use the bug tracking system. Secondly, there's "
789 "no explanation as to why the report is not a bug."
792 #. type: Content of: <chapter><section><section><screen>
793 #: best-pkging-practices.dbk:547
795 msgid " * Has been fixed for ages, but I forgot to close; closes: #54321.\n"
798 #. type: Content of: <chapter><section><section><para>
799 #: best-pkging-practices.dbk:550
801 "If for some reason you didn't mention the bug number in a previous changelog "
802 "entry, there's no problem, just close the bug normally in the BTS. There's "
803 "no need to touch the changelog file, presuming the description of the fix is "
804 "already in (this applies to the fixes by the upstream authors/maintainers as "
805 "well, you don't have to track bugs that they fixed ages ago in your "
809 #. type: Content of: <chapter><section><section><screen>
810 #: best-pkging-practices.dbk:557
812 msgid " * Closes: #12345, #12346, #15432\n"
815 #. type: Content of: <chapter><section><section><para>
816 #: best-pkging-practices.dbk:560
818 "Where's the description? If you can't think of a descriptive message, start "
819 "by inserting the title of each different bug."
822 #. type: Content of: <chapter><section><section><title>
823 #: best-pkging-practices.dbk:566
824 msgid "Supplementing changelogs with <filename>NEWS.Debian</filename> files"
827 #. type: Content of: <chapter><section><section><para>
828 #: best-pkging-practices.dbk:568
830 "Important news about changes in a package can also be put in <filename>NEWS."
831 "Debian</filename> files. The news will be displayed by tools like "
832 "<systemitem role=\"package\">apt-listchanges</systemitem>, before all the "
833 "rest of the changelogs. This is the preferred means to let the user know "
834 "about significant changes in a package. It is better than using <systemitem "
835 "role=\"package\">debconf</systemitem> notes since it is less annoying and "
836 "the user can go back and refer to the <filename>NEWS.Debian</filename> file "
837 "after the install. And it's better than listing major changes in "
838 "<filename>README.Debian</filename>, since the user can easily miss such "
842 #. type: Content of: <chapter><section><section><para>
843 #: best-pkging-practices.dbk:579
845 "The file format is the same as a debian changelog file, but leave off the "
846 "asterisks and describe each news item with a full paragraph when necessary "
847 "rather than the more concise summaries that would go in a changelog. It's a "
848 "good idea to run your file through <literal>dpkg-parsechangelog</literal> to "
849 "check its formatting as it will not be automatically checked during build as "
850 "the changelog is. Here is an example of a real <filename>NEWS.Debian</"
854 #. type: Content of: <chapter><section><section><screen>
855 #: best-pkging-practices.dbk:588
858 "cron (3.0pl1-74) unstable; urgency=low\n"
860 " The checksecurity script is no longer included with the cron package:\n"
861 " it now has its own package, checksecurity. If you liked the\n"
862 " functionality provided with that script, please install the new\n"
865 " -- Steve Greenland <stevegr@debian.org> Sat, 6 Sep 2003 17:15:03 -0500\n"
868 #. type: Content of: <chapter><section><section><para>
869 #: best-pkging-practices.dbk:598
871 "The <filename>NEWS.Debian</filename> file is installed as <filename>/usr/"
872 "share/doc/<replaceable>package</replaceable>/NEWS.Debian.gz</filename>. It "
873 "is compressed, and always has that name even in Debian native packages. If "
874 "you use <literal>debhelper</literal>, <literal>dh_installchangelogs</"
875 "literal> will install <filename>debian/NEWS</filename> files for you."
878 #. type: Content of: <chapter><section><section><para>
879 #: best-pkging-practices.dbk:605
881 "Unlike changelog files, you need not update <filename>NEWS.Debian</filename> "
882 "files with every release. Only update them if you have something "
883 "particularly newsworthy that user should know about. If you have no news at "
884 "all, there's no need to ship a <filename>NEWS.Debian</filename> file in your "
885 "package. No news is good news!"
888 #. type: Content of: <chapter><section><title>
889 #: best-pkging-practices.dbk:627
890 msgid "Best practices for maintainer scripts"
893 #. type: Content of: <chapter><section><para>
894 #: best-pkging-practices.dbk:629
896 "Maintainer scripts include the files <filename>debian/postinst</filename>, "
897 "<filename>debian/preinst</filename>, <filename>debian/prerm</filename> and "
898 "<filename>debian/postrm</filename>. These scripts take care of any package "
899 "installation or deinstallation setup which isn't handled merely by the "
900 "creation or removal of files and directories. The following instructions "
901 "supplement the <ulink url=\"&url-debian-policy;\">Debian Policy</ulink>."
904 #. type: Content of: <chapter><section><para>
905 #: best-pkging-practices.dbk:637
907 "Maintainer scripts must be idempotent. That means that you need to make "
908 "sure nothing bad will happen if the script is called twice where it would "
909 "usually be called once."
912 #. type: Content of: <chapter><section><para>
913 #: best-pkging-practices.dbk:642
915 "Standard input and output may be redirected (e.g. into pipes) for logging "
916 "purposes, so don't rely on them being a tty."
919 #. type: Content of: <chapter><section><para>
920 #: best-pkging-practices.dbk:646
922 "All prompting or interactive configuration should be kept to a minimum. "
923 "When it is necessary, you should use the <systemitem role=\"package"
924 "\">debconf</systemitem> package for the interface. Remember that prompting "
925 "in any case can only be in the <literal>configure</literal> stage of the "
926 "<filename>postinst</filename> script."
929 #. type: Content of: <chapter><section><para>
930 #: best-pkging-practices.dbk:653
932 "Keep the maintainer scripts as simple as possible. We suggest you use pure "
933 "POSIX shell scripts. Remember, if you do need any bash features, the "
934 "maintainer script must have a bash shebang line. POSIX shell or Bash are "
935 "preferred to Perl, since they enable <systemitem role=\"package\">debhelper</"
936 "systemitem> to easily add bits to the scripts."
939 #. type: Content of: <chapter><section><para>
940 #: best-pkging-practices.dbk:660
942 "If you change your maintainer scripts, be sure to test package removal, "
943 "double installation, and purging. Be sure that a purged package is "
944 "completely gone, that is, it must remove any files created, directly or "
945 "indirectly, in any maintainer script."
948 #. type: Content of: <chapter><section><para>
949 #: best-pkging-practices.dbk:666
951 "If you need to check for the existence of a command, you should use "
955 #. type: Content of: <chapter><section><programlisting>
956 #: best-pkging-practices.dbk:669
958 msgid "if [ -x /usr/sbin/install-docs ]; then ..."
961 #. type: Content of: <chapter><section><para>
962 #: best-pkging-practices.dbk:671
964 "If you don't wish to hard-code the path of a command in your maintainer "
965 "script, the following POSIX-compliant shell function may help:"
968 #. type: Content of: <chapter><section><para>
969 #: best-pkging-practices.dbk:676
971 "You can use this function to search <varname>$PATH</varname> for a command "
972 "name, passed as an argument. It returns true (zero) if the command was "
973 "found, and false if not. This is really the most portable way, since "
974 "<literal>command -v</literal>, <command>type</command>, and <command>which</"
975 "command> are not POSIX."
978 #. type: Content of: <chapter><section><para>
979 #: best-pkging-practices.dbk:683
981 "While <command>which</command> is an acceptable alternative, since it is "
982 "from the required <systemitem role=\"package\">debianutils</systemitem> "
983 "package, it's not on the root partition. That is, it's in <filename>/usr/"
984 "bin</filename> rather than <filename>/bin</filename>, so one can't use it in "
985 "scripts which are run before the <filename>/usr</filename> partition is "
986 "mounted. Most scripts won't have this problem, though."
989 #. type: Content of: <chapter><section><title>
990 #: best-pkging-practices.dbk:693
992 "Configuration management with <systemitem role=\"package\">debconf</"
996 #. type: Content of: <chapter><section><para>
997 #: best-pkging-practices.dbk:695
999 "<systemitem role=\"package\">Debconf</systemitem> is a configuration "
1000 "management system which can be used by all the various packaging scripts "
1001 "(<filename>postinst</filename> mainly) to request feedback from the user "
1002 "concerning how to configure the package. Direct user interactions must now "
1003 "be avoided in favor of <systemitem role=\"package\">debconf</systemitem> "
1004 "interaction. This will enable non-interactive installations in the future."
1007 #. type: Content of: <chapter><section><para>
1008 #: best-pkging-practices.dbk:703
1010 "Debconf is a great tool but it is often poorly used. Many common mistakes "
1011 "are listed in the <citerefentry> <refentrytitle>debconf-devel</"
1012 "refentrytitle> <manvolnum>7</manvolnum> </citerefentry> man page. It is "
1013 "something that you must read if you decide to use debconf. Also, we "
1014 "document some best practices here."
1017 #. type: Content of: <chapter><section><para>
1018 #: best-pkging-practices.dbk:710
1020 "These guidelines include some writing style and typography recommendations, "
1021 "general considerations about debconf usage as well as more specific "
1022 "recommendations for some parts of the distribution (the installation system "
1026 #. type: Content of: <chapter><section><section><title>
1027 #: best-pkging-practices.dbk:716
1028 msgid "Do not abuse debconf"
1031 #. type: Content of: <chapter><section><section><para>
1032 #: best-pkging-practices.dbk:718
1034 "Since debconf appeared in Debian, it has been widely abused and several "
1035 "criticisms received by the Debian distribution come from debconf abuse with "
1036 "the need of answering a wide bunch of questions before getting any little "
1040 #. type: Content of: <chapter><section><section><para>
1041 #: best-pkging-practices.dbk:724
1043 "Keep usage notes to what they belong: the <filename>NEWS.Debian</filename>, "
1044 "or <filename>README.Debian</filename> file. Only use notes for important "
1045 "notes which may directly affect the package usability. Remember that notes "
1046 "will always block the install until confirmed or bother the user by email."
1049 #. type: Content of: <chapter><section><section><para>
1050 #: best-pkging-practices.dbk:730
1052 "Carefully choose the questions priorities in maintainer scripts. See "
1053 "<citerefentry> <refentrytitle>debconf-devel</refentrytitle> <manvolnum>7</"
1054 "manvolnum> </citerefentry> for details about priorities. Most questions "
1055 "should use medium and low priorities."
1058 #. type: Content of: <chapter><section><section><title>
1059 #: best-pkging-practices.dbk:738
1060 msgid "General recommendations for authors and translators"
1063 #. type: Content of: <chapter><section><section><section><title>
1064 #: best-pkging-practices.dbk:740
1065 msgid "Write correct English"
1068 #. type: Content of: <chapter><section><section><section><para>
1069 #: best-pkging-practices.dbk:742
1071 "Most Debian package maintainers are not native English speakers. So, "
1072 "writing properly phrased templates may not be easy for them."
1075 #. type: Content of: <chapter><section><section><section><para>
1076 #: best-pkging-practices.dbk:746
1078 "Please use (and abuse) &email-debian-l10n-english; mailing list. Have your "
1079 "templates proofread."
1082 #. type: Content of: <chapter><section><section><section><para>
1083 #: best-pkging-practices.dbk:750
1085 "Badly written templates give a poor image of your package, of your work... "
1086 "or even of Debian itself."
1089 #. type: Content of: <chapter><section><section><section><para>
1090 #: best-pkging-practices.dbk:754
1092 "Avoid technical jargon as much as possible. If some terms sound common to "
1093 "you, they may be impossible to understand for others. If you cannot avoid "
1094 "them, try to explain them (use the extended description). When doing so, "
1095 "try to balance between verbosity and simplicity."
1098 #. type: Content of: <chapter><section><section><section><title>
1099 #: best-pkging-practices.dbk:762
1100 msgid "Be kind to translators"
1103 #. type: Content of: <chapter><section><section><section><para>
1104 #: best-pkging-practices.dbk:764
1106 "Debconf templates may be translated. Debconf, along with its sister package "
1107 "<command>po-debconf</command> offers a simple framework for getting "
1108 "templates translated by translation teams or even individuals."
1111 #. type: Content of: <chapter><section><section><section><para>
1112 #: best-pkging-practices.dbk:769
1114 "Please use gettext-based templates. Install <systemitem role=\"package\">po-"
1115 "debconf</systemitem> on your development system and read its documentation "
1116 "(<command>man po-debconf</command> is a good start)."
1119 #. type: Content of: <chapter><section><section><section><para>
1120 #: best-pkging-practices.dbk:774
1122 "Avoid changing templates too often. Changing templates text induces more "
1123 "work to translators which will get their translation fuzzied. A fuzzy "
1124 "translation is a string for which the original changed since it was "
1125 "translated, therefore requiring some update by a translator to be usable. "
1126 "When changes are small enough, the original translation is kept in PO files "
1127 "but marked as <literal>fuzzy</literal>."
1130 #. type: Content of: <chapter><section><section><section><para>
1131 #: best-pkging-practices.dbk:782
1133 "If you plan to do changes to your original templates, please use the "
1134 "notification system provided with the <systemitem role=\"package\">po-"
1135 "debconf</systemitem> package, namely the <command>podebconf-report-po</"
1136 "command>, to contact translators. Most active translators are very "
1137 "responsive and getting their work included along with your modified "
1138 "templates will save you additional uploads. If you use gettext-based "
1139 "templates, the translator's name and e-mail addresses are mentioned in the "
1140 "PO files headers and will be used by <command>podebconf-report-po</command>."
1143 #. type: Content of: <chapter><section><section><section><para>
1144 #: best-pkging-practices.dbk:794
1145 msgid "A recommended use of that utility is:"
1148 #. type: Content of: <chapter><section><section><section><programlisting>
1149 #: best-pkging-practices.dbk:796
1151 msgid "cd debian/po && podebconf-report-po --call --languageteam --withtranslators --deadline=\"+10 days\""
1154 #. type: Content of: <chapter><section><section><section><para>
1155 #: best-pkging-practices.dbk:798
1157 "This command will first synchronize the PO and POT files in <filename>debian/"
1158 "po</filename> with the templates files listed in <filename>debian/po/"
1159 "POTFILES.in</filename>. Then, it will send a call for new translations, in "
1160 "the &email-debian-i18n; mailing list. Finally, it will also send a call for "
1161 "translation updates to the language team (mentioned in the <literal>Language-"
1162 "Team</literal> field of each PO file) as well as the last translator "
1163 "(mentioned in <literal>Last-translator</literal>)."
1166 #. type: Content of: <chapter><section><section><section><para>
1167 #: best-pkging-practices.dbk:807
1169 "Giving a deadline to translators is always appreciated, so that they can "
1170 "organize their work. Please remember that some translation teams have a "
1171 "formalized translate/review process and a delay lower than 10 days is "
1172 "considered as unreasonable. A shorter delay puts too much pressure on "
1173 "translation teams and should be kept for very minor changes."
1176 #. type: Content of: <chapter><section><section><section><para>
1177 #: best-pkging-practices.dbk:814
1179 "If in doubt, you may also contact the translation team for a given language "
1180 "(debian-l10n-xxxxx@&lists-host;), or the &email-debian-i18n; mailing list."
1183 #. type: Content of: <chapter><section><section><section><title>
1184 #: best-pkging-practices.dbk:821
1185 msgid "Unfuzzy complete translations when correcting typos and spelling"
1188 #. type: Content of: <chapter><section><section><section><para>
1189 #: best-pkging-practices.dbk:823
1191 "When the text of a debconf template is corrected and you are <emphasis role="
1192 "\"strong\">sure</emphasis> that the change does <emphasis role=\"strong"
1193 "\">not</emphasis> affect translations, please be kind to translators and "
1194 "<emphasis>unfuzzy</emphasis> their translations."
1197 #. type: Content of: <chapter><section><section><section><para>
1198 #: best-pkging-practices.dbk:829
1200 "If you don't do so, the whole template will not be translated as long as a "
1201 "translator will send you an update."
1204 #. type: Content of: <chapter><section><section><section><para>
1205 #: best-pkging-practices.dbk:833
1207 "To <emphasis>unfuzzy</emphasis> translations, you can use two methods. The "
1208 "first method does <emphasis>preventive</emphasis> search and replace actions "
1209 "in the PO files. The latter uses <command>gettext</command> utilities to "
1210 "<emphasis>unfuzzy</emphasis> strings."
1213 #. type: Content of: <chapter><section><section><section><para>
1214 #: best-pkging-practices.dbk:839
1215 msgid "<emphasis>Preventive unfuzzy</emphasis> method:"
1218 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
1219 #: best-pkging-practices.dbk:844
1221 "Try finding a complete translation file <emphasis role=\"strong\">before</"
1222 "emphasis> the change:"
1225 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><programlisting>
1226 #: best-pkging-practices.dbk:847 best-pkging-practices.dbk:918
1228 msgid "for i in debian/po/*po; do echo -n $i: ; msgfmt -o /dev/null --statistics $i; done"
1231 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
1232 #: best-pkging-practices.dbk:849
1234 "The file only showing <emphasis>translated</emphasis> items will be used as "
1235 "the reference file. If there is none (which should not happen if you take "
1236 "care to properly interact with translators), you should use the file with "
1237 "the most translated strings."
1240 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
1241 #: best-pkging-practices.dbk:857
1243 "Identify the needed change. In this example, let's assume the change is "
1244 "about fixing a typo in the word <literal>typo</literal> which was "
1245 "inadvertently written as <literal>tpyo</literal>. Therefore, the change is "
1246 "<command>s/tpyo/typo</command>."
1249 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
1250 #: best-pkging-practices.dbk:865
1252 "Check that this change is only applied to the place where you really intend "
1253 "to make it and <emphasis role=\"strong\">not</emphasis> in any other place "
1254 "where the original string is appropriate. This specifically applies to "
1255 "change in punctuation, for instance."
1258 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
1259 #: best-pkging-practices.dbk:873
1261 "Modify all PO files by using <command>sed</command>. The use of that command "
1262 "is recommended over any text editor to guarantee that the files encoding "
1263 "will not be broken by the edit action:"
1266 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><programlisting>
1267 #: best-pkging-practices.dbk:878
1271 "for i in *.po; do sed -i 's/tpyo/typo/g' $i; done\n"
1274 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
1275 #: best-pkging-practices.dbk:884
1276 msgid "Change the debconf template file to fix the typo."
1279 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
1280 #: best-pkging-practices.dbk:889
1281 msgid "Run <command>debconf-updatepo</command>."
1284 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
1285 #: best-pkging-practices.dbk:894
1287 "Check the <filename>foo.po</filename> reference file. Its statistics should "
1291 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><programlisting>
1292 #: best-pkging-practices.dbk:898
1294 msgid "msgfmt -o /dev/null --statistics debian/po/foo.po\n"
1297 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
1298 #: best-pkging-practices.dbk:903
1300 "If the file's statistics changed, you did something wrong. Try again or ask "
1301 "for help on the &email-debian-i18n; mailing list."
1304 #. type: Content of: <chapter><section><section><section><para>
1305 #: best-pkging-practices.dbk:909
1306 msgid "Gettext utilities method:"
1309 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
1310 #: best-pkging-practices.dbk:914
1312 "Put all incomplete PO files out of the way. You can check the completeness "
1313 "by using (needs the <systemitem role=\"package\">gettext</systemitem> "
1314 "package installed):"
1317 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
1318 #: best-pkging-practices.dbk:922
1320 "Move all files which report either fuzzy strings to a temporary place. "
1321 "Files which report no fuzzy strings (only translated and untranslated) will "
1325 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
1326 #: best-pkging-practices.dbk:929
1328 "Now <emphasis role=\"strong\">and now only</emphasis>, modify the template "
1329 "for the typos and check again that translation are not impacted (typos, "
1330 "spelling errors, sometimes typographical corrections are usually OK)."
1333 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
1334 #: best-pkging-practices.dbk:936
1336 "Run <command>debconf-updatepo</command>. This will fuzzy all strings you "
1337 "modified in translations. You can see this by running the above again."
1340 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
1341 #: best-pkging-practices.dbk:942
1342 msgid "Use the following command:"
1345 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><programlisting>
1346 #: best-pkging-practices.dbk:944
1348 msgid "for i in debian/po/*po; do msgattrib --output-file=$i --clear-fuzzy $i; done"
1351 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
1352 #: best-pkging-practices.dbk:948
1354 "Move back to <filename>debian/po</filename> the files which showed fuzzy "
1355 "strings in the first step."
1358 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
1359 #: best-pkging-practices.dbk:953
1360 msgid "Run <command>debconf-updatepo</command> again."
1363 #. type: Content of: <chapter><section><section><section><title>
1364 #: best-pkging-practices.dbk:960
1365 msgid "Do not make assumptions about interfaces"
1368 #. type: Content of: <chapter><section><section><section><para>
1369 #: best-pkging-practices.dbk:962
1371 "Templates text should not make reference to widgets belonging to some "
1372 "debconf interfaces. Sentences like <emphasis>If you answer Yes...</"
1373 "emphasis> have no meaning for users of graphical interfaces which use "
1374 "checkboxes for boolean questions."
1377 #. type: Content of: <chapter><section><section><section><para>
1378 #: best-pkging-practices.dbk:967
1380 "String templates should also avoid mentioning the default values in their "
1381 "description. First, because this is redundant with the values seen by the "
1382 "users. Also, because these default values may be different from the "
1383 "maintainer choices (for instance, when the debconf database was preseeded)."
1386 #. type: Content of: <chapter><section><section><section><para>
1387 #: best-pkging-practices.dbk:973
1389 "More generally speaking, try to avoid referring to user actions. Just give "
1393 #. type: Content of: <chapter><section><section><section><title>
1394 #: best-pkging-practices.dbk:979
1395 msgid "Do not use first person"
1398 #. type: Content of: <chapter><section><section><section><para>
1399 #: best-pkging-practices.dbk:981
1401 "You should avoid the use of first person (<emphasis>I will do this...</"
1402 "emphasis> or <emphasis>We recommend...</emphasis>). The computer is not a "
1403 "person and the Debconf templates do not speak for the Debian developers. "
1404 "You should use neutral construction. Those of you who already wrote "
1405 "scientific publications, just write your templates like you would write a "
1406 "scientific paper. However, try using active voice if still possible, like "
1407 "<emphasis>Enable this if ...</emphasis> instead of <emphasis>This can be "
1408 "enabled if...</emphasis>."
1411 #. type: Content of: <chapter><section><section><section><title>
1412 #: best-pkging-practices.dbk:991
1413 msgid "Be gender neutral"
1416 #. type: Content of: <chapter><section><section><section><para>
1417 #: best-pkging-practices.dbk:993
1419 "The world is made of men and women. Please use gender-neutral constructions "
1423 #. type: Content of: <chapter><section><section><title>
1424 #: best-pkging-practices.dbk:1001
1425 msgid "Templates fields definition"
1428 #. type: Content of: <chapter><section><section><para>
1429 #: best-pkging-practices.dbk:1003
1431 "This part gives some information which is mostly taken from the "
1432 "<citerefentry> <refentrytitle>debconf-devel</refentrytitle> <manvolnum>7</"
1433 "manvolnum> </citerefentry> manual page."
1436 #. type: Content of: <chapter><section><section><section><title>
1437 #: best-pkging-practices.dbk:1008
1441 #. type: Content of: <chapter><section><section><section><section><title>
1442 #: best-pkging-practices.dbk:1010
1446 #. type: Content of: <chapter><section><section><section><section><para>
1447 #: best-pkging-practices.dbk:1012
1449 "Results in a free-form input field that the user can type any string into."
1452 #. type: Content of: <chapter><section><section><section><section><title>
1453 #: best-pkging-practices.dbk:1017
1457 #. type: Content of: <chapter><section><section><section><section><para>
1458 #: best-pkging-practices.dbk:1019
1460 "Prompts the user for a password. Use this with caution; be aware that the "
1461 "password the user enters will be written to debconf's database. You should "
1462 "probably clean that value out of the database as soon as is possible."
1465 #. type: Content of: <chapter><section><section><section><section><title>
1466 #: best-pkging-practices.dbk:1026
1470 #. type: Content of: <chapter><section><section><section><section><para>
1471 #: best-pkging-practices.dbk:1028
1473 "A true/false choice. Remember: true/false, <emphasis role=\"strong\">not "
1474 "yes/no</emphasis>..."
1477 #. type: Content of: <chapter><section><section><section><section><title>
1478 #: best-pkging-practices.dbk:1034
1482 #. type: Content of: <chapter><section><section><section><section><para>
1483 #: best-pkging-practices.dbk:1036
1485 "A choice between one of a number of values. The choices must be specified "
1486 "in a field named 'Choices'. Separate the possible values with commas and "
1487 "spaces, like this: <literal>Choices: yes, no, maybe</literal>."
1490 #. type: Content of: <chapter><section><section><section><section><para>
1491 #: best-pkging-practices.dbk:1041
1493 "If choices are translatable strings, the 'Choices' field may be marked as "
1494 "translatable by using <literal>__Choices</literal>. The double underscore "
1495 "will split out each choice in a separate string."
1498 #. type: Content of: <chapter><section><section><section><section><para>
1499 #: best-pkging-practices.dbk:1046
1501 "The <command>po-debconf</command> system also offers interesting "
1502 "possibilities to only mark <emphasis role=\"strong\">some</emphasis> choices "
1503 "as translatable. Example:"
1506 #. type: Content of: <chapter><section><section><section><section><programlisting>
1507 #: best-pkging-practices.dbk:1051
1510 "Template: foo/bar\n"
1512 "#flag:translate:3\n"
1513 "__Choices: PAL, SECAM, Other\n"
1514 "_Description: TV standard:\n"
1515 " Please choose the TV standard used in your country.\n"
1518 #. type: Content of: <chapter><section><section><section><section><para>
1519 #: best-pkging-practices.dbk:1059
1521 "In that example, only the 'Other' string is translatable while others are "
1522 "acronyms that should not be translated. The above allows only 'Other' to be "
1523 "included in PO and POT files."
1526 #. type: Content of: <chapter><section><section><section><section><para>
1527 #: best-pkging-practices.dbk:1064
1529 "The debconf templates flag system offers many such possibilities. The "
1530 "<citerefentry> <refentrytitle>po-debconf</refentrytitle> <manvolnum>7</"
1531 "manvolnum> </citerefentry> manual page lists all these possibilities."
1534 #. type: Content of: <chapter><section><section><section><section><title>
1535 #: best-pkging-practices.dbk:1072
1539 #. type: Content of: <chapter><section><section><section><section><para>
1540 #: best-pkging-practices.dbk:1074
1542 "Like the select data type, except the user can choose any number of items "
1543 "from the choices list (or chose none of them)."
1546 #. type: Content of: <chapter><section><section><section><section><title>
1547 #: best-pkging-practices.dbk:1080
1551 #. type: Content of: <chapter><section><section><section><section><para>
1552 #: best-pkging-practices.dbk:1082
1554 "Rather than being a question per se, this datatype indicates a note that can "
1555 "be displayed to the user. It should be used only for important notes that "
1556 "the user really should see, since debconf will go to great pains to make "
1557 "sure the user sees it; halting the install for them to press a key, and even "
1558 "mailing the note to them in some cases."
1561 #. type: Content of: <chapter><section><section><section><section><title>
1562 #: best-pkging-practices.dbk:1091
1566 #. type: Content of: <chapter><section><section><section><section><para>
1567 #: best-pkging-practices.dbk:1093
1568 msgid "This type is now considered obsolete: don't use it."
1571 #. type: Content of: <chapter><section><section><section><section><title>
1572 #: best-pkging-practices.dbk:1098
1576 #. type: Content of: <chapter><section><section><section><section><para>
1577 #: best-pkging-practices.dbk:1100
1579 "This type is designed to handle error messages. It is mostly similar to the "
1580 "note type. Frontends may present it differently (for instance, the dialog "
1581 "frontend of cdebconf draws a red screen instead of the usual blue one)."
1584 #. type: Content of: <chapter><section><section><section><section><para>
1585 #: best-pkging-practices.dbk:1105
1587 "It is recommended to use this type for any message that needs user attention "
1588 "for a correction of any kind."
1591 #. type: Content of: <chapter><section><section><section><title>
1592 #: best-pkging-practices.dbk:1113
1593 msgid "Description: short and extended description"
1596 #. type: Content of: <chapter><section><section><section><para>
1597 #: best-pkging-practices.dbk:1115
1599 "Template descriptions have two parts: short and extended. The short "
1600 "description is in the Description: line of the template."
1603 #. type: Content of: <chapter><section><section><section><para>
1604 #: best-pkging-practices.dbk:1119
1606 "The short description should be kept short (50 characters or so) so that it "
1607 "may be accomodated by most debconf interfaces. Keeping it short also helps "
1608 "translators, as usually translations tend to end up being longer than the "
1612 #. type: Content of: <chapter><section><section><section><para>
1613 #: best-pkging-practices.dbk:1125
1615 "The short description should be able to stand on its own. Some interfaces "
1616 "do not show the long description by default, or only if the user explicitely "
1617 "asks for it or even do not show it at all. Avoid things like What do you "
1621 #. type: Content of: <chapter><section><section><section><para>
1622 #: best-pkging-practices.dbk:1131
1624 "The short description does not necessarily have to be a full sentence. This "
1625 "is part of the keep it short and efficient recommendation."
1628 #. type: Content of: <chapter><section><section><section><para>
1629 #: best-pkging-practices.dbk:1135
1631 "The extended description should not repeat the short description word for "
1632 "word. If you can't think up a long description, then first, think some "
1633 "more. Post to debian-devel. Ask for help. Take a writing class! That "
1634 "extended description is important. If after all that you still can't come "
1635 "up with anything, leave it blank."
1638 #. type: Content of: <chapter><section><section><section><para>
1639 #: best-pkging-practices.dbk:1142
1641 "The extended description should use complete sentences. Paragraphs should "
1642 "be kept short for improved readability. Do not mix two ideas in the same "
1643 "paragraph but rather use another paragraph."
1646 #. type: Content of: <chapter><section><section><section><para>
1647 #: best-pkging-practices.dbk:1147
1649 "Don't be too verbose. User tend to ignore too long screens. 20 lines are "
1650 "by experience a border you shouldn't cross, because that means that in the "
1651 "classical dialog interface, people will need to scroll, and lot of people "
1652 "just don't do that."
1655 #. type: Content of: <chapter><section><section><section><para>
1656 #: best-pkging-practices.dbk:1153
1658 "The extended description should <emphasis role=\"strong\">never</emphasis> "
1659 "include a question."
1662 #. type: Content of: <chapter><section><section><section><para>
1663 #: best-pkging-practices.dbk:1157
1665 "For specific rules depending on templates type (string, boolean, etc.), "
1666 "please read below."
1669 #. type: Content of: <chapter><section><section><section><title>
1670 #: best-pkging-practices.dbk:1163
1674 #. type: Content of: <chapter><section><section><section><para>
1675 #: best-pkging-practices.dbk:1165
1677 "This field should be used for select and multiselect types. It contains the "
1678 "possible choices which will be presented to users. These choices should be "
1679 "separated by commas."
1682 #. type: Content of: <chapter><section><section><section><title>
1683 #: best-pkging-practices.dbk:1172
1687 #. type: Content of: <chapter><section><section><section><para>
1688 #: best-pkging-practices.dbk:1174
1690 "This field is optional. It contains the default answer for string, select "
1691 "and multiselect templates. For multiselect templates, it may contain a "
1692 "comma-separated list of choices."
1695 #. type: Content of: <chapter><section><section><title>
1696 #: best-pkging-practices.dbk:1183
1697 msgid "Templates fields specific style guide"
1700 #. type: Content of: <chapter><section><section><section><title>
1701 #: best-pkging-practices.dbk:1185
1705 #. type: Content of: <chapter><section><section><section><para>
1706 #: best-pkging-practices.dbk:1187
1708 "No specific indication except: use the appropriate type by referring to the "
1712 #. type: Content of: <chapter><section><section><section><title>
1713 #: best-pkging-practices.dbk:1193
1714 msgid "Description field"
1717 #. type: Content of: <chapter><section><section><section><para>
1718 #: best-pkging-practices.dbk:1195
1720 "Below are specific instructions for properly writing the Description (short "
1721 "and extended) depending on the template type."
1724 #. type: Content of: <chapter><section><section><section><section><title>
1725 #: best-pkging-practices.dbk:1199
1726 msgid "String/password templates"
1729 #. type: Content of: <chapter><section><section><section><section><itemizedlist><listitem><para>
1730 #: best-pkging-practices.dbk:1203
1732 "The short description is a prompt and <emphasis role=\"strong\">not</"
1733 "emphasis> a title. Avoid question style prompts (IP Address?) in favour of "
1734 "opened prompts (IP address:). The use of colons is recommended."
1737 #. type: Content of: <chapter><section><section><section><section><itemizedlist><listitem><para>
1738 #: best-pkging-practices.dbk:1210
1740 "The extended description is a complement to the short description. In the "
1741 "extended part, explain what is being asked, rather than ask the same "
1742 "question again using longer words. Use complete sentences. Terse writing "
1743 "style is strongly discouraged."
1746 #. type: Content of: <chapter><section><section><section><section><title>
1747 #: best-pkging-practices.dbk:1220
1748 msgid "Boolean templates"
1751 #. type: Content of: <chapter><section><section><section><section><itemizedlist><listitem><para>
1752 #: best-pkging-practices.dbk:1224
1754 "The short description should be phrased in the form of a question which "
1755 "should be kept short and should generally end with a question mark. Terse "
1756 "writing style is permitted and even encouraged if the question is rather "
1757 "long (remember that translations are often longer than original versions)"
1760 #. type: Content of: <chapter><section><section><section><section><itemizedlist><listitem><para>
1761 #: best-pkging-practices.dbk:1232
1763 "Again, please avoid referring to specific interface widgets. A common "
1764 "mistake for such templates is if you answer Yes-type constructions."
1767 #. type: Content of: <chapter><section><section><section><section><title>
1768 #: best-pkging-practices.dbk:1240
1769 msgid "Select/Multiselect"
1772 #. type: Content of: <chapter><section><section><section><section><itemizedlist><listitem><para>
1773 #: best-pkging-practices.dbk:1244
1775 "The short description is a prompt and <emphasis role=\"strong\">not</"
1776 "emphasis> a title. Do <emphasis role=\"strong\">not</emphasis> use useless "
1777 "Please choose... constructions. Users are clever enough to figure out they "
1778 "have to choose something...:)"
1781 #. type: Content of: <chapter><section><section><section><section><itemizedlist><listitem><para>
1782 #: best-pkging-practices.dbk:1252
1784 "The extended description will complete the short description. It may refer "
1785 "to the available choices. It may also mention that the user may choose more "
1786 "than one of the available choices, if the template is a multiselect one "
1787 "(although the interface often makes this clear)."
1790 #. type: Content of: <chapter><section><section><section><section><title>
1791 #: best-pkging-practices.dbk:1262
1795 #. type: Content of: <chapter><section><section><section><section><itemizedlist><listitem><para>
1796 #: best-pkging-practices.dbk:1266
1798 "The short description should be considered to be a <emphasis role=\"strong"
1799 "\">title</emphasis>."
1802 #. type: Content of: <chapter><section><section><section><section><itemizedlist><listitem><para>
1803 #: best-pkging-practices.dbk:1271
1805 "The extended description is what will be displayed as a more detailed "
1806 "explanation of the note. Phrases, no terse writing style."
1809 #. type: Content of: <chapter><section><section><section><section><itemizedlist><listitem><para>
1810 #: best-pkging-practices.dbk:1277
1812 "<emphasis role=\"strong\">Do not abuse debconf.</emphasis> Notes are the "
1813 "most common way to abuse debconf. As written in debconf-devel manual page: "
1814 "it's best to use them only for warning about very serious problems. The "
1815 "<filename>NEWS.Debian</filename> or <filename>README.Debian</filename> files "
1816 "are the appropriate location for a lot of notes. If, by reading this, you "
1817 "consider converting your Note type templates to entries in <filename>NEWS."
1818 "Debian</filename> or <filename>README.Debian</filename>, plus consider "
1819 "keeping existing translations for the future."
1822 #. type: Content of: <chapter><section><section><section><title>
1823 #: best-pkging-practices.dbk:1292
1824 msgid "Choices field"
1827 #. type: Content of: <chapter><section><section><section><para>
1828 #: best-pkging-practices.dbk:1294
1830 "If the Choices are likely to change often, please consider using the "
1831 "__Choices trick. This will split each individual choice into a single "
1832 "string, which will considerably help translators for doing their work."
1835 #. type: Content of: <chapter><section><section><section><title>
1836 #: best-pkging-practices.dbk:1301 best-pkging-practices.dbk:1339
1837 msgid "Default field"
1840 #. type: Content of: <chapter><section><section><section><para>
1841 #: best-pkging-practices.dbk:1303
1843 "If the default value, for a select template, is likely to vary depending on "
1844 "the user language (for instance, if the choice is a language choice), please "
1845 "use the _Default trick."
1848 #. type: Content of: <chapter><section><section><section><para>
1849 #: best-pkging-practices.dbk:1308
1851 "This special field allow translators to put the most appropriate choice "
1852 "according to their own language. It will become the default choice when "
1853 "their language is used while your own mentioned Default Choice will be used "
1854 "when using English."
1857 #. type: Content of: <chapter><section><section><section><para>
1858 #: best-pkging-practices.dbk:1314
1859 msgid "Example, taken from the geneweb package templates:"
1862 #. type: Content of: <chapter><section><section><section><screen>
1863 #: best-pkging-practices.dbk:1317
1866 "Template: geneweb/lang\n"
1868 "__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)\n"
1869 "# This is the default choice. Translators may put their own language here\n"
1870 "# instead of the default.\n"
1871 "# WARNING : you MUST use the ENGLISH NAME of your language\n"
1872 "# For instance, the french translator will need to put French (fr) here.\n"
1873 "_Default: English[ translators, please see comment in PO files]\n"
1874 "_Description: Geneweb default language:\n"
1877 #. type: Content of: <chapter><section><section><section><para>
1878 #: best-pkging-practices.dbk:1328
1880 "Note the use of brackets which allow internal comments in debconf fields. "
1881 "Also note the use of comments which will show up in files the translators "
1885 #. type: Content of: <chapter><section><section><section><para>
1886 #: best-pkging-practices.dbk:1333
1888 "The comments are needed as the _Default trick is a bit confusing: the "
1889 "translators may put their own choice"
1892 #. type: Content of: <chapter><section><section><section><para>
1893 #: best-pkging-practices.dbk:1341
1895 "Do NOT use empty default field. If you don't want to use default values, do "
1896 "not use Default at all."
1899 #. type: Content of: <chapter><section><section><section><para>
1900 #: best-pkging-practices.dbk:1345
1902 "If you use po-debconf (and you <emphasis role=\"strong\">should</emphasis>, "
1903 "see <xref linkend=\"s6.5.2.2\"/>), consider making this field translatable, "
1904 "if you think it may be translated."
1907 #. type: Content of: <chapter><section><section><section><para>
1908 #: best-pkging-practices.dbk:1350
1910 "If the default value may vary depending on language/country (for instance "
1911 "the default value for a language choice), consider using the special "
1912 "_Default type documented in <citerefentry> <refentrytitle>po-debconf</"
1913 "refentrytitle> <manvolnum>7</manvolnum> </citerefentry>)."
1916 #. type: Content of: <chapter><section><title>
1917 #: best-pkging-practices.dbk:1362
1918 msgid "Internationalization"
1921 #. type: Content of: <chapter><section><para>
1922 #: best-pkging-practices.dbk:1364
1924 "This section contains global information for developers to make translators' "
1925 "life easier. More information for translators and developers interrested in "
1926 "internationalization are available in the <ulink url=\"&url-i18n-l10n;"
1927 "\">Internationalisation and localisation in Debian</ulink> documentation."
1930 #. type: Content of: <chapter><section><section><title>
1931 #: best-pkging-practices.dbk:1371
1932 msgid "Handling debconf translations"
1935 #. type: Content of: <chapter><section><section><para>
1936 #: best-pkging-practices.dbk:1373
1938 "Like porters, translators have a difficult task. They work on many packages "
1939 "and must collaborate with many different maintainers. Moreover, most of the "
1940 "time, they are not native English speakers, so you may need to be "
1941 "particularly patient with them."
1944 #. type: Content of: <chapter><section><section><para>
1945 #: best-pkging-practices.dbk:1379
1947 "The goal of <systemitem role=\"package\">debconf</systemitem> was to make "
1948 "packages configuration easier for maintainers and for users. Originally, "
1949 "translation of debconf templates was handled with <command>debconf-"
1950 "mergetemplate</command>. However, that technique is now deprecated; the "
1951 "best way to accomplish <systemitem role=\"package\">debconf</systemitem> "
1952 "internationalization is by using the <systemitem role=\"package\">po-"
1953 "debconf</systemitem> package. This method is easier both for maintainer and "
1954 "translators; transition scripts are provided."
1957 #. type: Content of: <chapter><section><section><para>
1958 #: best-pkging-practices.dbk:1389
1960 "Using <systemitem role=\"package\">po-debconf</systemitem>, the translation "
1961 "is stored in <filename>.po</filename> files (drawing from <command>gettext</"
1962 "command> translation techniques). Special template files contain the "
1963 "original messages and mark which fields are translatable. When you change "
1964 "the value of a translatable field, by calling <command>debconf-updatepo</"
1965 "command>, the translation is marked as needing attention from the "
1966 "translators. Then, at build time, the <command>dh_installdebconf</command> "
1967 "program takes care of all the needed magic to add the template along with "
1968 "the up-to-date translations into the binary packages. Refer to the "
1969 "<citerefentry> <refentrytitle>po-debconf</refentrytitle> <manvolnum>7</"
1970 "manvolnum> </citerefentry> manual page for details."
1973 #. type: Content of: <chapter><section><section><title>
1974 #: best-pkging-practices.dbk:1405
1975 msgid "Internationalized documentation"
1978 #. type: Content of: <chapter><section><section><para>
1979 #: best-pkging-practices.dbk:1407
1981 "Internationalizing documentation is crucial for users, but a lot of labor. "
1982 "There's no way to eliminate all that work, but you can make things easier "
1986 #. type: Content of: <chapter><section><section><para>
1987 #: best-pkging-practices.dbk:1412
1989 "If you maintain documentation of any size, it is easier for translators if "
1990 "they have access to a source control system. That lets translators see the "
1991 "differences between two versions of the documentation, so, for instance, "
1992 "they can see what needs to be retranslated. It is recommended that the "
1993 "translated documentation maintain a note about what source control revision "
1994 "the translation is based on. An interesting system is provided by <ulink "
1995 "url=\"&url-i18n-doc-check;\">doc-check</ulink> in the <systemitem role="
1996 "\"package\">debian-installer</systemitem> package, which shows an overview "
1997 "of the translation status for any given language, using structured comments "
1998 "for the current revision of the file to be translated and, for a translated "
1999 "file, the revision of the original file the translation is based on. You "
2000 "might wish to adapt and provide that in your VCS area."
2003 #. type: Content of: <chapter><section><section><para>
2004 #: best-pkging-practices.dbk:1426
2006 "If you maintain XML or SGML documentation, we suggest that you isolate any "
2007 "language-independent information and define those as entities in a separate "
2008 "file which is included by all the different translations. This makes it "
2009 "much easier, for instance, to keep URLs up to date across multiple files."
2012 #. type: Content of: <chapter><section><section><para>
2013 #: best-pkging-practices.dbk:1432
2015 "Some tools (e.g. <systemitem role=\"package\">po4a</systemitem>, <systemitem "
2016 "role=\"package\">poxml</systemitem>, or the <systemitem role=\"package"
2017 "\">translate-toolkit</systemitem>) are specialized in extracting the "
2018 "translatable material from different formats. They produce PO files, a "
2019 "format quite common to translators, which permits to see what needs to be "
2020 "retranslated when the translated document is updated."
2023 #. type: Content of: <chapter><section><title>
2024 #: best-pkging-practices.dbk:1444
2025 msgid "Common packaging situations"
2028 #. type: Content of: <chapter><section><section><title>
2029 #: best-pkging-practices.dbk:1455
2030 msgid "Packages using <command>autoconf</command>/<command>automake</command>"
2033 #. type: Content of: <chapter><section><section><para>
2034 #: best-pkging-practices.dbk:1457
2036 "Keeping <command>autoconf</command>'s <filename>config.sub</filename> and "
2037 "<filename>config.guess</filename> files up to date is critical for porters, "
2038 "especially on more volatile architectures. Some very good packaging "
2039 "practices for any package using <command>autoconf</command> and/or "
2040 "<command>automake</command> have been synthesized in &file-bpp-autotools; "
2041 "from the <systemitem role=\"package\">autotools-dev</systemitem> package. "
2042 "You're strongly encouraged to read this file and to follow the given "
2046 #. type: Content of: <chapter><section><section><title>
2047 #: best-pkging-practices.dbk:1469
2051 #. type: Content of: <chapter><section><section><para>
2052 #: best-pkging-practices.dbk:1471
2054 "Libraries are always difficult to package for various reasons. The policy "
2055 "imposes many constraints to ease their maintenance and to make sure upgrades "
2056 "are as simple as possible when a new upstream version comes out. Breakage "
2057 "in a library can result in dozens of dependent packages breaking."
2060 #. type: Content of: <chapter><section><section><para>
2061 #: best-pkging-practices.dbk:1477
2063 "Good practices for library packaging have been grouped in <ulink url=\"&url-"
2064 "libpkg-guide;\">the library packaging guide</ulink>."
2067 #. type: Content of: <chapter><section><section><title>
2068 #: best-pkging-practices.dbk:1484
2069 msgid "Documentation"
2072 #. type: Content of: <chapter><section><section><para>
2073 #: best-pkging-practices.dbk:1486
2075 "Be sure to follow the <ulink url=\"&url-debian-policy;ch-docs.html\">Policy "
2076 "on documentation</ulink>."
2079 #. type: Content of: <chapter><section><section><para>
2080 #: best-pkging-practices.dbk:1491
2082 "If your package contains documentation built from XML or SGML, we recommend "
2083 "you not ship the XML or SGML source in the binary package(s). If users want "
2084 "the source of the documentation, they should retrieve the source package."
2087 #. type: Content of: <chapter><section><section><para>
2088 #: best-pkging-practices.dbk:1496
2090 "Policy specifies that documentation should be shipped in HTML format. We "
2091 "also recommend shipping documentation in PDF and plain text format if "
2092 "convenient and if output of reasonable quality is possible. However, it is "
2093 "generally not appropriate to ship plain text versions of documentation whose "
2094 "source format is HTML."
2097 #. type: Content of: <chapter><section><section><para>
2098 #: best-pkging-practices.dbk:1503
2100 "Major shipped manuals should register themselves with <systemitem role="
2101 "\"package\">doc-base</systemitem> on installation. See the <systemitem role="
2102 "\"package\">doc-base</systemitem> package documentation for more information."
2105 #. type: Content of: <chapter><section><section><para>
2106 #: best-pkging-practices.dbk:1509
2108 "Debian policy (section 12.1) directs that manual pages should accompany "
2109 "every program, utility, and function, and suggests them for other objects "
2110 "like configuration files. If the work you are packaging does not have such "
2111 "manual pages, consider writing them for inclusion in your package, and "
2112 "submitting them upstream."
2115 #. type: Content of: <chapter><section><section><para>
2116 #: best-pkging-practices.dbk:1516
2118 "The manpages do not need to be written directly in the troff format. "
2119 "Popular source formats are Docbook, POD and reST, which can be converted "
2120 "using <command>xsltproc</command>, <command>pod2man</command> and "
2121 "<command>rst2man</command> respectively. To a lesser extent, the "
2122 "<command>help2man</command> program can also be used to write a stub."
2125 #. type: Content of: <chapter><section><section><title>
2126 #: best-pkging-practices.dbk:1525
2127 msgid "Specific types of packages"
2130 #. type: Content of: <chapter><section><section><para>
2131 #: best-pkging-practices.dbk:1527
2133 "Several specific types of packages have special sub-policies and "
2134 "corresponding packaging rules and practices:"
2137 #. type: Content of: <chapter><section><section><itemizedlist><listitem><para>
2138 #: best-pkging-practices.dbk:1533
2140 "Perl related packages have a <ulink url=\"&url-perl-policy;\">Perl policy</"
2141 "ulink>, some examples of packages following that policy are <systemitem role="
2142 "\"package\">libdbd-pg-perl</systemitem> (binary perl module) or <systemitem "
2143 "role=\"package\">libmldbm-perl</systemitem> (arch independent perl module)."
2146 #. type: Content of: <chapter><section><section><itemizedlist><listitem><para>
2147 #: best-pkging-practices.dbk:1542
2149 "Python related packages have their python policy; see &file-python-policy; "
2150 "in the <systemitem role=\"package\">python</systemitem> package."
2153 #. type: Content of: <chapter><section><section><itemizedlist><listitem><para>
2154 #: best-pkging-practices.dbk:1549
2156 "Emacs related packages have the <ulink url=\"&url-emacs-policy;\">emacs "
2160 #. type: Content of: <chapter><section><section><itemizedlist><listitem><para>
2161 #: best-pkging-practices.dbk:1556
2163 "Java related packages have their <ulink url=\"&url-java-policy;\">java "
2167 #. type: Content of: <chapter><section><section><itemizedlist><listitem><para>
2168 #: best-pkging-practices.dbk:1563
2170 "Ocaml related packages have their own policy, found in &file-ocaml-policy; "
2171 "from the <systemitem role=\"package\">ocaml</systemitem> package. A good "
2172 "example is the <systemitem role=\"package\">camlzip</systemitem> source "
2176 #. type: Content of: <chapter><section><section><itemizedlist><listitem><para>
2177 #: best-pkging-practices.dbk:1571
2179 "Packages providing XML or SGML DTDs should conform to the recommendations "
2180 "found in the <systemitem role=\"package\">sgml-base-doc</systemitem> package."
2183 #. type: Content of: <chapter><section><section><itemizedlist><listitem><para>
2184 #: best-pkging-practices.dbk:1577
2186 "Lisp packages should register themselves with <systemitem role=\"package"
2187 "\">common-lisp-controller</systemitem>, about which see &file-lisp-"
2191 #. type: Content of: <chapter><section><section><title>
2192 #: best-pkging-practices.dbk:1607
2193 msgid "Architecture-independent data"
2196 #. type: Content of: <chapter><section><section><para>
2197 #: best-pkging-practices.dbk:1609
2199 "It is not uncommon to have a large amount of architecture-independent data "
2200 "packaged with a program. For example, audio files, a collection of icons, "
2201 "wallpaper patterns, or other graphic files. If the size of this data is "
2202 "negligible compared to the size of the rest of the package, it's probably "
2203 "best to keep it all in a single package."
2206 #. type: Content of: <chapter><section><section><para>
2207 #: best-pkging-practices.dbk:1616
2209 "However, if the size of the data is considerable, consider splitting it out "
2210 "into a separate, architecture-independent package (<filename>_all.deb</"
2211 "filename>). By doing this, you avoid needless duplication of the same data "
2212 "into eleven or more .debs, one per each architecture. While this adds some "
2213 "extra overhead into the <filename>Packages</filename> files, it saves a lot "
2214 "of disk space on Debian mirrors. Separating out architecture-independent "
2215 "data also reduces processing time of <command>lintian</command> (see <xref "
2216 "linkend=\"tools-lint\"/>) when run over the entire Debian archive."
2219 #. type: Content of: <chapter><section><section><title>
2220 #: best-pkging-practices.dbk:1628
2221 msgid "Needing a certain locale during build"
2224 #. type: Content of: <chapter><section><section><para>
2225 #: best-pkging-practices.dbk:1630
2227 "If you need a certain locale during build, you can create a temporary file "
2231 #. type: Content of: <chapter><section><section><para>
2232 #: best-pkging-practices.dbk:1634
2234 "If you set <varname>LOCPATH</varname> to the equivalent of <filename>/usr/"
2235 "lib/locale</filename>, and <varname>LC_ALL</varname> to the name of the "
2236 "locale you generate, you should get what you want without being root. "
2237 "Something like this:"
2240 #. type: Content of: <chapter><section><section><screen>
2241 #: best-pkging-practices.dbk:1639
2244 "LOCALE_PATH=debian/tmpdir/usr/lib/locale\n"
2245 "LOCALE_NAME=en_IN\n"
2246 "LOCALE_CHARSET=UTF-8\n"
2248 "mkdir -p $LOCALE_PATH\n"
2249 "localedef -i $LOCALE_NAME.$LOCALE_CHARSET -f $LOCALE_CHARSET $LOCALE_PATH/$LOCALE_NAME.$LOCALE_CHARSET\n"
2251 "# Using the locale\n"
2252 "LOCPATH=$LOCALE_PATH LC_ALL=$LOCALE_NAME.$LOCALE_CHARSET date\n"
2255 #. type: Content of: <chapter><section><section><title>
2256 #: best-pkging-practices.dbk:1652
2257 msgid "Make transition packages deborphan compliant"
2260 #. type: Content of: <chapter><section><section><para>
2261 #: best-pkging-practices.dbk:1654
2263 "Deborphan is a program for helping users to detect which packages can safely "
2264 "be removed from the system, i.e. the ones that have no packages depending "
2265 "on them. The default operation is to search only within the libs and "
2266 "oldlibs sections, to hunt down unused libraries. But when passed the right "
2267 "argument, it tries to catch other useless packages."
2270 #. type: Content of: <chapter><section><section><para>
2271 #: best-pkging-practices.dbk:1661
2273 "For example, with <literal>--guess-dummy</literal>, <command>deborphan</"
2274 "command> tries to search all transitional packages which were needed for "
2275 "upgrade but which can now safely be removed. For that, it looks for the "
2276 "string dummy or transitional in their short description."
2279 #. type: Content of: <chapter><section><section><para>
2280 #: best-pkging-practices.dbk:1668
2282 "So, when you are creating such a package, please make sure to add this text "
2283 "to your short description. If you are looking for examples, just run: "
2284 "<command>apt-cache search .|grep dummy</command> or <command>apt-cache "
2285 "search .|grep transitional</command>."
2288 #. type: Content of: <chapter><section><section><title>
2289 #: best-pkging-practices.dbk:1676
2290 msgid "Best practices for <filename>.orig.tar.{gz,bz2,lzma}</filename> files"
2293 #. type: Content of: <chapter><section><section><para>
2294 #: best-pkging-practices.dbk:1678
2296 "There are two kinds of original source tarballs: Pristine source and "
2297 "repackaged upstream source."
2300 #. type: Content of: <chapter><section><section><section><title>
2301 #: best-pkging-practices.dbk:1682
2302 msgid "Pristine source"
2305 #. type: Content of: <chapter><section><section><section><para><footnote><para>
2306 #: best-pkging-practices.dbk:1686
2308 "We cannot prevent upstream authors from changing the tarball they distribute "
2309 "without also incrementing the version number, so there can be no guarantee "
2310 "that a pristine tarball is identical to what upstream <emphasis>currently</"
2311 "emphasis> distributing at any point in time. All that can be expected is "
2312 "that it is identical to something that upstream once <emphasis>did</"
2313 "emphasis> distribute. If a difference arises later (say, if upstream "
2314 "notices that he wasn't using maximal compression in his original "
2315 "distribution and then re-<command>gzip</command>s it), that's just too bad. "
2316 "Since there is no good way to upload a new <filename>.orig.tar.{gz,bz2,lzma}"
2317 "</filename> for the same version, there is not even any point in treating "
2318 "this situation as a bug."
2321 #. type: Content of: <chapter><section><section><section><para>
2322 #: best-pkging-practices.dbk:1684
2324 "The defining characteristic of a pristine source tarball is that the "
2325 "<filename>.orig.tar.{gz,bz2,lzma}</filename> file is byte-for-byte identical "
2326 "to a tarball officially distributed by the upstream author.<placeholder type="
2327 "\"footnote\" id=\"0\"/> This makes it possible to use checksums to easily "
2328 "verify that all changes between Debian's version and upstream's are "
2329 "contained in the Debian diff. Also, if the original source is huge, "
2330 "upstream authors and others who already have the upstream tarball can save "
2331 "download time if they want to inspect your packaging in detail."
2334 #. type: Content of: <chapter><section><section><section><para>
2335 #: best-pkging-practices.dbk:1704
2337 "There is no universally accepted guidelines that upstream authors follow "
2338 "regarding to the directory structure inside their tarball, but <command>dpkg-"
2339 "source</command> is nevertheless able to deal with most upstream tarballs as "
2340 "pristine source. Its strategy is equivalent to the following:"
2343 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
2344 #: best-pkging-practices.dbk:1712
2345 msgid "It unpacks the tarball in an empty temporary directory by doing"
2348 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><screen>
2349 #: best-pkging-practices.dbk:1715
2351 msgid "zcat path/to/<replaceable>packagename</replaceable>_<replaceable>upstream-version</replaceable>.orig.tar.gz | tar xf -\n"
2354 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
2355 #: best-pkging-practices.dbk:1720
2357 "If, after this, the temporary directory contains nothing but one directory "
2358 "and no other files, <command>dpkg-source</command> renames that directory to "
2359 "<filename><replaceable>packagename</replaceable>-<replaceable>upstream-"
2360 "version</replaceable>(.orig)</filename>. The name of the top-level "
2361 "directory in the tarball does not matter, and is forgotten."
2364 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
2365 #: best-pkging-practices.dbk:1729
2367 "Otherwise, the upstream tarball must have been packaged without a common top-"
2368 "level directory (shame on the upstream author!). In this case, "
2369 "<command>dpkg-source</command> renames the temporary directory "
2370 "<emphasis>itself</emphasis> to <filename><replaceable>packagename</"
2371 "replaceable>-<replaceable>upstream-version</replaceable>(.orig)</filename>."
2374 #. type: Content of: <chapter><section><section><section><title>
2375 #: best-pkging-practices.dbk:1740
2376 msgid "Repackaged upstream source"
2379 #. type: Content of: <chapter><section><section><section><para>
2380 #: best-pkging-practices.dbk:1742
2382 "You <emphasis role=\"strong\">should</emphasis> upload packages with a "
2383 "pristine source tarball if possible, but there are various reasons why it "
2384 "might not be possible. This is the case if upstream does not distribute the "
2385 "source as gzipped tar at all, or if upstream's tarball contains non-DFSG-"
2386 "free material that you must remove before uploading."
2389 #. type: Content of: <chapter><section><section><section><para>
2390 #: best-pkging-practices.dbk:1749
2392 "In these cases the developer must construct a suitable <filename>.orig.tar."
2393 "{gz,bz2,lzma}</filename> file himself. We refer to such a tarball as a "
2394 "repackaged upstream source. Note that a repackaged upstream source is "
2395 "different from a Debian-native package. A repackaged source still comes "
2396 "with Debian-specific changes in a separate <filename>.diff.gz</filename> or "
2397 "<filename>.debian.tar.{gz,bz2,lzma}</filename> and still has a version "
2398 "number composed of <replaceable>upstream-version</replaceable> and "
2399 "<replaceable>debian-version</replaceable>."
2402 #. type: Content of: <chapter><section><section><section><para>
2403 #: best-pkging-practices.dbk:1758
2405 "There may be cases where it is desirable to repackage the source even though "
2406 "upstream distributes a <filename>.tar.{gz,bz2,lzma}</filename> that could in "
2407 "principle be used in its pristine form. The most obvious is if "
2408 "<emphasis>significant</emphasis> space savings can be achieved by "
2409 "recompressing the tar archive or by removing genuinely useless cruft from "
2410 "the upstream archive. Use your own discretion here, but be prepared to "
2411 "defend your decision if you repackage source that could have been pristine."
2414 #. type: Content of: <chapter><section><section><section><para>
2415 #: best-pkging-practices.dbk:1767
2416 msgid "A repackaged <filename>.orig.tar.{gz,bz2,lzma}</filename>"
2419 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
2420 #: best-pkging-practices.dbk:1772
2422 "<emphasis role=\"strong\">should</emphasis> be documented in the resulting "
2423 "source package. Detailed information on how the repackaged source was "
2424 "obtained, and on how this can be reproduced should be provided in "
2425 "<filename>debian/copyright</filename>. It is also a good idea to provide a "
2426 "<literal>get-orig-source</literal> target in your <filename>debian/rules</"
2427 "filename> file that repeats the process, as described in the Policy Manual, "
2428 "<ulink url=\"&url-debian-policy;ch-source.html#s-debianrules\">Main building "
2429 "script: <filename>debian/rules</filename></ulink>."
2432 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para><footnote><para>
2433 #: best-pkging-practices.dbk:1787
2435 "As a special exception, if the omission of non-free files would lead to the "
2436 "source failing to build without assistance from the Debian diff, it might be "
2437 "appropriate to instead edit the files, omitting only the non-free parts of "
2438 "them, and/or explain the situation in a <filename>README.source</filename> "
2439 "file in the root of the source tree. But in that case please also urge the "
2440 "upstream author to make the non-free components easier separable from the "
2441 "rest of the source."
2444 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
2445 #: best-pkging-practices.dbk:1785
2447 "<emphasis role=\"strong\">should not</emphasis> contain any file that does "
2448 "not come from the upstream author(s), or whose contents has been changed by "
2449 "you.<placeholder type=\"footnote\" id=\"0\"/>"
2452 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
2453 #: best-pkging-practices.dbk:1798
2455 "<emphasis role=\"strong\">should</emphasis>, except where impossible for "
2456 "legal reasons, preserve the entire building and portablility infrastructure "
2457 "provided by the upstream author. For example, it is not a sufficient reason "
2458 "for omitting a file that it is used only when building on MS-DOS. "
2459 "Similarly, a <filename>Makefile</filename> provided by upstream should not "
2460 "be omitted even if the first thing your <filename>debian/rules</filename> "
2461 "does is to overwrite it by running a configure script."
2464 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
2465 #: best-pkging-practices.dbk:1807
2467 "(<emphasis>Rationale:</emphasis> It is common for Debian users who need to "
2468 "build software for non-Debian platforms to fetch the source from a Debian "
2469 "mirror rather than trying to locate a canonical upstream distribution point)."
2472 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
2473 #: best-pkging-practices.dbk:1814
2475 "<emphasis role=\"strong\">should</emphasis> use "
2476 "<filename><replaceable>packagename</replaceable>-<replaceable>upstream-"
2477 "version</replaceable>.orig</filename> as the name of the top-level directory "
2478 "in its tarball. This makes it possible to distinguish pristine tarballs "
2479 "from repackaged ones."
2482 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
2483 #: best-pkging-practices.dbk:1822
2485 "<emphasis role=\"strong\">should</emphasis> be gzipped or bzipped with "
2486 "maximal compression."
2489 #. type: Content of: <chapter><section><section><section><title>
2490 #: best-pkging-practices.dbk:1829
2491 msgid "Changing binary files"
2494 #. type: Content of: <chapter><section><section><section><para>
2495 #: best-pkging-practices.dbk:1831
2497 "Sometimes it is necessary to change binary files contained in the original "
2498 "tarball, or to add binary files that are not in it. This is fully supported "
2499 "when using source packages in “3.0 (quilt)” format, see the "
2500 "<citerefentry><refentrytitle>dpkg-source</refentrytitle><manvolnum>1</"
2501 "manvolnum></citerefentry> manual page for details. When using the older "
2502 "format “1.0”, binary files can't be stored in the <filename>.diff.gz</"
2503 "filename> so you must store an <command>uuencode</command>d (or similar) "
2504 "version of the file(s) and decode it at build time in <filename>debian/"
2505 "rules</filename> (and move it in its official location)."
2508 #. type: Content of: <chapter><section><section><title>
2509 #: best-pkging-practices.dbk:1846
2510 msgid "Best practices for debug packages"
2513 #. type: Content of: <chapter><section><section><para>
2514 #: best-pkging-practices.dbk:1848
2516 "A debug package is a package with a name ending in -dbg, that contains "
2517 "additional information that <command>gdb</command> can use. Since Debian "
2518 "binaries are stripped by default, debugging information, including function "
2519 "names and line numbers, is otherwise not available when running "
2520 "<command>gdb</command> on Debian binaries. Debug packages allow users who "
2521 "need this additional debugging information to install it, without bloating a "
2522 "regular system with the information."
2525 #. type: Content of: <chapter><section><section><para>
2526 #: best-pkging-practices.dbk:1856
2528 "It is up to a package's maintainer whether to create a debug package or "
2529 "not. Maintainers are encouraged to create debug packages for library "
2530 "packages, since this can aid in debugging many programs linked to a "
2531 "library. In general, debug packages do not need to be added for all "
2532 "programs; doing so would bloat the archive. But if a maintainer finds that "
2533 "users often need a debugging version of a program, it can be worthwhile to "
2534 "make a debug package for it. Programs that are core infrastructure, such as "
2535 "apache and the X server are also good candidates for debug packages."
2538 #. type: Content of: <chapter><section><section><para>
2539 #: best-pkging-practices.dbk:1866
2541 "Some debug packages may contain an entire special debugging build of a "
2542 "library or other binary, but most of them can save space and build time by "
2543 "instead containing separated debugging symbols that <command>gdb</command> "
2544 "can find and load on the fly when debugging a program or library. The "
2545 "convention in Debian is to keep these symbols in <filename>/usr/lib/debug/"
2546 "<replaceable>path</replaceable></filename>, where <replaceable>path</"
2547 "replaceable> is the path to the executable or library. For example, "
2548 "debugging symbols for <filename>/usr/bin/foo</filename> go in <filename>/usr/"
2549 "lib/debug/usr/bin/foo</filename>, and debugging symbols for <filename>/usr/"
2550 "lib/libfoo.so.1</filename> go in <filename>/usr/lib/debug/usr/lib/libfoo."
2554 #. type: Content of: <chapter><section><section><para>
2555 #: best-pkging-practices.dbk:1878
2557 "The debugging symbols can be extracted from an object file using "
2558 "<command>objcopy --only-keep-debug</command>. Then the object file can be "
2559 "stripped, and <command>objcopy --add-gnu-debuglink</command> used to specify "
2560 "the path to the debugging symbol file. <citerefentry> "
2561 "<refentrytitle>objcopy</refentrytitle> <manvolnum>1</manvolnum> </"
2562 "citerefentry> explains in detail how this works."
2565 #. type: Content of: <chapter><section><section><para>
2566 #: best-pkging-practices.dbk:1886
2568 "The <command>dh_strip</command> command in <systemitem role=\"package"
2569 "\">debhelper</systemitem> supports creating debug packages, and can take "
2570 "care of using <command>objcopy</command> to separate out the debugging "
2571 "symbols for you. If your package uses <systemitem role=\"package"
2572 "\">debhelper</systemitem>, all you need to do is call <command>dh_strip --"
2573 "dbg-package=libfoo-dbg</command>, and add an entry to <filename>debian/"
2574 "control</filename> for the debug package."
2577 #. type: Content of: <chapter><section><section><para>
2578 #: best-pkging-practices.dbk:1893
2580 "Note that the debug package should depend on the package that it provides "
2581 "debugging symbols for, and this dependency should be versioned. For example:"
2584 #. type: Content of: <chapter><section><section><screen>
2585 #: best-pkging-practices.dbk:1897
2587 msgid "Depends: libfoo (= ${binary:Version})\n"