/[ddp]/manuals/trunk/maint-guide/maint-guide.en.dbk
ViewVC logotype

Diff of /manuals/trunk/maint-guide/maint-guide.en.dbk

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 8665 by taffit-guest, Tue Apr 12 23:07:30 2011 UTC revision 8772 by osamu, Sun May 1 05:28:31 2011 UTC
# Line 29  for people to check official documentati Line 29  for people to check official documentati
29  <title>Debian New Maintainers' Guide</title>  <title>Debian New Maintainers' Guide</title>
30  <bookinfo>  <bookinfo>
31  <authorgroup>  <authorgroup>
32  <author> <personname> <firstname>Josip</firstname> <surname>Rodin</surname> </personname> <email>joy-mg@debian.org</email> <contrib>(original contents)</contrib> </author>  <!-- do not use firstname and surname tags it braks Japanese.  The same with othercredit -->
33  <author> <personname> <firstname>Osamu</firstname> <surname>Aoki</surname> </personname> <email>osamu@debian.org</email> <contrib>(updated contents)</contrib> </author>  <author> <personname>Josip Rodin</personname> <email>joy-mg@debian.org</email> <contrib>original contents</contrib> </author>
34    <author> <personname>Osamu Aoki</personname> <email>osamu@debian.org</email> <contrib>updated contents</contrib> </author>
35  <!-- translator credits in po4a/translator.*.ent -->  <!-- translator credits in po4a/translator.*.ent -->
36  &othercredit;  &othercredit;
37  </authorgroup>  </authorgroup>
# Line 66  The New-Maintainer's Debian Packaging Ho Line 67  The New-Maintainer's Debian Packaging Ho
67  </bookinfo>  </bookinfo>
68  <chapter id="start"><title>Getting started The Right Way</title>  <chapter id="start"><title>Getting started The Right Way</title>
69  <para>  <para>
70  This document tries to describe building of a Debian package to the common  This document tries to describe the building of a Debian package to ordinary
71  Debian user, and the prospectus developer.  It uses pretty common language, and  Debian users and prospective developers.  It uses fairly non-technical language, and
72  it's well covered with working examples.  There is an old Roman saying,  it's well covered with working examples.  There is an old Latin saying:
73  <emphasis>Longum iter est per preaecepta, breve et efficax per  <emphasis>Longum iter est per praecepta, breve et efficax per
74  exempla!</emphasis> (It's a long way by the rules, but short and efficient with  exempla</emphasis> (It's a long way by the rules, but short and efficient with
75  examples!).  examples).
76  </para>  </para>
77  <para>  <para>
78  This document has been updated for the Debian <literal>&base-release;</literal>  This document has been updated for the Debian <literal>&base-release;</literal>
79  release.  release.
80  <footnote><para> The document assumes you are using the  <footnote><para> The document assumes you are using a
81  <literal>&base-release;</literal> system or newer.  If you need to follow this  <literal>&base-release;</literal> or newer system.  If you need to follow this
82  text in an older system (including an older Ubuntu system etc.), you must  text in an older system (including an older Ubuntu system etc.), you must
83  install backported <systemitem role="package">dpkg</systemitem> and  install backported <systemitem role="package">dpkg</systemitem> and
84  <systemitem role="package">debhelper</systemitem> packages, at least.  <systemitem role="package">debhelper</systemitem> packages, at least.
# Line 87  install backported <systemitem role="pac Line 88  install backported <systemitem role="pac
88  One of the things that makes Debian such a top-notch distribution is its  One of the things that makes Debian such a top-notch distribution is its
89  package system.  While there is a vast quantity of software already in the  package system.  While there is a vast quantity of software already in the
90  Debian format, sometimes you need to install software that isn't.  You may be  Debian format, sometimes you need to install software that isn't.  You may be
91  wondering how you can make your own packages and perhaps you think it is a very  wondering how you can make your own packages; and perhaps you think it is a very
92  difficult task.  Well, if you are a real novice on Linux, it is hard, but if  difficult task.  Well, if you are a real novice on Linux, it is hard, but if
93  you were rookie, you wouldn't be reading this doc now.  :-) You do need to know  you were a rookie, you wouldn't be reading this document now&nbsp;:-)
94  a little about Unix programming but you certainly don't need to be a wizard.  You do need to know a little about Unix programming but you certainly
95    don't need to be a wizard.
96  <footnote><para>  <footnote><para>
97  You can learn basic operations of the Debian system from  You can learn about the basic handling of a Debian system from the
98  <ulink url="&debref;">Debian Reference</ulink>.  It contains some pointers to  <ulink url="&debref;">Debian Reference</ulink>.  It contains some pointers to
99  learn about Unix programming, too.  learn about Unix programming, too.
100  </para></footnote>  </para></footnote>
101  </para>  </para>
102  <para>  <para>
103  One thing is certain, though: to properly create and maintain Debian packages  One thing is certain, though: to properly create and maintain Debian packages
104  you need many hours.  Make no mistake, for our system to work the maintainers  takes many hours.  Make no mistake, for our system to work the maintainers
105  need to be both technically competent and diligent.  need to be both technically competent and diligent.
106  </para>  </para>
107  <para>  <para>
 This document will explain every little (at first maybe irrelevant) step, and  
 help you create that first package, and to gain some experience in building  
 next releases of that and maybe other packages later on.  
 </para>  
 <para>  
108  If you need some help on packaging, please read <xref linkend="helpme"/>.  If you need some help on packaging, please read <xref linkend="helpme"/>.
109  </para>  </para>
110  <para>  <para>
111  Newer versions of this document should always be available online at  Newer versions of this document should always be available online at
112  <ulink url="&maint-guide;"/> and in the  <ulink url="&maint-guide;"/> and in the
113  <systemitem role="package">maint-guide</systemitem> package.  <systemitem role="package">maint-guide</systemitem> package.
114  The translations may be available in packages such as  The translations may be available in packages such as
115  <systemitem role="package">maint-guide-es</systemitem>.  <systemitem role="package">maint-guide-es</systemitem>.
116  Please note that this documentation may be slightly outdated.  Please note that this documentation may be slightly outdated.
117  </para>  </para>
 <section id="socialdynamism"><title>Social dynamism of Debian</title>  
118  <para>  <para>
119  Here are my observations of the social dynamism of Debian.  I hope this will prepare you for the interaction with Debian.  Since this is a tutorial, I choose to explain each detailed step for some
120    important topics.  Some of them may look irrelevant to you.  Please be patient.
121    I have also intentionally skipped some corner cases and provided only pointers
122    to keep this document simple.
123    </para>
124    <section id="socialdynamics"><title>Social dynamics of Debian</title>
125    <para>
126    Here are some observations of Debian's social dynamics, presented in the hope
127    that it will prepare you for interactions with Debian.
128  </para>  </para>
129  <itemizedlist>  <itemizedlist>
130  <listitem><para>We all are volunteers.</para>  <listitem><para>We all are volunteers.</para>
131      <itemizedlist>      <itemizedlist>
132      <listitem><para>You can not impose others what to do.</para></listitem>      <listitem><para>You cannot impose on others what to do.</para></listitem>
133      <listitem><para>You should be motivated to do things by yourself.</para></listitem>      <listitem><para>You should be motivated to do things by yourself.</para></listitem>
134      </itemizedlist></listitem>      </itemizedlist></listitem>
135  <listitem><para>Friendly cooperation is the driving force.</para>  <listitem><para>Friendly cooperation is the driving force.</para>
# Line 136  Here are my observations of the social d Line 140  Here are my observations of the social d
140  <listitem><para>Debian is not your school where you get automatic attention of teachers.</para>  <listitem><para>Debian is not your school where you get automatic attention of teachers.</para>
141      <itemizedlist>      <itemizedlist>
142      <listitem><para>You should be able to learn many things by yourself.</para></listitem>      <listitem><para>You should be able to learn many things by yourself.</para></listitem>
143      <listitem><para>Attention of other volunteers is the very scarce resource.</para></listitem>      <listitem><para>Attention from other volunteers is a very scarce resource.</para></listitem>
144      </itemizedlist></listitem>      </itemizedlist></listitem>
145  <listitem><para>Debian is constantly improving.</para>  <listitem><para>Debian is constantly improving.</para>
146      <itemizedlist>      <itemizedlist>
147      <listitem><para>You are expected to make high quality packages.</para></listitem>      <listitem><para>You are expected to make high quality packages.</para></listitem>
148      <listitem><para>You should adapt yourself to the change.</para></listitem>      <listitem><para>You should adapt yourself to change.</para></listitem>
149      </itemizedlist></listitem>      </itemizedlist></listitem>
150  </itemizedlist>  </itemizedlist>
151  <para>  <para>
152  Since we focus only on technical aspects of packaging in this document,  There are several types of people interacting around Debian with different
153  please refer to the following to learn how Debian functions and how you can get involved.  roles.
154  </para>  </para>
155  <itemizedlist>  <itemizedlist>
156  <listitem><para><ulink url="&logiciellibre;">Debian: 17 ans de logiciel libre,  "do-ocracy" et démocratie</ulink> (Introductory slides in English PDF) </para> </listitem>  <listitem>
157  <listitem><para><ulink url="&debianorghelp;">How can you help Debian?</ulink> (official) </para> </listitem>  <para>
158  <listitem><para><ulink url="&debianfaqhelp;">The Debian GNU/Linux FAQ, Chapter 13 - 'Contributing to the Debian Project'</ulink> (semi-official) </para> </listitem>  <emphasis role="strong">upstream author</emphasis>: the person who made the
159  <listitem><para><ulink url="&debianwikihelp;">Debian Wiki, HelpDebian</ulink> (supplemental) </para> </listitem>  original program.
160  <listitem><para><ulink url="&nm-do;">Debian New Maintainer site</ulink> (official) </para> </listitem>  </para>
161  <listitem><para><ulink url="&debianmentorfaq;">Debian Mentors FAQ</ulink> (supplemental) </para> </listitem>  </listitem>
162    <listitem>
163    <para>
164    <emphasis role="strong">upstream maintainer</emphasis>: the person who
165    currently maintains the program.
166    </para>
167    </listitem>
168    <listitem>
169    <para>
170    <emphasis role="strong">maintainer</emphasis>: the person making the Debian
171    package of the program.
172    </para>
173    </listitem>
174    <listitem>
175    <para>
176    <emphasis role="strong">sponsor</emphasis>: a person who helps maintainers to
177    upload packages to the official Debian package archive (after checking their
178    contents).
179    </para>
180    </listitem>
181    <listitem>
182    <para>
183    <emphasis role="strong">mentor</emphasis>: a person who helps novice
184    maintainers with packaging etc.
185    </para>
186    </listitem>
187    <listitem>
188    <para>
189    <emphasis role="strong">Debian Developer</emphasis> (DD): a member of
190    the Debian project with full upload rights to the official Debian package
191    archive.
192    </para>
193    </listitem>
194    <listitem>
195    <para>
196    <emphasis role="strong">Debian Maintainer</emphasis> (DM): a person with
197    limited upload rights to the official Debian package archive.
198    </para>
199    </listitem>
200  </itemizedlist>  </itemizedlist>
 </section>  
 <section id="debiandeveloper"><title>Official Debian Developer</title>  
201  <para>  <para>
202  You can not become an official  Please note that you cannot become an official
203  <emphasis role="strong">Debian Developer</emphasis> (DD) over night because it  <emphasis role="strong">Debian Developer</emphasis> (DD) overnight, because it
204  takes more than technical skill.  Please do not be discouraged by this.  If it  takes more than technical skill.  Please do not be discouraged by this.  If it
205  is useful to others, you can still upload your package either as a  is useful to others, you can still upload your package either as a
206  <emphasis role="strong">maintainer</emphasis> through a  <emphasis role="strong">maintainer</emphasis> through a
# Line 170  is useful to others, you can still uploa Line 210  is useful to others, you can still uploa
210  <para>  <para>
211  Please note that you do not need to create any new package to become an  Please note that you do not need to create any new package to become an
212  official Debian Developer.  Contributing to the existing packages can provide a  official Debian Developer.  Contributing to the existing packages can provide a
213  path to become an official Debian Developer too.  There are many packages  path to becoming an official Debian Developer too.  There are many packages
214  waiting for good maintainers (see <xref linkend="choose"/>).  waiting for good maintainers (see <xref linkend="choose"/>).
215  </para>  </para>
216    <para>
217    Since we focus only on technical aspects of packaging in this document,
218    please refer to the following to learn how Debian functions and how you can get involved.
219    </para>
220    <itemizedlist>
221    <listitem><para><ulink url="&logiciellibre;">Debian: 17 years of Free Software, "do-ocracy", and democracy</ulink> (Introductory slides) </para> </listitem>
222    <listitem><para><ulink url="&debianorghelp;">How can you help Debian?</ulink> (official) </para> </listitem>
223    <listitem><para><ulink url="&debianfaqhelp;">The Debian GNU/Linux FAQ, Chapter 13 - "Contributing to the Debian Project"</ulink> (semi-official) </para> </listitem>
224    <listitem><para><ulink url="&debianwikihelp;">Debian Wiki, HelpDebian</ulink> (supplemental) </para> </listitem>
225    <listitem><para><ulink url="&nm-do;">Debian New Maintainer site</ulink> (official) </para> </listitem>
226    <listitem><para><ulink url="&debianmentorfaq;">Debian Mentors FAQ</ulink> (supplemental) </para> </listitem>
227    </itemizedlist>
228  </section>  </section>
229  <section id="needprogs"><title>Programs you need for development</title>  <section id="needprogs"><title>Programs needed for development</title>
230  <para>  <para>
231  Before you start anything, you should make sure that you have properly  Before you start anything, you should make sure that you have properly
232  installed some additional packages needed for development.  Note that the list  installed some additional packages needed for development.  Note that the list
# Line 191  or with <literal>dpkg -s <replaceable>pa Line 243  or with <literal>dpkg -s <replaceable>pa
243  <para>  <para>
244  The most important package to install on your development system is the  The most important package to install on your development system is the
245  <systemitem role="package">build-essential</systemitem> package.  Once you try  <systemitem role="package">build-essential</systemitem> package.  Once you try
246  to install it, it will <emphasis>pull in</emphasis> other packages required to  to install that, it will <emphasis>pull in</emphasis> other packages required to
247  have a basic build environment.  have a basic build environment.
248  </para>  </para>
249  <para>  <para>
250  For some types of packages, that is all you will require, however there is  For some types of packages, that is all you will require; however, there is
251  another set of packages that while not essential for all package builds are  another set of packages that while not essential for all package builds are
252  useful to have install or may be required by your package:  useful to have installed or may be required by your package:
253  </para>  </para>
254  <itemizedlist>  <itemizedlist>
255  <listitem>  <listitem>
256  <para>  <para>
257  <systemitem role="package">file</systemitem> - this handy program can determine  <systemitem role="package">autoconf</systemitem>, <systemitem
258  what type a file is.  (see <citerefentry> <refentrytitle>file</refentrytitle>  role="package">automake</systemitem>, and <systemitem
259  <manvolnum>1</manvolnum> </citerefentry>)  role="package">autotools-dev</systemitem> - many newer programs use configure
260  </para>  scripts and <filename>Makefile</filename> files preprocessed with the help of
261  </listitem>  programs like these (see <literal>info autoconf</literal>, <literal>info
262  <listitem>  automake</literal>).  <systemitem role="package">autotools-dev</systemitem>
263  <para>  keeps up-to-date versions of certain auto files and has documentation about the
264  <systemitem role="package">patch</systemitem> - this very useful utility will  best way to use those files.
 take a file containing a difference listing (produced by the  
 <command>diff</command> program) and apply it to the original file, producing a  
 patched version.  (see <citerefentry> <refentrytitle>patch</refentrytitle>  
 <manvolnum>1</manvolnum> </citerefentry>)  
265  </para>  </para>
266  </listitem>  </listitem>
267  <listitem>  <listitem>
268  <para>  <para>
269  <systemitem role="package">perl</systemitem> - Perl is one of the most used  <systemitem role="package">debhelper</systemitem> and
270  interpreted scripting languages on today's Unix-like systems, often referred to  <systemitem role="package">dh-make</systemitem> -
271  as Unix's Swiss Army Chainsaw.  (see <citerefentry>  <systemitem role="package">dh-make</systemitem> is necessary to create
272  <refentrytitle>perl</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>)  the skeleton of our example package, and it will use some of the
273    <systemitem role="package">debhelper</systemitem> tools for creating
274    packages.  They are not essential for this purpose, but are
275    <emphasis>highly</emphasis> recommended for new maintainers.  It makes
276    the whole process very much easier to start, and to control afterwards.
277    (See <citerefentry> <refentrytitle>dh_make</refentrytitle>
278    <manvolnum>1</manvolnum> </citerefentry>, <citerefentry>
279    <refentrytitle>debhelper</refentrytitle> <manvolnum>1</manvolnum>
280    </citerefentry>.) <footnote><para> There are also some more specialized
281    but similar packages such as
282    <systemitem role="package">dh-make-perl</systemitem>,
283    <systemitem role="package">dh-make-php</systemitem>, etc.  </para>
284    </footnote>
285  </para>  </para>
286  </listitem>  </listitem>
287  <listitem>  <listitem>
288  <para>  <para>
289  <systemitem role="package">python</systemitem> - Python is another of the most  <systemitem role="package">devscripts</systemitem> - this package contains some
290  used interpreted scripting languages on the Debian system that combines  useful scripts that can be helpful for maintainers, but they are also
291  remarkable power with very clear syntax.  (see <citerefentry>  not necessary for building packages.  Packages recommended and suggested
292  <refentrytitle>python</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>)  by this package are worth looking into.  (See <ulink url="&devscripts-readme;"/>.)
293  </para>  </para>
294  </listitem>  </listitem>
295  <listitem>  <listitem>
296  <para>  <para>
297  <systemitem role="package">autoconf</systemitem>, <systemitem role="package">automake</systemitem> and <systemitem role="package">autotools-dev</systemitem> - many newer programs use configure  <systemitem role="package">fakeroot</systemitem> - this utility lets you
298  scripts and <filename>Makefile</filename> files preprocessed with help of  emulate being root which is necessary for some parts of the build process.
299  programs like these.  (see <literal>info autoconf</literal>, <literal>info  (See <citerefentry> <refentrytitle>fakeroot</refentrytitle>
300  automake</literal>).  The <systemitem role="package">autotools-dev</systemitem>  <manvolnum>1</manvolnum> </citerefentry>.)
 keeps up-to-date versions of certain auto files and has documentation about the  
 best way to use those files.  
301  </para>  </para>
302  </listitem>  </listitem>
303  <listitem>  <listitem>
304  <para>  <para>
305  <systemitem role="package">dh-make</systemitem> and <systemitem role="package">debhelper</systemitem> - <systemitem role="package">dh-make</systemitem> is necessary to create the skeleton of our  <systemitem role="package">file</systemitem> - this handy program can determine
306  example package, and it will use some of the <systemitem role="package">debhelper</systemitem> tools for creating packages.  They are  what type a file is.  (See <citerefentry> <refentrytitle>file</refentrytitle>
307  not essential for creation of packages, but are <emphasis>highly</emphasis>  <manvolnum>1</manvolnum> </citerefentry>.)
 recommended for new maintainers.  It makes the whole process very much easier  
 to start, and control afterwards.  (see <citerefentry>  
 <refentrytitle>dh_make</refentrytitle> <manvolnum>1</manvolnum>  
 </citerefentry>, <citerefentry> <refentrytitle>debhelper</refentrytitle>  
 <manvolnum>1</manvolnum> </citerefentry>) <footnote><para> There  
 are few similar but specialized packages such as <systemitem role="package">dh-make-perl</systemitem>, <systemitem role="package">dh-make-php</systemitem>, etc.  </para> </footnote>  
308  </para>  </para>
309  </listitem>  </listitem>
310  <listitem>  <listitem>
311  <para>  <para>
312  <systemitem role="package">devscripts</systemitem> - this package contains some  <systemitem role="package">gfortran</systemitem> - the GNU Fortran 95 compiler,
313  nice and useful scripts that can be helpful to the maintainers, but they are  necessary if your program is written in Fortran.  (See <citerefentry>
314  also not necessary for building packages.  Packages recommended and suggested  <refentrytitle>gfortran</refentrytitle> <manvolnum>1</manvolnum>
315  by this package are worth looking into.  (see  </citerefentry>.)
 <ulink url="&devscripts-readme;"/>.)  
316  </para>  </para>
317  </listitem>  </listitem>
318  <listitem>  <listitem>
319  <para>  <para>
320  <systemitem role="package">fakeroot</systemitem> - this utility lets you  <systemitem role="package">git</systemitem> - this package provides a popular
321  emulate being root which is necessary for some parts of the build process.  version control system designed to handle very large projects with speed and
322  (see <citerefentry> <refentrytitle>fakeroot</refentrytitle>  efficiency; it is used for many high profile open source projects, most notably
323  <manvolnum>1</manvolnum> </citerefentry>)  the Linux kernel.  (See <citerefentry> <refentrytitle>git</refentrytitle>
324    <manvolnum>1</manvolnum> </citerefentry>,
325    <ulink url="&git-doc;">git Manual</ulink>.)
326  </para>  </para>
327  </listitem>  </listitem>
328  <listitem>  <listitem>
# Line 277  emulate being root which is necessary fo Line 330  emulate being root which is necessary fo
330  <systemitem role="package">gnupg</systemitem> - a tool that enables you to  <systemitem role="package">gnupg</systemitem> - a tool that enables you to
331  digitally <emphasis>sign</emphasis> packages.  This is especially important if  digitally <emphasis>sign</emphasis> packages.  This is especially important if
332  you want to distribute it to other people, and you will certainly be doing that  you want to distribute it to other people, and you will certainly be doing that
333  when your work gets included in the Debian distribution.  (see <citerefentry>  when your work gets included in the Debian distribution.  (See <citerefentry>
334  <refentrytitle>gpg</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>)  <refentrytitle>gpg</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>.)
 </para>  
 </listitem>  
 <listitem>  
 <para>  
 <systemitem role="package">gfortran</systemitem> - the GNU Fortran 95 compiler,  
 necessary if your program is written in Fortran.  (see <citerefentry>  
 <refentrytitle>gfortran</refentrytitle> <manvolnum>1</manvolnum>  
 </citerefentry>)  
