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: 2012-01-10 17:56-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 "
28 "url=\"&url-debian-policy;\">Debian Policy</ulink>, which defines explicit "
29 "baseline requirements which all Debian packages must fulfill. Yet there is "
30 "also a shared history of experience which goes beyond the Debian Policy, an "
31 "accumulation of years of experience in packaging. Many very talented people "
32 "have created great tools, tools which help you, the Debian maintainer, "
33 "create and maintain excellent packages."
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 "
94 "role=\"package\">debhelper</systemitem>. Previous helper systems, such as "
95 "<systemitem role=\"package\">debmake</systemitem>, were monolithic: you "
96 "couldn't pick and choose which part of the helper you found useful, but had "
97 "to use the helper to do everything. <systemitem "
98 "role=\"package\">debhelper</systemitem>, however, is a number of separate "
99 "little <command>dh_*</command> programs. For instance, "
100 "<command>dh_installman</command> installs and compresses man pages, "
101 "<command>dh_installmenu</command> installs menu files, and so on. Thus, it "
102 "offers enough flexibility to be able to use the little helper scripts, where "
103 "useful, in conjunction with hand-crafted commands in "
104 "<filename>debian/rules</filename>."
107 #. type: Content of: <chapter><section><section><para>
108 #: best-pkging-practices.dbk:66
110 "You can get started with <systemitem role=\"package\">debhelper</systemitem> "
111 "by reading <citerefentry> <refentrytitle>debhelper</refentrytitle> "
112 "<manvolnum>1</manvolnum> </citerefentry>, and looking at the examples that "
113 "come with the package. <command>dh_make</command>, from the <systemitem "
114 "role=\"package\">dh-make</systemitem> package (see <xref "
115 "linkend=\"dh-make\"/>), can be used to convert a vanilla source package to a "
116 "<systemitem role=\"package\">debhelper</systemitem>ized package. This "
117 "shortcut, though, should not convince you that you do not need to bother "
118 "understanding the individual <command>dh_*</command> helpers. If you are "
119 "going to use a helper, you do need to take the time to learn to use that "
120 "helper, to learn its expectations and behavior."
123 #. type: Content of: <chapter><section><section><para>
124 #: best-pkging-practices.dbk:79
126 "Some people feel that vanilla <filename>debian/rules</filename> files are "
127 "better, since you don't have to learn the intricacies of any helper system. "
128 "This decision is completely up to you. Use what works for you. Many "
129 "examples of vanilla <filename>debian/rules</filename> files are available at "
130 "<ulink url=\"&url-rules-files;\"></ulink>."
133 #. type: Content of: <chapter><section><section><title>
134 #: best-pkging-practices.dbk:88
135 msgid "Separating your patches into multiple files"
138 #. type: Content of: <chapter><section><section><para>
139 #: best-pkging-practices.dbk:90
141 "Big, complex packages may have many bugs that you need to deal with. If you "
142 "correct a number of bugs directly in the source, and you're not careful, it "
143 "can get hard to differentiate the various patches that you applied. It can "
144 "get quite messy when you have to update the package to a new upstream "
145 "version which integrates some of the fixes (but not all). You can't take "
146 "the total set of diffs (e.g., from <filename>.diff.gz</filename>) and work "
147 "out which patch sets to back out as a unit as bugs are fixed upstream."
150 #. type: Content of: <chapter><section><section><para>
151 #: best-pkging-practices.dbk:99
153 "Fortunately, with the source format “3.0 (quilt)” it is now possible to keep "
154 "patches separate without having to modify <filename>debian/rules</filename> "
155 "to setup a patch system. Patches are stored in "
156 "<filename>debian/patches/</filename> and when the source package is unpacked "
157 "patches listed in <filename>debian/patches/series</filename> are "
158 "automatically applied. As the name implies, patches can be managed with "
159 "<command>quilt</command>."
162 #. type: Content of: <chapter><section><section><para>
163 #: best-pkging-practices.dbk:107
165 "When using the older source “1.0”, it's also possible to separate patches "
166 "but a dedicated patch system must be used: the patch files are shipped "
167 "within the Debian patch file (<filename>.diff.gz</filename>), usually within "
168 "the <filename>debian/</filename> directory. The only difference is that they "
169 "aren't applied immediately by <command>dpkg-source</command>, but by the "
170 "<literal>build</literal> rule of <filename>debian/rules</filename>, through "
171 "a dependency on the <literal>patch</literal> rule. Conversely, they are "
172 "reverted in the <literal>clean</literal> rule, through a dependency on the "
173 "<literal>unpatch</literal> rule."
176 #. type: Content of: <chapter><section><section><para>
177 #: best-pkging-practices.dbk:119
179 "<command>quilt</command> is the recommended tool for this. It does all of "
180 "the above, and also allows to manage patch series. See the <systemitem "
181 "role=\"package\">quilt</systemitem> package for more information."
184 #. type: Content of: <chapter><section><section><para>
185 #: best-pkging-practices.dbk:125
187 "There are other tools to manage patches, like <command>dpatch</command>, and "
188 "the patch system integrated with <systemitem "
189 "role=\"package\">cdbs</systemitem>."
192 #. type: Content of: <chapter><section><section><title>
193 #: best-pkging-practices.dbk:132
194 msgid "Multiple binary packages"
197 #. type: Content of: <chapter><section><section><para>
198 #: best-pkging-practices.dbk:134
200 "A single source package will often build several binary packages, either to "
201 "provide several flavors of the same software (e.g., the <systemitem "
202 "role=\"package\">vim</systemitem> source package) or to make several small "
203 "packages instead of a big one (e.g., so the user can install only the subset "
204 "needed, and thus save some disk space)."
207 #. type: Content of: <chapter><section><section><para>
208 #: best-pkging-practices.dbk:141
210 "The second case can be easily managed in <filename>debian/rules</filename>. "
211 "You just need to move the appropriate files from the build directory into "
212 "the package's temporary trees. You can do this using "
213 "<command>install</command> or <command>dh_install</command> from <systemitem "
214 "role=\"package\">debhelper</systemitem>. Be sure to check the different "
215 "permutations of the various packages, ensuring that you have the "
216 "inter-package dependencies set right in <filename>debian/control</filename>."
219 #. type: Content of: <chapter><section><section><para>
220 #: best-pkging-practices.dbk:150
222 "The first case is a bit more difficult since it involves multiple recompiles "
223 "of the same software but with different configuration options. The "
224 "<systemitem role=\"package\">vim</systemitem> source package is an example "
225 "of how to manage this using an hand-crafted "
226 "<filename>debian/rules</filename> file."
229 #. type: Content of: <chapter><section><title>
230 #: best-pkging-practices.dbk:162
231 msgid "Best practices for <filename>debian/control</filename>"
234 #. type: Content of: <chapter><section><para>
235 #: best-pkging-practices.dbk:164
237 "The following practices are relevant to the "
238 "<filename>debian/control</filename> file. They supplement the <ulink "
239 "url=\"&url-debian-policy;ch-binary.html#s-descriptions\">Policy on package "
240 "descriptions</ulink>."
243 #. type: Content of: <chapter><section><para>
244 #: best-pkging-practices.dbk:170
246 "The description of the package, as defined by the corresponding field in the "
247 "<filename>control</filename> file, contains both the package synopsis and "
248 "the long description for the package. <xref linkend=\"bpp-desc-basics\"/> "
249 "describes common guidelines for both parts of the package description. "
250 "Following that, <xref linkend=\"bpp-pkg-synopsis\"/> provides guidelines "
251 "specific to the synopsis, and <xref linkend=\"bpp-pkg-desc\"/> contains "
252 "guidelines specific to the description."
255 #. type: Content of: <chapter><section><section><title>
256 #: best-pkging-practices.dbk:179
257 msgid "General guidelines for package descriptions"
260 #. type: Content of: <chapter><section><section><para>
261 #: best-pkging-practices.dbk:181
263 "The package description should be written for the average likely user, the "
264 "average person who will use and benefit from the package. For instance, "
265 "development packages are for developers, and can be technical in their "
266 "language. More general-purpose applications, such as editors, should be "
267 "written for a less technical user."
270 #. type: Content of: <chapter><section><section><para>
271 #: best-pkging-practices.dbk:188
273 "Our review of package descriptions lead us to conclude that most package "
274 "descriptions are technical, that is, are not written to make sense for "
275 "non-technical users. Unless your package really is only for technical "
276 "users, this is a problem."
279 #. type: Content of: <chapter><section><section><para>
280 #: best-pkging-practices.dbk:194
282 "How do you write for non-technical users? Avoid jargon. Avoid referring to "
283 "other applications or frameworks that the user might not be familiar with — "
284 "GNOME or KDE is fine, since users are probably familiar with these terms, "
285 "but GTK+ is probably not. Try not to assume any knowledge at all. If you "
286 "must use technical terms, introduce them."
289 #. type: Content of: <chapter><section><section><para>
290 #: best-pkging-practices.dbk:201
292 "Be objective. Package descriptions are not the place for advocating your "
293 "package, no matter how much you love it. Remember that the reader may not "
294 "care about the same things you care about."
297 #. type: Content of: <chapter><section><section><para>
298 #: best-pkging-practices.dbk:206
300 "References to the names of any other software packages, protocol names, "
301 "standards, or specifications should use their canonical forms, if one "
302 "exists. For example, use X Window System, X11, or X; not X Windows, "
303 "X-Windows, or X Window. Use GTK+, not GTK or gtk. Use GNOME, not Gnome. "
304 "Use PostScript, not Postscript or postscript."
307 #. type: Content of: <chapter><section><section><para>
308 #: best-pkging-practices.dbk:213
310 "If you are having problems writing your description, you may wish to send it "
311 "along to &email-debian-l10n-english; and request feedback."
314 #. type: Content of: <chapter><section><section><title>
315 #: best-pkging-practices.dbk:219
316 msgid "The package synopsis, or short description"
319 #. type: Content of: <chapter><section><section><para>
320 #: best-pkging-practices.dbk:221
322 "Policy says the synopsis line (the short description) must be concise, not "
323 "repeating the package name, but also informative."
326 #. type: Content of: <chapter><section><section><para>
327 #: best-pkging-practices.dbk:225
329 "The synopsis functions as a phrase describing the package, not a complete "
330 "sentence, so sentential punctuation is inappropriate: it does not need extra "
331 "capital letters or a final period (full stop). It should also omit any "
332 "initial indefinite or definite article — \"a\", \"an\", or \"the\". Thus for "
336 #. type: Content of: <chapter><section><section><screen>
337 #: best-pkging-practices.dbk:231
341 "Description: exemplification support library\n"
344 #. type: Content of: <chapter><section><section><para>
345 #: best-pkging-practices.dbk:235
347 "Technically this is a noun phrase minus articles, as opposed to a verb "
348 "phrase. A good heuristic is that it should be possible to substitute the "
349 "package <replaceable>name</replaceable> and "
350 "<replaceable>synopsis</replaceable> into this formula:"
353 #. type: Content of: <chapter><section><section><para>
354 #: best-pkging-practices.dbk:240
356 "The package <replaceable>name</replaceable> provides {a,an,the,some} "
357 "<replaceable>synopsis</replaceable>."
360 #. type: Content of: <chapter><section><section><para>
361 #: best-pkging-practices.dbk:244
363 "Sets of related packages may use an alternative scheme that divides the "
364 "synopsis into two parts, the first a description of the whole suite and the "
365 "second a summary of the package's role within it:"
368 #. type: Content of: <chapter><section><section><screen>
369 #: best-pkging-practices.dbk:249
372 "Package: eg-tools\n"
373 "Description: simple exemplification system (utilities)\n"
376 "Description: simple exemplification system - documentation\n"
379 #. type: Content of: <chapter><section><section><para>
380 #: best-pkging-practices.dbk:256
382 "These synopses follow a modified formula. Where a package "
383 "\"<replaceable>name</replaceable>\" has a synopsis "
384 "\"<replaceable>suite</replaceable> (<replaceable>role</replaceable>)\" or "
385 "\"<replaceable>suite</replaceable> - <replaceable>role</replaceable>\", the "
386 "elements should be phrased so that they fit into the formula:"
389 #. type: Content of: <chapter><section><section><para>
390 #: best-pkging-practices.dbk:263
392 "The package <replaceable>name</replaceable> provides {a,an,the} "
393 "<replaceable>role</replaceable> for the <replaceable>suite</replaceable>."
396 #. type: Content of: <chapter><section><section><title>
397 #: best-pkging-practices.dbk:269
398 msgid "The long description"
401 #. type: Content of: <chapter><section><section><para>
402 #: best-pkging-practices.dbk:271
404 "The long description is the primary information available to the user about "
405 "a package before they install it. It should provide all the information "
406 "needed to let the user decide whether to install the package. Assume that "
407 "the user has already read the package synopsis."
410 #. type: Content of: <chapter><section><section><para>
411 #: best-pkging-practices.dbk:277
412 msgid "The long description should consist of full and complete sentences."
415 #. type: Content of: <chapter><section><section><para>
416 #: best-pkging-practices.dbk:280
418 "The first paragraph of the long description should answer the following "
419 "questions: what does the package do? what task does it help the user "
420 "accomplish? It is important to describe this in a non-technical way, unless "
421 "of course the audience for the package is necessarily technical."
424 #. type: Content of: <chapter><section><section><para>
425 #: best-pkging-practices.dbk:286
427 "The following paragraphs should answer the following questions: Why do I as "
428 "a user need this package? What other features does the package have? What "
429 "outstanding features and deficiencies are there compared to other packages "
430 "(e.g., if you need X, use Y instead)? Is this package related to other "
431 "packages in some way that is not handled by the package manager (e.g., this "
432 "is the client for the foo server)?"
435 #. type: Content of: <chapter><section><section><para>
436 #: best-pkging-practices.dbk:294
438 "Be careful to avoid spelling and grammar mistakes. Ensure that you "
439 "spell-check it. Both <command>ispell</command> and "
440 "<command>aspell</command> have special modes for checking "
441 "<filename>debian/control</filename> files:"
444 #. type: Content of: <chapter><section><section><screen>
445 #: best-pkging-practices.dbk:299
447 msgid "ispell -d american -g debian/control\n"
450 #. type: Content of: <chapter><section><section><screen>
451 #: best-pkging-practices.dbk:302
453 msgid "aspell -d en -D -c debian/control\n"
456 #. type: Content of: <chapter><section><section><para>
457 #: best-pkging-practices.dbk:305
459 "Users usually expect these questions to be answered in the package "
463 #. type: Content of: <chapter><section><section><itemizedlist><listitem><para>
464 #: best-pkging-practices.dbk:310
466 "What does the package do? If it is an add-on to another package, then the "
467 "short description of the package we are an add-on to should be put in here."
470 #. type: Content of: <chapter><section><section><itemizedlist><listitem><para>
471 #: best-pkging-practices.dbk:316
473 "Why should I want this package? This is related to the above, but not the "
474 "same (this is a mail user agent; this is cool, fast, interfaces with PGP and "
475 "LDAP and IMAP, has features X, Y, and Z)."
478 #. type: Content of: <chapter><section><section><itemizedlist><listitem><para>
479 #: best-pkging-practices.dbk:323
481 "If this package should not be installed directly, but is pulled in by "
482 "another package, this should be mentioned."
485 #. type: Content of: <chapter><section><section><itemizedlist><listitem><para>
486 #: best-pkging-practices.dbk:329
488 "If the package is <literal>experimental</literal>, or there are other "
489 "reasons it should not be used, if there are other packages that should be "
490 "used instead, it should be here as well."
493 #. type: Content of: <chapter><section><section><itemizedlist><listitem><para>
494 #: best-pkging-practices.dbk:336
496 "How is this package different from the competition? Is it a better "
497 "implementation? more features? different features? Why should I choose this "
501 #. type: Content of: <chapter><section><section><title>
502 #: best-pkging-practices.dbk:349
503 msgid "Upstream home page"
506 #. type: Content of: <chapter><section><section><para>
507 #: best-pkging-practices.dbk:351
509 "We recommend that you add the URL for the package's home page in the "
510 "<literal>Homepage</literal> field of the <literal>Source</literal> section "
511 "in <filename>debian/control</filename>. Adding this information in the "
512 "package description itself is considered deprecated."
515 #. type: Content of: <chapter><section><section><title>
516 #: best-pkging-practices.dbk:359
517 msgid "Version Control System location"
520 #. type: Content of: <chapter><section><section><para>
521 #: best-pkging-practices.dbk:361
523 "There are additional fields for the location of the Version Control System "
524 "in <filename>debian/control</filename>."
527 #. type: Content of: <chapter><section><section><section><title>
528 #: best-pkging-practices.dbk:365
532 #. type: Content of: <chapter><section><section><section><para>
533 #: best-pkging-practices.dbk:367
535 "Value of this field should be a <literal>http://</literal> URL pointing to a "
536 "web-browsable copy of the Version Control System repository used to maintain "
537 "the given package, if available."
540 #. type: Content of: <chapter><section><section><section><para>
541 #: best-pkging-practices.dbk:372
543 "The information is meant to be useful for the final user, willing to browse "
544 "the latest work done on the package (e.g. when looking for the patch fixing "
545 "a bug tagged as <literal>pending</literal> in the bug tracking system)."
548 #. type: Content of: <chapter><section><section><section><title>
549 #: best-pkging-practices.dbk:379
553 #. type: Content of: <chapter><section><section><section><para>
554 #: best-pkging-practices.dbk:381
556 "Value of this field should be a string identifying unequivocally the "
557 "location of the Version Control System repository used to maintain the given "
558 "package, if available. <literal>*</literal> identify the Version Control "
559 "System; currently the following systems are supported by the package "
560 "tracking system: <literal>arch</literal>, <literal>bzr</literal> (Bazaar), "
561 "<literal>cvs</literal>, <literal>darcs</literal>, <literal>git</literal>, "
562 "<literal>hg</literal> (Mercurial), <literal>mtn</literal> (Monotone), "
563 "<literal>svn</literal> (Subversion). It is allowed to specify different VCS "
564 "fields for the same package: they will all be shown in the PTS web "
568 #. type: Content of: <chapter><section><section><section><para>
569 #: best-pkging-practices.dbk:392
571 "The information is meant to be useful for a user knowledgeable in the given "
572 "Version Control System and willing to build the current version of a package "
573 "from the VCS sources. Other uses of this information might include "
574 "automatic building of the latest VCS version of the given package. To this "
575 "end the location pointed to by the field should better be version agnostic "
576 "and point to the main branch (for VCSs supporting such a concept). Also, "
577 "the location pointed to should be accessible to the final user; fulfilling "
578 "this requirement might imply pointing to an anonymous access of the "
579 "repository instead of pointing to an SSH-accessible version of the same."
582 #. type: Content of: <chapter><section><section><section><para>
583 #: best-pkging-practices.dbk:403
585 "In the following example, an instance of the field for a Subversion "
586 "repository of the <systemitem role=\"package\">vim</systemitem> package is "
587 "shown. Note how the URL is in the <literal>svn://</literal> scheme (instead "
588 "of <literal>svn+ssh://</literal>) and how it points to the "
589 "<filename>trunk/</filename> branch. The use of the "
590 "<literal>Vcs-Browser</literal> and <literal>Homepage</literal> fields "
591 "described above is also shown."
594 #. type: Content of: <chapter><section><section><section><screen>
595 #: best-pkging-practices.dbk:412
599 " Section: editors\n"
600 " Priority: optional\n"
602 " Vcs-Svn: svn://svn.debian.org/svn/pkg-vim/trunk/packages/vim\n"
603 " Vcs-Browser: http://svn.debian.org/wsvn/pkg-vim/trunk/packages/vim\n"
604 " Homepage: http://www.vim.org\n"
607 #. type: Content of: <chapter><section><title>
608 #: best-pkging-practices.dbk:427
609 msgid "Best practices for <filename>debian/changelog</filename>"
612 #. type: Content of: <chapter><section><para>
613 #: best-pkging-practices.dbk:429
615 "The following practices supplement the <ulink "
616 "url=\"&url-debian-policy;ch-docs.html#s-changelogs\">Policy on changelog "
620 #. type: Content of: <chapter><section><section><title>
621 #: best-pkging-practices.dbk:434
622 msgid "Writing useful changelog entries"
625 #. type: Content of: <chapter><section><section><para>
626 #: best-pkging-practices.dbk:436
628 "The changelog entry for a package revision documents changes in that "
629 "revision, and only them. Concentrate on describing significant and "
630 "user-visible changes that were made since the last version."
633 #. type: Content of: <chapter><section><section><para>
634 #: best-pkging-practices.dbk:441
636 "Focus on <emphasis>what</emphasis> was changed — who, how and when are "
637 "usually less important. Having said that, remember to politely attribute "
638 "people who have provided notable help in making the package (e.g., those who "
639 "have sent in patches)."
642 #. type: Content of: <chapter><section><section><para>
643 #: best-pkging-practices.dbk:447
645 "There's no need to elaborate the trivial and obvious changes. You can also "
646 "aggregate several changes in one entry. On the other hand, don't be overly "
647 "terse if you have undertaken a major change. Be especially clear if there "
648 "are changes that affect the behaviour of the program. For further "
649 "explanations, use the <filename>README.Debian</filename> file."
652 #. type: Content of: <chapter><section><section><para>
653 #: best-pkging-practices.dbk:454
655 "Use common English so that the majority of readers can comprehend it. Avoid "
656 "abbreviations, tech-speak and jargon when explaining changes that close "
657 "bugs, especially for bugs filed by users that did not strike you as "
658 "particularly technically savvy. Be polite, don't swear."
661 #. type: Content of: <chapter><section><section><para>
662 #: best-pkging-practices.dbk:460
664 "It is sometimes desirable to prefix changelog entries with the names of the "
665 "files that were changed. However, there's no need to explicitly list each "
666 "and every last one of the changed files, especially if the change was small "
667 "or repetitive. You may use wildcards."
670 #. type: Content of: <chapter><section><section><para>
671 #: best-pkging-practices.dbk:466
673 "When referring to bugs, don't assume anything. Say what the problem was, "
674 "how it was fixed, and append the closes: #nnnnn string. See <xref "
675 "linkend=\"upload-bugfix\"/> for more information."
678 #. type: Content of: <chapter><section><section><title>
679 #: best-pkging-practices.dbk:473
680 msgid "Common misconceptions about changelog entries"
683 #. type: Content of: <chapter><section><section><para>
684 #: best-pkging-practices.dbk:475
686 "The changelog entries should <emphasis role=\"strong\">not</emphasis> "
687 "document generic packaging issues (Hey, if you're looking for foo.conf, it's "
688 "in /etc/blah/.), since administrators and users are supposed to be at least "
689 "remotely acquainted with how such things are generally arranged on Debian "
690 "systems. Do, however, mention if you change the location of a configuration "
694 #. type: Content of: <chapter><section><section><para>
695 #: best-pkging-practices.dbk:483
697 "The only bugs closed with a changelog entry should be those that are "
698 "actually fixed in the same package revision. Closing unrelated bugs in the "
699 "changelog is bad practice. See <xref linkend=\"upload-bugfix\"/>."
702 #. type: Content of: <chapter><section><section><para>
703 #: best-pkging-practices.dbk:488
705 "The changelog entries should <emphasis role=\"strong\">not</emphasis> be "
706 "used for random discussion with bug reporters (I don't see segfaults when "
707 "starting foo with option bar; send in more info), general statements on "
708 "life, the universe and everything (sorry this upload took me so long, but I "
709 "caught the flu), or pleas for help (the bug list on this package is huge, "
710 "please lend me a hand). Such things usually won't be noticed by their "
711 "target audience, but may annoy people who wish to read information about "
712 "actual changes in the package. See <xref linkend=\"bug-answering\"/> for "
713 "more information on how to use the bug tracking system."
716 #. type: Content of: <chapter><section><section><para>
717 #: best-pkging-practices.dbk:499
719 "It is an old tradition to acknowledge bugs fixed in non-maintainer uploads "
720 "in the first changelog entry of the proper maintainer upload. As we have "
721 "version tracking now, it is enough to keep the NMUed changelog entries and "
722 "just mention this fact in your own changelog entry."
725 #. type: Content of: <chapter><section><section><title>
726 #: best-pkging-practices.dbk:507
727 msgid "Common errors in changelog entries"
730 #. type: Content of: <chapter><section><section><para>
731 #: best-pkging-practices.dbk:509
733 "The following examples demonstrate some common errors or examples of bad "
734 "style in changelog entries."
737 #. type: Content of: <chapter><section><section><screen>
738 #: best-pkging-practices.dbk:513
740 msgid " * Fixed all outstanding bugs.\n"
743 #. type: Content of: <chapter><section><section><para>
744 #: best-pkging-practices.dbk:516
745 msgid "This doesn't tell readers anything too useful, obviously."
748 #. type: Content of: <chapter><section><section><screen>
749 #: best-pkging-practices.dbk:519
751 msgid " * Applied patch from Jane Random.\n"
754 #. type: Content of: <chapter><section><section><para>
755 #: best-pkging-practices.dbk:522
756 msgid "What was the patch about?"
759 #. type: Content of: <chapter><section><section><screen>
760 #: best-pkging-practices.dbk:525
762 msgid " * Late night install target overhaul.\n"
765 #. type: Content of: <chapter><section><section><para>
766 #: best-pkging-practices.dbk:528
768 "Overhaul which accomplished what? Is the mention of late night supposed to "
769 "remind us that we shouldn't trust that code?"
772 #. type: Content of: <chapter><section><section><screen>
773 #: best-pkging-practices.dbk:532
775 msgid " * Fix vsync FU w/ ancient CRTs.\n"
778 #. type: Content of: <chapter><section><section><para>
779 #: best-pkging-practices.dbk:535
781 "Too many acronyms, and it's not overly clear what the, uh, fsckup (oops, a "
782 "curse word!) was actually about, or how it was fixed."
785 #. type: Content of: <chapter><section><section><screen>
786 #: best-pkging-practices.dbk:539
788 msgid " * This is not a bug, closes: #nnnnnn.\n"
791 #. type: Content of: <chapter><section><section><para>
792 #: best-pkging-practices.dbk:542
794 "First of all, there's absolutely no need to upload the package to convey "
795 "this information; instead, use the bug tracking system. Secondly, there's "
796 "no explanation as to why the report is not a bug."
799 #. type: Content of: <chapter><section><section><screen>
800 #: best-pkging-practices.dbk:547
802 msgid " * Has been fixed for ages, but I forgot to close; closes: #54321.\n"
805 #. type: Content of: <chapter><section><section><para>
806 #: best-pkging-practices.dbk:550
808 "If for some reason you didn't mention the bug number in a previous changelog "
809 "entry, there's no problem, just close the bug normally in the BTS. There's "
810 "no need to touch the changelog file, presuming the description of the fix is "
811 "already in (this applies to the fixes by the upstream authors/maintainers as "
812 "well, you don't have to track bugs that they fixed ages ago in your "
816 #. type: Content of: <chapter><section><section><screen>
817 #: best-pkging-practices.dbk:557
819 msgid " * Closes: #12345, #12346, #15432\n"
822 #. type: Content of: <chapter><section><section><para>
823 #: best-pkging-practices.dbk:560
825 "Where's the description? If you can't think of a descriptive message, start "
826 "by inserting the title of each different bug."
829 #. type: Content of: <chapter><section><section><title>
830 #: best-pkging-practices.dbk:566
831 msgid "Supplementing changelogs with <filename>NEWS.Debian</filename> files"
834 #. type: Content of: <chapter><section><section><para>
835 #: best-pkging-practices.dbk:568
837 "Important news about changes in a package can also be put in "
838 "<filename>NEWS.Debian</filename> files. The news will be displayed by tools "
839 "like <systemitem role=\"package\">apt-listchanges</systemitem>, before all "
840 "the rest of the changelogs. This is the preferred means to let the user "
841 "know about significant changes in a package. It is better than using "
842 "<systemitem role=\"package\">debconf</systemitem> notes since it is less "
843 "annoying and the user can go back and refer to the "
844 "<filename>NEWS.Debian</filename> file after the install. And it's better "
845 "than listing major changes in <filename>README.Debian</filename>, since the "
846 "user can easily miss such notes."
849 #. type: Content of: <chapter><section><section><para>
850 #: best-pkging-practices.dbk:579
852 "The file format is the same as a debian changelog file, but leave off the "
853 "asterisks and describe each news item with a full paragraph when necessary "
854 "rather than the more concise summaries that would go in a changelog. It's a "
855 "good idea to run your file through <literal>dpkg-parsechangelog</literal> to "
856 "check its formatting as it will not be automatically checked during build as "
857 "the changelog is. Here is an example of a real "
858 "<filename>NEWS.Debian</filename> file:"
861 #. type: Content of: <chapter><section><section><screen>
862 #: best-pkging-practices.dbk:588
865 "cron (3.0pl1-74) unstable; urgency=low\n"
867 " The checksecurity script is no longer included with the cron package:\n"
868 " it now has its own package, checksecurity. If you liked the\n"
869 " functionality provided with that script, please install the new\n"
872 " -- Steve Greenland <stevegr@debian.org> Sat, 6 Sep 2003 17:15:03 "
876 #. type: Content of: <chapter><section><section><para>
877 #: best-pkging-practices.dbk:598
879 "The <filename>NEWS.Debian</filename> file is installed as "
880 "<filename>/usr/share/doc/<replaceable>package</replaceable>/NEWS.Debian.gz</filename>. "
881 "It is compressed, and always has that name even in Debian native packages. "
882 "If you use <literal>debhelper</literal>, "
883 "<literal>dh_installchangelogs</literal> will install "
884 "<filename>debian/NEWS</filename> files for you."
887 #. type: Content of: <chapter><section><section><para>
888 #: best-pkging-practices.dbk:605
890 "Unlike changelog files, you need not update <filename>NEWS.Debian</filename> "
891 "files with every release. Only update them if you have something "
892 "particularly newsworthy that user should know about. If you have no news at "
893 "all, there's no need to ship a <filename>NEWS.Debian</filename> file in your "
894 "package. No news is good news!"
897 #. type: Content of: <chapter><section><title>
898 #: best-pkging-practices.dbk:627
899 msgid "Best practices for maintainer scripts"
902 #. type: Content of: <chapter><section><para>
903 #: best-pkging-practices.dbk:629
905 "Maintainer scripts include the files <filename>debian/postinst</filename>, "
906 "<filename>debian/preinst</filename>, <filename>debian/prerm</filename> and "
907 "<filename>debian/postrm</filename>. These scripts take care of any package "
908 "installation or deinstallation setup which isn't handled merely by the "
909 "creation or removal of files and directories. The following instructions "
910 "supplement the <ulink url=\"&url-debian-policy;\">Debian Policy</ulink>."
913 #. type: Content of: <chapter><section><para>
914 #: best-pkging-practices.dbk:637
916 "Maintainer scripts must be idempotent. That means that you need to make "
917 "sure nothing bad will happen if the script is called twice where it would "
918 "usually be called once."
921 #. type: Content of: <chapter><section><para>
922 #: best-pkging-practices.dbk:642
924 "Standard input and output may be redirected (e.g. into pipes) for logging "
925 "purposes, so don't rely on them being a tty."
928 #. type: Content of: <chapter><section><para>
929 #: best-pkging-practices.dbk:646
931 "All prompting or interactive configuration should be kept to a minimum. "
932 "When it is necessary, you should use the <systemitem "
933 "role=\"package\">debconf</systemitem> package for the interface. Remember "
934 "that prompting in any case can only be in the <literal>configure</literal> "
935 "stage of the <filename>postinst</filename> script."
938 #. type: Content of: <chapter><section><para>
939 #: best-pkging-practices.dbk:653
941 "Keep the maintainer scripts as simple as possible. We suggest you use pure "
942 "POSIX shell scripts. Remember, if you do need any bash features, the "
943 "maintainer script must have a bash shebang line. POSIX shell or Bash are "
944 "preferred to Perl, since they enable <systemitem "
945 "role=\"package\">debhelper</systemitem> to easily add bits to the scripts."
948 #. type: Content of: <chapter><section><para>
949 #: best-pkging-practices.dbk:660
951 "If you change your maintainer scripts, be sure to test package removal, "
952 "double installation, and purging. Be sure that a purged package is "
953 "completely gone, that is, it must remove any files created, directly or "
954 "indirectly, in any maintainer script."
957 #. type: Content of: <chapter><section><para>
958 #: best-pkging-practices.dbk:666
960 "If you need to check for the existence of a command, you should use "
964 #. type: Content of: <chapter><section><programlisting>
965 #: best-pkging-practices.dbk:669
967 msgid "if [ -x /usr/sbin/install-docs ]; then ..."
970 #. type: Content of: <chapter><section><para>
971 #: best-pkging-practices.dbk:671
973 "If you don't wish to hard-code the path of a command in your maintainer "
974 "script, the following POSIX-compliant shell function may help:"
977 #. type: Content of: <chapter><section><para>
978 #: best-pkging-practices.dbk:676
980 "You can use this function to search <varname>$PATH</varname> for a command "
981 "name, passed as an argument. It returns true (zero) if the command was "
982 "found, and false if not. This is really the most portable way, since "
983 "<literal>command -v</literal>, <command>type</command>, and "
984 "<command>which</command> are not POSIX."
987 #. type: Content of: <chapter><section><para>
988 #: best-pkging-practices.dbk:683
990 "While <command>which</command> is an acceptable alternative, since it is "
991 "from the required <systemitem role=\"package\">debianutils</systemitem> "
992 "package, it's not on the root partition. That is, it's in "
993 "<filename>/usr/bin</filename> rather than <filename>/bin</filename>, so one "
994 "can't use it in scripts which are run before the <filename>/usr</filename> "
995 "partition is mounted. Most scripts won't have this problem, though."
998 #. type: Content of: <chapter><section><title>
999 #: best-pkging-practices.dbk:693
1001 "Configuration management with <systemitem "
1002 "role=\"package\">debconf</systemitem>"
1005 #. type: Content of: <chapter><section><para>
1006 #: best-pkging-practices.dbk:695
1008 "<systemitem role=\"package\">Debconf</systemitem> is a configuration "
1009 "management system which can be used by all the various packaging scripts "
1010 "(<filename>postinst</filename> mainly) to request feedback from the user "
1011 "concerning how to configure the package. Direct user interactions must now "
1012 "be avoided in favor of <systemitem role=\"package\">debconf</systemitem> "
1013 "interaction. This will enable non-interactive installations in the future."
1016 #. type: Content of: <chapter><section><para>
1017 #: best-pkging-practices.dbk:703
1019 "Debconf is a great tool but it is often poorly used. Many common mistakes "
1020 "are listed in the <citerefentry> "
1021 "<refentrytitle>debconf-devel</refentrytitle> <manvolnum>7</manvolnum> "
1022 "</citerefentry> man page. It is something that you must read if you decide "
1023 "to use debconf. Also, we document some best practices here."
1026 #. type: Content of: <chapter><section><para>
1027 #: best-pkging-practices.dbk:710
1029 "These guidelines include some writing style and typography recommendations, "
1030 "general considerations about debconf usage as well as more specific "
1031 "recommendations for some parts of the distribution (the installation system "
1035 #. type: Content of: <chapter><section><section><title>
1036 #: best-pkging-practices.dbk:716
1037 msgid "Do not abuse debconf"
1040 #. type: Content of: <chapter><section><section><para>
1041 #: best-pkging-practices.dbk:718
1043 "Since debconf appeared in Debian, it has been widely abused and several "
1044 "criticisms received by the Debian distribution come from debconf abuse with "
1045 "the need of answering a wide bunch of questions before getting any little "
1049 #. type: Content of: <chapter><section><section><para>
1050 #: best-pkging-practices.dbk:724
1052 "Keep usage notes to what they belong: the <filename>NEWS.Debian</filename>, "
1053 "or <filename>README.Debian</filename> file. Only use notes for important "
1054 "notes which may directly affect the package usability. Remember that notes "
1055 "will always block the install until confirmed or bother the user by email."
1058 #. type: Content of: <chapter><section><section><para>
1059 #: best-pkging-practices.dbk:730
1061 "Carefully choose the questions priorities in maintainer scripts. See "
1062 "<citerefentry> <refentrytitle>debconf-devel</refentrytitle> "
1063 "<manvolnum>7</manvolnum> </citerefentry> for details about priorities. Most "
1064 "questions should use medium and low priorities."
1067 #. type: Content of: <chapter><section><section><title>
1068 #: best-pkging-practices.dbk:738
1069 msgid "General recommendations for authors and translators"
1072 #. type: Content of: <chapter><section><section><section><title>
1073 #: best-pkging-practices.dbk:740
1074 msgid "Write correct English"
1077 #. type: Content of: <chapter><section><section><section><para>
1078 #: best-pkging-practices.dbk:742
1080 "Most Debian package maintainers are not native English speakers. So, "
1081 "writing properly phrased templates may not be easy for them."
1084 #. type: Content of: <chapter><section><section><section><para>
1085 #: best-pkging-practices.dbk:746
1087 "Please use (and abuse) &email-debian-l10n-english; mailing list. Have your "
1088 "templates proofread."
1091 #. type: Content of: <chapter><section><section><section><para>
1092 #: best-pkging-practices.dbk:750
1094 "Badly written templates give a poor image of your package, of your "
1095 "work... or even of Debian itself."
1098 #. type: Content of: <chapter><section><section><section><para>
1099 #: best-pkging-practices.dbk:754
1101 "Avoid technical jargon as much as possible. If some terms sound common to "
1102 "you, they may be impossible to understand for others. If you cannot avoid "
1103 "them, try to explain them (use the extended description). When doing so, "
1104 "try to balance between verbosity and simplicity."
1107 #. type: Content of: <chapter><section><section><section><title>
1108 #: best-pkging-practices.dbk:762
1109 msgid "Be kind to translators"
1112 #. type: Content of: <chapter><section><section><section><para>
1113 #: best-pkging-practices.dbk:764
1115 "Debconf templates may be translated. Debconf, along with its sister package "
1116 "<command>po-debconf</command> offers a simple framework for getting "
1117 "templates translated by translation teams or even individuals."
1120 #. type: Content of: <chapter><section><section><section><para>
1121 #: best-pkging-practices.dbk:769
1123 "Please use gettext-based templates. Install <systemitem "
1124 "role=\"package\">po-debconf</systemitem> on your development system and read "
1125 "its documentation (<command>man po-debconf</command> is a good start)."
1128 #. type: Content of: <chapter><section><section><section><para>
1129 #: best-pkging-practices.dbk:774
1131 "Avoid changing templates too often. Changing templates text induces more "
1132 "work to translators which will get their translation fuzzied. A fuzzy "
1133 "translation is a string for which the original changed since it was "
1134 "translated, therefore requiring some update by a translator to be usable. "
1135 "When changes are small enough, the original translation is kept in PO files "
1136 "but marked as <literal>fuzzy</literal>."
1139 #. type: Content of: <chapter><section><section><section><para>
1140 #: best-pkging-practices.dbk:782
1142 "If you plan to do changes to your original templates, please use the "
1143 "notification system provided with the <systemitem "
1144 "role=\"package\">po-debconf</systemitem> package, namely the "
1145 "<command>podebconf-report-po</command>, to contact translators. Most active "
1146 "translators are very responsive and getting their work included along with "
1147 "your modified templates will save you additional uploads. If you use "
1148 "gettext-based templates, the translator's name and e-mail addresses are "
1149 "mentioned in the PO files headers and will be used by "
1150 "<command>podebconf-report-po</command>."
1153 #. type: Content of: <chapter><section><section><section><para>
1154 #: best-pkging-practices.dbk:794
1155 msgid "A recommended use of that utility is:"
1158 #. type: Content of: <chapter><section><section><section><programlisting>
1159 #: best-pkging-practices.dbk:796
1162 "cd debian/po && podebconf-report-po --call --languageteam "
1163 "--withtranslators --deadline=\"+10 days\""
1166 #. type: Content of: <chapter><section><section><section><para>
1167 #: best-pkging-practices.dbk:798
1169 "This command will first synchronize the PO and POT files in "
1170 "<filename>debian/po</filename> with the templates files listed in "
1171 "<filename>debian/po/POTFILES.in</filename>. Then, it will send a call for "
1172 "new translations, in the &email-debian-i18n; mailing list. Finally, it will "
1173 "also send a call for translation updates to the language team (mentioned in "
1174 "the <literal>Language-Team</literal> field of each PO file) as well as the "
1175 "last translator (mentioned in <literal>Last-translator</literal>)."
1178 #. type: Content of: <chapter><section><section><section><para>
1179 #: best-pkging-practices.dbk:807
1181 "Giving a deadline to translators is always appreciated, so that they can "
1182 "organize their work. Please remember that some translation teams have a "
1183 "formalized translate/review process and a delay lower than 10 days is "
1184 "considered as unreasonable. A shorter delay puts too much pressure on "
1185 "translation teams and should be kept for very minor changes."
1188 #. type: Content of: <chapter><section><section><section><para>
1189 #: best-pkging-practices.dbk:814
1191 "If in doubt, you may also contact the translation team for a given language "
1192 "(debian-l10n-xxxxx@&lists-host;), or the &email-debian-i18n; mailing list."
1195 #. type: Content of: <chapter><section><section><section><title>
1196 #: best-pkging-practices.dbk:821
1197 msgid "Unfuzzy complete translations when correcting typos and spelling"
1200 #. type: Content of: <chapter><section><section><section><para>
1201 #: best-pkging-practices.dbk:823
1203 "When the text of a debconf template is corrected and you are <emphasis "
1204 "role=\"strong\">sure</emphasis> that the change does <emphasis "
1205 "role=\"strong\">not</emphasis> affect translations, please be kind to "
1206 "translators and <emphasis>unfuzzy</emphasis> their translations."
1209 #. type: Content of: <chapter><section><section><section><para>
1210 #: best-pkging-practices.dbk:829
1212 "If you don't do so, the whole template will not be translated as long as a "
1213 "translator will send you an update."
1216 #. type: Content of: <chapter><section><section><section><para>
1217 #: best-pkging-practices.dbk:833
1219 "To <emphasis>unfuzzy</emphasis> translations, you can use "
1220 "<command>msguntypot</command> (part of the <systemitem "
1221 "role=\"package\">po4a</systemitem> package)."
1224 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
1225 #: best-pkging-practices.dbk:840
1226 msgid "Regenerate the POT and PO files."
1229 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><programlisting>
1230 #: best-pkging-practices.dbk:842 best-pkging-practices.dbk:865
1232 msgid "debconf-updatepo"
1235 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
1236 #: best-pkging-practices.dbk:846
1237 msgid "Make a copy of the POT file."
1240 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><programlisting>
1241 #: best-pkging-practices.dbk:848
1243 msgid "cp templates.pot templates.pot.orig"
1246 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
1247 #: best-pkging-practices.dbk:852
1248 msgid "Make a copy of all the PO files."
1251 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><programlisting>
1252 #: best-pkging-practices.dbk:854
1254 msgid "mkdir po_fridge; cp *.po po_fridge"
1257 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
1258 #: best-pkging-practices.dbk:858
1259 msgid "Change the debconf template files to fix the typos."
1262 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
1263 #: best-pkging-practices.dbk:863
1264 msgid "Regenerate the POT and PO files (again)."
1267 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
1268 #: best-pkging-practices.dbk:867
1270 "At this point, the typo fix fuzzied all the translations, and this "
1271 "unfortunate change is the only one between the PO files of your main "
1272 "directory and the one from the fridge. Here is how to solve this."
1275 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
1276 #: best-pkging-practices.dbk:874
1277 msgid "Discard fuzzy translation, restore the ones from the fridge."
1280 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><programlisting>
1281 #: best-pkging-practices.dbk:876
1283 msgid "cp po_fridge/*.po ."
1286 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
1287 #: best-pkging-practices.dbk:880
1289 "Manually merge the PO files with the new POT file, but taking the useless "
1290 "fuzzy into account."
1293 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><programlisting>
1294 #: best-pkging-practices.dbk:882
1296 msgid "msguntypot -o templates.pot.orig -n templates.pot *.po"
1299 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
1300 #: best-pkging-practices.dbk:886
1304 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><programlisting>
1305 #: best-pkging-practices.dbk:888
1307 msgid "rm -rf templates.pot.orig po_fridge"
1310 #. type: Content of: <chapter><section><section><section><title>
1311 #: best-pkging-practices.dbk:894
1312 msgid "Do not make assumptions about interfaces"
1315 #. type: Content of: <chapter><section><section><section><para>
1316 #: best-pkging-practices.dbk:896
1318 "Templates text should not make reference to widgets belonging to some "
1319 "debconf interfaces. Sentences like <emphasis>If you answer "
1320 "Yes...</emphasis> have no meaning for users of graphical interfaces which "
1321 "use checkboxes for boolean questions."
1324 #. type: Content of: <chapter><section><section><section><para>
1325 #: best-pkging-practices.dbk:901
1327 "String templates should also avoid mentioning the default values in their "
1328 "description. First, because this is redundant with the values seen by the "
1329 "users. Also, because these default values may be different from the "
1330 "maintainer choices (for instance, when the debconf database was preseeded)."
1333 #. type: Content of: <chapter><section><section><section><para>
1334 #: best-pkging-practices.dbk:907
1336 "More generally speaking, try to avoid referring to user actions. Just give "
1340 #. type: Content of: <chapter><section><section><section><title>
1341 #: best-pkging-practices.dbk:913
1342 msgid "Do not use first person"
1345 #. type: Content of: <chapter><section><section><section><para>
1346 #: best-pkging-practices.dbk:915
1348 "You should avoid the use of first person (<emphasis>I will do "
1349 "this...</emphasis> or <emphasis>We recommend...</emphasis>). The computer "
1350 "is not a person and the Debconf templates do not speak for the Debian "
1351 "developers. You should use neutral construction. Those of you who already "
1352 "wrote scientific publications, just write your templates like you would "
1353 "write a scientific paper. However, try using active voice if still "
1354 "possible, like <emphasis>Enable this if ...</emphasis> instead of "
1355 "<emphasis>This can be enabled if...</emphasis>."
1358 #. type: Content of: <chapter><section><section><section><title>
1359 #: best-pkging-practices.dbk:925
1360 msgid "Be gender neutral"
1363 #. type: Content of: <chapter><section><section><section><para>
1364 #: best-pkging-practices.dbk:927
1366 "The world is made of men and women. Please use gender-neutral constructions "
1370 #. type: Content of: <chapter><section><section><title>
1371 #: best-pkging-practices.dbk:935
1372 msgid "Templates fields definition"
1375 #. type: Content of: <chapter><section><section><para>
1376 #: best-pkging-practices.dbk:937
1378 "This part gives some information which is mostly taken from the "
1379 "<citerefentry> <refentrytitle>debconf-devel</refentrytitle> "
1380 "<manvolnum>7</manvolnum> </citerefentry> manual page."
1383 #. type: Content of: <chapter><section><section><section><title>
1384 #: best-pkging-practices.dbk:942
1388 #. type: Content of: <chapter><section><section><section><section><title>
1389 #: best-pkging-practices.dbk:944
1393 #. type: Content of: <chapter><section><section><section><section><para>
1394 #: best-pkging-practices.dbk:946
1395 msgid "Results in a free-form input field that the user can type any string into."
1398 #. type: Content of: <chapter><section><section><section><section><title>
1399 #: best-pkging-practices.dbk:951
1403 #. type: Content of: <chapter><section><section><section><section><para>
1404 #: best-pkging-practices.dbk:953
1406 "Prompts the user for a password. Use this with caution; be aware that the "
1407 "password the user enters will be written to debconf's database. You should "
1408 "probably clean that value out of the database as soon as is possible."
1411 #. type: Content of: <chapter><section><section><section><section><title>
1412 #: best-pkging-practices.dbk:960
1416 #. type: Content of: <chapter><section><section><section><section><para>
1417 #: best-pkging-practices.dbk:962
1419 "A true/false choice. Remember: true/false, <emphasis role=\"strong\">not "
1420 "yes/no</emphasis>..."
1423 #. type: Content of: <chapter><section><section><section><section><title>
1424 #: best-pkging-practices.dbk:968
1428 #. type: Content of: <chapter><section><section><section><section><para>
1429 #: best-pkging-practices.dbk:970
1431 "A choice between one of a number of values. The choices must be specified "
1432 "in a field named 'Choices'. Separate the possible values with commas and "
1433 "spaces, like this: <literal>Choices: yes, no, maybe</literal>."
1436 #. type: Content of: <chapter><section><section><section><section><para>
1437 #: best-pkging-practices.dbk:975
1439 "If choices are translatable strings, the 'Choices' field may be marked as "
1440 "translatable by using <literal>__Choices</literal>. The double underscore "
1441 "will split out each choice in a separate string."
1444 #. type: Content of: <chapter><section><section><section><section><para>
1445 #: best-pkging-practices.dbk:980
1447 "The <command>po-debconf</command> system also offers interesting "
1448 "possibilities to only mark <emphasis role=\"strong\">some</emphasis> choices "
1449 "as translatable. Example:"
1452 #. type: Content of: <chapter><section><section><section><section><programlisting>
1453 #: best-pkging-practices.dbk:985
1456 "Template: foo/bar\n"
1458 "#flag:translate:3\n"
1459 "__Choices: PAL, SECAM, Other\n"
1460 "_Description: TV standard:\n"
1461 " Please choose the TV standard used in your country.\n"
1464 #. type: Content of: <chapter><section><section><section><section><para>
1465 #: best-pkging-practices.dbk:993
1467 "In that example, only the 'Other' string is translatable while others are "
1468 "acronyms that should not be translated. The above allows only 'Other' to be "
1469 "included in PO and POT files."
1472 #. type: Content of: <chapter><section><section><section><section><para>
1473 #: best-pkging-practices.dbk:998
1475 "The debconf templates flag system offers many such possibilities. The "
1476 "<citerefentry> <refentrytitle>po-debconf</refentrytitle> "
1477 "<manvolnum>7</manvolnum> </citerefentry> manual page lists all these "
1481 #. type: Content of: <chapter><section><section><section><section><title>
1482 #: best-pkging-practices.dbk:1006
1486 #. type: Content of: <chapter><section><section><section><section><para>
1487 #: best-pkging-practices.dbk:1008
1489 "Like the select data type, except the user can choose any number of items "
1490 "from the choices list (or chose none of them)."
1493 #. type: Content of: <chapter><section><section><section><section><title>
1494 #: best-pkging-practices.dbk:1014
1498 #. type: Content of: <chapter><section><section><section><section><para>
1499 #: best-pkging-practices.dbk:1016
1501 "Rather than being a question per se, this datatype indicates a note that can "
1502 "be displayed to the user. It should be used only for important notes that "
1503 "the user really should see, since debconf will go to great pains to make "
1504 "sure the user sees it; halting the install for them to press a key, and even "
1505 "mailing the note to them in some cases."
1508 #. type: Content of: <chapter><section><section><section><section><title>
1509 #: best-pkging-practices.dbk:1025
1513 #. type: Content of: <chapter><section><section><section><section><para>
1514 #: best-pkging-practices.dbk:1027
1515 msgid "This type is now considered obsolete: don't use it."
1518 #. type: Content of: <chapter><section><section><section><section><title>
1519 #: best-pkging-practices.dbk:1032
1523 #. type: Content of: <chapter><section><section><section><section><para>
1524 #: best-pkging-practices.dbk:1034
1526 "This type is designed to handle error messages. It is mostly similar to the "
1527 "note type. Frontends may present it differently (for instance, the dialog "
1528 "frontend of cdebconf draws a red screen instead of the usual blue one)."
1531 #. type: Content of: <chapter><section><section><section><section><para>
1532 #: best-pkging-practices.dbk:1039
1534 "It is recommended to use this type for any message that needs user attention "
1535 "for a correction of any kind."
1538 #. type: Content of: <chapter><section><section><section><title>
1539 #: best-pkging-practices.dbk:1047
1540 msgid "Description: short and extended description"
1543 #. type: Content of: <chapter><section><section><section><para>
1544 #: best-pkging-practices.dbk:1049
1546 "Template descriptions have two parts: short and extended. The short "
1547 "description is in the Description: line of the template."
1550 #. type: Content of: <chapter><section><section><section><para>
1551 #: best-pkging-practices.dbk:1053
1553 "The short description should be kept short (50 characters or so) so that it "
1554 "may be accommodated by most debconf interfaces. Keeping it short also helps "
1555 "translators, as usually translations tend to end up being longer than the "
1559 #. type: Content of: <chapter><section><section><section><para>
1560 #: best-pkging-practices.dbk:1059
1562 "The short description should be able to stand on its own. Some interfaces "
1563 "do not show the long description by default, or only if the user explicitely "
1564 "asks for it or even do not show it at all. Avoid things like What do you "
1568 #. type: Content of: <chapter><section><section><section><para>
1569 #: best-pkging-practices.dbk:1065
1571 "The short description does not necessarily have to be a full sentence. This "
1572 "is part of the keep it short and efficient recommendation."
1575 #. type: Content of: <chapter><section><section><section><para>
1576 #: best-pkging-practices.dbk:1069
1578 "The extended description should not repeat the short description word for "
1579 "word. If you can't think up a long description, then first, think some "
1580 "more. Post to debian-devel. Ask for help. Take a writing class! That "
1581 "extended description is important. If after all that you still can't come "
1582 "up with anything, leave it blank."
1585 #. type: Content of: <chapter><section><section><section><para>
1586 #: best-pkging-practices.dbk:1076
1588 "The extended description should use complete sentences. Paragraphs should "
1589 "be kept short for improved readability. Do not mix two ideas in the same "
1590 "paragraph but rather use another paragraph."
1593 #. type: Content of: <chapter><section><section><section><para>
1594 #: best-pkging-practices.dbk:1081
1596 "Don't be too verbose. User tend to ignore too long screens. 20 lines are "
1597 "by experience a border you shouldn't cross, because that means that in the "
1598 "classical dialog interface, people will need to scroll, and lot of people "
1599 "just don't do that."
1602 #. type: Content of: <chapter><section><section><section><para>
1603 #: best-pkging-practices.dbk:1087
1605 "The extended description should <emphasis role=\"strong\">never</emphasis> "
1606 "include a question."
1609 #. type: Content of: <chapter><section><section><section><para>
1610 #: best-pkging-practices.dbk:1091
1612 "For specific rules depending on templates type (string, boolean, etc.), "
1613 "please read below."
1616 #. type: Content of: <chapter><section><section><section><title>
1617 #: best-pkging-practices.dbk:1097
1621 #. type: Content of: <chapter><section><section><section><para>
1622 #: best-pkging-practices.dbk:1099
1624 "This field should be used for select and multiselect types. It contains the "
1625 "possible choices which will be presented to users. These choices should be "
1626 "separated by commas."
1629 #. type: Content of: <chapter><section><section><section><title>
1630 #: best-pkging-practices.dbk:1106
1634 #. type: Content of: <chapter><section><section><section><para>
1635 #: best-pkging-practices.dbk:1108
1637 "This field is optional. It contains the default answer for string, select "
1638 "and multiselect templates. For multiselect templates, it may contain a "
1639 "comma-separated list of choices."
1642 #. type: Content of: <chapter><section><section><title>
1643 #: best-pkging-practices.dbk:1117
1644 msgid "Templates fields specific style guide"
1647 #. type: Content of: <chapter><section><section><section><title>
1648 #: best-pkging-practices.dbk:1119
1652 #. type: Content of: <chapter><section><section><section><para>
1653 #: best-pkging-practices.dbk:1121
1655 "No specific indication except: use the appropriate type by referring to the "
1659 #. type: Content of: <chapter><section><section><section><title>
1660 #: best-pkging-practices.dbk:1127
1661 msgid "Description field"
1664 #. type: Content of: <chapter><section><section><section><para>
1665 #: best-pkging-practices.dbk:1129
1667 "Below are specific instructions for properly writing the Description (short "
1668 "and extended) depending on the template type."
1671 #. type: Content of: <chapter><section><section><section><section><title>
1672 #: best-pkging-practices.dbk:1133
1673 msgid "String/password templates"
1676 #. type: Content of: <chapter><section><section><section><section><itemizedlist><listitem><para>
1677 #: best-pkging-practices.dbk:1137
1679 "The short description is a prompt and <emphasis "
1680 "role=\"strong\">not</emphasis> a title. Avoid question style prompts (IP "
1681 "Address?) in favour of opened prompts (IP address:). The use of colons is "
1685 #. type: Content of: <chapter><section><section><section><section><itemizedlist><listitem><para>
1686 #: best-pkging-practices.dbk:1144
1688 "The extended description is a complement to the short description. In the "
1689 "extended part, explain what is being asked, rather than ask the same "
1690 "question again using longer words. Use complete sentences. Terse writing "
1691 "style is strongly discouraged."
1694 #. type: Content of: <chapter><section><section><section><section><title>
1695 #: best-pkging-practices.dbk:1154
1696 msgid "Boolean templates"
1699 #. type: Content of: <chapter><section><section><section><section><itemizedlist><listitem><para>
1700 #: best-pkging-practices.dbk:1158
1702 "The short description should be phrased in the form of a question which "
1703 "should be kept short and should generally end with a question mark. Terse "
1704 "writing style is permitted and even encouraged if the question is rather "
1705 "long (remember that translations are often longer than original versions)."
1708 #. type: Content of: <chapter><section><section><section><section><itemizedlist><listitem><para>
1709 #: best-pkging-practices.dbk:1166
1711 "Again, please avoid referring to specific interface widgets. A common "
1712 "mistake for such templates is if you answer Yes-type constructions."
1715 #. type: Content of: <chapter><section><section><section><section><title>
1716 #: best-pkging-practices.dbk:1174
1717 msgid "Select/Multiselect"
1720 #. type: Content of: <chapter><section><section><section><section><itemizedlist><listitem><para>
1721 #: best-pkging-practices.dbk:1178
1723 "The short description is a prompt and <emphasis "
1724 "role=\"strong\">not</emphasis> a title. Do <emphasis "
1725 "role=\"strong\">not</emphasis> use useless Please choose... constructions. "
1726 "Users are clever enough to figure out they have to choose something...:)"
1729 #. type: Content of: <chapter><section><section><section><section><itemizedlist><listitem><para>
1730 #: best-pkging-practices.dbk:1186
1732 "The extended description will complete the short description. It may refer "
1733 "to the available choices. It may also mention that the user may choose more "
1734 "than one of the available choices, if the template is a multiselect one "
1735 "(although the interface often makes this clear)."
1738 #. type: Content of: <chapter><section><section><section><section><title>
1739 #: best-pkging-practices.dbk:1196
1743 #. type: Content of: <chapter><section><section><section><section><itemizedlist><listitem><para>
1744 #: best-pkging-practices.dbk:1200
1746 "The short description should be considered to be a <emphasis "
1747 "role=\"strong\">title</emphasis>."
1750 #. type: Content of: <chapter><section><section><section><section><itemizedlist><listitem><para>
1751 #: best-pkging-practices.dbk:1205
1753 "The extended description is what will be displayed as a more detailed "
1754 "explanation of the note. Phrases, no terse writing style."
1757 #. type: Content of: <chapter><section><section><section><section><itemizedlist><listitem><para>
1758 #: best-pkging-practices.dbk:1211
1760 "<emphasis role=\"strong\">Do not abuse debconf.</emphasis> Notes are the "
1761 "most common way to abuse debconf. As written in debconf-devel manual page: "
1762 "it's best to use them only for warning about very serious problems. The "
1763 "<filename>NEWS.Debian</filename> or <filename>README.Debian</filename> files "
1764 "are the appropriate location for a lot of notes. If, by reading this, you "
1765 "consider converting your Note type templates to entries in "
1766 "<filename>NEWS.Debian</filename> or <filename>README.Debian</filename>, plus "
1767 "consider keeping existing translations for the future."
1770 #. type: Content of: <chapter><section><section><section><title>
1771 #: best-pkging-practices.dbk:1226
1772 msgid "Choices field"
1775 #. type: Content of: <chapter><section><section><section><para>
1776 #: best-pkging-practices.dbk:1228
1778 "If the Choices are likely to change often, please consider using the "
1779 "__Choices trick. This will split each individual choice into a single "
1780 "string, which will considerably help translators for doing their work."
1783 #. type: Content of: <chapter><section><section><section><title>
1784 #: best-pkging-practices.dbk:1235 best-pkging-practices.dbk:1273
1785 msgid "Default field"
1788 #. type: Content of: <chapter><section><section><section><para>
1789 #: best-pkging-practices.dbk:1237
1791 "If the default value, for a select template, is likely to vary depending on "
1792 "the user language (for instance, if the choice is a language choice), please "
1793 "use the _Default trick."
1796 #. type: Content of: <chapter><section><section><section><para>
1797 #: best-pkging-practices.dbk:1242
1799 "This special field allow translators to put the most appropriate choice "
1800 "according to their own language. It will become the default choice when "
1801 "their language is used while your own mentioned Default Choice will be used "
1802 "when using English."
1805 #. type: Content of: <chapter><section><section><section><para>
1806 #: best-pkging-practices.dbk:1248
1807 msgid "Example, taken from the geneweb package templates:"
1810 #. type: Content of: <chapter><section><section><section><screen>
1811 #: best-pkging-practices.dbk:1251
1814 "Template: geneweb/lang\n"
1816 "__Choices: Afrikaans (af), Bulgarian (bg), Catalan (ca), Chinese (zh), Czech "
1817 "(cs), Danish (da), Dutch (nl), English (en), Esperanto (eo), Estonian (et), "
1818 "Finnish (fi), French (fr), German (de), Hebrew (he), Icelandic (is), Italian "
1819 "(it), Latvian (lv), Norwegian (no), Polish (pl), Portuguese (pt), Romanian "
1820 "(ro), Russian (ru), Spanish (es), Swedish (sv)\n"
1821 "# This is the default choice. Translators may put their own language here\n"
1822 "# instead of the default.\n"
1823 "# WARNING : you MUST use the ENGLISH NAME of your language\n"
1824 "# For instance, the french translator will need to put French (fr) here.\n"
1825 "_Default: English[ translators, please see comment in PO files]\n"
1826 "_Description: Geneweb default language:\n"
1829 #. type: Content of: <chapter><section><section><section><para>
1830 #: best-pkging-practices.dbk:1262
1832 "Note the use of brackets which allow internal comments in debconf fields. "
1833 "Also note the use of comments which will show up in files the translators "
1837 #. type: Content of: <chapter><section><section><section><para>
1838 #: best-pkging-practices.dbk:1267
1840 "The comments are needed as the _Default trick is a bit confusing: the "
1841 "translators may put their own choice"
1844 #. type: Content of: <chapter><section><section><section><para>
1845 #: best-pkging-practices.dbk:1275
1847 "Do NOT use empty default field. If you don't want to use default values, do "
1848 "not use Default at all."
1851 #. type: Content of: <chapter><section><section><section><para>
1852 #: best-pkging-practices.dbk:1279
1854 "If you use po-debconf (and you <emphasis role=\"strong\">should</emphasis>, "
1855 "see <xref linkend=\"s6.5.2.2\"/>), consider making this field translatable, "
1856 "if you think it may be translated."
1859 #. type: Content of: <chapter><section><section><section><para>
1860 #: best-pkging-practices.dbk:1284
1862 "If the default value may vary depending on language/country (for instance "
1863 "the default value for a language choice), consider using the special "
1864 "_Default type documented in <citerefentry> "
1865 "<refentrytitle>po-debconf</refentrytitle> <manvolnum>7</manvolnum> "
1869 #. type: Content of: <chapter><section><title>
1870 #: best-pkging-practices.dbk:1296
1871 msgid "Internationalization"
1874 #. type: Content of: <chapter><section><para>
1875 #: best-pkging-practices.dbk:1298
1877 "This section contains global information for developers to make translators' "
1878 "life easier. More information for translators and developers interested in "
1879 "internationalization are available in the <ulink "
1880 "url=\"&url-i18n-l10n;\">Internationalisation and localisation in "
1881 "Debian</ulink> documentation."
1884 #. type: Content of: <chapter><section><section><title>
1885 #: best-pkging-practices.dbk:1305
1886 msgid "Handling debconf translations"
1889 #. type: Content of: <chapter><section><section><para>
1890 #: best-pkging-practices.dbk:1307
1892 "Like porters, translators have a difficult task. They work on many packages "
1893 "and must collaborate with many different maintainers. Moreover, most of the "
1894 "time, they are not native English speakers, so you may need to be "
1895 "particularly patient with them."
1898 #. type: Content of: <chapter><section><section><para>
1899 #: best-pkging-practices.dbk:1313
1901 "The goal of <systemitem role=\"package\">debconf</systemitem> was to make "
1902 "packages configuration easier for maintainers and for users. Originally, "
1903 "translation of debconf templates was handled with "
1904 "<command>debconf-mergetemplate</command>. However, that technique is now "
1905 "deprecated; the best way to accomplish <systemitem "
1906 "role=\"package\">debconf</systemitem> internationalization is by using the "
1907 "<systemitem role=\"package\">po-debconf</systemitem> package. This method "
1908 "is easier both for maintainer and translators; transition scripts are "
1912 #. type: Content of: <chapter><section><section><para>
1913 #: best-pkging-practices.dbk:1323
1915 "Using <systemitem role=\"package\">po-debconf</systemitem>, the translation "
1916 "is stored in <filename>.po</filename> files (drawing from "
1917 "<command>gettext</command> translation techniques). Special template files "
1918 "contain the original messages and mark which fields are translatable. When "
1919 "you change the value of a translatable field, by calling "
1920 "<command>debconf-updatepo</command>, the translation is marked as needing "
1921 "attention from the translators. Then, at build time, the "
1922 "<command>dh_installdebconf</command> program takes care of all the needed "
1923 "magic to add the template along with the up-to-date translations into the "
1924 "binary packages. Refer to the <citerefentry> "
1925 "<refentrytitle>po-debconf</refentrytitle> <manvolnum>7</manvolnum> "
1926 "</citerefentry> manual page for details."
1929 #. type: Content of: <chapter><section><section><title>
1930 #: best-pkging-practices.dbk:1339
1931 msgid "Internationalized documentation"
1934 #. type: Content of: <chapter><section><section><para>
1935 #: best-pkging-practices.dbk:1341
1937 "Internationalizing documentation is crucial for users, but a lot of labor. "
1938 "There's no way to eliminate all that work, but you can make things easier "
1942 #. type: Content of: <chapter><section><section><para>
1943 #: best-pkging-practices.dbk:1346
1945 "If you maintain documentation of any size, it is easier for translators if "
1946 "they have access to a source control system. That lets translators see the "
1947 "differences between two versions of the documentation, so, for instance, "
1948 "they can see what needs to be retranslated. It is recommended that the "
1949 "translated documentation maintain a note about what source control revision "
1950 "the translation is based on. An interesting system is provided by <ulink "
1951 "url=\"&url-i18n-doc-check;\">doc-check</ulink> in the <systemitem "
1952 "role=\"package\">debian-installer</systemitem> package, which shows an "
1953 "overview of the translation status for any given language, using structured "
1954 "comments for the current revision of the file to be translated and, for a "
1955 "translated file, the revision of the original file the translation is based "
1956 "on. You might wish to adapt and provide that in your VCS area."
1959 #. type: Content of: <chapter><section><section><para>
1960 #: best-pkging-practices.dbk:1360
1962 "If you maintain XML or SGML documentation, we suggest that you isolate any "
1963 "language-independent information and define those as entities in a separate "
1964 "file which is included by all the different translations. This makes it "
1965 "much easier, for instance, to keep URLs up to date across multiple files."
1968 #. type: Content of: <chapter><section><section><para>
1969 #: best-pkging-practices.dbk:1366
1971 "Some tools (e.g. <systemitem role=\"package\">po4a</systemitem>, <systemitem "
1972 "role=\"package\">poxml</systemitem>, or the <systemitem "
1973 "role=\"package\">translate-toolkit</systemitem>) are specialized in "
1974 "extracting the translatable material from different formats. They produce "
1975 "PO files, a format quite common to translators, which permits to see what "
1976 "needs to be retranslated when the translated document is updated."
1979 #. type: Content of: <chapter><section><title>
1980 #: best-pkging-practices.dbk:1378
1981 msgid "Common packaging situations"
1984 #. type: Content of: <chapter><section><section><title>
1985 #: best-pkging-practices.dbk:1389
1986 msgid "Packages using <command>autoconf</command>/<command>automake</command>"
1989 #. type: Content of: <chapter><section><section><para>
1990 #: best-pkging-practices.dbk:1391
1992 "Keeping <command>autoconf</command>'s <filename>config.sub</filename> and "
1993 "<filename>config.guess</filename> files up to date is critical for porters, "
1994 "especially on more volatile architectures. Some very good packaging "
1995 "practices for any package using <command>autoconf</command> and/or "
1996 "<command>automake</command> have been synthesized in &file-bpp-autotools; "
1997 "from the <systemitem role=\"package\">autotools-dev</systemitem> package. "
1998 "You're strongly encouraged to read this file and to follow the given "
2002 #. type: Content of: <chapter><section><section><title>
2003 #: best-pkging-practices.dbk:1403
2007 #. type: Content of: <chapter><section><section><para>
2008 #: best-pkging-practices.dbk:1405
2010 "Libraries are always difficult to package for various reasons. The policy "
2011 "imposes many constraints to ease their maintenance and to make sure upgrades "
2012 "are as simple as possible when a new upstream version comes out. Breakage "
2013 "in a library can result in dozens of dependent packages breaking."
2016 #. type: Content of: <chapter><section><section><para>
2017 #: best-pkging-practices.dbk:1411
2019 "Good practices for library packaging have been grouped in <ulink "
2020 "url=\"&url-libpkg-guide;\">the library packaging guide</ulink>."
2023 #. type: Content of: <chapter><section><section><title>
2024 #: best-pkging-practices.dbk:1418
2025 msgid "Documentation"
2028 #. type: Content of: <chapter><section><section><para>
2029 #: best-pkging-practices.dbk:1420
2031 "Be sure to follow the <ulink url=\"&url-debian-policy;ch-docs.html\">Policy "
2032 "on documentation</ulink>."
2035 #. type: Content of: <chapter><section><section><para>
2036 #: best-pkging-practices.dbk:1425
2038 "If your package contains documentation built from XML or SGML, we recommend "
2039 "you not ship the XML or SGML source in the binary package(s). If users want "
2040 "the source of the documentation, they should retrieve the source package."
2043 #. type: Content of: <chapter><section><section><para>
2044 #: best-pkging-practices.dbk:1430
2046 "Policy specifies that documentation should be shipped in HTML format. We "
2047 "also recommend shipping documentation in PDF and plain text format if "
2048 "convenient and if output of reasonable quality is possible. However, it is "
2049 "generally not appropriate to ship plain text versions of documentation whose "
2050 "source format is HTML."
2053 #. type: Content of: <chapter><section><section><para>
2054 #: best-pkging-practices.dbk:1437
2056 "Major shipped manuals should register themselves with <systemitem "
2057 "role=\"package\">doc-base</systemitem> on installation. See the <systemitem "
2058 "role=\"package\">doc-base</systemitem> package documentation for more "
2062 #. type: Content of: <chapter><section><section><para>
2063 #: best-pkging-practices.dbk:1443
2065 "Debian policy (section 12.1) directs that manual pages should accompany "
2066 "every program, utility, and function, and suggests them for other objects "
2067 "like configuration files. If the work you are packaging does not have such "
2068 "manual pages, consider writing them for inclusion in your package, and "
2069 "submitting them upstream."
2072 #. type: Content of: <chapter><section><section><para>
2073 #: best-pkging-practices.dbk:1450
2075 "The manpages do not need to be written directly in the troff format. "
2076 "Popular source formats are Docbook, POD and reST, which can be converted "
2077 "using <command>xsltproc</command>, <command>pod2man</command> and "
2078 "<command>rst2man</command> respectively. To a lesser extent, the "
2079 "<command>help2man</command> program can also be used to write a stub."
2082 #. type: Content of: <chapter><section><section><title>
2083 #: best-pkging-practices.dbk:1459
2084 msgid "Specific types of packages"
2087 #. type: Content of: <chapter><section><section><para>
2088 #: best-pkging-practices.dbk:1461
2090 "Several specific types of packages have special sub-policies and "
2091 "corresponding packaging rules and practices:"
2094 #. type: Content of: <chapter><section><section><itemizedlist><listitem><para>
2095 #: best-pkging-practices.dbk:1467
2097 "Perl related packages have a <ulink url=\"&url-perl-policy;\">Perl "
2098 "policy</ulink>, some examples of packages following that policy are "
2099 "<systemitem role=\"package\">libdbd-pg-perl</systemitem> (binary perl "
2100 "module) or <systemitem role=\"package\">libmldbm-perl</systemitem> (arch "
2101 "independent perl module)."
2104 #. type: Content of: <chapter><section><section><itemizedlist><listitem><para>
2105 #: best-pkging-practices.dbk:1476
2107 "Python related packages have their python policy; see &file-python-policy; "
2108 "in the <systemitem role=\"package\">python</systemitem> package."
2111 #. type: Content of: <chapter><section><section><itemizedlist><listitem><para>
2112 #: best-pkging-practices.dbk:1483
2114 "Emacs related packages have the <ulink url=\"&url-emacs-policy;\">emacs "
2118 #. type: Content of: <chapter><section><section><itemizedlist><listitem><para>
2119 #: best-pkging-practices.dbk:1490
2121 "Java related packages have their <ulink url=\"&url-java-policy;\">java "
2125 #. type: Content of: <chapter><section><section><itemizedlist><listitem><para>
2126 #: best-pkging-practices.dbk:1497
2128 "Ocaml related packages have their own policy, found in &file-ocaml-policy; "
2129 "from the <systemitem role=\"package\">ocaml</systemitem> package. A good "
2130 "example is the <systemitem role=\"package\">camlzip</systemitem> source "
2134 #. type: Content of: <chapter><section><section><itemizedlist><listitem><para>
2135 #: best-pkging-practices.dbk:1505
2137 "Packages providing XML or SGML DTDs should conform to the recommendations "
2138 "found in the <systemitem role=\"package\">sgml-base-doc</systemitem> "
2142 #. type: Content of: <chapter><section><section><itemizedlist><listitem><para>
2143 #: best-pkging-practices.dbk:1511
2145 "Lisp packages should register themselves with <systemitem "
2146 "role=\"package\">common-lisp-controller</systemitem>, about which see "
2147 "&file-lisp-controller;."
2150 #. type: Content of: <chapter><section><section><title>
2151 #: best-pkging-practices.dbk:1541
2152 msgid "Architecture-independent data"
2155 #. type: Content of: <chapter><section><section><para>
2156 #: best-pkging-practices.dbk:1543
2158 "It is not uncommon to have a large amount of architecture-independent data "
2159 "packaged with a program. For example, audio files, a collection of icons, "
2160 "wallpaper patterns, or other graphic files. If the size of this data is "
2161 "negligible compared to the size of the rest of the package, it's probably "
2162 "best to keep it all in a single package."
2165 #. type: Content of: <chapter><section><section><para>
2166 #: best-pkging-practices.dbk:1550
2168 "However, if the size of the data is considerable, consider splitting it out "
2169 "into a separate, architecture-independent package "
2170 "(<filename>_all.deb</filename>). By doing this, you avoid needless "
2171 "duplication of the same data into eleven or more .debs, one per each "
2172 "architecture. While this adds some extra overhead into the "
2173 "<filename>Packages</filename> files, it saves a lot of disk space on Debian "
2174 "mirrors. Separating out architecture-independent data also reduces "
2175 "processing time of <command>lintian</command> (see <xref "
2176 "linkend=\"tools-lint\"/>) when run over the entire Debian archive."
2179 #. type: Content of: <chapter><section><section><title>
2180 #: best-pkging-practices.dbk:1562
2181 msgid "Needing a certain locale during build"
2184 #. type: Content of: <chapter><section><section><para>
2185 #: best-pkging-practices.dbk:1564
2187 "If you need a certain locale during build, you can create a temporary file "
2191 #. type: Content of: <chapter><section><section><para>
2192 #: best-pkging-practices.dbk:1568
2194 "If you set <varname>LOCPATH</varname> to the equivalent of "
2195 "<filename>/usr/lib/locale</filename>, and <varname>LC_ALL</varname> to the "
2196 "name of the locale you generate, you should get what you want without being "
2197 "root. Something like this:"
2200 #. type: Content of: <chapter><section><section><screen>
2201 #: best-pkging-practices.dbk:1573
2204 "LOCALE_PATH=debian/tmpdir/usr/lib/locale\n"
2205 "LOCALE_NAME=en_IN\n"
2206 "LOCALE_CHARSET=UTF-8\n"
2208 "mkdir -p $LOCALE_PATH\n"
2209 "localedef -i $LOCALE_NAME.$LOCALE_CHARSET -f $LOCALE_CHARSET "
2210 "$LOCALE_PATH/$LOCALE_NAME.$LOCALE_CHARSET\n"
2212 "# Using the locale\n"
2213 "LOCPATH=$LOCALE_PATH LC_ALL=$LOCALE_NAME.$LOCALE_CHARSET date\n"
2216 #. type: Content of: <chapter><section><section><title>
2217 #: best-pkging-practices.dbk:1586
2218 msgid "Make transition packages deborphan compliant"
2221 #. type: Content of: <chapter><section><section><para>
2222 #: best-pkging-practices.dbk:1588
2224 "Deborphan is a program for helping users to detect which packages can safely "
2225 "be removed from the system, i.e. the ones that have no packages depending "
2226 "on them. The default operation is to search only within the libs and "
2227 "oldlibs sections, to hunt down unused libraries. But when passed the right "
2228 "argument, it tries to catch other useless packages."
2231 #. type: Content of: <chapter><section><section><para>
2232 #: best-pkging-practices.dbk:1595
2234 "For example, with <literal>--guess-dummy</literal>, "
2235 "<command>deborphan</command> tries to search all transitional packages which "
2236 "were needed for upgrade but which can now safely be removed. For that, it "
2237 "looks for the string dummy or transitional in their short description."
2240 #. type: Content of: <chapter><section><section><para>
2241 #: best-pkging-practices.dbk:1602
2243 "So, when you are creating such a package, please make sure to add this text "
2244 "to your short description. If you are looking for examples, just run: "
2245 "<command>apt-cache search .|grep dummy</command> or <command>apt-cache "
2246 "search .|grep transitional</command>."
2249 #. type: Content of: <chapter><section><section><para>
2250 #: best-pkging-practices.dbk:1608
2252 "Also, it is recommended to adjust its section to <literal>oldlibs</literal> "
2253 "and its priority to <literal>extra</literal> in order to ease "
2254 "<command>deborphan</command>'s job."
2257 #. type: Content of: <chapter><section><section><title>
2258 #: best-pkging-practices.dbk:1617
2259 msgid "Best practices for <filename>.orig.tar.{gz,bz2,xz}</filename> files"
2262 #. type: Content of: <chapter><section><section><para>
2263 #: best-pkging-practices.dbk:1619
2265 "There are two kinds of original source tarballs: Pristine source and "
2266 "repackaged upstream source."
2269 #. type: Content of: <chapter><section><section><section><title>
2270 #: best-pkging-practices.dbk:1623
2271 msgid "Pristine source"
2274 #. type: Content of: <chapter><section><section><section><para><footnote><para>
2275 #: best-pkging-practices.dbk:1627
2277 "We cannot prevent upstream authors from changing the tarball they distribute "
2278 "without also incrementing the version number, so there can be no guarantee "
2279 "that a pristine tarball is identical to what upstream "
2280 "<emphasis>currently</emphasis> distributing at any point in time. All that "
2281 "can be expected is that it is identical to something that upstream once "
2282 "<emphasis>did</emphasis> distribute. If a difference arises later (say, if "
2283 "upstream notices that he wasn't using maximal compression in his original "
2284 "distribution and then re-<command>gzip</command>s it), that's just too bad. "
2285 "Since there is no good way to upload a new "
2286 "<filename>.orig.tar.{gz,bz2,xz}</filename> for the same version, there is "
2287 "not even any point in treating this situation as a bug."
2290 #. type: Content of: <chapter><section><section><section><para>
2291 #: best-pkging-practices.dbk:1625
2293 "The defining characteristic of a pristine source tarball is that the "
2294 "<filename>.orig.tar.{gz,bz2,xz}</filename> file is byte-for-byte identical "
2295 "to a tarball officially distributed by the upstream author.<placeholder "
2296 "type=\"footnote\" id=\"0\"/> This makes it possible to use checksums to "
2297 "easily verify that all changes between Debian's version and upstream's are "
2298 "contained in the Debian diff. Also, if the original source is huge, "
2299 "upstream authors and others who already have the upstream tarball can save "
2300 "download time if they want to inspect your packaging in detail."
2303 #. type: Content of: <chapter><section><section><section><para>
2304 #: best-pkging-practices.dbk:1645
2306 "There is no universally accepted guidelines that upstream authors follow "
2307 "regarding to the directory structure inside their tarball, but "
2308 "<command>dpkg-source</command> is nevertheless able to deal with most "
2309 "upstream tarballs as pristine source. Its strategy is equivalent to the "
2313 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
2314 #: best-pkging-practices.dbk:1653
2315 msgid "It unpacks the tarball in an empty temporary directory by doing"
2318 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><screen>
2319 #: best-pkging-practices.dbk:1656
2323 "path/to/<replaceable>packagename</replaceable>_<replaceable>upstream-version</replaceable>.orig.tar.gz "
2327 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
2328 #: best-pkging-practices.dbk:1661
2330 "If, after this, the temporary directory contains nothing but one directory "
2331 "and no other files, <command>dpkg-source</command> renames that directory to "
2332 "<filename><replaceable>packagename</replaceable>-<replaceable>upstream-version</replaceable>(.orig)</filename>. "
2333 "The name of the top-level directory in the tarball does not matter, and is "
2337 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
2338 #: best-pkging-practices.dbk:1670
2340 "Otherwise, the upstream tarball must have been packaged without a common "
2341 "top-level directory (shame on the upstream author!). In this case, "
2342 "<command>dpkg-source</command> renames the temporary directory "
2343 "<emphasis>itself</emphasis> to "
2344 "<filename><replaceable>packagename</replaceable>-<replaceable>upstream-version</replaceable>(.orig)</filename>."
2347 #. type: Content of: <chapter><section><section><section><title>
2348 #: best-pkging-practices.dbk:1681
2349 msgid "Repackaged upstream source"
2352 #. type: Content of: <chapter><section><section><section><para>
2353 #: best-pkging-practices.dbk:1683
2355 "You <emphasis role=\"strong\">should</emphasis> upload packages with a "
2356 "pristine source tarball if possible, but there are various reasons why it "
2357 "might not be possible. This is the case if upstream does not distribute the "
2358 "source as gzipped tar at all, or if upstream's tarball contains "
2359 "non-DFSG-free material that you must remove before uploading."
2362 #. type: Content of: <chapter><section><section><section><para>
2363 #: best-pkging-practices.dbk:1690
2365 "In these cases the developer must construct a suitable "
2366 "<filename>.orig.tar.{gz,bz2,xz}</filename> file himself. We refer to such a "
2367 "tarball as a repackaged upstream source. Note that a repackaged upstream "
2368 "source is different from a Debian-native package. A repackaged source still "
2369 "comes with Debian-specific changes in a separate "
2370 "<filename>.diff.gz</filename> or "
2371 "<filename>.debian.tar.{gz,bz2,xz}</filename> and still has a version number "
2372 "composed of <replaceable>upstream-version</replaceable> and "
2373 "<replaceable>debian-version</replaceable>."
2376 #. type: Content of: <chapter><section><section><section><para>
2377 #: best-pkging-practices.dbk:1699
2379 "There may be cases where it is desirable to repackage the source even though "
2380 "upstream distributes a <filename>.tar.{gz,bz2,xz}</filename> that could in "
2381 "principle be used in its pristine form. The most obvious is if "
2382 "<emphasis>significant</emphasis> space savings can be achieved by "
2383 "recompressing the tar archive or by removing genuinely useless cruft from "
2384 "the upstream archive. Use your own discretion here, but be prepared to "
2385 "defend your decision if you repackage source that could have been pristine."
2388 #. type: Content of: <chapter><section><section><section><para>
2389 #: best-pkging-practices.dbk:1708
2390 msgid "A repackaged <filename>.orig.tar.{gz,bz2,xz}</filename>"
2393 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
2394 #: best-pkging-practices.dbk:1713
2396 "<emphasis role=\"strong\">should</emphasis> be documented in the resulting "
2397 "source package. Detailed information on how the repackaged source was "
2398 "obtained, and on how this can be reproduced should be provided in "
2399 "<filename>debian/copyright</filename>. It is also a good idea to provide a "
2400 "<literal>get-orig-source</literal> target in your "
2401 "<filename>debian/rules</filename> file that repeats the process, as "
2402 "described in the Policy Manual, <ulink "
2403 "url=\"&url-debian-policy;ch-source.html#s-debianrules\">Main building "
2404 "script: <filename>debian/rules</filename></ulink>."
2407 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para><footnote><para>
2408 #: best-pkging-practices.dbk:1728
2410 "As a special exception, if the omission of non-free files would lead to the "
2411 "source failing to build without assistance from the Debian diff, it might be "
2412 "appropriate to instead edit the files, omitting only the non-free parts of "
2413 "them, and/or explain the situation in a <filename>README.source</filename> "
2414 "file in the root of the source tree. But in that case please also urge the "
2415 "upstream author to make the non-free components easier separable from the "
2416 "rest of the source."
2419 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
2420 #: best-pkging-practices.dbk:1726
2422 "<emphasis role=\"strong\">should not</emphasis> contain any file that does "
2423 "not come from the upstream author(s), or whose contents has been changed by "
2424 "you.<placeholder type=\"footnote\" id=\"0\"/>"
2427 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
2428 #: best-pkging-practices.dbk:1739
2430 "<emphasis role=\"strong\">should</emphasis>, except where impossible for "
2431 "legal reasons, preserve the entire building and portablility infrastructure "
2432 "provided by the upstream author. For example, it is not a sufficient reason "
2433 "for omitting a file that it is used only when building on MS-DOS. "
2434 "Similarly, a <filename>Makefile</filename> provided by upstream should not "
2435 "be omitted even if the first thing your <filename>debian/rules</filename> "
2436 "does is to overwrite it by running a configure script."
2439 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
2440 #: best-pkging-practices.dbk:1748
2442 "(<emphasis>Rationale:</emphasis> It is common for Debian users who need to "
2443 "build software for non-Debian platforms to fetch the source from a Debian "
2444 "mirror rather than trying to locate a canonical upstream distribution "
2448 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
2449 #: best-pkging-practices.dbk:1755
2451 "<emphasis role=\"strong\">should</emphasis> use "
2452 "<filename><replaceable>packagename</replaceable>-<replaceable>upstream-version</replaceable>.orig</filename> "
2453 "as the name of the top-level directory in its tarball. This makes it "
2454 "possible to distinguish pristine tarballs from repackaged ones."
2457 #. type: Content of: <chapter><section><section><section><orderedlist><listitem><para>
2458 #: best-pkging-practices.dbk:1763
2460 "<emphasis role=\"strong\">should</emphasis> be gzipped or bzipped with "
2461 "maximal compression."
2464 #. type: Content of: <chapter><section><section><section><title>
2465 #: best-pkging-practices.dbk:1770
2466 msgid "Changing binary files"
2469 #. type: Content of: <chapter><section><section><section><para>
2470 #: best-pkging-practices.dbk:1772
2472 "Sometimes it is necessary to change binary files contained in the original "
2473 "tarball, or to add binary files that are not in it. This is fully supported "
2474 "when using source packages in “3.0 (quilt)” format, see the "
2475 "<citerefentry><refentrytitle>dpkg-source</refentrytitle><manvolnum>1</manvolnum></citerefentry> "
2476 "manual page for details. When using the older format “1.0”, binary files "
2477 "can't be stored in the <filename>.diff.gz</filename> so you must store an "
2478 "<command>uuencode</command>d (or similar) version of the file(s) and decode "
2479 "it at build time in <filename>debian/rules</filename> (and move it in its "
2480 "official location)."
2483 #. type: Content of: <chapter><section><section><title>
2484 #: best-pkging-practices.dbk:1787
2485 msgid "Best practices for debug packages"
2488 #. type: Content of: <chapter><section><section><para>
2489 #: best-pkging-practices.dbk:1789
2491 "A debug package is a package with a name ending in -dbg, that contains "
2492 "additional information that <command>gdb</command> can use. Since Debian "
2493 "binaries are stripped by default, debugging information, including function "
2494 "names and line numbers, is otherwise not available when running "
2495 "<command>gdb</command> on Debian binaries. Debug packages allow users who "
2496 "need this additional debugging information to install it, without bloating a "
2497 "regular system with the information."
2500 #. type: Content of: <chapter><section><section><para>
2501 #: best-pkging-practices.dbk:1797
2503 "It is up to a package's maintainer whether to create a debug package or "
2504 "not. Maintainers are encouraged to create debug packages for library "
2505 "packages, since this can aid in debugging many programs linked to a "
2506 "library. In general, debug packages do not need to be added for all "
2507 "programs; doing so would bloat the archive. But if a maintainer finds that "
2508 "users often need a debugging version of a program, it can be worthwhile to "
2509 "make a debug package for it. Programs that are core infrastructure, such as "
2510 "apache and the X server are also good candidates for debug packages."
2513 #. type: Content of: <chapter><section><section><para>
2514 #: best-pkging-practices.dbk:1807
2516 "Some debug packages may contain an entire special debugging build of a "
2517 "library or other binary, but most of them can save space and build time by "
2518 "instead containing separated debugging symbols that <command>gdb</command> "
2519 "can find and load on the fly when debugging a program or library. The "
2520 "convention in Debian is to keep these symbols in "
2521 "<filename>/usr/lib/debug/<replaceable>path</replaceable></filename>, where "
2522 "<replaceable>path</replaceable> is the path to the executable or library. "
2523 "For example, debugging symbols for <filename>/usr/bin/foo</filename> go in "
2524 "<filename>/usr/lib/debug/usr/bin/foo</filename>, and debugging symbols for "
2525 "<filename>/usr/lib/libfoo.so.1</filename> go in "
2526 "<filename>/usr/lib/debug/usr/lib/libfoo.so.1</filename>."
2529 #. type: Content of: <chapter><section><section><para>
2530 #: best-pkging-practices.dbk:1819
2532 "The debugging symbols can be extracted from an object file using "
2533 "<command>objcopy --only-keep-debug</command>. Then the object file can be "
2534 "stripped, and <command>objcopy --add-gnu-debuglink</command> used to specify "
2535 "the path to the debugging symbol file. <citerefentry> "
2536 "<refentrytitle>objcopy</refentrytitle> <manvolnum>1</manvolnum> "
2537 "</citerefentry> explains in detail how this works."
2540 #. type: Content of: <chapter><section><section><para>
2541 #: best-pkging-practices.dbk:1827
2543 "The <command>dh_strip</command> command in <systemitem "
2544 "role=\"package\">debhelper</systemitem> supports creating debug packages, "
2545 "and can take care of using <command>objcopy</command> to separate out the "
2546 "debugging symbols for you. If your package uses <systemitem "
2547 "role=\"package\">debhelper</systemitem>, all you need to do is call "
2548 "<command>dh_strip --dbg-package=libfoo-dbg</command>, and add an entry to "
2549 "<filename>debian/control</filename> for the debug package."
2552 #. type: Content of: <chapter><section><section><para>
2553 #: best-pkging-practices.dbk:1834
2555 "Note that the debug package should depend on the package that it provides "
2556 "debugging symbols for, and this dependency should be versioned. For "
2560 #. type: Content of: <chapter><section><section><screen>
2561 #: best-pkging-practices.dbk:1838
2563 msgid "Depends: libfoo (= ${binary:Version})\n"
2566 #. type: Content of: <chapter><section><section><title>
2567 #: best-pkging-practices.dbk:1842
2568 msgid "Best practices for meta-packages"
2571 #. type: Content of: <chapter><section><section><para>
2572 #: best-pkging-practices.dbk:1844
2574 "A meta-package is a mostly empty package that makes it easy to install a "
2575 "coherent set of packages that can evolve over time. It achieves this by "
2576 "depending on all the packages of the set. Thanks to the power of APT, the "
2577 "meta-package maintainer can adjust the dependencies and the user's system "
2578 "will automatically get the supplementary packages. The dropped packages that "
2579 "were automatically installed will be also be marked as removal candidates "
2580 "(and are even automatically removed by <command>aptitude</command>). "
2581 "<systemitem role=\"package\">gnome</systemitem> and <systemitem "
2582 "role=\"package\">linux-image-amd64</systemitem> are two examples of "
2583 "meta-packages (built by the source packages <systemitem "
2584 "role=\"package\">meta-gnome2</systemitem> and <systemitem "
2585 "role=\"package\">linux-latest</systemitem>)."
2588 #. type: Content of: <chapter><section><section><para>
2589 #: best-pkging-practices.dbk:1858
2591 "The long description of the meta-package must clearly document its purpose "
2592 "so that the user knows what he will lose if he removes the package. Being "
2593 "explicit about the consequences is recommended. This is particularly "
2594 "important for meta-packages which are installed during initial installation "
2595 "and that have not been explicitly installed by the user. Those tend to be "
2596 "important to ensure smooth system upgrades and the user should be "
2597 "discouraged from uninstalling them to avoid potential breakages."