335  </para>  </para>
336  </listitem>  </listitem>
337  <listitem>  <listitem>
# Line 294  necessary if your program is written in Line 339  necessary if your program is written in
339  <systemitem role="package">gpc</systemitem> - the GNU Pascal compiler,  <systemitem role="package">gpc</systemitem> - the GNU Pascal compiler,
340  necessary if your program is written in Pascal.  Worthy of note here is  necessary if your program is written in Pascal.  Worthy of note here is
341  <systemitem role="package">fp-compiler</systemitem>, the Free Pascal Compiler,  <systemitem role="package">fp-compiler</systemitem>, the Free Pascal Compiler,
342  which is also good at this task.  (see <citerefentry>  which is also good at this task.  (See <citerefentry>
343  <refentrytitle>gpc</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>,  <refentrytitle>gpc</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>,
344  <citerefentry> <refentrytitle>ppc386</refentrytitle> <manvolnum>1</manvolnum>  <citerefentry> <refentrytitle>ppc386</refentrytitle>
345  </citerefentry>)  <manvolnum>1</manvolnum> </citerefentry>.)
346  </para>  </para>
347  </listitem>  </listitem>
348  <listitem>  <listitem>
349  <para>  <para>
350  <systemitem role="package">xutils-dev</systemitem> - some programs, usually  <systemitem role="package">lintian</systemitem> - this is the Debian package
351  those made for X11, also use these programs to generate  checker, which can let you know of any common mistakes after you build the
352  <filename>Makefile</filename> files from sets of macro functions.  (see  package, and explains the errors found.  (See <citerefentry>
353  <citerefentry> <refentrytitle>imake</refentrytitle> <manvolnum>1</manvolnum>  <refentrytitle>lintian</refentrytitle> <manvolnum>1</manvolnum>
354  </citerefentry>, <citerefentry> <refentrytitle>xmkmf</refentrytitle>  </citerefentry>,
355  <manvolnum>1</manvolnum> </citerefentry>)  <ulink url="&lintian-doc;">Lintian User's Manual</ulink>.)
356  </para>  </para>
357  </listitem>  </listitem>
358  <listitem>  <listitem>
359  <para>  <para>
360  <systemitem role="package">lintian</systemitem> - this is the Debian package  <systemitem role="package">patch</systemitem> - this very useful utility will
361  checker that can let you know of any common mistakes after you build the  take a file containing a difference listing (produced by the
362  package, and explains the errors found.  (see <citerefentry>  <command>diff</command> program) and apply it to the original file, producing a
363  <refentrytitle>lintian</refentrytitle> <manvolnum>1</manvolnum>  patched version.  (See <citerefentry> <refentrytitle>patch</refentrytitle>
364  </citerefentry>,  <manvolnum>1</manvolnum> </citerefentry>.)
365  <ulink url="&lintian-doc;">Lintian User's Manual</ulink>)  </para>
366    </listitem>
367    <listitem>
368    <para>
369    <systemitem role="package">patchutils</systemitem> - this package contains some
370    utilities to work with patches such as the <command>lsdiff</command>,
371    <command>interdiff</command> and <command>filterdiff</command> commands.
372  </para>  </para>
373  </listitem>  </listitem>
374  <listitem>  <listitem>
# Line 334  Build From Source) bugs.  (see <citerefe Line 385  Build From Source) bugs.  (see <citerefe
385  </listitem>  </listitem>
386  <listitem>  <listitem>
387  <para>  <para>
388  <systemitem role="package">patchutils</systemitem> - this package contains some  <systemitem role="package">perl</systemitem> - Perl is one of the most used
389  utilities to work with patches such as the <command>lsdiff</command>,  interpreted scripting languages on today's Unix-like systems, often referred to
390  <command>interdiff</command> and <command>filterdiff</command> commands.  as Unix's Swiss Army Chainsaw. (See <citerefentry>
391    <refentrytitle>perl</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>.)
392    </para>
393    </listitem>
394    <listitem>
395    <para>
396    <systemitem role="package">python</systemitem> - Python is another of the most
397    used interpreted scripting languages on the Debian system, combining
398    remarkable power with very clear syntax. (See <citerefentry>
399    <refentrytitle>python</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>.)
400  </para>  </para>
401  </listitem>  </listitem>
402  <listitem>  <listitem>
403  <para>  <para>
404  <systemitem role="package">quilt</systemitem> - this package helps you to  <systemitem role="package">quilt</systemitem> - this package helps you to
405  manage a series of patches by keeping track of the changes each of them makes.  manage large numbers of patches by keeping track of the changes each patch
406  They are logically organized as a stack, and you can apply (=push), un-apply  makes. Patches can be applied, un-applied, refreshed, and more.  (See
407  (=pop), refresh them easily by traveling into the stack.  (see <citerefentry>  <citerefentry> <refentrytitle>quilt</refentrytitle> <manvolnum>1</manvolnum></citerefentry>,
408  <refentrytitle>quilt</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>,  <ulink url="&quilt-pdf;">quilt.pdf</ulink>.)
 <ulink url="&quilt-pdf;">quilt.pdf</ulink>)  
409  </para>  </para>
410  </listitem>  </listitem>
411  <listitem>  <listitem>
412  <para>  <para>
413  <systemitem role="package">git</systemitem> - this package provides popular  <systemitem role="package">xutils-dev</systemitem> - some programs, usually
414  version control system designed to handle very large projects with speed and  those made for X11, also use these programs to generate
415  efficiency; it is used for many high profile open source projects, most notably  <filename>Makefile</filename> files from sets of macro functions.  (See
416  the Linux kernel.  (see <citerefentry> <refentrytitle>git</refentrytitle>  <citerefentry> <refentrytitle>imake</refentrytitle> <manvolnum>1</manvolnum>
417  <manvolnum>1</manvolnum> </citerefentry>,  </citerefentry>, <citerefentry> <refentrytitle>xmkmf</refentrytitle>
418  <ulink url="&git-doc;">git Manual</ulink>)  <manvolnum>1</manvolnum> </citerefentry>.)
419  </para>  </para>
420  </listitem>  </listitem>
421  </itemizedlist>  </itemizedlist>
422  <para>  <para>
423  The short descriptions that are given above only serve to introduce you to what  The short descriptions that are given above only serve to introduce you to what
424  each package does.  Before continuing please thoroughly read the documentation  each package does.  Before continuing please read the documentation
425  of each program, at least, for the standard usage.  It may seem like heavy  of each relevant program including ones installed through the package dependency such as
426    <command>make</command>, at least, for the standard usage.  It may seem like heavy
427  going now, but later on you'll be <emphasis>very</emphasis> glad you read it.  going now, but later on you'll be <emphasis>very</emphasis> glad you read it.
428  </para>  If you have specific questions later, I would suggest re-reading the documents
429  <para>  mentioned above.
 If you have specific questions later, I suggest you to read the documents  
 mentioned above again.  Since this is a tutorial, I intentionally skipped  
 details and provided only pointers to keep it simple.  
430  </para>  </para>
431  </section>  </section>
432  <section id="needdocs"><title>Documentations you need for development</title>  <section id="needdocs"><title>Documentation needed for development</title>
433  <para>  <para>
434  The following is the <emphasis>very important</emphasis> documentation which  The following is the <emphasis>very important</emphasis> documentation which
435  you should read along with this document:  you should read along with this document:
# Line 382  you should read along with this document Line 439  you should read along with this document
439  <para>  <para>
440  <systemitem role="package">debian-policy</systemitem> - the <ulink url="&debian-policy;">Debian Policy  <systemitem role="package">debian-policy</systemitem> - the <ulink url="&debian-policy;">Debian Policy
441  Manual</ulink> includes explanations of the structure and contents of the  Manual</ulink> includes explanations of the structure and contents of the
442  Debian archive, several OS design issues, the <ulink url="&fhs;">Filesystem Hierarchy Standard</ulink>  Debian archive, several OS design issues, the <ulink url="&fhs;">Filesystem Hierarchy Standard</ulink>
443  (FHS, which says where each file and directory should be) etc.  For you, the most  (FHS, which says where each file and directory should be), etc.  For you, the most
444  important thing is that it describes requirements that each package must  important thing is that it describes requirements that each package must
445  satisfy to be included in the distribution (see the local copies of  satisfy to be included in the distribution. (See the local copies of
446  <ulink url="&policy-pdf;">policy.pdf</ulink> and <ulink url="&fhs-pdf;">fhs-2.3.pdf</ulink>).  <ulink url="&policy-pdf;">policy.pdf</ulink> and <ulink url="&fhs-pdf;">fhs-2.3.pdf</ulink>.)
447  </para>  </para>
448  </listitem>  </listitem>
449  <listitem>  <listitem>
# Line 395  satisfy to be included in the distributi Line 452  satisfy to be included in the distributi
452  - the <ulink url="&developers-reference;">Debian Developer's Reference</ulink>  - the <ulink url="&developers-reference;">Debian Developer's Reference</ulink>
453  describes all matters not specifically about the technical  describes all matters not specifically about the technical
454  details of packaging, like the structure of the archive, how to rename, orphan,  details of packaging, like the structure of the archive, how to rename, orphan,
455  pick up packages, how to do NMUs, how to manage bugs, best packaging practices,  or adopt packages, how to do NMUs, how to manage bugs, best packaging practices,
456  when and where to upload etc.  (see the local copy of  when and where to upload etc.  (See the local copy of
457  <ulink url="&developers-refpdf;">developers-reference.pdf</ulink>).  <ulink url="&developers-refpdf;">developers-reference.pdf</ulink>.)
458  </para>  </para>
459  </listitem>  </listitem>
460    </itemizedlist>
461    <para>
462    The following is the <emphasis>important</emphasis> documentation which
463    you should read along with this document:
464    </para>
465    <itemizedlist>
466  <listitem>  <listitem>
467  <para>  <para>
468  <ulink url="&autotools-tutorial;">Autotools  <ulink url="&autotools-tutorial;">Autotools
469  Tutorial</ulink> provides very good tutorial for <ulink url="&gnu-build-system;">the GNU Build System known  Tutorial</ulink> provides a very good tutorial for <ulink url="&gnu-build-system;">the GNU Build System known
470  as the GNU Autotools</ulink> whose most important components are Autoconf,  as the GNU Autotools</ulink> whose most important components are Autoconf,
471  Automake, Libtool, and gettext.  Automake, Libtool, and gettext.
472  </para>  </para>
# Line 415  two pieces of documentation from the GNU Line 478  two pieces of documentation from the GNU
478  <ulink url="&gnu-standard;">GNU Coding Standards</ulink>, and  <ulink url="&gnu-standard;">GNU Coding Standards</ulink>, and
479  <ulink url="&gnu-maintainer;">Information for Maintainers of GNU Software</ulink>.  <ulink url="&gnu-maintainer;">Information for Maintainers of GNU Software</ulink>.
480  Although Debian does not require these to  Although Debian does not require these to
481  be followed, these are still helpful as guidelines and common sense.  (see the local copies of  be followed, these are still helpful as guidelines and common sense.
482    (See the local copies of
483  <ulink url="&gnu-standard-pdf;">standards.pdf</ulink> and  <ulink url="&gnu-standard-pdf;">standards.pdf</ulink> and
484  <ulink url="&gnu-maintainer-pdf;">maintain.pdf</ulink>).  <ulink url="&gnu-maintainer-pdf;">maintain.pdf</ulink>.)
485  </para>  </para>
486  </listitem>  </listitem>
487  </itemizedlist>  </itemizedlist>
488  <para>  <para>
489  If this document contradicts with any of the documents mentioned above, they  If this document contradicts any of the documents mentioned above, they
490  are correct.  Please file a bug report on the  are correct.  Please file a bug report on the
491  <systemitem role="package">maint-guide</systemitem> package using  <systemitem role="package">maint-guide</systemitem> package using
492  <command>reportbug</command>.  <command>reportbug</command>.
493  </para>  </para>
494  </section>  </section>
 <section id="terminology"><title>Basic terminology</title>  
 <para>  
 There are two types of packages.  
 </para>  
 <itemizedlist>  
 <listitem>  
 <para>  
 <emphasis role="strong">source package</emphasis>: A source package is a set of  
 files which contain code and data which you can compile and process into  
 execution programs and formatted documents.  It usually comes as a combination  
 of <filename>*.orig.tar.gz</filename>, <filename>*.debian.tar.gz</filename> (or  
 <filename>*.diff.gz</filename>), and <filename>*.dsc</filename>.  Some other  
 archive and compression methods may be used, too.  
 </para>  
 </listitem>  
 <listitem>  
 <para>  
 <emphasis role="strong">binary package</emphasis>: A binary package contains  
 execution programs and formatted documents.  It usually comes as  
 <filename>*.deb</filename> for the normal Debian system and as  
 <filename>*.udeb</filename> for the Debian Installer.  
 </para>  
 </listitem>  
 </itemizedlist>  
 <para>  
 Don't mix terms like source of the program and the source package of the  
 program!  
 </para>  
 <para>  
 There are several role names used around Debian.  
 </para>  
 <itemizedlist>  
 <listitem>  
 <para>  
 <emphasis role="strong">upstream author</emphasis>: The person who made the  
 original program.  
 </para>  
 </listitem>  
 <listitem>  
 <para>  
 <emphasis role="strong">upstream maintainer</emphasis>: The person who  
 currently maintains the program.  
 </para>  
 </listitem>  
 <listitem>  
 <para>  
 <emphasis role="strong">maintainer</emphasis>: The person who makes Debian  
 package of the program.  
 </para>  
 </listitem>  
 <listitem>  
 <para>  
 <emphasis role="strong">sponsor</emphasis>: The person who helps maintainers to  
 upload packages to the official Debian Package Archive after checking their  
 contents.  
 </para>  
 </listitem>  
 <listitem>  
 <para>  
 <emphasis role="strong">mentor</emphasis>: The person who helps novice  
 maintainers on packaging etc.  
 </para>  
 </listitem>  
 <listitem>  
 <para>  
 <emphasis role="strong">Debian Developer</emphasis> (DD): The person who is a  
 member of Debian.  He has full upload right to the official Debian Package  
 Archive.  
 </para>  
 </listitem>  
 <listitem>  
 <para>  
 <emphasis role="strong">Debian Maintainer</emphasis> (DM): The person who has  
 limited upload right to the official Debian Package Archive.  
 </para>  
 </listitem>  
 </itemizedlist>  
 <para>  
 There are several version names<footnote><para>See <ulink url="&policy-control;#s-f-Version">Debian Policy  Manual: 5.6.12 Version</ulink>.</para></footnote> used around Debian.  
 </para>  
 <itemizedlist>  
 <listitem>  
 <para>  
 <emphasis role="strong">upstream source version</emphasis>: The upstream source  
 version is referred as <literal><replaceable>version</replaceable></literal>.  
 </para>  
 </listitem>  
 <listitem>  
 <para>  
 <emphasis role="strong">Debian revision</emphasis>: The revision by Debian on  
 package is referred as <literal><replaceable>revision</replaceable></literal>.  
 </para>  
 </listitem>  
 <listitem>  
 <para>  
 <emphasis role="strong">Debian package version</emphasis>: The Debian package  
 version is referred as the following.  
 </para>  
 <itemizedlist>  
 <listitem>  
 <para>  
 <literal><replaceable>version</replaceable></literal> for the native Debian  
 binary package and for the Debian source package.  
 </para>  
 </listitem>  
 <listitem>  
 <para>  
 <literal><replaceable>version</replaceable>-<replaceable>revision</replaceable></literal>  
 for the non-native Debian binary package.  
 </para>  
 </listitem>  
 </itemizedlist>  
 </listitem>  
 </itemizedlist>  
 <para>  
 Please read the other manuals if you need more details on terminology.  
 <footnote><para>See lists in <xref linkend="socialdynamism"/> and <xref linkend="needdocs"/>.</para></footnote>  
 </para>  
 </section>  
495  <section id="helpme"><title>Where to ask for help</title>  <section id="helpme"><title>Where to ask for help</title>
496  <para>  <para>
497  Before you decide to ask your question in some public place, please read the fine documentation.  Before you decide to ask your question in some public place, please read the fine documentation.
# Line 554  Before you decide to ask your question i Line 499  Before you decide to ask your question i
499  <itemizedlist>  <itemizedlist>
500  <listitem>  <listitem>
501  <para>  <para>
 files in <filename>/usr/share/doc/dpkg</filename>  
 </para>  
 </listitem>  
 <listitem>  
 <para>  
 files in <filename>/usr/share/doc/debian</filename>  
 <!-- /usr/share/doc/debian is used be doc-debian and debian-faq -->  
 </para>  
 </listitem>  
 <listitem>  
 <para>  
 files in <filename>/usr/share/doc/autotools-dev</filename>  
 </para>  
 </listitem>  
 <listitem>  
 <para>  
502  files in <filename>/usr/share/doc/<replaceable>package</replaceable></filename> for all pertinent packages  files in <filename>/usr/share/doc/<replaceable>package</replaceable></filename> for all pertinent packages
503  </para>  </para>
504  </listitem>  </listitem>
# Line 595  contents of <ulink url="&debian-devel-ld Line 524  contents of <ulink url="&debian-devel-ld
524  </listitem>  </listitem>
525  </itemizedlist>  </itemizedlist>
526  <para>  <para>
527  Please consider to use web search engine effectively by including search string  You can use web search engines more effectively by including search strings
528  such as <literal>site:lists.debian.org</literal> to limit the domain.  such as <literal>site:lists.debian.org</literal> to limit the domain.
529  </para>  </para>
530  <para>  <para>
531  Making a small test package is good way to learn details of packaging.  Making a small test package is a good way to learn details of packaging.
532  Inspecting existing well maintained packages is the best way to learn how other  Inspecting existing well maintained packages is the best way to learn how other
533  people make packages.  people make packages.
534  </para>  </para>
# Line 634  is time for you to dig into the Line 563  is time for you to dig into the
563  <ulink url="&bts;">Debian Bug Tracking System</ulink>  <ulink url="&bts;">Debian Bug Tracking System</ulink>
564  and read the documentation there, to be able to  and read the documentation there, to be able to
565  deal with the reports efficiently.  I highly recommend reading the  deal with the reports efficiently.  I highly recommend reading the
566  <ulink url="&devref-bug-handling;">Debian Developer's Reference, 5.8.  'Handling bugs'</ulink>.  <ulink url="&devref-bug-handling;">Debian Developer's Reference, 5.8.
567    "Handling bugs"</ulink>.
568  </para>  </para>
569  <para>  <para>
570  Even if it all worked well, it's time to start praying.  Why?  Because in just  Even if it all worked well, it's time to start praying.  Why?  Because in just
# Line 652  documentation</emphasis> for details). Line 582  documentation</emphasis> for details).
582  </chapter>  </chapter>
583  <chapter id="first"><title>First steps</title>  <chapter id="first"><title>First steps</title>
584  <para>  <para>
585  Let's try to make your own package (or, better even, adopt an existing one).  Let's start by creating a package of your own (or, even better,
586    adopting an existing one).
587    </para>
588    <section id="workflow"><title>Debian package building workflow</title>
589    <para>
590    If you are making a Debian package with an upstream program, the
591    typical workflow of Debian package building involves generating several
592    specifically named files for each step as follows.
593    </para>
594    <itemizedlist>
595    <listitem>
596    <para>Get a copy of the upstream software, usually in a compressed tar format.</para>
597      <itemizedlist>
598      <listitem><literal><replaceable>package</replaceable>-<replaceable>version</replaceable>.tar.gz</literal></listitem>
599      </itemizedlist>
600    </listitem>
601    <listitem>
602    <para>
603    Add Debian-specific packaging modifications to the upstream program under the
604    <filename>debian</filename> directory, and create a non-native source package
605    (that is, the set of input files used for Debian package building) in
606    <literal>3.0 (quilt)</literal> format .
607  </para>  </para>
608      <itemizedlist>
609      <listitem><literal><replaceable>package</replaceable>_<replaceable>version</replaceable>.orig.tar.gz</literal></listitem>
610      <listitem><literal><replaceable>package</replaceable>_<replaceable>version</replaceable>-<replaceable>revision</replaceable>.debian.tar.gz</literal>
611        <footnote><para>For the older style of non-native Debian source packages in <literal>1.0</literal> format,
612        <literal><replaceable>package</replaceable>_<replaceable>version</replaceable>-<replaceable>revision</replaceable>.diff.gz</literal>
613        is used instead. </para></footnote></listitem>
614      <listitem><literal><replaceable>package</replaceable>_<replaceable>version</replaceable>-<replaceable>revision</replaceable>.dsc</literal></listitem>
615      </itemizedlist>
616    </listitem>
617    <listitem>
618    <para>
619    Build Debian binary packages, which are ordinary installable package files in <literal>.deb</literal> format (or <literal>.udeb</literal> format, used by the Debian Installer) from the Debian source package.
620    </para>
621      <itemizedlist>
622      <listitem><literal><replaceable>package</replaceable>_<replaceable>version</replaceable>-<replaceable>revision</replaceable>_<replaceable>arch</replaceable>.deb</literal></listitem>
623      </itemizedlist>
624    </listitem>
625    </itemizedlist>
626    <para>
627    Please note that the character separating
628    <literal><replaceable>package</replaceable></literal> and
629    <literal><replaceable>version</replaceable></literal> was changed from
630    <literal>-</literal> (hyphen) in the tarball name to
631    <literal>_</literal> (underscore) in the Debian package filenames.
632    </para>
633    <para>
634    In the file names above, replace
635    the <literal><replaceable>package</replaceable></literal> part with the <emphasis role="strong">package name</emphasis>,
636    the <literal><replaceable>version</replaceable></literal> part with the <emphasis role="strong">upstream version</emphasis>,
637    the <literal><replaceable>revision</replaceable></literal> part with the <emphasis role="strong">Debian revision</emphasis>,
638    and the <literal><replaceable>arch</replaceable></literal> part with the <emphasis role="strong">package architecture</emphasis>,
639    as defined in the Debian Policy Manual.
640    <footnote> <para> See
641    <ulink url="&policy-source;">5.6.1 Source</ulink>,
642    <ulink url="&policy-package;">5.6.7 Package</ulink>, and
643    <ulink url="&policy-version;">5.6.12 Version</ulink>.
644    The <emphasis role="strong">package architecture</emphasis> follows the
645    Debian Policy Manual: <ulink url="&policy-architecture;">5.6.8 Architecture</ulink>
646    and is automatically assigned by the package build process.</para></footnote>
647    </para>
648    <para>
649    If instead you are making a Debian-specific package with no upstream, the
650    typical workflow of Debian package building is simpler.
651    </para>
652    <itemizedlist>
653    <listitem>
654    <para>
655    Create a native Debian source package in the <literal>3.0 (native)</literal>
656    format using a single compressed tar file in which all files are included.
657    </para>
658      <itemizedlist>
659      <listitem><literal><replaceable>package</replaceable>_<replaceable>version</replaceable>.tar.gz</literal></listitem>
660      <listitem><literal><replaceable>package</replaceable>_<replaceable>version</replaceable>.dsc</literal></listitem>
661      </itemizedlist>
662    </listitem>
663    <listitem>
664    <para>
665    Build Debian binary packages from the native Debian source package.
666    </para>
667      <itemizedlist>
668      <listitem><literal><replaceable>package</replaceable>_<replaceable>version</replaceable>_<replaceable>arch</replaceable>.deb</literal></listitem>
669      </itemizedlist>
670    </listitem>
671    </itemizedlist>
672    <para>
673    Each step of this outline is explained with detailed examples in later sections.
674    </para>
675    </section>
676  <section id="choose"><title>Choose your program</title>  <section id="choose"><title>Choose your program</title>
677  <para>  <para>
678  You have probably chosen the package you want to create.  The first thing you  You have probably chosen the package you want to create.  The first thing you
# Line 665  using the following. Line 684  using the following.
684  <para>the <command>aptitude</command> command</para>  <para>the <command>aptitude</command> command</para>
685  </listitem>  </listitem>
686  <listitem>  <listitem>
687  <para><ulink url="&packages-do;">Debian packages</ulink> web page</para>  <para>the <ulink url="&packages-do;">Debian packages</ulink> web page</para>
688  </listitem>  </listitem>
689  <listitem>  <listitem>
690  <para><ulink url="&packages-qa-do;">Debian Package Tracking System</ulink> web page</para>  <para>the <ulink url="&packages-qa-do;">Debian Package Tracking System</ulink> web page</para>
691  </listitem>  </listitem>
692  </itemizedlist>  </itemizedlist>
693  <para>  <para>
694  If the package already exists, well, install it!  :-) If it happens to be  If the package already exists, well, install it!  :-) If it happens to be
695  <emphasis role="strong">orphaned</emphasis> -- if its maintainer is set to  <emphasis role="strong">orphaned</emphasis> (that is, if its
696  <ulink url="&qa-do;">Debian QA Group</ulink>, you may be able to pick it up if  maintainer is set to <ulink url="&qa-do;">Debian QA Group</ulink>),
697  it's still available.  You may also adopt a package for which the corresponding  you may be able to pick it up if it's still available.  You may also
698  maintainer has filed a Request for Adoption  adopt a package whose maintainer has filed a Request for Adoption
699  (<emphasis role="strong">RFA</emphasis>).  (<emphasis role="strong">RFA</emphasis>).<footnote> <para>See
700    <ulink url="&devref-adopt;">Debian Developer's Reference 5.9.5.
701    "Adopting a package"</ulink>.</para> </footnote>
702  </para>  </para>
703  <para>  <para>
704  There are several package ownership status resources.  There are several package ownership status resources.
# Line 702  for most kinds of programs, and the numb Line 723  for most kinds of programs, and the numb
723  archive is much larger than that of contributors with upload rights.  Thus,  archive is much larger than that of contributors with upload rights.  Thus,
724  contributions to packages already in the archive are far more appreciated (and  contributions to packages already in the archive are far more appreciated (and
725  more likely to receive sponsorship) by other developers <footnote><para> Having  more likely to receive sponsorship) by other developers <footnote><para> Having
726  said that, there will of course always be new programs that are worthwhile  said that, there will of course always be new programs that are worth
727  packaging.  </para> </footnote>.  You can do that in various ways.  packaging.  </para> </footnote>.  You can contribute in various ways.
728  </para>  </para>
729  <itemizedlist>  <itemizedlist>
730  <listitem>  <listitem>
# Line 733  If you are able to adopt the package, ge Line 754  If you are able to adopt the package, ge
754  examine them.  This document unfortunately doesn't include comprehensive  examine them.  This document unfortunately doesn't include comprehensive
755  information about adopting packages.  Thankfully you shouldn't have a hard time  information about adopting packages.  Thankfully you shouldn't have a hard time
756  figuring out how the package works since someone has already done the initial  figuring out how the package works since someone has already done the initial
757  set up for you.  Keep reading, though, a lot of the advice below will still be  setup for you.  Keep reading, though; a lot of the advice below will still be
758  applicable for your case.  applicable for your case.
759  </para>  </para>
760  <para>  <para>
# Line 743  as follows: Line 764  as follows:
764  <itemizedlist>  <itemizedlist>
765  <listitem>  <listitem>
766  <para>  <para>
767  First, you must know that program works, and have tried it for some time to  First, you must know that the program works, and have tried it for some time to
768  confirm its usefulness.  confirm its usefulness.
769  </para>  </para>
770  </listitem>  </listitem>
771  <listitem>  <listitem>
772  <para>  <para>
773  You must check if no one else is working on the package already at the  You must check that no one else is already working on the package on the
774  <ulink url="&wnpp-do;">Work-Needing and Prospective Packages</ulink> site.  <ulink url="&wnpp-do;">Work-Needing and Prospective Packages</ulink> site.
775  If no one else is working on it, file an ITP (Intent  If no one else is working on it, file an ITP (Intent
776  To Package) bug report to the <systemitem role="package">wnpp</systemitem>  To Package) bug report to the <systemitem role="package">wnpp</systemitem>
777  pseudo-package using <command>reportbug</command>.  If someone's already on it,  pseudo-package using <command>reportbug</command>.  If someone's already on it,
778  contact them if you feel you need to.  If not - find another interesting  contact them if you feel you need to.  If not - find another interesting
779  program that nobody maintains.  program that nobody is maintaining.
780  </para>  </para>
781  </listitem>  </listitem>
782  <listitem>  <listitem>
783  <para>  <para>
784  That program <emphasis role="strong">must have a license</emphasis>.  The software <emphasis role="strong">must have a license</emphasis>.
785  </para>  </para>
786  <itemizedlist>  <itemizedlist>
787  <listitem>  <listitem>
788  <para>  <para>
789  For the <literal>main</literal> section, it <emphasis role="strong">must be  For the <literal>main</literal> section, Debian Policy requires it
790  compliant to all the Debian Free Software Guidelines</emphasis> (<ulink url="&dfsg;">DFSG</ulink>)  <emphasis role="strong">to be fully compliant with the Debian Free Software
791  and <emphasis role="strong">that program must not require a package outside of  Guidelines</emphasis> (<ulink url="&dfsg;">DFSG</ulink>)
792  <literal>main</literal></emphasis> for compilation or execution as required by  and <emphasis role="strong">not to require a package outside of
793  the Debian Policy.  This is desired case.  <literal>main</literal></emphasis> for compilation or execution.  This
794    is the desired case.
795  </para>  </para>
796  </listitem>  </listitem>
797  <listitem>  <listitem>
798  <para>  <para>
799  For the <literal>contrib</literal> section, it must be compliant to all the  For the <literal>contrib</literal> section, it must comply with the
800  DFSG but it may require a package outside of <literal>main</literal> for  DFSG but it may require a package outside of <literal>main</literal> for
801  compilation or execution.  compilation or execution.
802  </para>  </para>
803  </listitem>  </listitem>
804  <listitem>  <listitem>
805  <para>  <para>
806  For the <literal>non-free</literal> section, it may not be compliant to some of  For the <literal>non-free</literal> section, it may be non-compliant
807  the DFSG but it <emphasis role="strong">must be distributable</emphasis>.  with the DFSG but it <emphasis role="strong">must be distributable</emphasis>.
808  </para>  </para>
809  </listitem>  </listitem>
810  </itemizedlist>  <listitem>
811  <para>  <para>
812  If you are unsure about where it should go, post the license text on <ulink url="&debian-legal-ldo;">debian-legal@lists.debian.org</ulink>  If you are unsure about where it should go, post the license text on
813    <ulink url="&debian-legal-ldo;">debian-legal@lists.debian.org</ulink>
814  and ask for advice.  and ask for advice.
815  </para>  </para>
816  </listitem>  </listitem>
817    </itemizedlist>
818    </listitem>
819  <listitem>  <listitem>
820  <para>  <para>
821  That program certainly should <emphasis role="strong">not</emphasis> run setuid  The program should <emphasis role="strong">not</emphasis> introduce security
822  root, or even better - it shouldn't need to be setuid or setgid to anything.  and maintenance concerns to the Debian system.
823  </para>  </para>
824  </listitem>  <itemizedlist>
825  <listitem>  <listitem>
826  <para>  <para>
827  That program should not be a daemon, or something that goes in  The program should be well documented and its code needs to be understandable
828  <filename>*/sbin</filename> directories, or open a port as root.  (i.e.  not obfuscated).
829  </para>  </para>
830  </listitem>  </listitem>
831  <listitem>  <listitem>
832  <para>  <para>
833  That program should result in binary executable form, libraries are harder to  You should contact the program's author(s) to check if they agree with packaging it
834  handle.  and are amicable to Debian.  It is important to be able to consult with the author(s)
835    in case of any problems with the program, so don't try to package
836    unmaintained software.
837  </para>  </para>
838  </listitem>  </listitem>
839  <listitem>  <listitem>
840  <para>  <para>
841  That program should be well documented and its code needs to be understandable  The program certainly should <emphasis role="strong">not</emphasis> run setuid
842  (i.e.  not obfuscated).  root, or even better, it shouldn't need to be setuid or setgid to anything.
843  </para>  </para>
844  </listitem>  </listitem>
845  <listitem>  <listitem>
846  <para>  <para>
847  You should contact program's author(s) to check if they agree with packaging it  The program should not be a daemon, or go in an
848  and amicable to Debian.  It is important to be able to consult with author(s)  <filename>*/sbin</filename> directory, or open a port as root.
 about the program in case of any program specific problems, so don't try to  
 package unmaintained pieces of software.  
849  </para>  </para>
850  </listitem>  </listitem>
851  </itemizedlist>  </itemizedlist>
852    </listitem>
853    </itemizedlist>
854    <para>
855    Of course, the last one is just a safety measures, and intended to save you from
856    enraging users if you do something wrong in some setuid daemon...  When you gain
857    more experience in packaging, you'll be able to package such software.
858    </para>
859  <para>  <para>
860  Of course, these things are just safety measures, and intended to save you from  As a new maintainer, you are encouraged to get some experience in packaging
861  raging users if you do something wrong in some setuid daemon...  When you gain  with easier packages and discouraged from creating complicated packages.
 some more experience in packaging, you'll be able to package such packages.  
862  </para>  </para>
863    <itemizedlist>
864    <listitem><para>Simple packages</para>
865    <itemizedlist>
866      <listitem><para>single binary package, arch = all (collection of data such as wallpaper graphics)</para></listitem>
867      <listitem><para>single binary package, arch = all (executables written in an interpreted language such as POSIX shell)</para></listitem>
868    </itemizedlist>
869    </listitem>
870    <listitem><para>Intermediate complexity packages</para>
871    <itemizedlist>
872      <listitem><para>single binary package, arch = any (executables written in compiled languages such as C and C++)</para></listitem>
873      <listitem><para>multiple binary packages, arch = any + all (packages for executables + documentation)</para></listitem>
874      <listitem><para>upstream source in a format other than <filename>tar.gz</filename> or <filename>tar.bz2</filename></para></listitem>
875      <listitem><para>upstream source containing undistributable contents</para></listitem>
876    </itemizedlist>
877    </listitem>
878    <listitem><para>High complexity packages</para>
879    <itemizedlist>
880      <listitem><para>interpreter module package used by other packages</para></listitem>
881      <listitem><para>generic library package used by other packages</para></listitem>
882      <listitem><para>multiple binary packages including a library package</para></listitem>
883      <listitem><para>source package with multiple upstream sources</para></listitem>
884      <listitem><para>kernel module packages</para></listitem>
885      <listitem><para>kernel patch packages</para></listitem>
886      <listitem><para>any package with non-trivial maintainer scripts</para></listitem>
887    </itemizedlist>
888    </listitem>
889    </itemizedlist>
890    <para>
891    Packaging high complexity packages is not too hard, but it requires a bit more
892    knowledge. You should seek specific guidance for every complex feature. For
893    example, some languages have their own sub-policy documents:
894    </para>
895    <itemizedlist>
896    <listitem><para><ulink url="&policy-perl;">Perl policy</ulink></para></listitem>
897    <listitem><para><ulink url="&policy-python;">Python policy</ulink></para></listitem>
898    <listitem><para><ulink url="&policy-java;">Java policy</ulink></para></listitem>
899    </itemizedlist>
900    <para>
901    There is another old Latin saying: <emphasis>fabricando fit faber</emphasis>
902    (practice makes perfect).  It is <emphasis>highly</emphasis> recommended to
903    practice and experiment with all the steps of Debian packaging with simple packages
904    while reading this tutorial.  A trivial upstream tarball
905    <filename>hello-sh-1.0.tar.gz</filename> created as followings may offer
906    a good starting point.<footnote><para>Do not worry about the missing
907    <filename>Makefile</filename>.  You can install the <command>hello</command>
908    command by simply using <command>debhelper</command> as in
909    <xref linkend="install"/>, or by modifying the upstream source to add a new
910    <filename>Makefile</filename> with the <literal>install</literal> target as in
911    <xref linkend="modify"/>.</para></footnote>
912    </para>
913    <screen>
914    $ mkdir -p hello-sh/hello-sh-1.0; cd hello-sh/hello-sh-1.0
915    $ cat &gt; hello &lt;&lt;EOF
916    #!/bin/sh
917    # (C) 2011 Foo Bar, GPL2+
918    echo "Hello!"
919    EOF
920    $ chmod 755 hello
921    $ cd ..
922    $ tar -cvzf hello-sh-1.0.tar.gz hello-sh-1.0
923    </screen>
924  </section>  </section>
925  <section id="getit"><title>Get the program, and try it out</title>  <section id="getit"><title>Get the program, and try it out</title>
926  <para>  <para>
927  So the first thing to do is to find and download the original source code.  I  So the first thing to do is to find and download the original source code.
928  presume that you already have the source file that you picked up at the  Presumably you already have the source file that you picked up at the
929  author's homepage.  Sources for free Unix programs usually come in  author's homepage.  Sources for free Unix programs usually come in
930  <command>tar</command>+<command>gzip</command> format with extension  <command>tar</command>+<command>gzip</command> format with the extension
931  <filename>.tar.gz</filename>, or  <filename>.tar.gz</filename>,
932  <command>tar</command>+<command>bzip2</command> format with extension  <command>tar</command>+<command>bzip2</command> format with the extension
933  <filename>.tar.bz2</filename>.  These usually contain the subdirectory called  <filename>.tar.bz2</filename>, or
934  <filename><replaceable>programname</replaceable>-<replaceable>version</replaceable></filename>  <command>tar</command>+<command>xz</command> format with the extension
935  in them and all the sources under it.  <filename>.tar.xz</filename>.  These usually contain a directory called
936    <filename><replaceable>package</replaceable>-<replaceable>version</replaceable></filename>
937    with all the sources inside.
938  </para>  </para>
939  <para>  <para>
940  If the latest version of such sources are available through VCS such as Git,  If the latest version of the source is available through a VCS such as Git,
941  Subversion, or CVS repository, you need to get it with <literal>git  Subversion, or CVS, you need to get it with <literal>git
942  clone</literal>, <literal>svn co</literal>, or <literal>cvs co</literal> and  clone</literal>, <literal>svn co</literal>, or <literal>cvs co</literal> and
943  repack it into <command>tar</command>+<command>gzip</command> format by  repack it into <command>tar</command>+<command>gzip</command> format yourself
944  yourself using the <literal>--exclude-vcs</literal> option.  by using the <literal>--exclude-vcs</literal> option.
945  </para>  </para>
946  <para>  <para>
947  If your program's source comes as some other sort of archive (for instance, the  If your program's source comes as some other sort of archive (for instance, the
948  filename ends in <filename>.Z</filename> or  filename ends in <filename>.Z</filename> or
949  <filename>.zip</filename><footnote><para> You can identify the archive format  <filename>.zip</filename><footnote><para> You can identify the archive format
950  using the <command>file</command> command when the file extension is not  using the <command>file</command> command when the file extension is not
951  enough.  </para> </footnote>), unpack it with appropriate tools and repack it,  enough.  </para> </footnote>), you should also unpack it with the
952  too.  appropriate tools and repack it.
953  </para>  </para>
954  <para>  <para>
955  As an example, I'll use a program called <command>gentoo</command>, an X GTK+  If your program's source comes with some contents which do not comply with
956    DFSG, you should also unpack it to remove such contents and repack it with a
957    modified upstream version containg <literal>dfsg</literal>.
958    </para>
959    <para>
960    As an example, I'll use a program called <command>gentoo</command>, a GTK+
961  file manager.  file manager.
962  <footnote><para> This program is already packaged. Its  <footnote><para> This program is already packaged. The
963  <ulink url="&gentoo-package;">current version</ulink> uses Autotools as its  <ulink url="&gentoo-package;">current version</ulink> uses Autotools as its
964  build structure and is substantially different from the following examples  build structure and is substantially different from the following examples,
965  based on the version 0.9.12.</para>  which were based on version 0.9.12.</para>
966  </footnote>  </footnote>
967  </para>  </para>
968  <para>  <para>
# Line 871  Create a subdirectory under your home di Line 970  Create a subdirectory under your home di
970  <filename>debian</filename> or <filename>deb</filename> or anything you find  <filename>debian</filename> or <filename>deb</filename> or anything you find
971  appropriate (e.g.  just <filename>~/gentoo</filename> would do fine in this  appropriate (e.g.  just <filename>~/gentoo</filename> would do fine in this
972  case).  Place the downloaded archive in it, and extract it (with <literal>tar  case).  Place the downloaded archive in it, and extract it (with <literal>tar
973  xzf gentoo-0.9.12.tar.gz</literal>).  Make sure there are no errors, even some  xzf gentoo-0.9.12.tar.gz</literal>).  Make sure there are no warning
974  <emphasis>irrelevant</emphasis> ones, because there will most probably be  messages, even <emphasis>irrelevant</emphasis> ones, because other
975  problems unpacking on other people's systems, whose unpacking tools may or may  people's unpacking tools may or may not ignore these anomalies, so they
976  not ignore those anomalies.  On your console screen, you should see the  may have problems unpacking them.  Your shell command line may look
977  following.  something like this:
978  </para>  </para>
979  <screen>  <screen>
980  $ mkdir ~/gentoo ; cd ~/gentoo  $ mkdir ~/gentoo ; cd ~/gentoo
# Line 890  Now you have another subdirectory, calle Line 989  Now you have another subdirectory, calle
989  Change to that directory and <emphasis>thoroughly</emphasis> read the provided  Change to that directory and <emphasis>thoroughly</emphasis> read the provided
990  documentation.  Usually there are files named <filename>README*</filename>,  documentation.  Usually there are files named <filename>README*</filename>,
991  <filename>INSTALL*</filename>, <filename>*.lsm</filename> or  <filename>INSTALL*</filename>, <filename>*.lsm</filename> or
992  <filename>*.html</filename>.  You must find instructions on how to correctly  <filename>*.html</filename>.  You must find instructions on how to
993  compile and install the program (most probably they'll assume you want to  compile and install the program (most probably they'll assume you want to
994  install to <filename>/usr/local/bin</filename> directory; you won't be doing  install to the <filename>/usr/local/bin</filename> directory; you won't be doing
995  that, but more on that later in <xref linkend="destdir"/>).  that, but more on that later in <xref linkend="destdir"/>).
996  </para>  </para>
997  <para>  <para>
998  Simple programs come with a <filename>Makefile</filename> file in them and can  You should start packaging with a completely clean (pristine) source directory,
999  be compiled simply with <literal>make</literal>.<footnote><para>  or simply with freshly unpacked sources.
1000    </para>
1001    </section>
1002    <section id="simplemake"><title>Simple build systems</title>
1003    <para>
1004    Simple programs usually come with a <filename>Makefile</filename> and can
1005    be compiled just by invoking <literal>make</literal>.<footnote><para>
1006  Many modern programs come with a script <filename>configure</filename> which  Many modern programs come with a script <filename>configure</filename> which
1007  creates a <filename>Makefile</filename> file customized for your system upon  when executed creates a <filename>Makefile</filename> customized for
1008  its execution.</para></footnote> Some of them support  your system.</para></footnote> Some of them support
1009  <literal>make check</literal>, which runs included self-checks.  Installation  <literal>make check</literal>, which runs included self-tests.  Installation
1010  to the destination directories is usually done with <literal>make  to the destination directories is usually done with <literal>make
1011  install</literal>.  install</literal>.
1012  </para>  </para>
# Line 916  there's even a <literal>make uninstall</ Line 1021  there's even a <literal>make uninstall</
1021  all the installed files.  all the installed files.
1022  </para>  </para>
1023  </section>  </section>
1024  <section id="portable"><title>Free portable programs</title>  <section id="portable"><title>Popular portable build systems</title>
1025  <para>  <para>
1026  A lot of Free programs are written in the <ulink url="&c-program;">C</ulink> and  A lot of free software programs are written in the <ulink url="&c-program;">C</ulink> and
1027  <ulink url="&cxx;">C++</ulink> languages.  Many of  <ulink url="&cxx;">C++</ulink> languages.  Many of these use Autotools or
1028  these use Autotools or CMake to make them portable across different platforms.  CMake to make them portable across different platforms.  These build tools need
1029  These tools are used to generate <filename>Makefile</filename> and other  to be used to generate the <filename>Makefile</filename> and other
1030  required source files.  Then, such programs are built with usual <literal>make;  required source files first.  Then, such programs are built using the usual
1031  make install</literal>.  <literal>make; make install</literal>.
1032  </para>  </para>
1033  <para>  <para>
1034  <ulink url="&gnu-build-system;">Autotools</ulink>  <ulink url="&gnu-build-system;">Autotools</ulink> is the GNU build
1035  are the GNU build system comprising <ulink url="&autoconf;">Autoconf</ulink>, <ulink url="&automake;">Automake</ulink>, <ulink url="&libtool;">Libtool</ulink>, and <ulink url="&gettext;">gettext</ulink>.  You can notice  system comprising <ulink url="&autoconf;">Autoconf</ulink>,
1036    <ulink url="&automake;">Automake</ulink>,
1037    <ulink url="&libtool;">Libtool</ulink>, and
1038    <ulink url="&gettext;">gettext</ulink>.  You can recognize
1039  such sources by the <filename>configure.ac</filename>,  such sources by the <filename>configure.ac</filename>,
1040  <filename>Makefile.am</filename>, and <filename>Makefile.in</filename> files.  <filename>Makefile.am</filename>, and <filename>Makefile.in</filename> files.
1041  <footnote><para> See <ulink url="&autotools-tutorial;">Autotools Tutorial</ulink>  <footnote><para>Autotools is too big to deal in this small tutorial. This
1042  and <ulink url="&autotools-readme;"/>.  </para> </footnote>  section is meant to provide keywords and references only.  Please make sure to read the
1043    <ulink url="&autotools-tutorial;">Autotools Tutorial</ulink> and
1044    <ulink url="&autotools-readme;"/>, if you need to use it.</para></footnote>
1045  </para>  </para>
1046  <para>  <para>
1047  The first step of Autotools work flow is usually that the upstream runs  The first step of the Autotools workflow is usually that upstream runs
1048  <literal>autoreconf -i -f</literal> in the source and distributes this source  <literal>autoreconf -i -f</literal> in the source directory and
1049  with generated files.  distributes the generated files along with the source.
1050  </para>  </para>
1051  <screen>  <screen>
1052  configure.ac-----+-&gt; autoreconf -+-&gt; configure  configure.ac-----+-&gt; autoreconf -+-&gt; configure
# Line 955  files requires some knowledge of <comman Line 1065  files requires some knowledge of <comman
1065  <literal>info automake</literal>.  <literal>info automake</literal>.
1066  </para>  </para>
1067  <para>  <para>
1068  The second step of Autotools work flow is usually that the user obtains this  The second step of the Autotools workflow is usually that the user obtains this
1069  distributed source and runs <literal>./configure &amp;&amp; make</literal> in  distributed source and runs <literal>./configure &amp;&amp; make</literal> in
1070  the source to compile program into a  the source directory to compile the program into a
1071  <command><replaceable>binary</replaceable></command>.  <command><replaceable>binary</replaceable></command> executable.
1072  </para>  </para>
1073  <screen>  <screen>
1074  Makefile.in -----+                +-&gt; Makefile -----+-&gt; make -&gt; <replaceable>binary</replaceable>  Makefile.in -----+                +-&gt; Makefile -----+-&gt; make -&gt; <replaceable>binary</replaceable>
# Line 969  config.h.in -----+                +-&gt; Line 1079  config.h.in -----+                +-&gt;
1079             config.guess --+             config.guess --+
1080  </screen>  </screen>
1081  <para>  <para>
1082  You can change many things in the <filename>Makefile</filename> file such as  You can change many things in the <filename>Makefile</filename>; for
1083  the default file install location using the command option, e.g.  instance you can change the default location for file installation
1084  <command>./configure --prefix=/usr</command>.  using the option <command>./configure --prefix=/usr</command>.
1085  </para>  </para>
1086  <para>  <para>
1087  Although it is not required, updating the <filename>configure</filename> and  Although it is not required, updating the <filename>configure</filename> and
1088  other files with <literal>autoreconf -i -f</literal> as the user may improve  other files with <literal>autoreconf -i -f</literal> may improve
1089  the compatibility of the source.  the compatibility of the source.
1090  <footnote><para>You can automate this by using  <footnote><para>You can automate this by using
1091  <systemitem role="package">dh-autoreconf</systemitem> package.  <systemitem role="package">dh-autoreconf</systemitem> package.
# Line 983  See <xref linkend="customrules"/>.</para Line 1093  See <xref linkend="customrules"/>.</para
1093  </para>  </para>
1094  <para>  <para>
1095  <ulink url="&cmake;">CMake</ulink> is an alternative  <ulink url="&cmake;">CMake</ulink> is an alternative
1096  build system.  You can notice such sources by the  build system.  You can recognize such sources by the
1097  <filename>CMakeLists.txt</filename> file.  <filename>CMakeLists.txt</filename> file.
1098  </para>  </para>
1099  </section>  </section>
1100  <section id="namever"><title>Package name and version</title>  <section id="namever"><title>Package name and version</title>
1101  <para>  <para>
1102  You should start packaging with a completely clean (pristine) source directory,  If the upstream source comes as <filename>gentoo-0.9.12.tar.gz</filename>, you can
1103  or simply with freshly unpacked sources.  take <literal>gentoo</literal> as the (source) <emphasis role="strong">package name</emphasis>
1104    and <literal>0.9.12</literal> as the <emphasis role="strong">upstream version</emphasis>.
1105    These are used in the <filename>debian/changelog</filename> file described later in
1106    <xref linkend="changelog"/>, too.
1107    </para>
1108    <para>
1109    Although this simple approach works most of the times, you may need to adjust
1110    <emphasis role="strong">package name</emphasis> and
1111    <emphasis role="strong">upstream version</emphasis> by renaming the upstream
1112    source to follow Debian Policy and existing convention.
1113    </para>
1114    <para>
1115    You must choose the <emphasis role="strong">package name</emphasis>
1116    to consist only of lower case letters (<literal>a-z</literal>), digits
1117    (<literal>0-9</literal>), plus (<literal>+</literal>) and minus
1118    (<literal>-</literal>) signs, and periods (<literal>.</literal>). It must be
1119    at least two characters long, must start with an alphanumeric character, and
1120    must not be the same as existing ones.
1121    It is a good idea to keep its length within 30 characters.
1122    <footnote><para>The default package name field length of <command>aptitude</command> is 30.  For more than 90% of packages, the package name is less than 24 characters.</para></footnote>
1123    </para>
1124    <!--
1125    Osamu's archive stat (2011-04-23, sid, kfreebsd-amd64):
1126    === stat for package name string length ===
1127    11 1947 36.9%   mode
1128    14 1717 54.7%  50% median
1129    23 611 91.0%   90%
1130    32 89 99.0%    99%
1131    41 12 99.9%    99.9%
1132    52 1 100.0%
1133    Previous 20 chars is becoming too short for 17% of packages
1134    Default aptitude setting display up to 30 chars (98.3%).
1135    -->
1136    <para>
1137    If upstream uses some generic term such as <literal>test-suite</literal> for
1138    its name, it is a good idea to rename it to identify its contents explicitly and avoid namespace pollution.
1139    <footnote><para>If you follow the
1140    <ulink url="&devref-newpackage;">Debian Developer's Reference 5.1. "New packages"</ulink>,
1141    the ITP process will usually catch this kind of issues.</para></footnote>
1142    </para>
1143    <para>
1144    You should choose the <emphasis role="strong">upstream version</emphasis>
1145    to consist only of
1146    alphanumerics (<literal>0-9A-Za-z</literal>), plus (<literal>+</literal>),
1147    tildes (<literal>~</literal>), and periods (<literal>.</literal>). It must
1148    start with a digit (<literal>0-9</literal>).  <footnote><para>This stricter
1149    rule should help you avoid confusing file names.</para></footnote>
1150    It is good idea to keep its length within 8 characters if possible.
1151    <footnote><para>The default version field length of <command>aptitude</command> is 10.  The Debian revision with preceding hyphen usually consumes 2.  For more than 80% of packages, the upstream version is less than 8 characters and the Debian revision is less than 2 characters.  For more than 90% of packages, the upstream version is less than 10 characters and the Debian revision is less than 3 characters.</para></footnote>
1152    </para>
1153    <!--
1154    Osamu's archive stat (2011-04-23, sid, kfreebsd-amd64):
1155    === stat for upstream version string length ===
1156    5 9765 60.2%  50% median and mode
1157    6 3765 73.3%
1158    7 2789 82.9%
1159    8 1158 86.9%
1160    9 501 88.6%
1161    10 773 91.3%  90%
1162    18 55 99.1%   99%
1163    27 11 99.9%    99.9
1164    35 6 100.0%
1165    === stat for debian revision string length ===
1166    1 22556 83.3%  50% median and mode
1167    2 1106 87.2%
1168    3 1312 91.7%   90%
1169    4 2127 99.1%   99%
1170    7 14 99.9%     99.9%
1171    
1172    aptitude display 10 = 8char for up + 1char (for -) + 1char for deb
1173    90chars as max for file name of binary debs (package+up+deb+arch+.deb)
1174    -->
1175    <para>
1176    If upstream does not use a normal versioning scheme such as
1177    <literal>2.30.32</literal> but uses some kind of date such as
1178    <literal>09Oct23</literal>, a random codename string, or a VCS hash value as part
1179    of the version, make sure to remove them from the
1180    <emphasis role="strong">upstream version</emphasis>.  Such information can be
1181    recorded in the <filename>debian/changelog</filename> file.  If you need to
1182    invent a version string, use the <literal>YYYYMMDD</literal> format such as
1183    <literal>20110429</literal> as upstream version.  This ensures that
1184    <command>dpkg</command> interprets later versions correctly as upgrades.
1185    </para>
1186    <para>
1187    Version strings <footnote><para>Version strings may be
1188    <emphasis role="strong">upstream version</emphasis>
1189    (<literal><replaceable>version</replaceable></literal>),
1190    <emphasis role="strong">Debian revision</emphasis>
1191    (<literal><replaceable>revision</replaceable></literal>), or
1192    <emphasis role="strong">version</emphasis>
1193    (<literal><replaceable>version</replaceable>-<replaceable>revision</replaceable></literal>).
1194    See <xref linkend="newrevision"/> for how the
1195    <emphasis role="strong">Debian revision</emphasis> is incremented.
1196    </para></footnote>
1197    can be compared using <citerefentry>
1198    <refentrytitle>dpkg</refentrytitle> <manvolnum>1</manvolnum> </citerefentry> as follows.
1199    </para>
1200    <screen>
1201     $ dpkg --compare-versions <replaceable>ver1</replaceable> <replaceable>op</replaceable> <replaceable>ver2</replaceable>
1202    </screen>
1203    <para>
1204    The version comparison rule can be summarized as:
1205    </para>
1206    <itemizedlist>
1207    <listitem><para>Strings are compared from the head to the tail.</para></listitem>
1208    <listitem><para>Letters are larger than digits.</para></listitem>
1209    <listitem><para>Numbers are compared as integers.</para></listitem>
1210    <listitem><para>Letters are compared in ASCII code order.</para></listitem>
1211    <listitem><para>There are special rules for period
1212    (<literal>.</literal>), plus (<literal>+</literal>), and tilde
1213    (<literal>~</literal>) characters, as follows.</para>
1214      <para>
1215      <literal>0.0</literal> &lt;
1216      <literal>0.5</literal> &lt;
1217      <literal>0.10</literal> &lt;
1218      <literal>0.99</literal> &lt;
1219      <literal>1</literal> &lt;
1220      <literal>1.0~rc1</literal> &lt;
1221      <literal>1.0</literal> &lt;
1222      <literal>1.0+b1</literal> &lt;
1223      <literal>1.0+nmu1</literal> &lt;
1224      <literal>1.1</literal> &lt;
1225      <literal>2.0</literal>
1226      </para>
1227    </listitem>
1228    </itemizedlist>
1229    <para>
1230    One tricky case occurs when upstream releases
1231    <filename>gentoo-0.9.12-ReleaseCandidate-99.tar.gz</filename> as the
1232    pre-release of <filename>gentoo-0.9.12.tar.gz</filename>.  You need to make
1233    sure that the upgrade works properly by renaming the upstream source to
1234    <filename>gentoo-0.9.12~rc99.tar.gz</filename>.
1235  </para>  </para>
1236    </section>
1237    <section id="dh-make"><title>Setting up <command>dh_make</command></title>
1238  <para>  <para>
1239  For the package to be built correctly, you must make the program's original  Set up the shell environment variables <literal>$DEBEMAIL</literal> and
1240  name lowercase (if it isn't already), and you should move the source directory  <literal>$DEBFULLNAME</literal> so that various Debian maintenance
1241  to  tools recognize your email address and name to use for packages. <footnote><para> The
 <filename><replaceable>packagename</replaceable>-<replaceable>version</replaceable></filename>.  
 </para>  
 <para>  
 If the program name consists of more than one word, contract them to one word,  
 or make an abbreviation.  For example, program John's little editor for X  
 package would be named <systemitem role="package">johnledx</systemitem>, or  
 <systemitem role="package">jle4x</systemitem>, or whatever you decide, as long  
 as it's under some reasonable limit, e.g.  20 characters.  
 </para>  
 <para>  
 Also check for the exact version of the program (to be included in the package  
 version).  If that piece of software is not numbered with versions like  
 <literal>X.Y.Z</literal>, but with some kind of date, feel free to use that  
 date as the version number, as long as newer version numbers will look larger.  
 While it is best to use the same version number as what upstream uses, if it is  
 in the format of <literal>09Oct23</literal> you may need to convert it to  
 <literal>YYYYMMDD</literal> format, which would be <literal>20091023</literal>,  
 to ensure proper order for upgrade with the <command>dpkg</command>  
 program.<footnote><para> Version string can be compared by <literal>dpkg  
 --compare-versions <replaceable>ver1</replaceable>  
 <replaceable>op</replaceable> <replaceable>ver2</replaceable></literal>.  See  
 <citerefentry> <refentrytitle>dpkg</refentrytitle> <manvolnum>1</manvolnum>  
 </citerefentry> manpage.  </para> </footnote>  
 </para>  
 <para>  
 Some programs won't be numbered at all, in which case you should contact the  
 upstream maintainer to see if they've got some other revision-tracking method.  
 </para>  
 </section>  
 <section id="dh-make"><title>Initial Debian package</title>  
 <para>  
 Let's set up the shell environment variable <literal>$DEBEMAIL</literal> and  
 <literal>$DEBFULLNAME</literal> so many Debian maintenance tools recognize your  
 name and email address to use for packages as follows.<footnote><para> The  
1242  following text assumes you are using Bash as your login shell.  If you use  following text assumes you are using Bash as your login shell.  If you use
1243  other login shells such as Z shell, use their pertinent configuration files  some other login shell such as Z shell, use their corresponding
1244  instead of <filename>~/.bashrc</filename>.  </para> </footnote>.  configuration files instead of <filename>~/.bashrc</filename>. </para> </footnote>
1245  </para>  </para>
1246  <screen>  <screen>
1247  $ cat &gt;&gt;~/.bashrc &lt;&lt;EOF  $ cat &gt;&gt;~/.bashrc &lt;&lt;EOF
# Line 1040  DEBEMAIL=your.email.address@example.org Line 1249  DEBEMAIL=your.email.address@example.org
1249  DEBFULLNAME=Firstname Lastname  DEBFULLNAME=Firstname Lastname
1250  export DEBEMAIL DEBFULLNAME  export DEBEMAIL DEBFULLNAME
1251  EOF  EOF
1252    $ . ~/.bashrc
1253  </screen>  </screen>
1254    </section>
1255    <section id="non-native-dh-make"><title>Initial non-native Debian package</title>
1256  <para>  <para>
1257  Let's make an initial Debian package by issuing the <command>dh_make</command>  Normal Debian packages are non-native Debian packages made from upstream
1258    programs.  If you wish to create a non-native Debian package of an upstream
1259    source <filename>gentoo-0.9.12.tar.gz</filename>, you can create an initial
1260    non-native Debian package for it by issuing the <command>dh_make</command>
1261  command as follows.  command as follows.
1262  </para>  </para>
1263  <screen>  <screen>
1264  $ . ~/.bashrc  $ cd ~/gentoo
1265  $ cd ~/gentoo/gentoo-0.9.12  $ wget http://example.org/gentoo-0.9.12.tar.gz
1266    $ tar -xvzf gentoo-0.9.12.tar.gz
1267    $ cd gentoo-0.9.12
1268  $ dh_make -f ../gentoo-0.9.12.tar.gz  $ dh_make -f ../gentoo-0.9.12.tar.gz
1269  </screen>  </screen>
1270  <para>  <para>
1271  Of course, replace the filename with the name of your original source archive.  Of course, replace the filename with the name of your original source archive.
1272  <footnote><para> If the upstream source provides the  <footnote><para> If the upstream source provides the
1273  <filename>debian</filename> directory and its contents, run the  <filename>debian</filename> directory and its contents, run the
1274  <command>dh_make</command> command with the <literal>--addmissing</literal>  <command>dh_make</command> command with the extra option
1275  option, instead.  The new source <literal>3.0 (quilt)</literal> format is quite  <literal>--addmissing</literal>.  The new source <literal>3.0 (quilt)</literal> format is
1276  robust not to break even for these packages.  You may need to update contents  robust enough not to break even for these packages.  You may need to update the contents
1277  provided by the upstream for your Debian package.  </para> </footnote> See  provided by the upstream for your Debian package.  </para> </footnote> See
1278  <citerefentry> <refentrytitle>dh_make</refentrytitle> <manvolnum>1</manvolnum>  <citerefentry> <refentrytitle>dh_make</refentrytitle> <manvolnum>1</manvolnum>
1279  </citerefentry> for details.  </citerefentry> for details.
1280  </para>  </para>
1281  <para>  <para>
1282  Some information will come up.  It will ask you what sort of package you want  You should see some output asking you what sort of package you want
1283  to create.  Gentoo is a single binary package - it creates only one binary, and  to create.  Gentoo is a single binary package - it creates only one binary package, i.e,
1284  thus one <filename>.deb</filename> file - so we will select the first option,  one <filename>.deb</filename> file - so we will select the first option
1285  with the <literal>s</literal> key, check the information on the screen and  (with the <literal>s</literal> key), check the information on the screen, and
1286  confirm by pressing <literal><replaceable>ENTER</replaceable></literal>.  confirm by pressing <literal><replaceable>ENTER</replaceable></literal>.
1287  <footnote><para> There are few choices here: <literal>s</literal> for Single  <footnote><para> There are several choices here: <literal>s</literal> for
1288  binary, <literal>i</literal> for Arch-Independent, <literal>m</literal> for  Single binary package, <literal>i</literal> for arch-Independent package, <literal>m</literal> for
1289  Multiple binary, <literal>l</literal> for Library, <literal>k</literal> for  Multiple binary packages, <literal>l</literal> for Library package, <literal>k</literal> for
1290  Kernel module, <literal>n</literal> for Kernel patch and <literal>b</literal>  Kernel module package, <literal>n</literal> for kernel patch package, and <literal>b</literal>
1291  for <systemitem role="package">cdbs</systemitem>.  This document focuses on the  for <systemitem role="package">cdbs</systemitem> package.  This document focuses on the
1292  use of the <systemitem role="package">debhelper</systemitem> package with the  use of the <command>dh</command> command (from the package
1293  <command>dh</command> command.  This document focuses on the use of the new  <systemitem role="package">debhelper</systemitem>) to create a single binary package,
1294  <command>dh</command> command for Single binary and touches on it for  but also touches on how to use it for arch-independent or
1295  Arch-Independent and Multiple binary.  The <systemitem role="package">cdbs</systemitem> package offers alternative package script  multiple binary packages.  The package
1296  infrastructure to the <command>dh</command> command and outside of the scope of  <systemitem role="package">cdbs</systemitem> offers an alternative packaging script
1297    infrastructure to the <command>dh</command> command and is outside the scope of
1298  this document.  </para> </footnote>  this document.  </para> </footnote>
1299  </para>  </para>
1300  <para>  <para>
1301  After this execution of <command>dh_make</command>, a copy of the upstream  This execution of <command>dh_make</command> creates a copy of the upstream
1302  tarball is created as <filename>gentoo_0.9.12.orig.tar.gz</filename> in the  tarball as <filename>gentoo_0.9.12.orig.tar.gz</filename> in the
1303  parent directory to accommodate the creation of the non-native Debian source  parent directory to accommodate the creation of the non-native Debian source
1304  package with the <filename>debian.tar.gz</filename> later.  package with the name <filename>debian.tar.gz</filename> later.
1305  </para>  </para>
1306  <screen>  <screen>
1307  $ cd ~/gentoo ; ls -F  $ cd ~/gentoo ; ls -F
# Line 1092  gentoo-0.9.12.tar.gz Line 1310  gentoo-0.9.12.tar.gz
1310  gentoo_0.9.12.orig.tar.gz  gentoo_0.9.12.orig.tar.gz
1311  </screen>  </screen>
1312  <para>  <para>
1313  Please note 2 key features in this  Please note two key features of this filename
1314  <filename>gentoo_0.9.12.orig.tar.gz</filename> file name:  <filename>gentoo_0.9.12.orig.tar.gz</filename>:
1315  </para>  </para>
1316  <itemizedlist>  <itemizedlist>
1317  <listitem>  <listitem>
1318  <para>  <para>
1319  Package name and version are separated by the <literal>_</literal>  Package name and version are separated by the character <literal>_</literal>
1320  (underscore).  (underscore).
1321  </para>  </para>
1322  </listitem>  </listitem>
1323  <listitem>  <listitem>
1324  <para>  <para>
1325  There is the <filename>.orig</filename> before the  The string <filename>.orig</filename> is inserted before the
1326  <filename>.tar.gz</filename>.  <filename>.tar.gz</filename>.
1327  </para>  </para>
1328  </listitem>  </listitem>
1329  </itemizedlist>  </itemizedlist>
1330  <para>  <para>
1331  You should also notice that many template files are created in the source under  You should also notice that many template files are created in the source under
1332  the <filename>debian</filename> directory.  These will be explained in <xref linkend="dreq"/> and <xref linkend="dother"/>.  You should also understand  the <filename>debian</filename> directory.  These will be explained in
1333  that the packaging is not automatic process.  You need to modify the upstream  <xref linkend="dreq"/> and <xref linkend="dother"/>.  You should also understand
1334  source for Debian as <xref linkend="modify"/>.  After all these, you need to  that packaging cannot be a fully automated process.  You will need to modify the upstream
1335  build Debian packages under the proper method as <xref linkend="build"/>,  source for Debian (see <xref linkend="modify"/>).  After this, you need to
1336  check them as <xref linkend="checkit"/>, and upload them as <xref linkend="upload"/>.  I will explain all these steps.  use the proper methods for building Debian packages (<xref linkend="build"/>),
1337    testing them (<xref linkend="checkit"/>), and uploading them (<xref linkend="upload"/>).
1338    All the steps will be explained.
1339  </para>  </para>
1340  <para>  <para>
1341  Once again, as a new maintainer you are discouraged from creating complicated  If you accidentally erased some template files while working on them, you can
1342  packages, e.g.,  recover them by running <command>dh_make</command> with the
1343  </para>  <literal>--addmissing</literal> option again in a Debian package source tree.
 <itemizedlist>  
 <listitem>  
 <para>  
 multiple binary packages,  
 </para>  
 </listitem>  
 <listitem>  
 <para>  
 library packages,  
 </para>  
 </listitem>  
 <listitem>  
 <para>  
 kernel module packages,  
 </para>  
 </listitem>  
 <listitem>  
 <para>  
 kernel patch packages,  
 </para>  
 </listitem>  
 <listitem>  
 <para>  
 the source file format being neither in <filename>tar.gz</filename> nor  
 <filename>tar.bz2</filename>, or  
1344  </para>  </para>
 </listitem>  
 <listitem>  
1345  <para>  <para>
1346  the source tarball containing undistributable contents.  Updating an existing package may get complicated since it may be using older
1347    techniques.  While learning the basics, please stick to creating a fresh
1348    package; further explanations are given in <xref linkend="update"/>.
1349  </para>  </para>
 </listitem>  
 </itemizedlist>  
1350  <para>  <para>
1351  It's not too hard, but it does require a bit more knowledge, so we won't  Please note that the source file does not need to contain any build system
1352  describe all of it here.  discussed in <xref linkend="simplemake"/> and <xref linkend="portable"/>.  It
1353    could be just a collection of graphical data etc.  Installation of files may be
1354    carried out using only <systemitem role="package">debhelper</systemitem> configuration
1355    files such as <filename>debian/install</filename> (see
1356    <xref linkend="install"/>).
1357  </para>  </para>
1358    </section>
1359    <section id="native-dh-make"><title>Initial native Debian package</title>
1360  <para>  <para>
1361  If you accidentally erased some template files while working on them, you can  If a package contains source files you are only maintaining for Debian,
1362  recover them by running <command>dh_make</command> with the  possibly only for local use, it may be simpler to create it as a Debian
1363  <literal>--addmissing</literal> option again in a Debian package source tree.  native package. If you have source
1364    files in <filename>~/mypackage-1.0</filename>, you can create an initial native
1365    Debian package for it by issuing the <command>dh_make</command> command as
1366    follows.
1367  </para>  </para>
1368    <screen>
1369    $ cd ~/mypackage-1.0
1370    $ dh_make --native
1371    </screen>
1372  <para>  <para>
1373  Updating an existing package may get complicated since it may be using older  Then the <filename>debian</filename> directory and its contents are created
1374  techniques.  Please stick with fresh packaging cases for now to learn basics.  just like <xref linkend="non-native-dh-make"/>.  This does not create a tarball
1375  I will come back to explain it later in <xref linkend="update"/>.  since this is a native Debian package.  But that is the only difference.
1376    The rest of the packaging activities are practically the same.
1377  </para>  </para>
1378  </section>  </section>
1379  </chapter>  </chapter>
# Line 1176  Please note that there isn't space here Line 1383  Please note that there isn't space here
1383  details of fixing upstream sources, but here are some basic steps and problems  details of fixing upstream sources, but here are some basic steps and problems
1384  people often run across.  people often run across.
1385  </para>  </para>
1386  <section id="quiltrc"><title>Set up <command>quilt</command></title>  <section id="quiltrc"><title>Setting up <command>quilt</command></title>
1387  <para>  <para>
1388  The <command>quilt</command> program offers the basic method to record  The program <command>quilt</command> offers a basic method for recording
1389  modification to the source for the Debian packaging.  Since slightly different  modifications to the upstream source for Debian packaging.  It's
1390  default is desirable, let's create an alias <command>dquilt</command> for  useful to have a slightly customized default, so let's create an alias
1391  Debian packaging by adding the following line to <filename>~/.bashrc</filename>.  <command>dquilt</command> for Debian packaging by adding the following
1392    line to <filename>~/.bashrc</filename>.
1393  </para>  </para>
1394  <screen>  <screen>
1395  alias dquilt=quilt --quiltrc=~/.quiltrc-dpkg  alias dquilt="quilt --quiltrc=~/.quiltrc-dpkg"
1396  </screen>  </screen>
1397  <para>  <para>
1398  Then let's create <filename>~/.quiltrc-dpkg</filename> as follows.  Then let's create <filename>~/.quiltrc-dpkg</filename> as follows.
# Line 1192  Then let's create <filename>~/.quiltrc-d Line 1400  Then let's create <filename>~/.quiltrc-d
1400  <screen>  <screen>
1401  d=. ; while [ ! -d $d/debian -a `readlink -e $d` != / ]; do d=$d/..; done  d=. ; while [ ! -d $d/debian -a `readlink -e $d` != / ]; do d=$d/..; done
1402  if [ -d $d/debian ] &amp;&amp; [ -z $QUILT_PATCHES ]; then  if [ -d $d/debian ] &amp;&amp; [ -z $QUILT_PATCHES ]; then
1403      # Debian packaging case and unset $QUILT_PATCHES      # if in Debian packaging tree with unset $QUILT_PATCHES
1404      QUILT_PATCHES="debian/patches"      QUILT_PATCHES="debian/patches"
1405      QUILT_PATCH_OPTS="--reject-format=unified"      QUILT_PATCH_OPTS="--reject-format=unified"
1406      QUILT_DIFF_ARGS="-p ab --no-timestamps --no-index --color=auto"      QUILT_DIFF_ARGS="-p ab --no-timestamps --no-index --color=auto"
# Line 1204  fi Line 1412  fi
1412  <para>  <para>
1413  See <citerefentry> <refentrytitle>quilt</refentrytitle>  See <citerefentry> <refentrytitle>quilt</refentrytitle>
1414  <manvolnum>1</manvolnum> </citerefentry> and  <manvolnum>1</manvolnum> </citerefentry> and
1415  <ulink url="&quilt-pdf;">quilt.pdf</ulink> for how to use  <ulink url="&quilt-pdf;">quilt.pdf</ulink> on how to use
1416  <command>quilt</command>.  <command>quilt</command>.
1417  </para>  </para>
1418  </section>  </section>
1419  <section id="fixupstream"><title>Fixing upstream bug</title>  <section id="fixupstream"><title>Fixing upstream bugs</title>
1420  <para>  <para>
1421  Let's assume you find an error in the upstream <filename>Makefile</filename>  Let's assume you find an error in the upstream <filename>Makefile</filename>
1422  file as follows where <literal>install: gentoo</literal> should have been  as follows where <literal>install: gentoo</literal> should have been
1423  <literal>install: gentoo-target</literal>.  <literal>install: gentoo-target</literal>.
1424  </para>  </para>
1425  <screen>  <screen>
# Line 1221  install: gentoo Line 1429  install: gentoo
1429          install gentoorc-example $(HOME)/.gentoorc          install gentoorc-example $(HOME)/.gentoorc
1430  </screen>  </screen>
1431  <para>  <para>
1432  Let's fix this and record this with the <command>dquilt</command> command as  Let's fix this and record it with the <command>dquilt</command> command as
1433  <filename>fix-gentoo-target.patch</filename>.  <footnote><para> The  <filename>fix-gentoo-target.patch</filename>.  <footnote><para> The
1434  <filename>debian/patches</filename> directory should exist now if you run  <filename>debian/patches</filename> directory should exist now if you ran
1435  <command>dh_make</command> as described before.  This example operation creates  <command>dh_make</command> as described before.  This example operation creates
1436  it just in case you are updating the existing package.  </para> </footnote>  it just in case you are updating an existing package.  </para> </footnote>
1437  </para>  </para>
1438  <screen>  <screen>
1439  $ mkdir debian/patches  $ mkdir debian/patches
# Line 1242  install: gentoo-target Line 1450  install: gentoo-target
1450          install gentoorc-example $(HOME)/.gentoorc          install gentoorc-example $(HOME)/.gentoorc
1451  </screen>  </screen>
1452  <para>  <para>
1453  Ask <command>dquilt</command> to refresh the patch to create  Ask <command>dquilt</command> to generate the patch to create
1454  <filename>debian/patches/fix-gentoo-target.patch</filename> and add its  <filename>debian/patches/fix-gentoo-target.patch</filename> and add its
1455  description following <ulink url="&dep3;">DEP-3: Patch Tagging Guidelines</ulink>.  description following <ulink url="&dep3;">DEP-3: Patch Tagging Guidelines</ulink>.
1456  </para>  </para>
# Line 1252  $ dquilt header -e Line 1460  $ dquilt header -e
1460  ... describe patch  ... describe patch
1461  </screen>  </screen>
1462  </section>  </section>
1463    <section id="destdir"><title>Installation of files to their destination</title>
 <section id="destdir"><title>Installation of files to the destination</title>  
1464  <para>  <para>
1465  Normally, programs install themselves in the <filename>/usr/local</filename>  Most third-party software installs itself in the <filename>/usr/local</filename>
1466  subdirectory.  Since it is reserved for system administrator's (or user's)  directory hierarchy.  On Debian this is reserved for private use
1467  private use, Debian packages must not use that directory but should use system  by the system administrator, so packages must not use directories such
1468  directories such as the <filename>/usr/bin</filename> subdirectory following  as <filename>/usr/local/bin</filename> but should instead use system
1469  the <ulink url="&fhs;">Filesystem Hierarchy Standard</ulink> (FHS).  directories such as <filename>/usr/bin</filename>, obeying the
1470    <ulink url="&fhs;">Filesystem Hierarchy Standard</ulink> (FHS).
1471  </para>  </para>
1472  <para>  <para>
1473  Normally, <citerefentry> <refentrytitle>make</refentrytitle>  Normally, <citerefentry> <refentrytitle>make</refentrytitle>
1474  <manvolnum>1</manvolnum> </citerefentry> is used to automate building the  <manvolnum>1</manvolnum> </citerefentry> is used to automate building the
1475  program and the execution of <literal>make install</literal> installs programs  program, and executing <literal>make install</literal> installs programs
1476  directly to the desired destination by the <literal>install</literal> target of  directly to the desired destination (following the
1477  the <filename>Makefile</filename> file.  In order for Debian to provide binary  <literal>install</literal> target in the
1478  packages, the build system installs programs to the file tree image created  <filename>Makefile</filename>).  In order for Debian to provide
1479  under a temporary directory instead to the actual destination.  pre-built installable packages, it modifies the build system to install
1480    programs into a file tree image created under a temporary directory
1481    instead of the actual destination.
1482  </para>  </para>
1483  <para>  <para>
1484  These 2 differences between (1) the normal program installation and (2) the  These two differences between normal program installation on one hand and the
1485  Debian packaging can be transparently addressed by the <systemitem role="package">debhelper</systemitem> package through the  Debian packaging system on the other can be transparently addressed by the
1486    <systemitem role="package">debhelper</systemitem> package through the
1487  <command>dh_auto_configure</command> and <command>dh_auto_install</command>  <command>dh_auto_configure</command> and <command>dh_auto_install</command>
1488  commands if the following conditions are met.  commands if the following conditions are met.
1489  </para>  </para>
1490  <itemizedlist>  <itemizedlist>
1491  <listitem>  <listitem>
1492  <para>  <para>
1493  The <filename>Makefile</filename> file follows the GNU conventions to support  The <filename>Makefile</filename> must follow GNU conventions and
1494  <literal>$(DESTDIR)</literal> variable.  support the <literal>$(DESTDIR)</literal> variable.
1495  <footnote><para> See <ulink url="&gnu-destdir;">GNU Coding Standards: 7.2.4 DESTDIR: Support for Staged Installs</ulink>.</para></footnote>  <footnote><para> See <ulink url="&gnu-destdir;">GNU Coding Standards: 7.2.4 DESTDIR: Support for Staged Installs</ulink>.</para></footnote>
1496  </para>  </para>
1497  </listitem>  </listitem>
1498  <listitem>  <listitem>
1499  <para>  <para>
1500  The source follows the Filesystem Hierarchy Standard (FHS).  The source must follow the Filesystem Hierarchy Standard (FHS).
1501  </para>  </para>
1502  </listitem>  </listitem>
1503  </itemizedlist>  </itemizedlist>
1504  <para>  <para>
1505  Programs that use GNU <command>autoconf</command>  Programs that use GNU <command>autoconf</command> follow the GNU conventions
1506  <emphasis>automatically</emphasis> follow the GNU conventions and their  automatically, so they can be trivial to package.  On the basis of
1507  packaging is almost <emphasis>automatic</emphasis>.  With this and other  this and other heuristics, it is estimated that the
1508  heuristics, the <systemitem role="package">debhelper</systemitem> package  <systemitem role="package">debhelper</systemitem> package will work for
1509  estimates that it works for about 90% of packages without making any intrusive  about 90% of packages without making any intrusive changes to their
1510  changes to their build system.  So the packaging is not as complicated as it  build system.  So packaging is not as complicated as it may seem.
 may seem.  
1511  </para>  </para>
1512  <para>  <para>
1513  If you need to make changes in the <filename>Makefile</filename> file, you  If you need to make changes in the <filename>Makefile</filename>, you
1514  should make sure to support these <literal>$(DESTDIR)</literal> variable.  The  should be careful to support the <literal>$(DESTDIR)</literal>
1515  <literal>$(DESTDIR)</literal> variable is unset in it and is prepended to each  variable.  Although it is unset by default, the <literal>$(DESTDIR)</literal>
1516  file path used for the program installation.  The packaging script will set  variable is prepended to each file path used for the program
1517  <literal>$(DESTDIR)</literal> to the temporary directory.  installation.  The packaging script will set
1518    <literal>$(DESTDIR)</literal> to the temporary directory.
1519  </para>  </para>
1520  <para>  <para>
1521  The temporary directory used by the <command>dh_auto_install</command> command  For packages of the single binary type, the temporary directory used
1522  is chosen as <filename>debian/<replaceable>package</replaceable></filename> for  by the <command>dh_auto_install</command> command will be set to
1523  single binary packages.  <footnote><para> For multiple binary packages, the  <filename>debian/<replaceable>package</replaceable></filename>.
1524    <footnote><para> For packages of the multiple binary type, the
1525  <command>dh_auto_install</command> command uses <filename>debian/tmp</filename>  <command>dh_auto_install</command> command uses <filename>debian/tmp</filename>
1526  as the temporary directory while the <command>dh_install</command> command with  as the temporary directory while the <command>dh_install</command> command with
1527  the help of  the help of
1528  <filename>debian/<replaceable>package-1</replaceable>.install</filename> and  <filename>debian/<replaceable>package-1</replaceable>.install</filename> and
1529  <filename>debian/<replaceable>package-2</replaceable>.install</filename> files  <filename>debian/<replaceable>package-2</replaceable>.install</filename> files
1530  will split contents of <filename>debian/tmp</filename> into  will split the contents of <filename>debian/tmp</filename> into
1531  <filename>debian/<replaceable>package-1</replaceable></filename> and  <filename>debian/<replaceable>package-1</replaceable></filename> and
1532  <filename>debian/<replaceable>package-2</replaceable></filename> temporary  <filename>debian/<replaceable>package-2</replaceable></filename> temporary
1533  directories to create multiple binary <filename>*.deb</filename> packages.  directories, to create
1534    <filename><replaceable>package-1</replaceable>_*.deb</filename> and
1535    <filename><replaceable>package-2</replaceable>_*.deb</filename> binary
1536    packages.
1537  </para> </footnote> Everything that is contained in the temporary directory  </para> </footnote> Everything that is contained in the temporary directory
1538  will be installed on a user's system when they install your package, the only  will be installed on users' systems when they install your package; the only
1539  difference is that <command>dpkg</command> will be installing the files in the  difference is that <command>dpkg</command> will be installing the
1540  root directory.  files to paths relative to the root directory rather than your working
1541    directory.
1542  </para>  </para>
1543  <para>  <para>
1544  Bear in mind that even though your program installs in  Bear in mind that even though your program installs in
1545  <filename>debian/<replaceable>package</replaceable></filename>, it still needs  <filename>debian/<replaceable>package</replaceable></filename>, it still needs
1546  to behave correctly when placed in the root directory, i.e.  when installed  to behave correctly when installed from the <filename>.deb</filename>
1547  from the <filename>.deb</filename> package.  So you must not allow the build  package under the root directory.  So you must not allow the build
1548  system to hardcode strings like  system to hardcode strings like
1549  <literal>/home/me/deb/<replaceable>package</replaceable>-<replaceable>version</replaceable>/usr/share/<replaceable>package</replaceable></literal>  <literal>/home/me/deb/<replaceable>package</replaceable>-<replaceable>version</replaceable>/usr/share/<replaceable>package</replaceable></literal>
1550  into the package file.  into files in the package.
1551  </para>  </para>
1552  <para>  <para>
1553  Here's the relevant part of <systemitem role="package">gentoo</systemitem>'s  Here's the relevant part of <systemitem role="package">gentoo</systemitem>'s
1554  <filename>Makefile</filename> file <footnote><para> This is just an example to  <filename>Makefile</filename><footnote><para> This is just an example to
1555  show how the <filename>Makefile</filename> file should look like.  If the  show what a <filename>Makefile</filename> should look like.  If the
1556  <filename>Makefile</filename> file is created by the  <filename>Makefile</filename> is created by the
1557  <command>./configure</command> command, the correct way to fix this kind of  <command>./configure</command> command, the correct way to fix this kind of
1558  <filename>Makefile</filename> is to executed the <command>./configure</command>  <filename>Makefile</filename> is to execute <command>./configure</command>
1559  command from the <command>dh_auto_configure</command> command with default  from the <command>dh_auto_configure</command> command with default
1560  options including <literal>--prefix=/usr</literal>.  </para> </footnote>:  options including <literal>--prefix=/usr</literal>.  </para> </footnote>:
1561  </para>  </para>
1562  <screen>  <screen>
1563  # Where to put binary on 'make install'?  # Where to put binary executables on 'make install'?
1564  BIN     = /usr/local/bin  BIN     = /usr/local/bin
1565  # Where to put icons on 'make install'?  # Where to put icons on 'make install'?
1566  ICONS   = /usr/local/share/gentoo  ICONS   = /usr/local/share/gentoo
1567  </screen>  </screen>
1568  <para>  <para>
1569  We see that the files are set to install under <filename>/usr/local</filename>.  We see that the files are set to install under <filename>/usr/local</filename>.
1570  Change those paths to:  As explained above, that directory hierarchy is reserved for local use on
1571    Debian, so change those paths to:
1572  </para>  </para>
1573  <screen>  <screen>
1574  # Where to put binary on 'make install'?  # Where to put binary executables on 'make install'?
1575  BIN     = $(DESTDIR)/usr/bin  BIN     = $(DESTDIR)/usr/bin
1576  # Where to put icons on 'make install'?  # Where to put icons on 'make install'?
1577  ICONS   = $(DESTDIR)/usr/share/gentoo  ICONS   = $(DESTDIR)/usr/share/gentoo
1578  </screen>  </screen>
1579  <para>  <para>
1580  But why in that directory, and not some other?  Because Debian packages never  The exact locations that should be used for binaries, icons,
1581  install files beneath <filename>/usr/local</filename> -- that tree is reserved  documentation, etc. are specified in the Filesystem Hierarchy Standard
1582  for the system administrator's use.  Such files on Debian systems go under  (FHS).  You should browse through it and read the sections relevant to
1583  <filename>/usr</filename> instead.  your package.
 </para>  
 <para>  
 The more exact locations for binaries, icons, documentation etc.  are specified  
 in the Filesystem Hierarchy Standard (FHS).  I recommend you  
 browse it and read the sections that might concern your package.  
1584  </para>  </para>
1585  <para>  <para>
1586  So, we should install the binary in <filename>/usr/bin</filename> instead of  So, we should install binary executables in <filename>/usr/bin</filename> instead of
1587  <filename>/usr/local/bin</filename>, the manual page in  <filename>/usr/local/bin</filename>, the manual page in
1588  <filename>/usr/share/man/man1</filename> instead of  <filename>/usr/share/man/man1</filename> instead of
1589  <filename>/usr/local/man/man1</filename> etc.  Notice how there's no manual  <filename>/usr/local/man/man1</filename>, and so on.  Notice how there's no manual
1590  page mentioned in <systemitem role="package">gentoo</systemitem>'s  page mentioned in <systemitem role="package">gentoo</systemitem>'s
1591  <filename>Makefile</filename>, but since the Debian Policy requires that every  <filename>Makefile</filename>, but since Debian Policy requires that every
1592  program has one, we'll make one later and install it in  program has one, we'll make one later and install it in
1593  <filename>/usr/share/man/man1</filename>.  <filename>/usr/share/man/man1</filename>.
1594  </para>  </para>
# Line 1387  to fix them to use the right locations. Line 1599  to fix them to use the right locations.
1599  for?  You can find this out by issuing:  for?  You can find this out by issuing:
1600  </para>  </para>
1601  <screen>  <screen>
1602  $ grep -nr -e 'usr/local/lib' --include='*.[c|h]' .  $ grep -nr --include='*.[c|h]' -e 'usr/local/lib' .
1603  </screen>  </screen>
1604  <para>  <para>
1605  <command>grep</command> will run recursively through the source tree and tell  <command>grep</command> will run recursively through the source tree and tell
# Line 1398  Edit those files and in those lines repl Line 1610  Edit those files and in those lines repl
1610  with <literal>usr/lib</literal>.  This can be done automatically as follows:  with <literal>usr/lib</literal>.  This can be done automatically as follows:
1611  </para>  </para>
1612  <screen>  <screen>
1613  $ vim '+argdo %s/usr\/local\/lib/usr\/lib/gce|update' +q \  $ sed -i -e 's#usr/local/lib#usr/lib#g' \
1614        $(find . -type f -name '*.[c|h]')        $(find . -type f -name '*.[c|h]')
1615  </screen>  </screen>
1616  <para>  <para>
1617  Be careful that you don't mess up the rest of the code!  :-)  If you want to confirm each substitution instead, this can be done interactively as follows:
1618  </para>  </para>
1619    <screen>
1620    $ vim '+argdo %s#usr/local/lib#usr/lib#gce|update' +q \
1621          $(find . -type f -name '*.[c|h]')
1622    </screen>
1623    
1624  <para>  <para>
1625  After that you should find the install target (search for line that starts with  Next you should find the <literal>install</literal> target (searching
1626  <literal>install:</literal>, that will usually work) and rename all references  for the line that starts with <literal>install:</literal> will usually
1627  to directories other than ones defined at the top of the  work) and rename all references to directories other than ones defined
1628  <filename>Makefile</filename>.  at the top of the <filename>Makefile</filename>.
1629  </para>  </para>
1630  <para>  <para>
1631  Before your upstream bug fix, <systemitem role="package">gentoo</systemitem>'s  Originally, <systemitem role="package">gentoo</systemitem>'s
1632  install target said:  install target said:
1633  </para>  </para>
1634  <screen>  <screen>
# Line 1421  install: gentoo-target Line 1638  install: gentoo-target
1638          install gentoorc-example $(HOME)/.gentoorc          install gentoorc-example $(HOME)/.gentoorc
1639  </screen>  </screen>
1640  <para>  <para>
1641  Let's fix this and record this with the <command>dquilt</command> command as  Let's fix this upstream bug and record it with the <command>dquilt</command> command as
1642  <filename>debian/patches/install.patch</filename>.  <filename>debian/patches/install.patch</filename>.
1643  </para>  </para>
1644  <screen>  <screen>
# Line 1429  $ dquilt new install.patch Line 1646  $ dquilt new install.patch
1646  $ dquilt add Makefile  $ dquilt add Makefile
1647  </screen>  </screen>
1648  <para>  <para>
1649  Let's change this for Debian package as following using the editor:  In your editor, change this for the Debian package as follows:
1650  </para>  </para>
1651  <screen>  <screen>
1652  install: gentoo-target  install: gentoo-target
# Line 1439  install: gentoo-target Line 1656  install: gentoo-target
1656          install -m644 gentoorc-example $(DESTDIR)/etc/gentoorc          install -m644 gentoorc-example $(DESTDIR)/etc/gentoorc
1657  </screen>  </screen>
1658  <para>  <para>
1659  You've surely noticed that there's now a <literal>install -d</literal> command  You'll have noticed that there's now an <literal>install -d</literal> command
1660  before the other commands in the rule.  The original  before the other commands in the rule.  The original
1661  <filename>Makefile</filename> didn't have it because usually the  <filename>Makefile</filename> didn't have it because usually
1662  <literal>/usr/local/bin</literal> and other directories already exist on the  <literal>/usr/local/bin</literal> and other directories already exist on the
1663  system where one runs <literal>make install</literal>.  However, since we will  system where you are running <literal>make install</literal>.  However, since we will
1664  install into our own empty (or even nonexistent) directory, we will have to  be installing into a newly created private directory tree, we will have to
1665  create each and every one of those directories.  create each and every one of those directories.
1666  </para>  </para>
1667  <para>  <para>
# Line 1456  of additional documentation that the ups Line 1673  of additional documentation that the ups
1673          cp -a docs/* $(DESTDIR)/usr/share/doc/gentoo/html          cp -a docs/* $(DESTDIR)/usr/share/doc/gentoo/html
1674  </screen>  </screen>
1675  <para>  <para>
1676  After careful check, if everything is fine, ask <command>dquilt</command> to  Check carefully, and if everything is okay, ask <command>dquilt</command> to
1677  refresh the patch to create <filename>debian/patches/install.patch</filename>  generate the patch to create <filename>debian/patches/install.patch</filename>
1678  and add its description.  and add its description.
1679  </para>  </para>
1680  <screen>  <screen>
# Line 1485  Debian specific packaging modification: Line 1702  Debian specific packaging modification:
1702  Whenever you make changes that are not specifically related to Debian package  Whenever you make changes that are not specifically related to Debian package
1703  such as <filename>debian/patches/fix-gentoo-target.patch</filename>, be sure to  such as <filename>debian/patches/fix-gentoo-target.patch</filename>, be sure to
1704  send them to the upstream maintainer so they can be included in the next  send them to the upstream maintainer so they can be included in the next
1705  program revision and be useful to everyone else.  Also remember to make your  revision of the program and be useful to everyone else.  Also remember
1706  fixes not specific to Debian or Linux (or even Unix!) prior to sending them --  to avoid making your fixes specific to Debian or Linux - or even Unix!
1707  make them portable.  This will make your fixes much easier to apply.  Make them portable.  This will make your fixes much easier to apply.
1708  </para>  </para>
1709  <para>  <para>
1710  Note that you don't have to send the <filename>debian/*</filename> files  Note that you don't have to send the <filename>debian/*</filename> files
# Line 1498  upstream. Line 1715  upstream.
1715  <para>  <para>
1716  There is one other common problem: libraries are often different from platform  There is one other common problem: libraries are often different from platform
1717  to platform.  For example, a <filename>Makefile</filename> can contain a  to platform.  For example, a <filename>Makefile</filename> can contain a
1718  reference to a library which doesn't exist on Debian systems.  In that case, we  reference to a library which doesn't exist on the Debian system.  In that case, we
1719  need to change it to a library which does exist in Debian, and serves the same  need to change it to a library which does exist in Debian, and serves the same
1720  purpose.  purpose.
1721  </para>  </para>
1722  <para>  <para>
1723  So, if there is a line in your program's <filename>Makefile</filename> (or  Let's assume a line in your program's <filename>Makefile</filename> (or
1724  <filename>Makefile.in</filename>) that says something like this (and your  <filename>Makefile.in</filename>) as the following.
 program doesn't compile) <footnote><para> The author realizes that this is not  
 the best example considering our <systemitem role="package">libncurses</systemitem> package now ships with a  
 <filename>libcurses.so</filename> symlink, but he couldn't think of a better  
 one.  Suggestions very welcome :-) </para> </footnote>:  
1725  </para>  </para>
1726  <screen>  <screen>
1727  LIBS = -lcurses -lsomething -lsomethingelse  LIBS = -lfoo -lbar
1728  </screen>  </screen>
1729  <para>  <para>
1730  Let's fix this as <filename>debian/patches/ncurse.patch</filename> by changing  If your program doesn't compile since the <literal>foo</literal> library
1731  <literal>curses</literal> into <literal>ncurses</literal>.  doesn't exist and its equivalent is provided by the <literal>foo2</literal>
1732    library on the Debian system, you can fix this build problem as
1733    <filename>debian/patches/foo2.patch</filename> by changing
1734    <literal>foo</literal> into <literal>foo2</literal>.<footnote><para>If there
1735    are API changes from the <literal>foo</literal> library to the
1736    <literal>foo2</literal> library, required changes to the source code need to be
1737    made to match the new API.</para> </footnote>
1738  </para>  </para>
1739  <screen>  <screen>
1740  $ dquilt new ncurse.patch  $ dquilt new foo2.patch
1741  $ dquilt add Makefile  $ dquilt add Makefile
1742  $ sed -i -e s/-lcurses/-lncurses/g Makefile  $ sed -i -e 's/-lfoo/-lfoo2/g' Makefile
1743  $ dquilt refresh  $ dquilt refresh
1744  $ dquilt header -e  $ dquilt header -e
1745  ... describe patch  ... describe patch
# Line 1535  that we should edit in order to customiz Line 1754  that we should edit in order to customiz
1754  most important of them are <filename>control</filename>,  most important of them are <filename>control</filename>,
1755  <filename>changelog</filename>, <filename>copyright</filename> and  <filename>changelog</filename>, <filename>copyright</filename> and
1756  <filename>rules</filename>, which are required for all packages.  <filename>rules</filename>, which are required for all packages.
1757    <footnote><para>
1758    In this chapter, files in the <filename>debian</filename> directory are
1759    referred without preceding <filename>debian/</filename> for simplicity whenever
1760    they are obvious.
1761    </para></footnote>
1762  </para>  </para>
1763  <section id="control"><title><filename>control</filename> file</title>  <section id="control"><title><filename>control</filename> file</title>
1764  <para>  <para>
1765  This file contains various values which <command>dpkg</command>,  This file contains various values which <command>dpkg</command>,
1766  <command>dselect</command>, <command>apt-get</command>,  <command>dselect</command>, <command>apt-get</command>,
1767  <command>apt-cache</command>, <command>aptitude</command>, and other package  <command>apt-cache</command>, <command>aptitude</command>, and other package
1768  management tools will use to manage the package.  It is defined by the <ulink url="&policy-control;">Debian  management tools will use to manage the package.  It is defined by the
1769  Policy Manual, 5 'Control files and their fields'</ulink>.  <ulink url="&policy-control;">Debian Policy Manual, 5 "Control files and their fields"</ulink>.
1770  </para>  </para>
1771  <para>  <para>
1772  Here is the <filename>control</filename> file <command>dh_make</command>  Here is the <filename>control</filename> file <command>dh_make</command>
# Line 1589  for e-mail readers and daemons, <literal Line 1813  for e-mail readers and daemons, <literal
1813  daemons, <literal>x11</literal> for X11 programs that don't fit anywhere else,  daemons, <literal>x11</literal> for X11 programs that don't fit anywhere else,
1814  and many more.  and many more.
1815  <footnote> <para>See  <footnote> <para>See
1816  <ulink url="&policy-subsections;">Debian Policy Manual, 2.4 'Sections'</ulink> and  <ulink url="&policy-subsections;">Debian Policy Manual, 2.4 "Sections"</ulink> and
1817  <ulink url="&sections-unstable;">List of sections in <literal>sid</literal></ulink>.</para>  <ulink url="&sections-unstable;">List of sections in <literal>sid</literal></ulink>.</para>
1818  </footnote>  </footnote>
1819  </para>  </para>
# Line 1600  we can omit it.) Line 1824  we can omit it.)
1824  <para>  <para>
1825  Line 3 describes how important it is that the user installs this package.  Line 3 describes how important it is that the user installs this package.
1826  <footnote> <para>See  <footnote> <para>See
1827  <ulink url="&policy-priorities;">Debian Policy Manual, 2.5 'Priorities'</ulink>.  <ulink url="&policy-priorities;">Debian Policy Manual, 2.5 "Priorities"</ulink>.
1828  </para>  </para>
1829  </footnote>  </footnote>
1830  </para>  </para>
# Line 1639  you.  Avoid using commas, ampersands and Line 1863  you.  Avoid using commas, ampersands and
1863  The 5th line includes the list of packages required to build your package as  The 5th line includes the list of packages required to build your package as
1864  the <literal>Build-Depends</literal> field.  You can also have the  the <literal>Build-Depends</literal> field.  You can also have the
1865  <literal>Build-Depends-Indep</literal> field as an additional line, here.  <literal>Build-Depends-Indep</literal> field as an additional line, here.
1866  <footnote><para>See <ulink url="&policy-relationships;#s-sourcebinarydeps">Debian  <footnote><para>See
1867  Policy Manual, 7.7 'Relationships between source and binary packages -  <ulink url="&policy-relationships;#s-sourcebinarydeps">Debian Policy Manual, 7.7 "Relationships between source and binary packages - Build-Depends, Build-Depends-Indep, Build-Conflicts, Build-Conflicts-Indep"</ulink>.</para></footnote>
1868  Build-Depends, Build-Depends-Indep, Build-Conflicts,  Some packages like
 Build-Conflicts-Indep'</ulink>.</para></footnote>  Some packages like  
1869  <systemitem role="package">gcc</systemitem> and  <systemitem role="package">gcc</systemitem> and
1870  <systemitem role="package">make</systemitem> which are required by the  <systemitem role="package">make</systemitem> which are required by the
1871  <systemitem role="package">build-essential</systemitem> package are implied.  If you need  <systemitem role="package">build-essential</systemitem> package are implied.  If you need
1872  to have other tools to build your package, you should add them to these fields.  to have other tools to build your package, you should add them to these fields.
1873  Multiple entries are separated with commas; read on for the explanation of  Multiple entries are separated with commas; read on for the explanation of
1874  binary dependencies to find out more about the syntax of these lines.  binary package dependencies to find out more about the syntax of these lines.
1875  </para>  </para>
1876  <itemizedlist>  <itemizedlist>
1877  <listitem>  <listitem>
# Line 1767  these relations; if not, it will be expl Line 1990  these relations; if not, it will be expl
1990  <para>  <para>
1991  Here is a simplified description of package relationships.  Here is a simplified description of package relationships.
1992  <footnote><para>See  <footnote><para>See
1993  <ulink url="&policy-relationships;">Debian Policy Manual, 7 'Declaring relationships between packages'</ulink>.  <ulink url="&policy-relationships;">Debian Policy Manual, 7 "Declaring relationships between packages"</ulink>.
1994  </para></footnote>  </para></footnote>
1995  </para>  </para>
1996  <itemizedlist>  <itemizedlist>
# Line 1945  English.  Translations of these descript Line 2168  English.  Translations of these descript
2168  Let's insert <literal>Vcs-*</literal> fields to document the Version Control  Let's insert <literal>Vcs-*</literal> fields to document the Version Control
2169  System (VCS) location between line 6 and 7.  System (VCS) location between line 6 and 7.
2170  <footnote><para>See  <footnote><para>See
2171  <ulink url="&devref-bpp-vcs;">Developer's Reference, 6.2.5. 'Version Control System location'</ulink>.  <ulink url="&devref-bpp-vcs;">Debian Developer's Reference, 6.2.5. "Version Control System location"</ulink>.
2172  </para></footnote>  </para></footnote>
2173  Let's assume that the <systemitem role="package">gentoo</systemitem>  Let's assume that the <systemitem role="package">gentoo</systemitem>
2174  package has its VCS located in Debian Alioth Git Service at  package has its VCS located in Debian Alioth Git Service at
# Line 1992  Finally, here is the updated <filename>c Line 2215  Finally, here is the updated <filename>c
2215  <para>  <para>
2216  This file contains the information about package upstream resources, copyright  This file contains the information about package upstream resources, copyright
2217  and license information.  and license information.
2218  <ulink url="&policy-copyright;">Debian Policy Manual, 12.5 'Copyright information'</ulink>  <ulink url="&policy-copyright;">Debian Policy Manual, 12.5 "Copyright information"</ulink>
2219  dictates its content and  dictates its content and
2220  <ulink url="&dep5;">DEP-5: Machine-parseable <filename>debian/copyright</filename></ulink>  <ulink url="&dep5;">DEP-5: Machine-parseable <filename>debian/copyright</filename></ulink>
2221  provides guidelines for its format.  provides guidelines for its format.
# Line 2062  debian-devel-announce: <ulink url="&howt Line 2285  debian-devel-announce: <ulink url="&howt
2285  <section id="changelog"><title><filename>changelog</filename> file</title>  <section id="changelog"><title><filename>changelog</filename> file</title>
2286  <para>  <para>
2287  This is a required file, which has a special format described in the  This is a required file, which has a special format described in the
2288  <ulink url="&policy-dpkgchangelog;">Debian Policy Manual, 4.4 'debian/changelog'</ulink>.  <ulink url="&policy-dpkgchangelog;">Debian Policy Manual, 4.4 "debian/changelog"</ulink>.
2289  This format is used by <command>dpkg</command> and other programs to obtain the  This format is used by <command>dpkg</command> and other programs to obtain the
2290  version number, revision, distribution and urgency of your package.  version number, revision, distribution and urgency of your package.
2291  </para>  </para>
# Line 2143  is marked as executable. Line 2366  is marked as executable.
2366  Every <filename>rules</filename> file, as any other  Every <filename>rules</filename> file, as any other
2367  <filename>Makefile</filename>, consists of several targets and their rules  <filename>Makefile</filename>, consists of several targets and their rules
2368  specifying how to handle the source.  <ulink url="&policy-debianrules;">Debian  specifying how to handle the source.  <ulink url="&policy-debianrules;">Debian
2369  Policy Manual, 4.9 'Main building script: debian/rules'</ulink> explains its  Policy Manual, 4.9 "Main building script: debian/rules"</ulink> explains its
2370  details.  details.
2371  </para>  </para>
2372  <para>  <para>
# Line 2684  This installs <command>bash</command> co Line 2907  This installs <command>bash</command> co
2907  </listitem>  </listitem>
2908  </itemizedlist>  </itemizedlist>
2909  <para>  <para>
 For sources using Autotools, use combination of above as <literal>dh --with  
 autotools-dev --with autoreconf $@</literal> to be most current with the GNU  
 Build System.  
 </para>  
 <para>  
2910  Many <command>dh_*</command> commands invoked by the new <command>dh</command>  Many <command>dh_*</command> commands invoked by the new <command>dh</command>
2911  command can be customized by the corresponding configuration files in the  command can be customized by the corresponding configuration files in the
2912  <filename>debian</filename> directory.  See <xref linkend="dother"/> and the  <filename>debian</filename> directory.  See <xref linkend="dother"/> and the
# Line 2801  possible. Line 3019  possible.
3019  <para>  <para>
3020  To control most of what <systemitem role="package">debhelper</systemitem> does  To control most of what <systemitem role="package">debhelper</systemitem> does
3021  while building the package, you put optional configuration files under the  while building the package, you put optional configuration files under the
3022  <filename>debian</filename> directory.  This chapter will make an overview of  <filename>debian</filename> directory.  This chapter will provide an overview of
3023  what each of these does and its format.  Please read <ulink url="&debian-policy;">Debian Policy  what each of these does and its format.  Please read the <ulink url="&debian-policy;">Debian Policy
3024  Manual</ulink> and <ulink url="&developers-reference;">Debian Developer's  Manual</ulink> and <ulink url="&developers-reference;">Debian Developer's
3025  Reference</ulink> for guidelines for the packaging.  Reference</ulink> for guidelines for packaging.
3026  </para>  </para>
3027  <para>  <para>
3028  The <command>dh_make</command> command will create some template configuration  The <command>dh_make</command> command will create some template configuration
# Line 2813  filenames suffixed by <literal>.ex</lite Line 3031  filenames suffixed by <literal>.ex</lite
3031  prefixed by the binary package name such as  prefixed by the binary package name such as
3032  <literal><replaceable>package</replaceable></literal>.  Take a look at all of  <literal><replaceable>package</replaceable></literal>.  Take a look at all of
3033  them.  them.
3034    <footnote><para>
3035    In this chapter, files in the <filename>debian</filename> directory are
3036    referred to without the preceding <filename>debian/</filename> for simplicity whenever
3037    they are obvious.
3038    </para></footnote>
3039  </para>  </para>
3040  <para>  <para>
3041  The <command>dh_make</command> command may not create some template  Some template configuration files for <systemitem role="package">debhelper</systemitem>
3042  configuration files for <systemitem role="package">debhelper</systemitem>.  In  may not be created by the <command>dh_make</command> command.  In
3043  such cases, you need to create them with the editor.  such cases, you need to create them with an editor.
3044  </para>  </para>
3045  <para>  <para>
3046  If you wish or need to activate any of those, please do the following.  If you wish or need to activate any of these, please do the following:
3047  </para>  </para>
3048  <itemizedlist>  <itemizedlist>
3049  <listitem>  <listitem>
3050  <para>  <para>
3051  rename template files by removing the <literal>.ex</literal> or  rename template files by removing the <literal>.ex</literal> or
3052  <literal>.EX</literal> suffix if the template files have one.  <literal>.EX</literal> suffix if they have one;
3053  </para>  </para>
3054  </listitem>  </listitem>
3055  <listitem>  <listitem>
3056  <para>  <para>
3057  rename the name of these configuration files using the actual binary package  rename the configuration files to use the actual binary package
3058  name in place of <literal><replaceable>package</replaceable></literal>.  name in place of <literal><replaceable>package</replaceable></literal>;
3059  </para>  </para>
3060  </listitem>  </listitem>
3061  <listitem>  <listitem>
3062  <para>  <para>
3063  modify template file contents to suit your needs.  modify template file contents to suit your needs;
3064  </para>  </para>
3065  </listitem>  </listitem>
3066  <listitem>  <listitem>
3067  <para>  <para>
3068  remove template files which you do not need.  remove template files which you do not need;
3069  </para>  </para>
3070  </listitem>  </listitem>
3071  <listitem>  <listitem>
3072  <para>  <para>
3073  modify the <filename>control</filename> file (see <xref linkend="control"/>),  modify the <filename>control</filename> file (see <xref linkend="control"/>),
3074  if necessary.  if necessary;
3075  </para>  </para>
3076  </listitem>  </listitem>
3077  <listitem>  <listitem>
# Line 2859  necessary. Line 3082  necessary.
3082  </listitem>  </listitem>
3083  </itemizedlist>  </itemizedlist>
3084  <para>  <para>
3085  Those <systemitem role="package">debhelper</systemitem> configuration files  Any <systemitem role="package">debhelper</systemitem> configuration files
3086  without <filename><replaceable>package</replaceable></filename> prefix such as  without a <filename><replaceable>package</replaceable></filename> prefix, such as
3087  <filename>install</filename> apply to the first binary package.  When there are  <filename>install</filename>, apply to the first binary package.  When there are
3088  many binary packages, their configurations can be specified by prefixing their  many binary packages, their configurations can be specified by prefixing their
3089  name to their configuration filenames such as  name to their configuration filenames such as
3090  <filename><replaceable>package-1</replaceable>.install</filename>,  <filename><replaceable>package-1</replaceable>.install</filename>,
3091  <filename><replaceable>package-2</replaceable>.install</filename>, etc.  <filename><replaceable>package-2</replaceable>.install</filename>, etc.
3092  </para>  </para>
3093  <section id="readme"><title><filename>README.Debian</filename> file</title>  <section id="readme"><title><filename>README.Debian</filename></title>
3094  <para>  <para>
3095  Any extra details or discrepancies between the original package and your Debian  Any extra details or discrepancies between the original package and your Debian
3096  version should be documented here.  version should be documented here.
3097  </para>  </para>
3098  <para>  <para>
3099  <command>dh_make</command> created a default one, this is what it looks like:  <command>dh_make</command> created a default one; this is what it looks like:
3100  </para>  </para>
3101  <screen>  <screen>
3102  gentoo for Debian  gentoo for Debian
# Line 2887  If you have nothing to be documented, re Line 3110  If you have nothing to be documented, re
3110  </citerefentry>.  </citerefentry>.
3111  </para>  </para>
3112  </section>  </section>
3113  <section id="compat"><title><filename>compat</filename> file</title>  <section id="compat"><title><filename>compat</filename></title>
3114  <para>  <para>
3115  The <filename>compat</filename> file defines the <systemitem role="package">debhelper</systemitem> compatibility level.  Currently, you  The <filename>compat</filename> file defines the <systemitem role="package">debhelper</systemitem> compatibility level.  Currently, you
3116  should set it to the <systemitem role="package">debhelper</systemitem> V7 by  should set it to the <systemitem role="package">debhelper</systemitem> v7 as
3117  the following.  follows:
3118  </para>  </para>
3119  <screen>  <screen>
3120  $ echo 7 &gt; debian/compat  $ echo 7 &gt; debian/compat
3121  </screen>  </screen>
3122  </section>  </section>
3123  <section id="conffiles"><title><filename>conffiles</filename> file</title>  <section id="conffiles"><title><filename>conffiles</filename></title>
3124  <para>  <para>
3125  One of the most annoying things about software is when you spend a great deal  One of the most annoying things about software is when you spend a great deal
3126  of time and effort customizing a program, only to have an upgrade stomp all  of time and effort customizing a program, only to have an upgrade stomp all
3127  over your changes.  Debian solves this problem by marking such configuration files as conffiles.  over your changes.  Debian solves this problem by marking such configuration files as conffiles.
3128  <footnote><para>See <citerefentry> <refentrytitle>dpkg</refentrytitle>  <footnote><para>See <citerefentry> <refentrytitle>dpkg</refentrytitle>
3129  <manvolnum>1</manvolnum> </citerefentry> and  <manvolnum>1</manvolnum> </citerefentry> and
3130  <ulink url="&policy-conffiles;">Debian Policy Manual 'D.2.5 Conffiles'</ulink>.  <ulink url="&policy-conffiles;">Debian Policy Manual "D.2.5 Conffiles"</ulink>.
3131  </para></footnote>  </para></footnote>
3132  When you upgrade a package, you'll be prompted whether you want to keep  When you upgrade a package, you'll be asked whether you want to keep
3133  your old configuration files or not.  your old configuration files or not.
3134  </para>  </para>
3135  <para>  <para>
3136  Since <systemitem role="package">debhelper</systemitem> V3, <citerefentry>  <citerefentry><refentrytitle>dh_installdeb</refentrytitle> <manvolnum>1</manvolnum>
3137  <refentrytitle>dh_installdeb</refentrytitle> <manvolnum>1</manvolnum>  </citerefentry> <emphasis>automatically</emphasis> flags any files under
 </citerefentry> will <emphasis>automatically</emphasis> flag any files under  
3138  the <filename>/etc</filename> directory as conffiles, so if your program only  the <filename>/etc</filename> directory as conffiles, so if your program only
3139  has conffiles there you do not need to specify them in this file.  For most  has conffiles there you do not need to specify them in this file.  For most
3140  package types, the only place there is (and should be conffiles) is under  package types, the only place conffiles should ever be is under
3141  <filename>/etc</filename> and so this file doesn't need to exist.  <filename>/etc</filename>, and so this file doesn't need to exist.
3142  </para>  </para>
3143  <para>  <para>
3144  If your program uses configuration files but also rewrites them on its own,  If your program uses configuration files but also rewrites them on its own,
3145  it's best not to make them as conffiles because <command>dpkg</command> will  it's best not to make them conffiles because <command>dpkg</command> will
3146  then prompt users to verify the changes all the time.  then prompt users to verify the changes all the time.
3147  </para>  </para>
3148  <para>  <para>
3149  If the program you're packaging requires every user to modify the configuration  If the program you're packaging requires every user to modify the configuration
3150  files in the <filename>/etc</filename> directory, there are 2 popular ways to  files in the <filename>/etc</filename> directory, there are two popular ways to
3151  make them not as conffiles to keep <command>dpkg</command> quiet.  arrange for them to not be conffiles, keeping <command>dpkg</command> quiet.
3152  </para>  </para>
3153  <itemizedlist>  <itemizedlist>
3154  <listitem>  <listitem>
3155  <para>  <para>
3156  You make a symlink under the <filename>/etc</filename> directory pointing to a  Create a symlink under the <filename>/etc</filename> directory pointing to a
3157  file under the <filename>/var</filename> directory generated by the  file under the <filename>/var</filename> directory generated by the
3158  <emphasis>maintainer scripts</emphasis>.  maintainer scripts.
3159  </para>  </para>
3160  </listitem>  </listitem>
3161  <listitem>  <listitem>
3162  <para>  <para>
3163  You make a file generated by the <emphasis>maintainer scripts</emphasis> under  Create a file generated by the maintainer scripts under the <filename>/etc</filename> directory.
 the <filename>/etc</filename> directory.  
3164  </para>  </para>
3165  </listitem>  </listitem>
3166  </itemizedlist>  </itemizedlist>
3167  <para>  <para>
3168  For more information on the <emphasis>maintainer scripts</emphasis>, see <xref linkend="maintscripts"/>.  For information on maintainer scripts, see <xref linkend="maintscripts"/>.
3169  </para>  </para>
3170  </section>  </section>
3171  <section id="crond"><title><filename><replaceable>package</replaceable>.cron.*</filename> files</title>  <section id="crond"><title><filename><replaceable>package</replaceable>.cron.*</filename></title>
3172  <para>  <para>
3173  If your package requires regularly scheduled tasks to operate properly, you can  If your package requires regularly scheduled tasks to operate properly, you can
3174  use this file to set it up.  You can either setup regular tasks that happen  use these files to set that up.  You can set up regular tasks that either happen
3175  hourly, daily, weekly or monthly or alternatively happen any other time that  hourly, daily, weekly, or monthly, or alternatively happen at any other time that
3176  you wish.  The filenames are:  you wish.  The filenames are:
3177  </para>  </para>
3178  <itemizedlist>  <itemizedlist>
3179  <listitem>  <listitem>
3180  <para>  <para>
3181  <filename>cron.hourly</filename> - Installed as  <filename><replaceable>package</replaceable>.cron.hourly</filename> - Installed as
3182  <filename>/etc/cron.hourly/<replaceable>package</replaceable></filename>: run  <filename>/etc/cron.hourly/<replaceable>package</replaceable></filename>; run
3183  once an hour every hour.  once an hour.
3184  </para>  </para>
3185  </listitem>  </listitem>
3186  <listitem>  <listitem>
3187  <para>  <para>
3188  <filename>cron.daily</filename> - Installed as  <filename><replaceable>package</replaceable>.cron.daily</filename> - Installed as
3189  <filename>/etc/cron.daily/<replaceable>package</replaceable></filename>: run  <filename>/etc/cron.daily/<replaceable>package</replaceable></filename>; run
3190  once a day, usually early morning.  once a day.
3191  </para>  </para>
3192  </listitem>  </listitem>
3193  <listitem>  <listitem>
3194  <para>  <para>
3195  <filename>cron.weekly</filename> - Installed as  <filename><replaceable>package</replaceable>.cron.weekly</filename> - Installed as
3196  <filename>/etc/cron.weekly/<replaceable>package</replaceable></filename>: run  <filename>/etc/cron.weekly/<replaceable>package</replaceable></filename>; run
3197  once a week, usually early Sunday morning.  once a week.
3198  </para>  </para>
3199  </listitem>  </listitem>
3200  <listitem>  <listitem>
3201  <para>  <para>
3202  <filename>cron.monthly</filename> - Installed as  <filename><replaceable>package</replaceable>.cron.monthly</filename> - Installed as
3203  <filename>/etc/cron.monthly/<replaceable>package</replaceable></filename>: run  <filename>/etc/cron.monthly/<replaceable>package</replaceable></filename>: run
3204  once a month, usually early morning on the first of the month.  once a month.
3205  </para>  </para>
3206  </listitem>  </listitem>
3207  <listitem>  <listitem>
3208  <para>  <para>
3209  <filename>cron.d</filename> - Installed as  <filename><replaceable>package</replaceable>.cron.d</filename> - Installed as
3210  <filename>/etc/cron.d/<replaceable>package</replaceable></filename>: for any  <filename>/etc/cron.d/<replaceable>package</replaceable></filename>: for any
3211  other time  other time.
3212  </para>  </para>
3213  </listitem>  </listitem>
3214  </itemizedlist>  </itemizedlist>
3215  <para>  <para>
3216  For the named files, the format of them is the shell script.  The different one  Most of these files are shell scripts, with the exception of
3217  is <filename><replaceable>package</replaceable>.cron.d</filename> which follows  <filename><replaceable>package</replaceable>.cron.d</filename> which follows
3218  the format of <citerefentry> <refentrytitle>crontab</refentrytitle>  the format of <citerefentry> <refentrytitle>crontab</refentrytitle>
3219  <manvolnum>5</manvolnum> </citerefentry>.  <manvolnum>5</manvolnum> </citerefentry>.
3220  </para>  </para>
3221  <para>  <para>
3222  Note that this doesn't include log rotation; for that, see <citerefentry>  No explicit <filename>cron.*</filename> file is needed to set up log rotation;
3223  <refentrytitle>dh_installlogrotate</refentrytitle> <manvolnum>1</manvolnum>  for that, see
3224  </citerefentry> and <citerefentry> <refentrytitle>logrotate</refentrytitle>  <citerefentry><refentrytitle>dh_installlogrotate</refentrytitle>
3225  <manvolnum>8</manvolnum> </citerefentry>.  <manvolnum>1</manvolnum></citerefentry> and
3226    <citerefentry><refentrytitle>logrotate</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
3227  </para>  </para>
3228  </section>  </section>
3229  <section id="dirs"><title><filename>dirs</filename> file</title>  <section id="dirs"><title><filename>dirs</filename></title>
3230  <para>  <para>
3231  This file specifies the directories which we need but the normal installation  This file specifies any directories which we need but which are not created by the normal installation
3232  procedure (<literal>make install DESTDIR=...</literal> invoked by  procedure (<literal>make install DESTDIR=...</literal> invoked by
3233  <literal>dh_auto_install</literal>) somehow doesn't create.  This generally  <literal>dh_auto_install</literal>).  This generally
3234  means there is a problem with the <filename>Makefile</filename>.  means there is a problem with the <filename>Makefile</filename>.
3235  </para>  </para>
3236  <para>  <para>
3237  Files listed in the <filename>install</filename> file doesn't need the  Files listed in an <filename>install</filename> file don't need their
3238  directories created first.  See <xref linkend="install"/>.  directories created first.  See <xref linkend="install"/>.
3239  </para>  </para>
3240  <para>  <para>
3241  It is best to try to run the installation first and only use this if you  It is best to try to run the installation first and only use this if you
3242  run into trouble.  There is no preceding slash on the directory names listed in  run into trouble.  There is no preceding slash on the directory names listed in
3243  the <filename>dirs</filename> file.  the <filename>dirs</filename> file.
3244  </para>  </para>
3245  </section>  </section>
3246  <section id="doc-base"><title><filename><replaceable>package</replaceable>.doc-base</filename> file</title>  <section id="doc-base"><title><filename><replaceable>package</replaceable>.doc-base</filename></title>
3247  <para>  <para>
3248  If your package has documentation other than manual pages and info docs, you  If your package has documentation other than manual and info pages, you
3249  should use the <systemitem role="package">doc-base</systemitem> file to  should use the <systemitem role="package">doc-base</systemitem> file to
3250  register it, so the user can find it with e.g.  <citerefentry>  register it, so the user can find it with e.g.  <citerefentry>
3251  <refentrytitle>dhelp</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>,  <refentrytitle>dhelp</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>,
3252  <citerefentry> <refentrytitle>dwww</refentrytitle> <manvolnum>1</manvolnum>  <citerefentry> <refentrytitle>dwww</refentrytitle> <manvolnum>1</manvolnum>
3253  </citerefentry> or <citerefentry> <refentrytitle>doccentral</refentrytitle>  </citerefentry>, or <citerefentry> <refentrytitle>doccentral</refentrytitle>
3254  <manvolnum>1</manvolnum> </citerefentry>.  <manvolnum>1</manvolnum> </citerefentry>.
3255  </para>  </para>
3256  <para>  <para>
# Line 3036  This usually includes HTML, PS and PDF f Line 3258  This usually includes HTML, PS and PDF f
3258  <filename>/usr/share/doc/<replaceable>packagename</replaceable>/</filename>.  <filename>/usr/share/doc/<replaceable>packagename</replaceable>/</filename>.
3259  </para>  </para>
3260  <para>  <para>
3261  This is how <systemitem role="package">gentoo</systemitem>'s doc-base file  This is what <systemitem role="package">gentoo</systemitem>'s doc-base file
3262  <filename>gentoo.doc-base</filename> looks like:  <filename>gentoo.doc-base</filename> looks like:
3263  </para>  </para>
3264  <screen>  <screen>
# Line 3059  manual, in <ulink url="&doc-base;">Debia Line 3281  manual, in <ulink url="&doc-base;">Debia
3281  For more details on installing additional documentation, look in <xref linkend="destdir"/>.  For more details on installing additional documentation, look in <xref linkend="destdir"/>.
3282  </para>  </para>
3283  </section>  </section>
3284  <section id="docs"><title><filename>docs</filename> file</title>  <section id="docs"><title><filename>docs</filename></title>
3285  <para>  <para>
3286  This file specifies the file names of documentation files we can have  This file specifies the file names of documentation files we can have
3287  <citerefentry> <refentrytitle>dh_installdocs</refentrytitle>  <citerefentry> <refentrytitle>dh_installdocs</refentrytitle>
# Line 3072  directory that are called <filename>BUGS Line 3294  directory that are called <filename>BUGS
3294  <filename>README*</filename>, <filename>TODO</filename> etc.  <filename>README*</filename>, <filename>TODO</filename> etc.
3295  </para>  </para>
3296  <para>  <para>
3297  For <systemitem role="package">gentoo</systemitem>, I also included some other  For <systemitem role="package">gentoo</systemitem>, some other files
3298  files:  are also included:
3299  </para>  </para>
3300  <screen>  <screen>
3301  BUGS  BUGS
# Line 3085  README.gtkrc Line 3307  README.gtkrc
3307  TODO  TODO
3308  </screen>  </screen>
3309  </section>  </section>
3310  <section id="emacsen"><title><filename>emacsen-*</filename> file</title>  <section id="emacsen"><title><filename>emacsen-*</filename></title>
3311  <para>  <para>
3312  If your package supplies Emacs files that can be bytecompiled at package  If your package supplies Emacs files that can be bytecompiled at package
3313  installation time, you can use these files to set it up.  installation time, you can use these files to set it up.
# Line 3099  They are installed into the temporary di Line 3321  They are installed into the temporary di
3321  If you don't need these, remove them.  If you don't need these, remove them.
3322  </para>  </para>
3323  </section>  </section>
3324  <section id="examples"><title><filename><replaceable>package</replaceable>.examples</filename> file</title>  <section id="examples"><title><filename><replaceable>package</replaceable>.examples</filename></title>
3325  <para>  <para>
3326  The <citerefentry> <refentrytitle>dh_installexamples</refentrytitle>  The <citerefentry> <refentrytitle>dh_installexamples</refentrytitle>
3327  <manvolnum>1</manvolnum> </citerefentry> command installs files and directories  <manvolnum>1</manvolnum> </citerefentry> command installs files and directories
3328  listed in this file as example files.  listed in this file as example files.
3329  </para>  </para>
3330  </section>  </section>
3331  <section id="initd"><title><filename><replaceable>package</replaceable>.init</filename> and <filename><replaceable>package</replaceable>.default</filename> files</title>  <section id="initd"><title><filename><replaceable>package</replaceable>.init</filename> and <filename><replaceable>package</replaceable>.default</filename></title>
3332  <para>  <para>
3333  If your package is a daemon that needs to be run at the system start-up, you've  If your package is a daemon that needs to be run at system start-up, you've
3334  obviously disregarded my initial recommendation, haven't you?  :-)  obviously disregarded my initial recommendation, haven't you?  :-)
3335  </para>  </para>
3336  <para>  <para>
3337  The <filename><replaceable>package</replaceable>.init</filename> file is  The <filename><replaceable>package</replaceable>.init</filename> file is
3338  installed as the  installed as the
3339  <filename>/etc/init.d/<replaceable>package</replaceable></filename> script.  <filename>/etc/init.d/<replaceable>package</replaceable></filename> script
3340    which starts and stops the daemon.
3341  Its fairly generic skeleton template is provided by the  Its fairly generic skeleton template is provided by the
3342  <command>dh_make</command> command as <filename>init.d.ex</filename>.  You'll  <command>dh_make</command> command as <filename>init.d.ex</filename>.  You'll
3343  likely have to rename and edit it, a lot, while making sure to provide  likely have to rename and edit it, a lot, while making sure to provide
# Line 3125  gets installed into the temporary direct Line 3348  gets installed into the temporary direct
3348  </para>  </para>
3349  <para>  <para>
3350  The <filename><replaceable>package</replaceable>.default</filename> file will  The <filename><replaceable>package</replaceable>.default</filename> file will
3351  be installed into  be installed as
3352  <filename>/etc/default/<replaceable>package</replaceable></filename>.  This  <filename>/etc/default/<replaceable>package</replaceable></filename>.  This
3353  file sets defaults that are sourced by the <filename>.init</filename> script.  Most times this  file sets defaults that are sourced by the init script.  This
3354  <filename>.default</filename> file is used to disable running a daemon, set some default flags or  <filename><replaceable>package</replaceable>.default</filename> file
3355  timeouts.  If your <filename>.init</filename> script has certain <emphasis>settable</emphasis>  is most often used to disable running a daemon, or to set some default flags or
3356  features you want to install these into the <filename>.default</filename> file, not the <filename>.init</filename> script.  timeouts.  If your init script has certain configurable
3357    features, you can set them in the <filename><replaceable>package</replaceable>.default</filename> file,
3358    instead of in the init script itself.
3359  </para>  </para>
3360  <para>  <para>
3361  If your upstream program has an <filename>.init</filename> file you can either use it or not.  If you  If your upstream program provides a file for the init script, you can either use it or not.  If you
3362  don't use their <filename>init.d</filename> script then create a new one in  don't use their init script then create a new one in
3363  <filename>debian/<replaceable>package</replaceable>.init</filename>.  However  <filename><replaceable>package</replaceable>.init</filename>.  However
3364  if the upstream <filename>.init</filename> script looks fine and installs in the right place you  if the upstream init script looks fine and installs in the right place you
3365  still need to setup the <filename>rc*</filename> symlinks.  To do this you will  still need to set up the <filename>rc*</filename> symlinks.  To do this you will
3366  need to override <command>dh_installinit</command> in the  need to override <command>dh_installinit</command> in the
3367  <filename>rules</filename> file with the following lines:  <filename>rules</filename> file with the following lines:
3368  </para>  </para>
# Line 3149  override_dh_installinit: Line 3374  override_dh_installinit:
3374  If you don't need this, remove the files.  If you don't need this, remove the files.
3375  </para>  </para>
3376  </section>  </section>
3377  <section id="install"><title><filename>install</filename> file</title>  <section id="install"><title><filename>install</filename></title>
3378  <para>  <para>
3379  If there are files that need to be installed into your package but your  If there are files that need to be installed into your package but your
3380  standard <literal>make install</literal> won't do it, you put the filenames and  standard <literal>make install</literal> won't do it, put the filenames and
3381  destinations into this <filename>install</filename> file.  They are installed  destinations into this <filename>install</filename> file.  They are installed
3382  by <citerefentry> <refentrytitle>dh_install</refentrytitle>  by <citerefentry> <refentrytitle>dh_install</refentrytitle>
3383  <manvolnum>1</manvolnum> </citerefentry>.<footnote><para> This replaces the  <manvolnum>1</manvolnum> </citerefentry>.<footnote><para> This replaces the
# Line 3165  the <filename>docs</filename> file and n Line 3390  the <filename>docs</filename> file and n
3390  <para>  <para>
3391  This <filename>install</filename> file has one line per file installed, with  This <filename>install</filename> file has one line per file installed, with
3392  the name of the file (relative to the top build directory) then a space then  the name of the file (relative to the top build directory) then a space then
3393  the installation directory (relative to the install directory).  One example of  the installation directory (relative to the install directory).  One example of where this is used is if a binary <filename>src/<replaceable>bar</replaceable></filename> is left uninstalled; the
3394  where this is used is where a binary is forgotten to be installed, the  <filename>install</filename> file might look like:
 <filename>install</filename> file would look like:  
3395  </para>  </para>
3396  <screen>  <screen>
3397  src/foo/mybin usr/bin  src/<replaceable>bar</replaceable> usr/bin
3398  </screen>  </screen>
3399  <para>  <para>
3400  This will mean when this package is installed, there will be a binary file  This means when this package is installed, there will be a binary executable
3401  <filename>/usr/bin/mybin</filename>.  <filename>/usr/bin/<replaceable>bar</replaceable></filename>.
3402  </para>  </para>
3403  <para>  <para>
3404  Alternatively, this <filename>install</filename> can have the name of the file  Alternatively, this <filename>install</filename> can have the name of the file
3405  only without the installation directory when the relative directory path does  only without the installation directory when the relative directory path does
3406  not change.  This format is usually used for a large package that splits build  not change.  This format is usually used for a large package that splits the
3407  result into multiple binary packages using  output of its build into multiple binary packages using
3408  <filename><replaceable>package-1</replaceable>.install</filename>,  <filename><replaceable>package-1</replaceable>.install</filename>,
3409  <filename><replaceable>package-2</replaceable>.install</filename>, etc.  <filename><replaceable>package-2</replaceable>.install</filename>, etc.
3410  </para>  </para>
3411  <para>  <para>
3412  The <command>dh_install</command> command will fall back to look in  The <command>dh_install</command> command will fall back to looking in
3413  <filename>debian/tmp</filename> for files, if it doesn't find them in the  <filename>debian/tmp</filename> for files, if it doesn't find them in the
3414  current directory (or wherever you've told it to look using  current directory (or wherever you've told it to look using
3415  <literal>--sourcedir</literal>).  <literal>--sourcedir</literal>).
3416  </para>  </para>
3417  </section>  </section>
3418  <section id="info"><title><filename><replaceable>package</replaceable>.info</filename> file</title>  <section id="info"><title><filename><replaceable>package</replaceable>.info</filename></title>
3419  <para>  <para>
3420  If your package has info pages, you should install them using <citerefentry>  If your package has info pages, you should install them using <citerefentry>
3421  <refentrytitle>dh_installinfo</refentrytitle> <manvolnum>1</manvolnum>  <refentrytitle>dh_installinfo</refentrytitle> <manvolnum>1</manvolnum>
3422  </citerefentry> by listing them in the  </citerefentry> by listing them in a
3423  <filename><replaceable>package</replaceable>.info</filename> files.  <filename><replaceable>package</replaceable>.info</filename> file.
3424  </para>  </para>
3425  </section>  </section>
3426  <section id="lintian"><title><filename>{<replaceable>package</replaceable>.|source/}lintian-overrides</filename> files</title>  <section id="lintian"><title><filename>{<replaceable>package</replaceable>.,source/}lintian-overrides</filename></title>
3427  <para>  <para>
3428  If <systemitem role="package">lintian</systemitem> reports an erroneous  If <systemitem role="package">lintian</systemitem> reports an erroneous
3429  diagnostics for a case when the policy allows exceptions to some rule, you can  diagnostic for a case where Debian policy allows exceptions to some rule, you can
3430  use <filename><replaceable>package</replaceable>.lintian-overrides</filename>  use <filename><replaceable>package</replaceable>.lintian-overrides</filename>
3431  or <filename>source/lintian-overrides</filename> to quiet it.  Please read  or <filename>source/lintian-overrides</filename> to quieten it.  Please read
3432  <ulink url="&lintian-doc;">Lintian User's Manual</ulink> and refrain  <ulink url="&lintian-doc;">Lintian User's Manual</ulink> and refrain
3433  from abusing this.  from abusing this.
3434  </para>  </para>
3435  <para>  <para>
3436  <filename><replaceable>package</replaceable>.lintian-overrides</filename> is  <filename><replaceable>package</replaceable>.lintian-overrides</filename> is
3437  for the binary package named as <systemitem role="package"><replaceable>package</replaceable></systemitem> and is installed  for the binary package named <systemitem role="package"><replaceable>package</replaceable></systemitem> and is installed
3438  into  into
3439  <filename>usr/share/lintian/overrides/<replaceable>package</replaceable></filename>  <filename>usr/share/lintian/overrides/<replaceable>package</replaceable></filename>
3440  by the <command>dh_lintian</command> command.  by the <command>dh_lintian</command> command.
# Line 3220  by the <command>dh_lintian</command> com Line 3444  by the <command>dh_lintian</command> com
3444  is not installed.  is not installed.
3445  </para>  </para>
3446  </section>  </section>
3447  <section id="manpage"><title><filename>manpage.*</filename> files</title>  <section id="manpage"><title><filename>manpage.*</filename></title>
3448  <para>  <para>
3449  Your program(s) should have a manual page.  If they don't, you should create  Your program(s) should have a manual page.  If they don't, you should create
3450  them.  The <command>dh_make</command> command creates few template files for a  them.  The <command>dh_make</command> command creates some template files for
3451  manual page.  These need to be copied and edited for each command without its  manual pages.  These need to be copied and edited for each command missing its
3452  manual page.  Please make sure to remove unused templates.  manual page.  Please make sure to remove unused templates.
3453  </para>  </para>
3454  <section id="manpage1"><title><filename>manpage.1.ex</filename> file</title>  <section id="manpage1"><title><filename>manpage.1.ex</filename></title>
3455  <para>  <para>
3456  Manual pages are normally written in <citerefentry>  Manual pages are normally written in <citerefentry>
3457  <refentrytitle>nroff</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>.  <refentrytitle>nroff</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>.
# Line 3237  The <filename>manpage.1.ex</filename> te Line 3461  The <filename>manpage.1.ex</filename> te
3461  manual page for a brief description of how to edit such a file.  manual page for a brief description of how to edit such a file.
3462  </para>  </para>
3463  <para>  <para>
3464  The final manual page file name should include the name of the program it is  The final manual page file name should give the name of the program it is
3465  documenting, so we will rename it from <literal>manpage</literal> to  documenting, so we will rename it from <literal>manpage</literal> to
3466  <literal>gentoo</literal>.  The file name also includes <literal>.1</literal>  <literal>gentoo</literal>.  The file name also includes <literal>.1</literal>
3467  as the first suffix, which means it's a manual page for a user command.  Be  as the first suffix, which means it's a manual page for a user command.  Be
3468  sure to verify that this section is indeed the correct one.  Here's a short  sure to verify that this section is indeed the correct one.  Here's a short
3469  list of manual page sections:  list of manual page sections:
3470  </para>  </para>
3471  <table id="manpage-sections" pgwide="0" frame="topbot" rowsep="1" colsep="1">  <informaltable id="manpage-sections" pgwide="0" frame="topbot" rowsep="1" colsep="1">
 <title>manual page sections</title>  
3472  <tgroup cols="3">  <tgroup cols="3">
3473    <colspec colwidth="8*" align="left"/> <colspec colwidth="24*" align="left"/> <colspec colwidth="40*" align="left"/>    <colspec colwidth="8*" align="left"/> <colspec colwidth="24*" align="left"/> <colspec colwidth="40*" align="left"/>
3474    <thead>    <thead>
# Line 3263  list of manual page sections: Line 3486  list of manual page sections:
3486      <row> <entry>9</entry> <entry>Kernel routines</entry> <entry>Non-standard calls and internals</entry> </row>      <row> <entry>9</entry> <entry>Kernel routines</entry> <entry>Non-standard calls and internals</entry> </row>
3487    </tbody>    </tbody>
3488  </tgroup>  </tgroup>
3489  </table>  </informaltable>
3490  <para>  <para>
3491  So <systemitem role="package">gentoo</systemitem>'s man page should be called  So <systemitem role="package">gentoo</systemitem>'s man page should be called
3492  <filename>gentoo.1</filename>.  If there was no <filename>gentoo.1</filename>  <filename>gentoo.1</filename>.  If there was no <filename>gentoo.1</filename>
3493  man page in the original source, you should create it by renaming the  man page in the original source, you should create it by renaming the
3494  <filename>manpage.1.ex</filename> template to <filename>gentoo.1</filename> and  <filename>manpage.1.ex</filename> template to <filename>gentoo.1</filename> and
3495  edit it by using information from the example and from upstream docs.  editing it using information from the example and from the upstream docs.
3496  </para>  </para>
3497  <para>  <para>
3498  You can use the <command>help2man</command> command to generate a man page out  You can use the <command>help2man</command> command to generate a man page out
3499  of <literal>--help</literal> and <literal>--version</literal> output of each  of the <literal>--help</literal> and <literal>--version</literal> output of each
3500  program, too.  <footnote><para> If the command is missing  program, too.  <footnote><para> Note that <command>help2man</command>'s
3501  <command>info</command> page but have documentation files in the  placeholder man page will claim that more detailed documentation is
3502  <filename>/usr/share/<replaceable>package</replaceable></filename> directory,  available in the info system. If the command is missing an
3503  you should manually edit generated the man page created by the  <command>info</command> page, you
3504    should manually edit the man page created by the
3505  <command>help2man</command> command.  </para> </footnote>  <command>help2man</command> command.  </para> </footnote>
3506  </para>  </para>
3507  </section>  </section>
3508  <section id="manpagesgml"><title><filename>manpage.sgml.ex</filename> file</title>  <section id="manpagesgml"><title><filename>manpage.sgml.ex</filename></title>
3509  <para>  <para>
3510  If on the other hand you prefer writing SGML instead of  If on the other hand you prefer writing SGML instead of
3511  <command>nroff</command>, you can use the <filename>manpage.sgml.ex</filename>  <command>nroff</command>, you can use the <filename>manpage.sgml.ex</filename>
# Line 3306  line in the <filename>control</filename> Line 3530  line in the <filename>control</filename>
3530  </listitem>  </listitem>
3531  <listitem>  <listitem>
3532  <para>  <para>
3533  add a <literal>override_dh_auto_build</literal> target to your  add an <literal>override_dh_auto_build</literal> target to your
3534  <filename>rules</filename> file:  <filename>rules</filename> file:
3535  </para>  </para>
3536  <screen>  <screen>
# Line 3317  override_dh_auto_build: Line 3541  override_dh_auto_build:
3541  </listitem>  </listitem>
3542  </itemizedlist>  </itemizedlist>
3543  </section>  </section>
3544  <section id="manpagexml"><title><filename>manpage.xml.ex</filename> file</title>  <section id="manpagexml"><title><filename>manpage.xml.ex</filename></title>
3545  <para>  <para>
3546  If you prefer XML over SGML, you can use the <literal>manpage.xml.ex</literal>  If you prefer XML over SGML, you can use the <literal>manpage.xml.ex</literal>
3547  template.  If you do this, you have to:  template.  If you do this, you have to:
# Line 3337  XSLT processor like <systemitem role="pa Line 3561  XSLT processor like <systemitem role="pa
3561  </listitem>  </listitem>
3562  <listitem>  <listitem>
3563  <para>  <para>
3564  add the <literal>docbook-xsl</literal>, <literal>docbook-xml</literal> and  add the <literal>docbook-xsl</literal>, <literal>docbook-xml</literal>, and
3565  <literal>xsltproc</literal> packages to the <literal>Build-Depends</literal>  <literal>xsltproc</literal> packages to the <literal>Build-Depends</literal>
3566  line in the <literal>control</literal> file  line in the <literal>control</literal> file
3567  </para>  </para>
3568  </listitem>  </listitem>
3569  <listitem>  <listitem>
3570  <para>  <para>
3571  add a <literal>override_dh_auto_build</literal> target to your  add an <literal>override_dh_auto_build</literal> target to your
3572  <filename>rules</filename> file:  <filename>rules</filename> file:
3573  </para>  </para>
3574  <screen>  <screen>
# Line 3362  override_dh_auto_build: Line 3586  override_dh_auto_build:
3586  </itemizedlist>  </itemizedlist>
3587  </section>  </section>
3588  </section>  </section>
3589  <section id="manpages"><title><filename><replaceable>package</replaceable>.manpages</filename> file</title>  <section id="manpages"><title><filename><replaceable>package</replaceable>.manpages</filename></title>
3590  <para>  <para>
3591  If your package has manual pages, you should install them using <citerefentry>  If your package has manual pages, you should install them using <citerefentry>
3592  <refentrytitle>dh_installman</refentrytitle> <manvolnum>1</manvolnum>  <refentrytitle>dh_installman</refentrytitle> <manvolnum>1</manvolnum>
3593  </citerefentry> by listing them in the  </citerefentry> by listing them in a
3594  <filename><replaceable>package</replaceable>.manpages</filename> files.  <filename><replaceable>package</replaceable>.manpages</filename> file.
3595  </para>  </para>
3596  <para>  <para>
3597  To install <filename>docs/gentoo.1</filename> for the <systemitem role="package">gentoo</systemitem> package as its manpage, you create a  To install <filename>docs/gentoo.1</filename> as a manpage for the <systemitem role="package">gentoo</systemitem> package, create a
3598  <filename>gentoo.manpages</filename> file as the following.  <filename>gentoo.manpages</filename> file as follows.
3599  </para>  </para>
3600  <screen>  <screen>
3601  docs/gentoo.1  docs/gentoo.1
3602  </screen>  </screen>
3603  </section>  </section>
3604  <section id="menu"><title><filename>menu</filename> file</title>  <section id="menu"><title><filename>menu</filename></title>
3605  <para>  <para>
3606  X Window System users usually have a window manager with a menu that can be  X Window System users usually have a window manager with a menu that can be
3607  customized to launch programs.  If they have installed the Debian <systemitem role="package">menu</systemitem> package, a set of menus for every program on  customized to launch programs.  If they have installed the Debian <systemitem role="package">menu</systemitem> package, a set of menus for every program on
# Line 3398  specifies what kind of interface the pro Line 3622  specifies what kind of interface the pro
3622  listed alternatives, e.g.  <literal>text</literal> or <literal>X11</literal>.  listed alternatives, e.g.  <literal>text</literal> or <literal>X11</literal>.
3623  </para>  </para>
3624  <para>  <para>
3625  The next is <literal>section</literal>, where the menu and submenu entry  The next is the <literal>section</literal> that the menu and submenu entry
3626  should appear in.  should appear in.
3627  <footnote><para> The current list of sections is at  <footnote><para> The current list of sections is in
3628  <ulink url="&menu-structure;">The Debian Menu sub-policy 2.1 'Preferred menu structure'</ulink>.  <ulink url="&menu-structure;">The Debian Menu sub-policy 2.1 "Preferred menu structure"</ulink>.
3629  There were a major reorganization of menu structure for <literal>squeeze</literal>.  There was a major reorganization of menu structure for <literal>squeeze</literal>.
3630  </para> </footnote>  </para> </footnote>
3631  </para>  </para>
3632  <para>  <para>
# Line 3429  You can also add other fields like <lite Line 3653  You can also add other fields like <lite
3653  </citerefentry>, <citerefentry> <refentrytitle>menufile</refentrytitle>  </citerefentry>, <citerefentry> <refentrytitle>menufile</refentrytitle>
3654  <manvolnum>5</manvolnum> </citerefentry>, <citerefentry>  <manvolnum>5</manvolnum> </citerefentry>, <citerefentry>
3655  <refentrytitle>update-menus</refentrytitle> <manvolnum>1</manvolnum>  <refentrytitle>update-menus</refentrytitle> <manvolnum>1</manvolnum>
3656  </citerefentry> and  </citerefentry>, and
3657  <ulink url="&menu-policy;">The Debian Menu sub-policy</ulink> for more  <ulink url="&policy-menu;">The Debian Menu sub-policy</ulink> for more
3658  information.  information.
3659  </para>  </para>
3660  </section>  </section>
3661  <section id="news"><title><filename>NEWS</filename> file</title>  <section id="news"><title><filename>NEWS</filename></title>
3662  <para>  <para>
3663  The <citerefentry> <refentrytitle>dh_installchangelogs</refentrytitle>  The <citerefentry> <refentrytitle>dh_installchangelogs</refentrytitle>
3664  <manvolnum>1</manvolnum> </citerefentry> command installs this.  <manvolnum>1</manvolnum> </citerefentry> command installs this.
3665  </para>  </para>
3666  </section>  </section>
3667  <section id="maintscripts"><title><filename>{post|pre}{inst|rm}</filename> files</title>  <section id="maintscripts"><title><filename>{pre,post}{inst,rm}</filename></title>
3668  <para>  <para>
3669  These <filename>postinst</filename>, <filename>preinst</filename>,  These <filename>postinst</filename>, <filename>preinst</filename>,
3670  <filename>postrm</filename>, and <filename>prerm</filename> files  <filename>postrm</filename>, and <filename>prerm</filename> files
3671  <footnote><para> Although I used Bash short hand expression to indicate these  <footnote><para> Despite this use of the <command>bash</command>
3672  files as <filename>{post|pre}{inst|rm}</filename> here, I recommend you to use  shorthand expression <filename>{pre,post}{inst,rm}</filename> to indicate these
3673  pure POSIX (non-Bash) shell for these <emphasis>maintainer scripts</emphasis>  filenames, you should use pure POSIX syntax for these maintainer scripts for
3674  as much as possible for the better compatibility.  </para> </footnote> are  compatibility with <command>dash</command> as the system shell.  </para> </footnote> are
3675  called <emphasis>maintainer scripts</emphasis>.  They are scripts which are put  called <emphasis>maintainer scripts</emphasis>.  They are scripts which are put
3676  in the control area of the package and run by <command>dpkg</command> when your  in the control area of the package and run by <command>dpkg</command> when your
3677  package is installed, upgraded or removed.  package is installed, upgraded, or removed.
3678  </para>  </para>
3679  <para>  <para>
3680  As a novice maintainer, you should avoid any manual editing of  As a novice maintainer, you should avoid any manual editing of
3681  <emphasis>maintainer scripts</emphasis> because they are problematic.  For more  maintainer scripts because they are problematic.  For more
3682  information look in the <ulink url="&policy-mantainerscripts;">Debian  information refer to the <ulink url="&policy-mantainerscripts;">Debian
3683  Policy Manual, 6 'Package maintainer scripts and installation  Policy Manual, 6 "Package maintainer scripts and installation
3684  procedure'</ulink>, and take a look at these example files provided by  procedure"</ulink>, and take a look at the example files provided by
3685  <command>dh_make</command>.  <command>dh_make</command>.
3686  </para>  </para>
3687  <para>  <para>
3688  If you did not listen to me and made your custom <emphasis>maintainer  If you did not listen to me and have created custom maintainer
3689  scripts</emphasis> for a package, you should make sure to test them not only  scripts for a package, you should make sure to test them not only
3690  for <emphasis role="strong">install</emphasis> and <emphasis role="strong">upgrade</emphasis> but also for <emphasis role="strong">remove</emphasis> and <emphasis role="strong">purge</emphasis>.  for <emphasis role="strong">install</emphasis> and
3691    <emphasis role="strong">upgrade</emphasis> but also for
3692    <emphasis role="strong">remove</emphasis> and
3693    <emphasis role="strong">purge</emphasis>.
3694  </para>  </para>
3695  <para>  <para>
3696  Upgrades to the new version should be silent and non-intrusive (existing users  Upgrades to the new version should be silent and non-intrusive (existing users
3697  should not notice the upgrade except by discovering that old bugs have been  should not notice the upgrade except by discovering that old bugs have been
3698  fixed and there perhaps are new features).  fixed and perhaps that there are new features).
3699  </para>  </para>
3700  <para>  <para>
3701  When the upgrade is necessarily intrusive (eg., config files scattered through  When the upgrade is necessarily intrusive (eg., config files scattered through
3702  various home directories with totally different structure), you may consider to  various home directories with totally different structure), you may
3703  set package to the safe default (e.g., disabled service) and provide proper  consider as the last resort switching the package to a safe fallback state
3704  documentations required by the policy (<filename>README.Debian</filename> and  (e.g., disabling a service) and providing the proper documentation
3705  <filename>NEWS.Debian</filename>) as the last resort.  Don't bother user with  required by policy (<filename>README.Debian</filename> and
3706  the <command>debconf</command> note invoked from these <emphasis>maintainer  <filename>NEWS.Debian</filename>).  Don't bother the user with
3707  scripts</emphasis> for upgrades.  <command>debconf</command> notes invoked from these maintainer scripts
3708    for upgrades.
3709  </para>  </para>
3710  <para>  <para>
3711  The <systemitem role="package">ucf</systemitem> package provides  The <systemitem role="package">ucf</systemitem> package provides a
3712  <emphasis>conffile-like</emphasis> handling infrastructure to preserve user  <emphasis>conffile-like</emphasis> handling infrastructure to preserve user
3713  changes for files that may not be labeled <emphasis>conffiles</emphasis> such  changes for files that may not be labeled as <emphasis>conffiles</emphasis> such
3714  as ones managed by the <emphasis>maintainer scripts</emphasis>.  This should  as those managed by the maintainer scripts.  This should
3715  minimize issues associated with them.  minimize issues associated with them.
3716  </para>  </para>
3717  <para>  <para>
3718  These <emphasis>maintainer scripts</emphasis> are the Debian enhancements that  These maintainer scripts are among the Debian enhancements that
3719  explain <emphasis role="strong">why people choose Debian</emphasis>.  You must  explain <emphasis role="strong">why people choose Debian</emphasis>.  You must
3720  be very careful not to annoy them with these.  be very careful not to turn them into a source of annoyance.
3721  </para>  </para>
3722  </section>  </section>
3723  <section id="todo"><title><filename>TODO</filename> file</title>  <section id="todo"><title><filename>TODO</filename></title>
3724  <para>  <para>
3725  The <citerefentry> <refentrytitle>dh_installdocs</refentrytitle>  The <citerefentry> <refentrytitle>dh_installdocs</refentrytitle>
3726  <manvolnum>1</manvolnum> </citerefentry> command installs this.  <manvolnum>1</manvolnum> </citerefentry> command installs this.
3727  </para>  </para>
3728  </section>  </section>
3729  <section id="watch"><title><filename>watch</filename> file</title>  <section id="watch"><title><filename>watch</filename></title>
3730  <para>  <para>
3731  The <filename>watch</filename> file format is documented in the <citerefentry>  The <filename>watch</filename> file format is documented in the <citerefentry>
3732  <refentrytitle>uscan</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>  <refentrytitle>uscan</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>
3733  manpage.  The <filename>watch</filename> file configures the  manpage.  The <filename>watch</filename> file configures the
3734  <command>uscan</command> program (in the <systemitem role="package">devscripts</systemitem> package) to watch the site where you  <command>uscan</command> program (in the <systemitem role="package">devscripts</systemitem> package) to watch the site where you
3735  originally got the source from.  This is also used by <ulink url="&dehs;">Debian External Health Status (DEHS)</ulink>.  originally got the source from.  This is also used by the
3736    <ulink url="&dehs;">Debian External Health Status (DEHS)</ulink> service.
3737  </para>  </para>
3738  <para>  <para>
3739  Here's what I put in it:  Here are its contents:
3740  </para>  </para>
3741  <screen>  <screen>
3742  # watch control file for uscan  # watch control file for uscan
# Line 3515  version=3 Line 3744  version=3
3744  &sf-net;/gentoo/gentoo-(.+)\.tar\.gz debian uupdate  &sf-net;/gentoo/gentoo-(.+)\.tar\.gz debian uupdate
3745  </screen>  </screen>
3746  <para>  <para>
3747  Normally with this <filename>watch</filename> file, the URL at  Normally with a <filename>watch</filename> file, the URL at
3748  <literal>&sf-net;/gentoo</literal> is downloaded and searched for links of  <literal>&sf-net;/gentoo</literal> is downloaded and searched for links of
3749  the form <literal>&lt;a href=...&gt;</literal>.  The base name (just the part  the form <literal>&lt;a href=...&gt;</literal>.  The basename (just the part
3750  after the final <literal>/</literal>) of these linked URLs are matched against  after the final <literal>/</literal>) of each linked URL is compared against
3751  Perl regular expression (see <citerefentry> <refentrytitle>perlre</refentrytitle>  the Perl regular expression pattern (see <citerefentry> <refentrytitle>perlre</refentrytitle>
3752  <manvolnum>1</manvolnum> </citerefentry>) pattern  <manvolnum>1</manvolnum> </citerefentry>)
3753  <literal>gentoo-(.+)\.tar\.gz</literal>.  Out of matched files, the file with  <literal>gentoo-(.+)\.tar\.gz</literal>.  Out of the files that match, the one with
3754  the greatest version number is downloaded and the <command>uupdate</command>  the greatest version number is downloaded and the <command>uupdate</command>
3755  program is run to create the updated source tree from them.  program is run to create an updated source tree.
3756  </para>  </para>
3757  <para>  <para>
3758  Although this is true for other sites, the SourceForge download service at  Although this is true for other sites, the SourceForge download service at
3759  <ulink url="&sf-net;"/> is an exception.  When the  <ulink url="&sf-net;"/> is an exception.  When the
3760  <filename>watch</filename> file has an URL matching with the Perl regexp  <filename>watch</filename> file has an URL matching the Perl regexp
3761  <literal>^http://sf\.net/</literal>, the <command>uscan</command> program  <literal>^http://sf\.net/</literal>, the <command>uscan</command> program
3762  substitutes it with <literal>&qa-do;watch/sf.php/</literal> and  replaces it with <literal>&qa-do;watch/sf.php/</literal> and
3763  then applies this rule.  The URL redirector service at this <ulink url="&qa-do;"/> is designed to offer  then applies this rule.  The URL redirector service at <ulink url="&qa-do;"/> is designed to offer
3764  a stable redirect service to the desired file for the  a stable redirect service to the desired file for any
3765  <filename>watch</filename> file having  <filename>watch</filename> pattern of the form
3766  <literal>&sf-net;/<replaceable>project</replaceable>/<replaceable>tar-name</replaceable>-(.+)\.tar\.gz</literal>.  <literal>&sf-net;/<replaceable>project</replaceable>/<replaceable>tar-name</replaceable>-(.+)\.tar\.gz</literal>.
3767  This solves issues related to the periodically changing URL there.  This solves issues related to periodically changing SourceForge URLs.
3768  </para>  </para>
3769  </section>  </section>
3770  <section id="sourcef"><title><filename>source/format</filename> file</title>  <section id="sourcef"><title><filename>source/format</filename></title>
3771  <para>  <para>
3772  In the <filename>debian/source/format</filename> file, there should be a single  In the <filename>debian/source/format</filename> file, there should be a single
3773  line indicating the desired format for the source package (check <citerefentry>  line indicating the desired format for the source package (check <citerefentry>
# Line 3562  should say either: Line 3791  should say either:
3791  The newer <literal>3.0 (quilt)</literal> source format records modifications in  The newer <literal>3.0 (quilt)</literal> source format records modifications in
3792  a <command>quilt</command> patch series within  a <command>quilt</command> patch series within
3793  <filename>debian/patches</filename>.  Those changes are then automatically  <filename>debian/patches</filename>.  Those changes are then automatically
3794  applied during extraction of the source package.  <footnote><para> See <ulink url="&debsrc3;">DebSrc3.0</ulink> for the  applied during extraction of the source package.  <footnote><para> See
3795  summary information concerning the switch to the new <literal>3.0  <ulink url="&debsrc3;">DebSrc3.0</ulink> for a summary on the switch to the new <literal>3.0
3796  (quilt)</literal> and <literal>3.0 (native)</literal> source formats.  </para>  (quilt)</literal> and <literal>3.0 (native)</literal> source formats.  </para>
3797  </footnote> The Debian modifications are simply stored in a  </footnote> The Debian modifications are simply stored in a
3798  <filename>debian.tar.gz</filename> archive containing all files under the  <filename>debian.tar.gz</filename> archive containing all files under the
3799  <filename>debian</filename> directory.  This new format supports inclusion of  <filename>debian</filename> directory.  This new format supports inclusion of
3800  binary files such as PNG icons by the package maintainer without requiring  binary files such as PNG icons by the package maintainer without requiring
3801  tricks.  <footnote><para> Actually, this new format also supports multiple  tricks.  <footnote><para>Actually, this new format also supports multiple
3802  upstream tarballs and more compression methods.  These are beyond the scope of  upstream tarballs and more compression methods.  These are beyond the scope of
3803  this document.  </para> </footnote>  this document.</para> </footnote>
3804  </para>  </para>
3805  <para>  <para>
3806  When <command>dpkg-source</command> extracts a source package in <literal>3.0  When <command>dpkg-source</command> extracts a source package in <literal>3.0
# Line 3580  When <command>dpkg-source</command> extr Line 3809  When <command>dpkg-source</command> extr
3809  the end of the extraction with the <literal>--skip-patches</literal> option.  the end of the extraction with the <literal>--skip-patches</literal> option.
3810  </para>  </para>
3811  </section>  </section>
3812  <section id="sourcel"><title><filename>source/local-options</filename> file</title>  <section id="sourcel"><title><filename>source/local-options</filename></title>
3813  <para>  <para>
3814  When you want to manage Debian packaging activities under a VCS, you typically  When you want to manage Debian packaging activities under a VCS, you typically
3815  create one branch (e.g.  <literal>upstream</literal>) tracking the upstream  create one branch (e.g.  <literal>upstream</literal>) tracking the upstream
# Line 3605  unapply-patches Line 3834  unapply-patches
3834  abort-on-upstream-changes  abort-on-upstream-changes
3835  </screen>  </screen>
3836  </section>  </section>
3837  <section id="sourceopt"><title><filename>source/options</filename> file</title>  <section id="sourceopt"><title><filename>source/options</filename></title>
3838  <para>  <para>
3839  The autogenerated files in the source tree can be quite annoying for packaging  The autogenerated files in the source tree can be quite annoying for packaging
3840  since they generate meaningless large patch files.  There are custom modules  since they generate meaningless large patch files.  There are custom modules
# Line 3620  You can provide a Perl regular expressio Line 3849  You can provide a Perl regular expressio
3849  creating the source package.  creating the source package.
3850  </para>  </para>
3851  <para>  <para>
3852  You can store such <command>dpkg-source</command> option argument in the  As a general solution to address this problem of the autogenerated files,
3853  <filename>source/options</filename> file of the source package as the generic  you can store such a <command>dpkg-source</command> option argument in the
3854  solution to address this problem of the autogenerated files.  The following  <filename>source/options</filename> file of the source package.  The following
3855  will skip creating patch files for <filename>config.sub</filename>,  will skip creating patch files for <filename>config.sub</filename>,
3856  <filename>config.guess</filename> and <filename>Makefile</filename>.  <filename>config.guess</filename>, and <filename>Makefile</filename>.
3857  </para>  </para>
3858  <screen>  <screen>
3859  extend-diff-ignore = "(^|/)(config\.sub|config\.guess|Makefile)$"  extend-diff-ignore = "(^|/)(config\.sub|config\.guess|Makefile)$"
3860  </screen>  </screen>
3861  </section>  </section>
3862  <section id="patches"><title><filename>patches/*</filename> files</title>  <section id="patches"><title><filename>patches/*</filename></title>
3863  <para>  <para>
3864  The old <literal>1.0</literal> source format created a single large  The old <literal>1.0</literal> source format created a single large
3865  <filename>diff.gz</filename> file which contains package maintenance files in  <filename>diff.gz</filename> file containing package maintenance files in
3866  <filename>debian</filename> and patch files to the source.  Such a package is a  <filename>debian</filename> and patch files for the source.  Such a package is a
3867  bit cumbersome to inspect and understand for each source tree modification  bit cumbersome to inspect and understand for each source tree modification
3868  later.  This is not so nice.  later.  This is not so nice.
3869  </para>  </para>
3870  <para>  <para>
3871  The newer <literal>3.0 (quilt)</literal> source format stores patches in  The newer <literal>3.0 (quilt)</literal> source format stores patches in
3872  <filename>debian/patches/*</filename> files using the <command>quilt</command>  <filename>debian/patches/*</filename> files using the <command>quilt</command>
3873  command.  These patches and other package data which are all constrained under  command.  These patches and other package data which are all contained under
3874  the <filename>debian</filename> directory are packaged as the  the <filename>debian</filename> directory are packaged as the
3875  <filename>debian.tar.gz</filename> file.  Since the  <filename>debian.tar.gz</filename> file.  Since the
3876  <command>dpkg-source</command> command can handle <command>quilt</command>  <command>dpkg-source</command> command can handle <command>quilt</command>
3877  formatted patch data in the <literal>3.0 (quilt)</literal> source without the  formatted patch data in the <literal>3.0 (quilt)</literal> source without the
3878  <systemitem role="package">quilt</systemitem> package, it does not need to  <systemitem role="package">quilt</systemitem> package, it does not need a
3879  <literal>Build-Depends</literal> on the <systemitem role="package">quilt</systemitem> package.  <footnote><para> Several methods  <literal>Build-Depends</literal> on <systemitem role="package">quilt</systemitem>.
3880  for the patch set maintenance have been proposed and are in use with Debian  <footnote><para> Several methods of patch set maintenance have been proposed and are in use for Debian
3881  packages.  The <command>quilt</command> system is the preferred maintenance  packages.  The <command>quilt</command> system is the preferred maintenance
3882  system in use.  Other ones are <command>dpatch</command>,  system in use.  Others include <command>dpatch</command>,
3883  <command>dbs</command>, <command>cdbs</command>, etc.  Many of these keep such  <command>dbs</command>, and <command>cdbs</command>.  Many of these keep such
3884  patches as <filename>debian/patches/*</filename> files.  </para> </footnote>  patches as <filename>debian/patches/*</filename> files.  </para> </footnote>
3885  </para>  </para>
3886  <para>  <para>
# Line 3660  The <command>quilt</command> command is Line 3889  The <command>quilt</command> command is
3889  It records modifications to the source as a stack of <literal>-p1</literal>  It records modifications to the source as a stack of <literal>-p1</literal>
3890  patch files in the <filename>debian/patches</filename> directory and the source  patch files in the <filename>debian/patches</filename> directory and the source
3891  tree is untouched outside of the <filename>debian</filename> directory.  The  tree is untouched outside of the <filename>debian</filename> directory.  The
3892  order of these patches are recorded in the  order of these patches is recorded in the
3893  <filename>debian/patches/series</filename> file.  You can apply (=push),  <filename>debian/patches/series</filename> file.  You can apply (=push),
3894  un-apply (=pop), and refresh patches easily.  <footnote><para> If you are  un-apply (=pop), and refresh patches easily.  <footnote><para> If you are
3895  asking a sponsor to upload your package, this kind of clear separation and  asking a sponsor to upload your package, this kind of clear separation and
3896  documentation of your changes are very important to expedite the package review  documentation of your changes is very important to expedite the package review
3897  by your sponsor.  </para> </footnote>  by your sponsor.  </para> </footnote>
3898  </para>  </para>
3899  <para>  <para>
3900  For <xref linkend="modify"/>, we created 3 patches in  For <xref linkend="modify"/>, we created three patches in
3901  <filename>debian/patches</filename>.  <filename>debian/patches</filename>.
3902  </para>  </para>
3903  <para>  <para>
3904  Since Debian patches are located in <filename>debian/patches</filename>, please  Since Debian patches are located in <filename>debian/patches</filename>, please
3905  make sure to setup the <command>dquilt</command> command properly as described  make sure to set up the <command>dquilt</command> command properly as described
3906  in <xref linkend="quiltrc"/>.  in <xref linkend="quiltrc"/>.
3907  </para>  </para>
3908  <para>  <para>
3909  When someone (including yourself) provides you with a patch  When anyone (including yourself) provides a patch
3910  <filename><replaceable>foo</replaceable>.patch</filename> to the source later,  <filename><replaceable>foo</replaceable>.patch</filename> to the source later,
3911  then the modification of a <literal>3.0 (quilt)</literal> source package is  modifying a <literal>3.0 (quilt)</literal> source package is
3912  quite simple:  quite simple:
3913  </para>  </para>
3914  <screen>  <screen>
# Line 3693  $ dquilt header -e Line 3922  $ dquilt header -e
3922  </screen>  </screen>
3923  <para>  <para>
3924  The patches stored in the newer <literal>3.0 (quilt)</literal> source format  The patches stored in the newer <literal>3.0 (quilt)</literal> source format
3925  must be <emphasis>fuzz</emphasis> free.  You should ensure it as <literal>dquilt  must be <emphasis>fuzz</emphasis> free.  You can ensure this with <literal>dquilt
3926  pop -a; while dquilt push; do dquilt refresh; done</literal>.  pop -a; while dquilt push; do dquilt refresh; done</literal>.
3927  </para>  </para>
3928  </section>  </section>
# Line 3704  We should now be ready to build the pack Line 3933  We should now be ready to build the pack
3933  </para>  </para>
3934  <section id="completebuild"><title>Complete (re)build</title>  <section id="completebuild"><title>Complete (re)build</title>
3935  <para>  <para>
3936  In order to properly make complete (re)build of a package, you have to ensure  In order to perform a complete (re)build of a package properly, you
3937  to install  need to make sure you have installed
3938  </para>  </para>
3939  <itemizedlist>  <itemizedlist>
3940  <listitem>  <listitem>
# Line 3772  The only input that will be required of Line 4001  The only input that will be required of
4001  twice.  twice.
4002  <footnote><para>  <footnote><para>
4003  This GPG key must be signed by a Debian developer to get connected to the web  This GPG key must be signed by a Debian developer to get connected to the web
4004  of trust and must be registerd to <ulink url="&keyring;">the Debian  of trust and must be registered to <ulink url="&keyring;">the Debian
4005  keyring</ulink>.  This enables your uploaded packages to be accepted to the  keyring</ulink>.  This enables your uploaded packages to be accepted to the
4006  Debian archives.  See  Debian archives.  See
4007  <ulink url="&keycreate;">Creating a new GPG key</ulink> and  <ulink url="&keycreate;">Creating a new GPG key</ulink> and
4008  <ulink url="&keysigning; ">Debian Wiki on Keysigning</ulink>.  <ulink url="&keysigning; ">Debian Wiki on Keysigning</ulink>.
4009  </para></footnote>  </para></footnote>
4010    If you are building Debian packages only for your own local use, you can skip
4011    promptings for the GPG signatures on the <filename>.dsc</filename> file and the
4012    <filename>.changes</filename> file like this:
4013  </para>  </para>
4014    <screen>
4015    $ dpkg-buildpackage -us -uc
4016    </screen>
4017  <para>  <para>
4018  After all this is done, you will see the following files in the directory above  For a non-native Debian package, e.g.,
4019  (<filename>~/gentoo</filename>):  <systemitem role="package">gentoo</systemitem>, you will see the following
4020    files in the parent directory (<filename>~/gentoo</filename>) after building
4021    packages:
4022  </para>  </para>
4023  <itemizedlist>  <itemizedlist>
4024  <listitem>  <listitem>
# Line 3789  After all this is done, you will see the Line 4026  After all this is done, you will see the
4026  <filename>gentoo_0.9.12.orig.tar.gz</filename>  <filename>gentoo_0.9.12.orig.tar.gz</filename>
4027  </para>  </para>
4028  <para>  <para>
4029  This is the original source code tarball, merely renamed to the above so that  This is the original upstream source code tarball, merely renamed to the above so that
4030  it adheres to the Debian standard.  Note that this was created initially by the  it adheres to the Debian standard.  Note that this was created initially by the
4031  <literal>dh_make -f ../gentoo-0.9.12.tar.gz</literal>.  <literal>dh_make -f ../gentoo-0.9.12.tar.gz</literal>.
4032  </para>  </para>
# Line 3812  people can be sure that it's really your Line 4049  people can be sure that it's really your
4049  </para>  </para>
4050  <para>  <para>
4051  This compressed tarball contains your <filename>debian</filename> directory  This compressed tarball contains your <filename>debian</filename> directory
4052  contents.  Each and every addition you made to the original source code are  contents.  Each and every addition you made to the original source code is
4053  stored as <command>quilt</command> patches in  stored as a <command>quilt</command> patch in
4054  <filename>debian/patches</filename>.  <filename>debian/patches</filename>.
4055  </para>  </para>
4056  <para>  <para>
# Line 3841  install and remove this just like any ot Line 4078  install and remove this just like any ot
4078  <filename>gentoo_0.9.12-1_i386.changes</filename>  <filename>gentoo_0.9.12-1_i386.changes</filename>
4079  </para>  </para>
4080  <para>  <para>
4081  This file describes all the changes made in the current package revision, and  This file describes all the changes made in the current package revision;
4082  it is used by the Debian FTP archive maintenance programs to install the binary  it is used by the Debian FTP archive maintenance programs to install the binary
4083  and source packages in it.  It is partly generated from the  and source packages.  It is partly generated from the
4084  <filename>changelog</filename> file and the <filename>.dsc</filename> file.  <filename>changelog</filename> file and the <filename>.dsc</filename> file.
4085  This file is GPG signed, so that people can be sure that it's really yours.  This file is GPG signed, so that people can be sure that it's really yours.
4086  </para>  </para>
4087  <para>  <para>
4088  As you keep working on the package, behavior will change and new features will  As you keep working on the package, its behavior will change and new features will
4089  be added.  People downloading your package can look at this file and quickly  be added.  People downloading your package can look at this file and quickly
4090  see what has changed.  Debian archive maintenance programs will also post the  see what has changed.  Debian archive maintenance programs will also post the
4091  contents of this file to the <ulink url="&debian-devel-announce-ldo;">debian-devel-announce@lists.debian.org</ulink>  contents of this file to the <ulink url="&debian-devel-announce-ldo;">debian-devel-announce@lists.debian.org</ulink>
# Line 3858  mailing list. Line 4095  mailing list.
4095  </itemizedlist>  </itemizedlist>
4096  <para>  <para>
4097  The long strings of numbers in the <filename>.dsc</filename> and  The long strings of numbers in the <filename>.dsc</filename> and
4098  <filename>.changes</filename> files are MD5/SHA1/SHA256 checksums for the files  <filename>.changes</filename> files are SHA1/SHA256 checksums for the files
4099  mentioned.  A person downloading your files can test them with <citerefentry>  mentioned.  Anyone downloading your files can test them with <citerefentry>
4100  <refentrytitle>md5sum</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>,  <refentrytitle>sha1sum</refentrytitle> <manvolnum>1</manvolnum>
4101  <citerefentry> <refentrytitle>sha1sum</refentrytitle> <manvolnum>1</manvolnum>  </citerefentry> or <citerefentry> <refentrytitle>sha256sum</refentrytitle>
 </citerefentry>, or <citerefentry> <refentrytitle>sha256sum</refentrytitle>  
4102  <manvolnum>1</manvolnum> </citerefentry> and if the numbers don't match,  <manvolnum>1</manvolnum> </citerefentry> and if the numbers don't match,
4103  they'll know the file is corrupt or has been tampered with.  they'll know the file is corrupt or has been tampered with.
4104  </para>  </para>
4105    <para>
4106    For a native Debian package, e.g.,
4107    <systemitem role="package">mypackage</systemitem>, you will see the following
4108    files in the parent directory after building packages:
4109    </para>
4110    <itemizedlist>
4111    <listitem>
4112    <para>
4113    <filename>mypackage_1.0.tar.gz</filename>
4114    </para>
4115    <para>
4116    This is the source code tarball created from the
4117    <filename>mypackage-1.0</filename> directory by the
4118    <command>dpkg-source</command>.  (Its suffix is not <filename>orig.tar.gz</filename>.)
4119    </para>
4120    </listitem>
4121    <listitem>
4122    <para>
4123    <filename>mypackage_1.0.dsc</filename>
4124    </para>
4125    <para>
4126    This is a summary of the contents of the source code as in the non-native
4127    Debian package. (There is no Debian revision.)
4128    </para>
4129    </listitem>
4130    <listitem>
4131    <para>
4132    <filename>mypackage_1.0_i386.deb</filename>
4133    </para>
4134    <para>
4135    This is your completed binary package as in the non-native Debian package.
4136    (There is no Debian revision.)
4137    </para>
4138    </listitem>
4139    <listitem>
4140    <para>
4141    <filename>mypackage_1.0_i386.changes</filename>
4142    </para>
4143    <para>
4144    This file describes all the changes made in the current package version as in
4145    the non-native Debian package. (There is no Debian revision.)
4146    </para>
4147    </listitem>
4148    </itemizedlist>
4149  </section>  </section>
4150  <section id="autobuilder"><title>Autobuilder</title>  <section id="autobuilder"><title>Autobuilder</title>
4151  <para>  <para>
4152  Debian supports many <ulink url="&ports;">ports</ulink>  Debian supports many <ulink url="&ports;">ports</ulink>
4153  with the <ulink url="&buildd;">autobuilder  with the <ulink url="&buildd;">autobuilder
4154  network</ulink> running <command>buildd</command> daemons on many different  network</ulink> running <command>buildd</command> daemons on computers
4155  architecture computers.  Although you do not need to do this by yourself, you  of many different architectures.  Although you do not need to do this yourself, you
4156  should be aware of what will happen on your packages.  Let's look into roughly  should be aware of what will happen to your packages.  Let's look into roughly
4157  how your packages are rebuild for many different architectures by them.  how they rebuild your packages for multiple architectures.
4158  <footnote><para> The actual autobuilder system involves much more complicated  <footnote><para> The actual autobuilder system involves much more complicated
4159  schemes than the one documented here.  Such details are beyond the scope of  schemes than the one documented here.  Such details are beyond the scope of
4160  this document.  </para> </footnote>  this document.  </para> </footnote>
4161  </para>  </para>
4162  <para>  <para>
4163  For <literal>Architecture: any</literal> packages, the autobuilder system  For <literal>Architecture: any</literal> packages, the autobuilder system
4164  rebuild them.  It ensures to install  performs a rebuild.  It ensures the installation of
4165  </para>  </para>
4166  <itemizedlist>  <itemizedlist>
4167  <listitem>  <listitem>
# Line 3938  create and sign the upload <filename>.ch Line 4218  create and sign the upload <filename>.ch
4218  This is why you see your package for other architectures.  This is why you see your package for other architectures.
4219  </para>  </para>
4220  <para>  <para>
4221  Although packages listed in the <literal>Build-Depends-indep</literal> field  Although packages listed in the <literal>Build-Depends-Indep</literal> field
4222  are required to be installed for the normal packaging by us (see <xref linkend="completebuild"/>), they are not required to be installed for the  are required to be installed for our normal packaging work (see
4223  autobuilder system since it build only architecture dependent binary packages.  <xref linkend="completebuild"/>), they are not required to be installed for the
4224    autobuilder system since it builds only architecture dependent binary packages.
4225  <footnote><para> Unlike under the <systemitem role="package">pbuilder</systemitem> package, the <command>chroot</command>  <footnote><para> Unlike under the <systemitem role="package">pbuilder</systemitem> package, the <command>chroot</command>
4226  environment under the <systemitem role="package">sbuild</systemitem> package  environment under the <systemitem role="package">sbuild</systemitem> package
4227  used by the autobuilder system does not force the minimal system and may leave  used by the autobuilder system does not enforce the use of a minimal
4228  many packages installed.  </para> </footnote> This difference between normal  system and may have many leftover packages installed.  </para>
4229  packaging and autobuilder situation dictates whether you record such required  </footnote> This distinction between normal packaging and autobuilding
4230    procedures is what dictates whether you should record such required
4231  packages in the <literal>Build-Depends</literal> or  packages in the <literal>Build-Depends</literal> or
4232  <literal>Build-Depends-indep</literal> fields of the  <literal>Build-Depends-Indep</literal> fields of the
4233  <filename>debian/control</filename> file (see <xref linkend="control"/>).  <filename>debian/control</filename> file (see <xref linkend="control"/>).
4234  </para>  </para>
4235  </section>  </section>
 <section id="option-sa"><title>Including <filename>orig.tar.gz</filename> for upload</title>  
 <para>  
 When you first upload the package to the archive, you need to include the  
 original <filename>orig.tar.gz</filename> source, too.  If the Debian revision  
 number of such package is neither <literal>1</literal> nor  
 <literal>0</literal>, you must provide <command>dpkg-buildpackage</command>  
 command with the <literal>-sa</literal> option.  On the other hand, the  
 <literal>-sd</literal> option will force to exclude the original  
 <filename>orig.tar.gz</filename> source.  
 </para>  
 </section>  
4236  <section id="debuild"><title><command>debuild</command> command</title>  <section id="debuild"><title><command>debuild</command> command</title>
4237  <para>  <para>
4238  You can automate package build process of the  You can automate the <command>dpkg-buildpackage</command> command's
4239  <command>dpkg-buildpackage</command> command further with the  package build process further with the
4240  <command>debuild</command> command.  See <citerefentry>  <command>debuild</command> command.  See <citerefentry>
4241  <refentrytitle>debuild</refentrytitle> <manvolnum>1</manvolnum>  <refentrytitle>debuild</refentrytitle> <manvolnum>1</manvolnum>
4242  </citerefentry>.  </citerefentry>.
# Line 3973  You can automate package build process o Line 4244  You can automate package build process o
4244  <para>  <para>
4245  Customization of the <command>debuild</command> command can be done through  Customization of the <command>debuild</command> command can be done through
4246  <filename>/etc/devscripts.conf</filename> or  <filename>/etc/devscripts.conf</filename> or
4247  <filename>~/.devscripts</filename>.  I would suggest at least following items:  <filename>~/.devscripts</filename>.  I would suggest at least the following items:
4248  </para>  </para>
4249  <screen>  <screen>
4250  DEBSIGN_KEYID=Your_GPG_keyID  DEBSIGN_KEYID=Your_GPG_keyID
 DEBUILD_LINTIAN=yes  
4251  DEBUILD_LINTIAN_OPTS=-i -I --show-overrides  DEBUILD_LINTIAN_OPTS=-i -I --show-overrides
4252  </screen>  </screen>
4253  <para>  <para>
4254  With these, packages are signed by your specified GPG key ID (good for  With these, packages are signed by your specified GPG key ID (good for
4255  sponsoring packages) and checked by the <command>lintian</command> command in  sponsoring packages) and checked in detail by the <command>lintian</command> command.
 details.  
4256  </para>  </para>
4257  <para>  <para>
4258  Cleaning source and rebuilding package from a user account is as simple as:  Cleaning the source and rebuilding the package from your user account is as simple as:
4259  </para>  </para>
4260  <screen>  <screen>
4261  $ debuild  $ debuild
4262  </screen>  </screen>
4263  <para>  <para>
4264  Please note that the <command>dpkg-buildpackage</command> option  Here, if you are building Debian packages only for your own local use, you can skip
4265  <literal>-sa</literal> to include the original <filename>orig.tar.gz</filename>  promptings for the GPG signatures on the <filename>.dsc</filename> file and the
4266  source can be specified as:  <filename>.changes</filename> file like this:
4267  </para>  </para>
4268  <screen>  <screen>
4269  $ debuild -sa  $ debuild -us -uc
4270  </screen>  </screen>
4271  <para>  <para>
4272  You can clean source tree as simple as:  You can clean the source tree as simply as:
4273  </para>  </para>
4274  <screen>  <screen>
4275  $ debuild clean  $ debuild clean
# Line 4010  $ debuild clean Line 4279  $ debuild clean
4279  <para>  <para>
4280  For a clean room (<command>chroot</command>) build environment to verify the  For a clean room (<command>chroot</command>) build environment to verify the
4281  build dependencies, the <systemitem role="package">pbuilder</systemitem>  build dependencies, the <systemitem role="package">pbuilder</systemitem>
4282  package is very useful.  <footnote><para> Since the <systemitem role="package">pbuilder</systemitem> package is still evolving, you have to  package is very useful.  <footnote><para> Since the <systemitem
4283    role="package">pbuilder</systemitem> package is still evolving, you should
4284  check the actual configuration situation by consulting the latest official  check the actual configuration situation by consulting the latest official
4285  documentation.</para> </footnote> This ensures a clean build from the source  documentation.</para> </footnote> This ensures a clean build from the source
4286  under the <literal>sid</literal> auto-builder for different architectures and  under the <literal>sid</literal> auto-builder for different architectures and
4287  avoids the severity serious FTBFS (Fails To Build From Source) bug which is  avoids a severity serious FTBFS (Fails To Build From Source) bug which is
4288  always in the RC (release critical) category.  always in the RC (release critical) category.
4289  <footnote><para>See <ulink url="&buildd-do;"/> for more on the  <footnote><para>See <ulink url="&buildd-do;"/> for more on
4290  auto-builder of the Debian package.</para></footnote>  Debian package auto-building.</para></footnote>
4291  </para>  </para>
4292  <para>  <para>
4293  Let's customize the <systemitem role="package">pbuilder</systemitem> package by  Let's customize the <systemitem role="package">pbuilder</systemitem> package as
4294  the following.  follows:
4295  </para>  </para>
4296  <itemizedlist>  <itemizedlist>
4297  <listitem>  <listitem>
4298  <para>  <para>
4299  setting <filename>/var/cache/pbuilder/result</filename> directory writable by  setting the <filename>/var/cache/pbuilder/result</filename> directory writable by
4300  the user.  for your user account.
4301  </para>  </para>
4302  </listitem>  </listitem>
4303  <listitem>  <listitem>
4304  <para>  <para>
4305  creating a directory, e.g.  creating a directory, e.g.
4306  <filename><replaceable>/var/cache/pbuilder/hooks</replaceable></filename>,  <filename><replaceable>/var/cache/pbuilder/hooks</replaceable></filename>,
4307  writable by the user to place hook scripts.  writable by the user, to place hook scripts in.
4308  </para>  </para>
4309  </listitem>  </listitem>
4310  <listitem>  <listitem>
4311  <para>  <para>
4312  setting <filename>~/.pbuilderrc</filename> or  configuring <filename>~/.pbuilderrc</filename> or
4313  <filename>/etc/pbuilderrc</filename> to include as follows.  <filename>/etc/pbuilderrc</filename> to include the followsing.
4314  </para>  </para>
4315  <screen>  <screen>
4316  AUTO_DEBSIGN=yes  AUTO_DEBSIGN=${AUTO_DEBSIGN:-yes}
4317  HOOKDIR=<replaceable>/var/cache/pbuilder/hooks</replaceable>  HOOKDIR=<replaceable>/var/cache/pbuilder/hooks</replaceable>
4318  </screen>  </screen>
4319  </listitem>  </listitem>
# Line 4053  This will allow you to sign generated pa Line 4323  This will allow you to sign generated pa
4323  <filename>~/.gnupg/</filename> directory.  <filename>~/.gnupg/</filename> directory.
4324  </para>  </para>
4325  <para>  <para>
4326  Let's then initialize the local <systemitem role="package">pbuilder</systemitem> <command>chroot</command> system first as  First let's initialize the local <systemitem role="package">pbuilder</systemitem> <command>chroot</command> system as
4327  follows.  follows.
4328  </para>  </para>
4329  <screen>  <screen>
4330  $ sudo pbuilder create  $ sudo pbuilder create
4331  </screen>  </screen>
4332  <para>  <para>
4333  If you already have the completed source packages, issue the following commands  If you already have a completed source package, issue the following commands
4334  in the directory where the  in the directory where the
4335  <filename><replaceable>foo</replaceable>.orig.tar.gz</filename>,  <filename><replaceable>foo</replaceable>.orig.tar.gz</filename>,
4336  <filename><replaceable>foo</replaceable>.debian.tar.gz</filename>, and  <filename><replaceable>foo</replaceable>.debian.tar.gz</filename>, and
# Line 4070  the local <systemitem role="package">pbu Line 4340  the local <systemitem role="package">pbu
4340  </para>  </para>
4341  <screen>  <screen>
4342  $ sudo pbuilder --update  $ sudo pbuilder --update
4343  $ sudo pbuilder --build <replaceable>foo</replaceable>.dsc  $ sudo pbuilder --build <replaceable>foo_version</replaceable>.dsc
4344  </screen>  </screen>
4345  <para>  <para>
4346  Please note that the <command>dpkg-buildpackage</command> option  The newly built packages without the GPG signatures will be located in
4347  <literal>-sa</literal> to include the original <filename>orig.tar.gz</filename>  <filename>/var/cache/pbuilder/result/</filename> with non-root ownership.
 source can be specified as:  
4348  </para>  </para>
 <screen>  
 $ sudo pbuilder --build --debbuildopts -sa <replaceable>foo</replaceable>.dsc  
 </screen>  
4349  <para>  <para>
4350  The newly built packages will be located in  The GPG signatures on the <filename>.dsc</filename> file and the
4351  <filename>/var/cache/pbuilder/result/</filename> with non-root ownership.  <filename>.changes</filename> file can be generated as:
4352  </para>  </para>
4353    <screen>
4354    $ cd /var/cache/pbuilder/result/
4355    $ debsign <replaceable>foo_version</replaceable>.dsc
4356    $ debsign <replaceable>foo_version_arch</replaceable>.changes
4357    </screen>
4358  <para>  <para>
4359  If you already have the updated source tree without generating the matching  If you have an updated source tree but have not generated the matching
4360  source packages, issue the following commands in the source directory where the  source package, issue the following commands in the source directory where the
4361  <filename>debian</filename> directory exists, instead.  <filename>debian</filename> directory exists, instead.
4362  </para>  </para>
4363  <screen>  <screen>
# Line 4094  $ sudo pbuilder --update Line 4365  $ sudo pbuilder --update
4365  $ pdebuild  $ pdebuild
4366  </screen>  </screen>
4367  <para>  <para>
4368  Please note that the <command>dpkg-buildpackage</command> option  Here, if you are building Debian packages only for your local use, you can skip
4369  <literal>-sa</literal> to include the original <filename>orig.tar.gz</filename>  promptings for the GPG signatures on the <filename>.dsc</filename> file and the
4370  source can be specified as:  <filename>.changes</filename> file as:
4371  </para>  </para>
4372  <screen>  <screen>
4373  $ pdebuild --debbuildopts -sa  $ AUTO_DEBSIGN=no pdebuild
4374  </screen>  </screen>
4375  <para>  <para>
4376  You can log into its <command>chroot</command> environment with the  You can log into its <command>chroot</command> environment with the
# Line 4113  the <literal>chroot</literal> environmen Line 4384  the <literal>chroot</literal> environmen
4384  <filename><replaceable>/var/cache/pbuilder/hooks</replaceable>/B90lintian</filename>  <filename><replaceable>/var/cache/pbuilder/hooks</replaceable>/B90lintian</filename>
4385  configured as follows.  <footnote><para> This assumes  configured as follows.  <footnote><para> This assumes
4386  <literal>HOOKDIR=/var/cache/pbuilder/hooks</literal>.  You can find many  <literal>HOOKDIR=/var/cache/pbuilder/hooks</literal>.  You can find many
4387  examples of the hook script in the  examples of hook scripts in the
4388  <filename>/usr/share/doc/pbuilder/examples</filename> directory.  </para>  <filename>/usr/share/doc/pbuilder/examples</filename> directory.  </para>
4389  </footnote>  </footnote>
4390  </para>  </para>
# Line 4132  echo +++ end of lintian output +++ Line 4403  echo +++ end of lintian output +++
4403  </screen>  </screen>
4404  <para>  <para>
4405  You need to have access to the latest <literal>sid</literal> environment to  You need to have access to the latest <literal>sid</literal> environment to
4406  build packages properly for <literal>sid</literal>.  In reality,  build packages properly for <literal>sid</literal>.  In practice,
4407  <literal>sid</literal> may be experiencing issues which makes it not desirable  <literal>sid</literal> may be experiencing issues which makes it undesirable
4408  for you to migrate your whole system.  The <systemitem role="package">pbuilder</systemitem> package can help you to cope with this  for you to migrate your whole system.  The <systemitem role="package">pbuilder</systemitem> package can help you to cope with this
4409  kind of situation.  kind of situation.
4410  </para>  </para>
# Line 4142  You may need to update your <literal>sta Line 4413  You may need to update your <literal>sta
4413  release for <literal>stable-proposed-updates</literal>,  release for <literal>stable-proposed-updates</literal>,
4414  <literal>stable/updates</literal>, etc.  <footnote><para> There are some  <literal>stable/updates</literal>, etc.  <footnote><para> There are some
4415  restrictions for such updates of your <literal>stable</literal> package.  restrictions for such updates of your <literal>stable</literal> package.
4416  </para> </footnote> For such occasions, I am running <literal>sid</literal>  </para> </footnote> For such occasions, the fact you may be running a <literal>sid</literal>
4417  system is not good enough excuse not to update them promptly.  The <systemitem role="package">pbuilder</systemitem> package can help you to access  system is not a good enough excuse for failing to update them promptly.  The <systemitem role="package">pbuilder</systemitem> package can help you to access
4418  environments of almost any Debian derivative distributions of the same CPU  environments of almost any Debian derivative distribution of the same CPU
4419  architecture.  architecture.
4420  </para>  </para>
4421  <para>  <para>
# Line 4158  See <ulink url="&pbuilder;"/>, Line 4429  See <ulink url="&pbuilder;"/>,
4429  </section>  </section>
4430  <section id="git-buildpackage"><title><command>git-buildpackage</command> command and similars</title>  <section id="git-buildpackage"><title><command>git-buildpackage</command> command and similars</title>
4431  <para>  <para>
4432  If your upstream uses the source code management system (VCS)  If your upstream uses a source code management system (VCS)
4433  <footnote><para>See <ulink url="&debref-vcs;">Version control systems</ulink> for more.</para></footnote>  <footnote><para>See <ulink url="&debref-vcs;">Version control systems</ulink> for more.</para></footnote>
4434  to maintain their code, you should consider to use them.  That makes merging  to maintain their code, you should consider using it as well.  This makes merging
4435  and cherry-picking upstream patches much easier.  There are several specialized  and cherry-picking upstream patches much easier.  There are several specialized
4436  wrapper script packages for the Debian package building for each VCS.  wrapper script packages for Debian package building for each VCS.
4437  </para>  </para>
4438  <itemizedlist>  <itemizedlist>
4439  <listitem>  <listitem>
4440  <para>  <para>
4441  <systemitem role="package">git-buildpackage</systemitem>: Suite to help with  <systemitem role="package">git-buildpackage</systemitem>: a suite to help with
4442  Debian packages in Git repositories.  Debian packages in Git repositories.
4443  </para>  </para>
4444  </listitem>  </listitem>
# Line 4179  maintain Debian packages with Subversion Line 4450  maintain Debian packages with Subversion
4450  </listitem>  </listitem>
4451  <listitem>  <listitem>
4452  <para>  <para>
4453  <systemitem role="package">cvs-buildpackage</systemitem>: A set of Debian  <systemitem role="package">cvs-buildpackage</systemitem>: a set of Debian
4454  package scripts for CVS source trees.  package scripts for CVS source trees.
4455  </para>  </para>
4456  </listitem>  </listitem>
4457  </itemizedlist>  </itemizedlist>
4458  <para>  <para>
4459  There are packages which <emphasis>automate</emphasis> building of packages  For advanced audiences, there are packages which <emphasis>automate</emphasis>
4460  under VCS managed source tree for advanced audiences.  I will not explain them  the building of packages under a VCS-managed source tree.  I will not explain them
4461  in this tutorial.  in this tutorial.
4462  <footnote><para> Here are few web resources available for advanced audiences.  </para>  <footnote><para> Here are some web resources available for advanced audiences.  </para>
4463  <itemizedlist>  <itemizedlist>
4464  <listitem> <para> <ulink url="&git-buildpackage-doc;">Building Debian Packages with git-buildpackage</ulink> </para> </listitem>  <listitem> <para> <ulink url="&git-buildpackage-doc;">Building Debian Packages with git-buildpackage</ulink> </para> </listitem>
4465  <listitem> <para> <ulink url="&debian-packages-git;">debian packages in git</ulink> </para> </listitem>  <listitem> <para> <ulink url="&debian-packages-git;">debian packages in git</ulink> </para> </listitem>
4466  <listitem> <para> <ulink url="&git-debian-packaging;">Using Git for Debian Packaging</ulink> </para> </listitem>  <listitem> <para> <ulink url="&git-debian-packaging;">Using Git for Debian Packaging</ulink> </para> </listitem>
4467  <listitem> <para> <ulink url="&git-dpm;">git-dpm: Debian packages in Git manager</ulink> </para> </listitem>  <listitem> <para> <ulink url="&git-dpm;">git-dpm: Debian packages in Git manager</ulink> </para> </listitem>
4468  <listitem> <para> <ulink url="&topgit;">Using TopGit to generate quilt series for Debian packaging</ulink> </para> </listitem>  <listitem> <para> <ulink url="&topgit;">Using TopGit to generate quilt series for Debian packaging</ulink> </para> </listitem>
# Line 4202  in this tutorial. Line 4473  in this tutorial.
4473  <section id="quickrebuild"><title>Quick rebuild</title>  <section id="quickrebuild"><title>Quick rebuild</title>
4474  <para>  <para>
4475  With a large package, you may not want to rebuild from scratch every time while  With a large package, you may not want to rebuild from scratch every time while
4476  you tune details in <filename>debian/rules</filename>.  For testing purposes,  you're tuning details in <filename>debian/rules</filename>.  For testing purposes,
4477  you can make a <filename>.deb</filename> file without rebuilding the upstream  you can make a <filename>.deb</filename> file without rebuilding the upstream
4478  sources like this <footnote><para> Environment variables which are normally  sources like this<footnote><para> Environment variables which are normally
4479  configured to proper values are not set by this method.  Never create real  configured to proper values are not set by this method.  Never create real
4480  packages to be uploaded using this <emphasis role="strong">quick</emphasis>  packages to be uploaded using this <emphasis role="strong">quick</emphasis>
4481  method.  </para> </footnote>:  method.  </para> </footnote>:
# Line 4213  method.  </para> </footnote>: Line 4484  method.  </para> </footnote>:
4484  $ fakeroot debian/rules binary  $ fakeroot debian/rules binary
4485  </screen>  </screen>
4486  <para>  <para>
4487  Or, simply as following to see if it build or not.  Or simply do the following to see if it builds or not:
4488  </para>  </para>
4489  <screen>  <screen>
4490  $ fakeroot debian/rules build  $ fakeroot debian/rules build
# Line 4227  proper procedure.  You may not be able t Line 4498  proper procedure.  You may not be able t
4498  </chapter>  </chapter>
4499  <chapter id="checkit"><title>Checking the package for errors</title>  <chapter id="checkit"><title>Checking the package for errors</title>
4500  <para>  <para>
4501  There are few chores you should know to check the package for errors by  There are some techniques you should know for checking a package for errors
4502  yourself before uploading packages to public archives.  before uploading it to the public archives.
4503  </para>  </para>
4504  <para>  <para>
4505  Testing on machine other than your own is also good idea.  You must watch  It's also a good idea to carry out testing on a machine other than your own.  You must watch
4506  closely for any warnings or errors for all the test described here.  closely for any warnings or errors for all the tests described here.
4507  </para>  </para>
4508  <section id="pinstall"><title>Verifying package for install</title>  <section id="inadvent"><title>Suspicious changes</title>
4509  <para>  <para>
4510  You must test your package if it installs without problem.  The <citerefentry>  If you find a new autogenerated patch file such as
4511    <filename>debian-changes-*</filename> in the
4512    <filename>debian/patches</filename> directory after building your non-native
4513    Debian package in <literal>3.0 (quilt)</literal> format, chances are you
4514    changed some files by accident or the build script modified the upstream
4515    source.  If it is your mistake, fix it.  If it is caused by the build script,
4516    fix the root cause with <command>dh-autoreconf</command> as in
4517    <xref linkend="customrules"/> or work around it with
4518    <filename>source/options</filename> as in <xref linkend="sourceopt"/>.
4519    </para>
4520    </section>
4521    <section id="pinstall"><title>Verifying a package's installation</title>
4522    <para>
4523    You must test your package for whether it installs without problem.  The <citerefentry>
4524  <refentrytitle>debi</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>  <refentrytitle>debi</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>
4525  command helps you to test to install all the generated binary packages.  command helps you to test installing all the generated binary packages.
4526  </para>  </para>
4527  <screen>  <screen>
4528  $ sudo debi gentoo_0.9.12-1_i386.changes  $ sudo debi gentoo_0.9.12-1_i386.changes
4529  </screen>  </screen>
4530  <para>  <para>
4531  You have to make sure that there are no overlapped files with other existing  To prevent installation problem on different systems, you must make
4532  packages using the  sure that there are no filenames conflicting with other existing packages,
4533    using the
4534  <filename>Contents-<replaceable>i386</replaceable></filename> file downloaded  <filename>Contents-<replaceable>i386</replaceable></filename> file downloaded
4535  from the Debian archive to prevent installation problem on different systems.  from the Debian archive,
4536  The <command>apt-file</command> command may be handy for this task.  If there  The <command>apt-file</command> command may be handy for this task.  If there
4537  are overlapped files, please take actions to avoid the real problem using the  are collisions, please take action to avoid this real problem, whether by
4538  alternatives mechanism (see <citerefentry>  renaming the file, moving a common file to a separate package that
4539  <refentrytitle>update-alternatives</refentrytitle> <manvolnum>1</manvolnum>  multiple packages can depend on, using the alternatives mechanism (see
4540  </citerefentry>) by coordinating with other affected packages or by setting the  <citerefentry><refentrytitle>update-alternatives</refentrytitle>
4541  <literal>Conflicts</literal> entry in the <filename>debian/control</filename>  <manvolnum>1</manvolnum></citerefentry>) in coordination with the
4542  file.  maintainers of other affected packages, or declaring a
4543    <literal>Conflicts</literal> relationship in the
4544    <filename>debian/control</filename> file.
4545  </para>  </para>
4546  </section>  </section>
4547  <section id="pmaintscripts"><title>Verifying package for <emphasis>maintainer scripts</emphasis></title>  <section id="pmaintscripts"><title>Verifying a package's maintainer scripts</title>
4548  <para>  <para>
4549  All <emphasis>maintainer scripts</emphasis>, i.e.,  All maintainer scripts (that is,
4550  <filename>preinst</filename>, <filename>prerm</filename>,  <filename>preinst</filename>, <filename>prerm</filename>,
4551  <filename>postinst</filename>, and <filename>postrm</filename> files, are  <filename>postinst</filename>, and <filename>postrm</filename> files) are
4552  non-trivial unless they are auto-generated by the <systemitem role="package">debhelper</systemitem> programs.  So do not use them if you are  hard to write correctly unless they are auto-generated by the
4553    <systemitem role="package">debhelper</systemitem> programs.  So do not use them if you are
4554  a novice maintainer (see <xref linkend="maintscripts"/>).  a novice maintainer (see <xref linkend="maintscripts"/>).
4555  </para>  </para>
4556  <para>  <para>
4557  If the package makes use of these non-trivial <emphasis>maintainer  If the package makes use of these non-trivial maintainer scripts, be sure to test not only for install but also for remove,
4558  scripts</emphasis>, be sure to test not only for install but also for remove,  purge, and upgrade processes.  Many maintainer script bugs show up
 purge, and upgrade.  Many <emphasis>maintainer script</emphasis> bugs show up  
4559  when packages are removed or purged.  Use the <command>dpkg</command> command  when packages are removed or purged.  Use the <command>dpkg</command> command
4560  as follows to test them.  as follows to test them.
4561  </para>  </para>
# Line 4332  people will often be upgrading to your p Line 4619  people will often be upgrading to your p
4619  last Debian release.  Remember to test upgrades from that version too.  last Debian release.  Remember to test upgrades from that version too.
4620  </para>  </para>
4621  <para>  <para>
4622  Although downgrade is not officially supported, it should be nice to support  Although downgrading is not officially supported, supporting it is a
4623  it.  friendly gesture.
4624  </para>  </para>
4625  </section>  </section>
4626  <section id="lintians"><title><systemitem role="package">lintian</systemitem> package</title>  <section id="lintians"><title>Using <systemitem role="package">lintian</systemitem></title>
4627  <para>  <para>
4628  Run <citerefentry> <refentrytitle>lintian</refentrytitle>  Run <citerefentry> <refentrytitle>lintian</refentrytitle>
4629  <manvolnum>1</manvolnum> </citerefentry> on your <filename>.changes</filename>  <manvolnum>1</manvolnum> </citerefentry> on your <filename>.changes</filename>
# Line 4353  $ lintian -i -I --show-overrides gentoo_ Line 4640  $ lintian -i -I --show-overrides gentoo_
4640  <para>  <para>
4641  Of course, replace the filename with the name of the  Of course, replace the filename with the name of the
4642  <filename>.changes</filename> file generated for your package.  The output of  <filename>.changes</filename> file generated for your package.  The output of
4643  the <command>lintian</command> command are marked as follows.  the <command>lintian</command> command uses the following flags.
4644  </para>  </para>
4645  <itemizedlist>  <itemizedlist>
4646  <listitem>  <listitem>
4647  <para>  <para>
4648  <literal>E:</literal> for error; a sure policy violation or a packaging error.  <literal>E:</literal> for error; a sure policy violation or packaging error.
4649  </para>  </para>
4650  </listitem>  </listitem>
4651  <listitem>  <listitem>
4652  <para>  <para>
4653  <literal>W:</literal> for warning; a possible policy violation or a packaging  <literal>W:</literal> for warning; a possible policy violation or packaging
4654  error.  error.
4655  </para>  </para>
4656  </listitem>  </listitem>
4657  <listitem>  <listitem>
4658  <para>  <para>
4659  <literal>I:</literal> for info; a information on certain packaging aspects.  <literal>I:</literal> for info; information on certain aspects of packaging.
4660  </para>  </para>
4661  </listitem>  </listitem>
4662  <listitem>  <listitem>
# Line 4386  error. Line 4673  error.
4673  </listitem>  </listitem>
4674  </itemizedlist>  </itemizedlist>
4675  <para>  <para>
4676  For warnings, tune the package to avoid them or verify that the warnings are  When you see warnings, tune the package to avoid them or verify that the warnings are
4677  spurious.  If spurious, set the <filename>lintian-overrides</filename> files as  spurious.  If spurious, set up <filename>lintian-overrides</filename> files as
4678  described in <xref linkend="lintian"/>.  described in <xref linkend="lintian"/>.
4679  </para>  </para>
4680  <para>  <para>
4681  Note that you can build the package with <command>dpkg-buildpackage</command>  Note that you can build the package with <command>dpkg-buildpackage</command>
4682  and run <command>lintian</command> on it in one command with <citerefentry>  and run <command>lintian</command> on it in one command, if you use <citerefentry>
4683  <refentrytitle>debuild</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>  <refentrytitle>debuild</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>
4684  or with <citerefentry> <refentrytitle>pdebuild</refentrytitle>  or <citerefentry> <refentrytitle>pdebuild</refentrytitle>
4685  <manvolnum>1</manvolnum> </citerefentry>.  <manvolnum>1</manvolnum> </citerefentry>.
4686  </para>  </para>
4687  </section>  </section>
4688  <section id="debc"><title><command>debc</command> command</title>  <section id="debc"><title>The <command>debc</command> command</title>
4689  <para>  <para>
4690  You can list files in the binary Debian package by <citerefentry>  You can list files in the binary Debian package with the <citerefentry>
4691  <refentrytitle>debc</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>  <refentrytitle>debc</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>
4692  command.  command.
4693  </para>  </para>
# Line 4408  command. Line 4695  command.
4695  $ debc <replaceable>package</replaceable>.changes  $ debc <replaceable>package</replaceable>.changes
4696  </screen>  </screen>
4697  </section>  </section>
4698  <section id="debdiff"><title><command>debdiff</command> command</title>  <section id="debdiff"><title>The <command>debdiff</command> command</title>
4699  <para>  <para>
4700  You can compare file contents in two source Debian packages with the  You can compare file contents in two source Debian packages with the
4701  <citerefentry> <refentrytitle>debdiff</refentrytitle> <manvolnum>1</manvolnum>  <citerefentry> <refentrytitle>debdiff</refentrytitle> <manvolnum>1</manvolnum>
# Line 4426  You can also compare file lists in two s Line 4713  You can also compare file lists in two s
4713  $ debdiff <replaceable>old-package</replaceable>.changes <replaceable>new-package</replaceable>.changes  $ debdiff <replaceable>old-package</replaceable>.changes <replaceable>new-package</replaceable>.changes
4714  </screen>  </screen>
4715  <para>  <para>
4716  These are useful to identify what has been changed in the source packages, if  These are useful to identify what has been changed in the source packages
4717  no files have been unintentionally misplaced or removed in the binary packages,  and to check for inadvertent changes made when updating binary
4718  and if no other inadvertent changes were made when updating binary packages.  packages, such as unintentionally misplacing or removing files.
4719  </para>  </para>
4720  </section>  </section>
4721  <section id="interdiff"><title><command>interdiff</command> command</title>  <section id="interdiff"><title>The <command>interdiff</command> command</title>
4722  <para>  <para>
4723  You can compare two <filename>diff.gz</filename> files with the <citerefentry>  You can compare two <filename>diff.gz</filename> files with the <citerefentry>
4724  <refentrytitle>interdiff</refentrytitle> <manvolnum>1</manvolnum>  <refentrytitle>interdiff</refentrytitle> <manvolnum>1</manvolnum>
# Line 4448  files as described in <xref linkend="pat Line 4735  files as described in <xref linkend="pat
4735  <filename>debian/patches/*</filename> file using <command>interdiff</command>, too.  <filename>debian/patches/*</filename> file using <command>interdiff</command>, too.
4736  </para>  </para>
4737  </section>  </section>
4738  <section id="mc"><title><command>mc</command> command</title>  <section id="mc"><title>The <command>mc</command> command</title>
4739  <para>  <para>
4740  Many of these file inspection operations can be made into an intuitive process  Many of these file inspection operations can be made into an intuitive process
4741  by using a file manager like <citerefentry> <refentrytitle>mc</refentrytitle>  by using a file manager like <citerefentry> <refentrytitle>mc</refentrytitle>
# Line 4460  contents of <filename>*.deb</filename> p Line 4747  contents of <filename>*.deb</filename> p
4747  <para>  <para>
4748  Be on the lookout for extra unneeded files or zero length files, both in the  Be on the lookout for extra unneeded files or zero length files, both in the
4749  binary and source package.  Often cruft doesn't get cleaned up properly; adjust  binary and source package.  Often cruft doesn't get cleaned up properly; adjust
4750  your <filename>rules</filename> file to compensate for that.  your <filename>rules</filename> file to compensate for this.
4751  </para>  </para>
4752  </section>  </section>
4753  </chapter>  </chapter>
# Line 4473  a public archive to share it. Line 4760  a public archive to share it.
4760  <para>  <para>
4761  Once you become an official developer,  Once you become an official developer,
4762  <footnote><para>  <footnote><para>
4763  See <xref linkend="debiandeveloper"/>.  See <xref linkend="socialdynamics"/>.
4764  </para></footnote>  </para></footnote>
4765  you can upload the package to the Debian archive.  you can upload the package to the Debian archive.
4766  <footnote><para>  <footnote><para>
4767  There are publicly accessible archives such as <ulink url="&mentors-dn;"/>  There are publicly accessible archives such as <ulink url="&mentors-dn;"/>
4768  which work almost the same way as Debian archive and provide upload area for  which work almost the same way as the Debian archive and provide an upload area for
4769  the non-DD.  You can set up an equivalent archive by yourself using tools  non-DDs.  You can set up an equivalent archive by yourself using the tools
4770  listed at <ulink url="&deb-archive;"/>.  So this section is useful for the  listed at <ulink url="&deb-archive;"/>.  So this section is useful for
4771  non-DD, too.  non-DDs, too.
4772  </para></footnote>  </para></footnote>
4773  You can do this manually, but it's easier to use the existing  You can do this manually, but it's easier to use the existing
4774  automated tools, like <citerefentry> <refentrytitle>dupload</refentrytitle>  automated tools, like <citerefentry> <refentrytitle>dupload</refentrytitle>
# Line 4489  automated tools, like <citerefentry> <re Line 4776  automated tools, like <citerefentry> <re
4776  <refentrytitle>dput</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>.  <refentrytitle>dput</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>.
4777  We'll describe how it's done with <command>dupload</command>.  <footnote><para>  We'll describe how it's done with <command>dupload</command>.  <footnote><para>
4778  The <systemitem role="package">dput</systemitem> package seems to come with  The <systemitem role="package">dput</systemitem> package seems to come with
4779  more features and becoming more popular than the <systemitem role="package">dupload</systemitem> package.  It uses the  more features and to be becoming more popular than the <systemitem role="package">dupload</systemitem> package.  It uses the
4780  <filename>/etc/dput</filename> file for the global configuration and the  file <filename>/etc/dput</filename> for its global configuration and the
4781  <filename>~/.dput.cf</filename> file for the per-user one.  It supports Ubuntu  file <filename>~/.dput.cf</filename> for per-user configuration.  It supports
4782  related services out-of-box, too.  </para> </footnote>  Ubuntu-related services out-of-the-box, too.  </para> </footnote>
4783  </para>  </para>
4784  <para>  <para>
4785  First you have to set up <command>dupload</command>'s config file.  You can  First you have to set up <command>dupload</command>'s config file.  You can
# Line 4509  these options means. Line 4796  these options means.
4796  The <literal>$default_host</literal> option determines which of the upload  The <literal>$default_host</literal> option determines which of the upload
4797  queues will be used by default.  <literal>anonymous-ftp-master</literal> is the  queues will be used by default.  <literal>anonymous-ftp-master</literal> is the
4798  primary one, but it's possible that you will want to use another one.  primary one, but it's possible that you will want to use another one.
4799  <footnote><para>See <ulink url="&devref-upload;">Debian Developer's Reference 5.6. 'Uploading a package'</ulink>.</para></footnote>  <footnote><para>See <ulink url="&devref-upload;">Debian Developer's Reference 5.6. "Uploading a package"</ulink>.</para></footnote>
4800  </para>  </para>
4801  <para>  <para>
4802  While connected to the Internet, you can upload your package by the following:  While connected to the Internet, you can upload your package as follows:
4803  </para>  </para>
4804  <screen>  <screen>
4805  $ dupload gentoo_0.9.12-1_i386.changes  $ dupload gentoo_0.9.12-1_i386.changes
4806  </screen>  </screen>
4807  <para>  <para>
4808  <command>dupload</command> checks that the MD5/SHA1/SHA256 checksums of the  <command>dupload</command> checks that the SHA1/SHA256 file checksums
4809  files match those from the <filename>.changes</filename> file.  If they do not  match those listed in the <filename>.changes</filename> file.  If they do not
4810  match, it will warn you to rebuild it as described in <xref linkend="completebuild"/> so it can be properly uploaded.  match, it will warn you to rebuild it as described in <xref linkend="completebuild"/> so it can be properly uploaded.
4811  </para>  </para>
4812  <!--  <!--
# Line 4529  will ask for your password on Debian mac Line 4816  will ask for your password on Debian mac
4816  -->  -->
4817  <para>  <para>
4818  If you encounter an upload problem at <ulink url="&uploadqueue;"/>, you can fix this  If you encounter an upload problem at <ulink url="&uploadqueue;"/>, you can fix this
4819  by manually uploading GPG signed <filename>*.commands</filename> file to there  by manually uploading a GPG-signed <filename>*.commands</filename> file to there
4820  with <command>ftp</command>.  <footnote><para> See <ulink url="&uploadqueue-readme;"/>.  Alternatively, you may  with <command>ftp</command>.  <footnote><para> See <ulink url="&uploadqueue-readme;"/>.  Alternatively, you can
4821  use <command>dcut</command> command from the <systemitem role="package">dput</systemitem> package.  </para> </footnote> For example, use  use the <command>dcut</command> command from the <systemitem
4822    role="package">dput</systemitem> package.  </para> </footnote> For example, using
4823  <filename>hello.commands</filename>:  <filename>hello.commands</filename>:
4824  </para>  </para>
4825  <screen>  <screen>
4826  -----BEGIN PGP SIGNED MESSAGE-----  -----BEGIN PGP SIGNED MESSAGE-----
4827    Hash: SHA1
4828  Uploader: Foo Bar &lt;Foo.Bar@example.org&gt;  Uploader: Foo Bar &lt;Foo.Bar@example.org&gt;
4829  Commands:  Commands:
4830   rm hello_1.0-1_i386.deb   rm hello_1.0-1_i386.deb
4831   mv hello_1.0-1.dsx hello_1.0-1.dsc   mv hello_1.0-1.dsx hello_1.0-1.dsc
4832  -----BEGIN PGP SIGNATURE-----  -----BEGIN PGP SIGNATURE-----
4833  Version: 2.6.3ia  Version: GnuPG v1.4.10 (GNU/Linux)
4834  iQCVAwUBNFiQSXVhJ0HiWnvJAQG58AP+IDJVeSWmDvzMUphScg1EK0mvChgnuD7h