| 1 |
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
<!-- -*- DocBook -*- -->
|
| 3 |
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
| 4 |
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
| 5 |
<!ENTITY % trans SYSTEM "po4a/maint-guide.en.ent"> %trans;
|
| 6 |
<!ENTITY % common SYSTEM "common.ent"> %common;
|
| 7 |
<!ENTITY % version SYSTEM "version.ent"> %version;
|
| 8 |
]>
|
| 9 |
<book lang="en">
|
| 10 |
<!-- This is UTF-8 encoded. -->
|
| 11 |
<!--
|
| 12 |
This is reorganized to make this document robust for translation
|
| 13 |
when some externally referenced information changes.
|
| 14 |
|
| 15 |
If you want to add extra contents to this document, please do so by
|
| 16 |
* adding tag like &othercredit; in English and provide it for each language.
|
| 17 |
* add extra content within msgstr but within <footnote>...</footnote>
|
| 18 |
Please note there will be content checker to match tags of msgid and msgstr.
|
| 19 |
The second rule is a way to get exception to this rule.
|
| 20 |
|
| 21 |
Please try to correct something in translation. If you think contents needs fix,
|
| 22 |
Let's fix it in the root cause.
|
| 23 |
|
| 24 |
Please understand to keep this document focused. Not everything you think important
|
| 25 |
for new maintainer should be written down. Something social needs to be elsewhere.
|
| 26 |
Some thing should be left to the practice. Something needs to be left for exercise
|
| 27 |
for people to check official documentations.
|
| 28 |
-->
|
| 29 |
<title>Debian New Maintainers' Guide</title>
|
| 30 |
<bookinfo>
|
| 31 |
<authorgroup>
|
| 32 |
<!-- do not use firstname and surname tags it braks Japanese. The same with othercredit -->
|
| 33 |
<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 -->
|
| 36 |
&othercredit;
|
| 37 |
</authorgroup>
|
| 38 |
<releaseinfo>version &docversion;</releaseinfo>
|
| 39 |
<pubdate>&docisodate;</pubdate>
|
| 40 |
<copyright><year>1998-2002</year> <holder>Josip Rodin</holder></copyright>
|
| 41 |
<copyright><year>2005-2011</year> <holder>Osamu Aoki</holder></copyright>
|
| 42 |
<copyright><year>2010</year> <holder>Craig Small</holder></copyright>
|
| 43 |
<copyright><year>2010</year> <holder>Raphaël Hertzog</holder></copyright>
|
| 44 |
<legalnotice>
|
| 45 |
<para>
|
| 46 |
This document may be used under the terms the GNU General Public License
|
| 47 |
version 2 or higher.
|
| 48 |
</para>
|
| 49 |
<para>
|
| 50 |
This document was made using these two documents as examples:
|
| 51 |
</para>
|
| 52 |
<itemizedlist>
|
| 53 |
<listitem>
|
| 54 |
<para>
|
| 55 |
Making a Debian Package (AKA the Debmake Manual), copyright © 1997 Jaldhar
|
| 56 |
Vyas.
|
| 57 |
</para>
|
| 58 |
</listitem>
|
| 59 |
<listitem>
|
| 60 |
<para>
|
| 61 |
The New-Maintainer's Debian Packaging Howto, copyright © 1997 Will Lowe.
|
| 62 |
</para>
|
| 63 |
</listitem>
|
| 64 |
</itemizedlist>
|
| 65 |
</legalnotice>
|
| 66 |
<!-- toc -->
|
| 67 |
</bookinfo>
|
| 68 |
<chapter id="start"><title>Getting started The Right Way</title>
|
| 69 |
<para>
|
| 70 |
This document tries to describe the building of a Debian package to ordinary
|
| 71 |
Debian users and prospective developers. It uses fairly non-technical language, and
|
| 72 |
it's well covered with working examples. There is an old Latin saying:
|
| 73 |
<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
|
| 75 |
examples).
|
| 76 |
</para>
|
| 77 |
<para>
|
| 78 |
This document has been updated for the Debian <literal>&base-release;</literal>
|
| 79 |
release.
|
| 80 |
<footnote><para> The document assumes you are using a
|
| 81 |
<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
|
| 83 |
install backported <systemitem role="package">dpkg</systemitem> and
|
| 84 |
<systemitem role="package">debhelper</systemitem> packages, at least.
|
| 85 |
</para> </footnote>
|
| 86 |
</para>
|
| 87 |
<para>
|
| 88 |
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
|
| 90 |
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
|
| 92 |
difficult task. Well, if you are a real novice on Linux, it is hard, but if
|
| 93 |
you were a rookie, you wouldn't be reading this document now :-)
|
| 94 |
You do need to know a little about Unix programming but you certainly
|
| 95 |
don't need to be a wizard.
|
| 96 |
<footnote><para>
|
| 97 |
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
|
| 99 |
learn about Unix programming, too.
|
| 100 |
</para></footnote>
|
| 101 |
</para>
|
| 102 |
<para>
|
| 103 |
One thing is certain, though: to properly create and maintain Debian packages
|
| 104 |
takes many hours. Make no mistake, for our system to work the maintainers
|
| 105 |
need to be both technically competent and diligent.
|
| 106 |
</para>
|
| 107 |
<para>
|
| 108 |
If you need some help on packaging, please read <xref linkend="helpme"/>.
|
| 109 |
</para>
|
| 110 |
<para>
|
| 111 |
Newer versions of this document should always be available online at
|
| 112 |
<ulink url="&maint-guide;"/> and in the
|
| 113 |
<systemitem role="package">maint-guide</systemitem> package.
|
| 114 |
The translations may be available in packages such as
|
| 115 |
<systemitem role="package">maint-guide-es</systemitem>.
|
| 116 |
Please note that this documentation may be slightly outdated.
|
| 117 |
</para>
|
| 118 |
<para>
|
| 119 |
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>
|
| 129 |
<itemizedlist>
|
| 130 |
<listitem><para>We all are volunteers.</para>
|
| 131 |
<itemizedlist>
|
| 132 |
<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>
|
| 134 |
</itemizedlist></listitem>
|
| 135 |
<listitem><para>Friendly cooperation is the driving force.</para>
|
| 136 |
<itemizedlist>
|
| 137 |
<listitem><para>Your contribution should not overstrain others.</para></listitem>
|
| 138 |
<listitem><para>Your contribution is valuable only when others appreciate it.</para></listitem>
|
| 139 |
</itemizedlist></listitem>
|
| 140 |
<listitem><para>Debian is not your school where you get automatic attention of teachers.</para>
|
| 141 |
<itemizedlist>
|
| 142 |
<listitem><para>You should be able to learn many things by yourself.</para></listitem>
|
| 143 |
<listitem><para>Attention from other volunteers is a very scarce resource.</para></listitem>
|
| 144 |
</itemizedlist></listitem>
|
| 145 |
<listitem><para>Debian is constantly improving.</para>
|
| 146 |
<itemizedlist>
|
| 147 |
<listitem><para>You are expected to make high quality packages.</para></listitem>
|
| 148 |
<listitem><para>You should adapt yourself to change.</para></listitem>
|
| 149 |
</itemizedlist></listitem>
|
| 150 |
</itemizedlist>
|
| 151 |
<para>
|
| 152 |
There are several types of people interacting around Debian with different
|
| 153 |
roles.
|
| 154 |
</para>
|
| 155 |
<itemizedlist>
|
| 156 |
<listitem>
|
| 157 |
<para>
|
| 158 |
<emphasis role="strong">upstream author</emphasis>: the person who made the
|
| 159 |
original program.
|
| 160 |
</para>
|
| 161 |
</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>
|
| 201 |
<para>
|
| 202 |
Please note that you cannot become an official
|
| 203 |
<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
|
| 205 |
is useful to others, you can still upload your package either as a
|
| 206 |
<emphasis role="strong">maintainer</emphasis> through a
|
| 207 |
<emphasis role="strong">sponsor</emphasis> or as a
|
| 208 |
<emphasis role="strong">Debian Maintainer</emphasis>.
|
| 209 |
</para>
|
| 210 |
<para>
|
| 211 |
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
|
| 213 |
path to becoming an official Debian Developer too. There are many packages
|
| 214 |
waiting for good maintainers (see <xref linkend="choose"/>).
|
| 215 |
</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 Member site</ulink> (official) </para> </listitem>
|
| 226 |
<listitem><para><ulink url="&debianmentorfaq;">Debian Mentors FAQ</ulink> (supplemental) </para> </listitem>
|
| 227 |
</itemizedlist>
|
| 228 |
</section>
|
| 229 |
<section id="needprogs"><title>Programs needed for development</title>
|
| 230 |
<para>
|
| 231 |
Before you start anything, you should make sure that you have properly
|
| 232 |
installed some additional packages needed for development. Note that the list
|
| 233 |
doesn't contain any packages marked <literal>essential</literal> or
|
| 234 |
<literal>required</literal> - we expect that you have those installed already.
|
| 235 |
</para>
|
| 236 |
<para>
|
| 237 |
The following packages come with the standard Debian installation, so you
|
| 238 |
probably have them already (along with any additional packages they depend on).
|
| 239 |
Still, you should check it with <literal>aptitude show
|
| 240 |
<replaceable>package</replaceable></literal>
|
| 241 |
or with <literal>dpkg -s <replaceable>package</replaceable></literal>.
|
| 242 |
</para>
|
| 243 |
<para>
|
| 244 |
The most important package to install on your development system is the
|
| 245 |
<systemitem role="package">build-essential</systemitem> package. Once you try
|
| 246 |
to install that, it will <emphasis>pull in</emphasis> other packages required to
|
| 247 |
have a basic build environment.
|
| 248 |
</para>
|
| 249 |
<para>
|
| 250 |
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
|
| 252 |
useful to have installed or may be required by your package:
|
| 253 |
</para>
|
| 254 |
<itemizedlist>
|
| 255 |
<listitem>
|
| 256 |
<para>
|
| 257 |
<systemitem role="package">autoconf</systemitem>, <systemitem
|
| 258 |
role="package">automake</systemitem>, and <systemitem
|
| 259 |
role="package">autotools-dev</systemitem> - many newer programs use configure
|
| 260 |
scripts and <filename>Makefile</filename> files preprocessed with the help of
|
| 261 |
programs like these (see <literal>info autoconf</literal>, <literal>info
|
| 262 |
automake</literal>). <systemitem role="package">autotools-dev</systemitem>
|
| 263 |
keeps up-to-date versions of certain auto files and has documentation about the
|
| 264 |
best way to use those files.
|
| 265 |
</para>
|
| 266 |
</listitem>
|
| 267 |
<listitem>
|
| 268 |
<para>
|
| 269 |
<systemitem role="package">debhelper</systemitem> and
|
| 270 |
<systemitem role="package">dh-make</systemitem> -
|
| 271 |
<systemitem role="package">dh-make</systemitem> is necessary to create
|
| 272 |
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>8</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>
|
| 286 |
</listitem>
|
| 287 |
<listitem>
|
| 288 |
<para>
|
| 289 |
<systemitem role="package">devscripts</systemitem> - this package contains some
|
| 290 |
useful scripts that can be helpful for maintainers, but they are also
|
| 291 |
not necessary for building packages. Packages recommended and suggested
|
| 292 |
by this package are worth looking into. (See <filename>&devscripts-readme;</filename>.)
|
| 293 |
</para>
|
| 294 |
</listitem>
|
| 295 |
<listitem>
|
| 296 |
<para>
|
| 297 |
<systemitem role="package">fakeroot</systemitem> - this utility lets you
|
| 298 |
emulate being root which is necessary for some parts of the build process.
|
| 299 |
(See <citerefentry> <refentrytitle>fakeroot</refentrytitle>
|
| 300 |
<manvolnum>1</manvolnum> </citerefentry>.)
|
| 301 |
</para>
|
| 302 |
</listitem>
|
| 303 |
<listitem>
|
| 304 |
<para>
|
| 305 |
<systemitem role="package">file</systemitem> - this handy program can determine
|
| 306 |
what type a file is. (See <citerefentry> <refentrytitle>file</refentrytitle>
|
| 307 |
<manvolnum>1</manvolnum> </citerefentry>.)
|
| 308 |
</para>
|
| 309 |
</listitem>
|
| 310 |
<listitem>
|
| 311 |
<para>
|
| 312 |
<systemitem role="package">gfortran</systemitem> - the GNU Fortran 95 compiler,
|
| 313 |
necessary if your program is written in Fortran. (See <citerefentry>
|
| 314 |
<refentrytitle>gfortran</refentrytitle> <manvolnum>1</manvolnum>
|
| 315 |
</citerefentry>.)
|
| 316 |
</para>
|
| 317 |
</listitem>
|
| 318 |
<listitem>
|
| 319 |
<para>
|
| 320 |
<systemitem role="package">git</systemitem> - this package provides a popular
|
| 321 |
version control system designed to handle very large projects with speed and
|
| 322 |
efficiency; it is used for many high profile open source projects, most notably
|
| 323 |
the Linux kernel. (See <citerefentry> <refentrytitle>git</refentrytitle>
|
| 324 |
<manvolnum>1</manvolnum> </citerefentry>,
|
| 325 |
git Manual (<filename>&git-doc;</filename>).)
|
| 326 |
</para>
|
| 327 |
</listitem>
|
| 328 |
<listitem>
|
| 329 |
<para>
|
| 330 |
<systemitem role="package">gnupg</systemitem> - a tool that enables you to
|
| 331 |
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
|
| 333 |
when your work gets included in the Debian distribution. (See <citerefentry>
|
| 334 |
<refentrytitle>gpg</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>.)
|
| 335 |
</para>
|
| 336 |
</listitem>
|
| 337 |
<listitem>
|
| 338 |
<para>
|
| 339 |
<systemitem role="package">gpc</systemitem> - the GNU Pascal compiler,
|
| 340 |
necessary if your program is written in Pascal. Worthy of note here is
|
| 341 |
<systemitem role="package">fp-compiler</systemitem>, the Free Pascal Compiler,
|
| 342 |
which is also good at this task. (See <citerefentry>
|
| 343 |
<refentrytitle>gpc</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>,
|
| 344 |
<citerefentry> <refentrytitle>ppc386</refentrytitle>
|
| 345 |
<manvolnum>1</manvolnum> </citerefentry>.)
|
| 346 |
</para>
|
| 347 |
</listitem>
|
| 348 |
<listitem>
|
| 349 |
<para>
|
| 350 |
<systemitem role="package">lintian</systemitem> - this is the Debian package
|
| 351 |
checker, which can let you know of any common mistakes after you build the
|
| 352 |
package, and explains the errors found. (See <citerefentry>
|
| 353 |
<refentrytitle>lintian</refentrytitle> <manvolnum>1</manvolnum>
|
| 354 |
</citerefentry>,
|
| 355 |
<ulink url="&lintian-doc;">Lintian User's Manual</ulink>.)
|
| 356 |
</para>
|
| 357 |
</listitem>
|
| 358 |
<listitem>
|
| 359 |
<para>
|
| 360 |
<systemitem role="package">patch</systemitem> - this very useful utility will
|
| 361 |
take a file containing a difference listing (produced by the
|
| 362 |
<command>diff</command> program) and apply it to the original file, producing a
|
| 363 |
patched version. (See <citerefentry> <refentrytitle>patch</refentrytitle>
|
| 364 |
<manvolnum>1</manvolnum> </citerefentry>.)
|
| 365 |
</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>
|
| 373 |
</listitem>
|
| 374 |
<listitem>
|
| 375 |
<para>
|
| 376 |
<systemitem role="package">pbuilder</systemitem> - this package contains
|
| 377 |
programs which are used for creating and maintaining <command>chroot</command>
|
| 378 |
environment. Building Debian package in this <command>chroot</command>
|
| 379 |
environment verifies the proper build dependency and avoid FTBFS (Fails To
|
| 380 |
Build From Source) bugs. (see <citerefentry>
|
| 381 |
<refentrytitle>pbuilder</refentrytitle> <manvolnum>8</manvolnum>
|
| 382 |
</citerefentry> and <citerefentry> <refentrytitle>pdebuild</refentrytitle>
|
| 383 |
<manvolnum>1</manvolnum> </citerefentry>)
|
| 384 |
</para>
|
| 385 |
</listitem>
|
| 386 |
<listitem>
|
| 387 |
<para>
|
| 388 |
<systemitem role="package">perl</systemitem> - Perl is one of the most used
|
| 389 |
interpreted scripting languages on today's Unix-like systems, often referred to
|
| 390 |
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>
|
| 401 |
</listitem>
|
| 402 |
<listitem>
|
| 403 |
<para>
|
| 404 |
<systemitem role="package">quilt</systemitem> - this package helps you to
|
| 405 |
manage large numbers of patches by keeping track of the changes each patch
|
| 406 |
makes. Patches can be applied, un-applied, refreshed, and more. (See
|
| 407 |
<citerefentry> <refentrytitle>quilt</refentrytitle> <manvolnum>1</manvolnum></citerefentry>,
|
| 408 |
and <filename>&quilt-pdf;</filename>.)
|
| 409 |
</para>
|
| 410 |
</listitem>
|
| 411 |
<listitem>
|
| 412 |
<para>
|
| 413 |
<systemitem role="package">xutils-dev</systemitem> - some programs, usually
|
| 414 |
those made for X11, also use these programs to generate
|
| 415 |
<filename>Makefile</filename> files from sets of macro functions. (See
|
| 416 |
<citerefentry> <refentrytitle>imake</refentrytitle> <manvolnum>1</manvolnum>
|
| 417 |
</citerefentry>, <citerefentry> <refentrytitle>xmkmf</refentrytitle>
|
| 418 |
<manvolnum>1</manvolnum> </citerefentry>.)
|
| 419 |
</para>
|
| 420 |
</listitem>
|
| 421 |
</itemizedlist>
|
| 422 |
<para>
|
| 423 |
The short descriptions that are given above only serve to introduce you to what
|
| 424 |
each package does. Before continuing please read the documentation
|
| 425 |
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.
|
| 428 |
If you have specific questions later, I would suggest re-reading the documents
|
| 429 |
mentioned above.
|
| 430 |
</para>
|
| 431 |
</section>
|
| 432 |
<section id="needdocs"><title>Documentation needed for development</title>
|
| 433 |
<para>
|
| 434 |
The following is the <emphasis>very important</emphasis> documentation which
|
| 435 |
you should read along with this document:
|
| 436 |
</para>
|
| 437 |
<itemizedlist>
|
| 438 |
<listitem>
|
| 439 |
<para>
|
| 440 |
<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
|
| 442 |
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
|
| 444 |
important thing is that it describes requirements that each package must
|
| 445 |
satisfy to be included in the distribution. (See the local copies of
|
| 446 |
<filename>&policy-pdf;</filename> and <filename>&fhs-pdf;</filename>.)
|
| 447 |
</para>
|
| 448 |
</listitem>
|
| 449 |
<listitem>
|
| 450 |
<para>
|
| 451 |
<systemitem role="package">developers-reference</systemitem>
|
| 452 |
- the <ulink url="&developers-reference;">Debian Developer's Reference</ulink>
|
| 453 |
describes all matters not specifically about the technical
|
| 454 |
details of packaging, like the structure of the archive, how to rename, orphan,
|
| 455 |
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
|
| 457 |
<filename>&developers-refpdf;</filename>.)
|
| 458 |
</para>
|
| 459 |
</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>
|
| 467 |
<para>
|
| 468 |
<ulink url="&autotools-tutorial;">Autotools
|
| 469 |
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,
|
| 471 |
Automake, Libtool, and gettext.
|
| 472 |
</para>
|
| 473 |
</listitem>
|
| 474 |
<listitem>
|
| 475 |
<para>
|
| 476 |
<systemitem role="package">gnu-standards</systemitem> - this package contains
|
| 477 |
two pieces of documentation from the GNU project:
|
| 478 |
<ulink url="&gnu-standard;">GNU Coding Standards</ulink>, and
|
| 479 |
<ulink url="&gnu-maintainer;">Information for Maintainers of GNU Software</ulink>.
|
| 480 |
Although Debian does not require these to
|
| 481 |
be followed, these are still helpful as guidelines and common sense.
|
| 482 |
(See the local copies of
|
| 483 |
<filename>&gnu-standard-pdf;</filename> and
|
| 484 |
<filename>&gnu-maintainer-pdf;</filename>.)
|
| 485 |
</para>
|
| 486 |
</listitem>
|
| 487 |
</itemizedlist>
|
| 488 |
<para>
|
| 489 |
If this document contradicts any of the documents mentioned above, they
|
| 490 |
are correct. Please file a bug report on the
|
| 491 |
<systemitem role="package">maint-guide</systemitem> package using
|
| 492 |
<command>reportbug</command>.
|
| 493 |
</para>
|
| 494 |
<para>
|
| 495 |
The following is an alternative tutorial documentation which you may
|
| 496 |
read along with this document:
|
| 497 |
</para>
|
| 498 |
<itemizedlist>
|
| 499 |
<listitem><para><ulink url="&debpkg-tutorial0;">Debian Packaging Tutorial</ulink></para></listitem>
|
| 500 |
</itemizedlist>
|
| 501 |
</section>
|
| 502 |
<section id="helpme"><title>Where to ask for help</title>
|
| 503 |
<para>
|
| 504 |
Before you decide to ask your question in some public place, please read the fine documentation.
|
| 505 |
</para>
|
| 506 |
<itemizedlist>
|
| 507 |
<listitem>
|
| 508 |
<para>
|
| 509 |
files in <filename>/usr/share/doc/<replaceable>package</replaceable></filename> for all pertinent packages
|
| 510 |
</para>
|
| 511 |
</listitem>
|
| 512 |
<listitem>
|
| 513 |
<para>
|
| 514 |
contents of <literal><command>man</command> <replaceable>command</replaceable></literal> for all pertinent commands
|
| 515 |
</para>
|
| 516 |
</listitem>
|
| 517 |
<listitem>
|
| 518 |
<para>
|
| 519 |
contents of <literal><command>info</command> <replaceable>command</replaceable></literal> for all pertinent commands
|
| 520 |
</para>
|
| 521 |
</listitem>
|
| 522 |
<listitem>
|
| 523 |
<para>
|
| 524 |
contents of <ulink url="&debian-mentors-ldo;">debian-mentors@lists.debian.org mailing list archive</ulink>
|
| 525 |
</para>
|
| 526 |
</listitem>
|
| 527 |
<listitem>
|
| 528 |
<para>
|
| 529 |
contents of <ulink url="&debian-devel-ldo;">debian-devel@lists.debian.org mailing list archive</ulink>
|
| 530 |
</para>
|
| 531 |
</listitem>
|
| 532 |
</itemizedlist>
|
| 533 |
<para>
|
| 534 |
You can use web search engines more effectively by including search strings
|
| 535 |
such as <literal>site:lists.debian.org</literal> to limit the domain.
|
| 536 |
</para>
|
| 537 |
<para>
|
| 538 |
Making a small test package is a good way to learn details of packaging.
|
| 539 |
Inspecting existing well maintained packages is the best way to learn how other
|
| 540 |
people make packages.
|
| 541 |
</para>
|
| 542 |
<para>
|
| 543 |
If you still have questions about packaging that you couldn't find answers to
|
| 544 |
in the available documentation and web resources, you can ask them interactively.
|
| 545 |
</para>
|
| 546 |
<itemizedlist>
|
| 547 |
<listitem>
|
| 548 |
<para>
|
| 549 |
<ulink url="&debian-mentors-ldo;">debian-mentors@lists.debian.org mailing list</ulink>. (This mailing list is for the novice.)
|
| 550 |
</para>
|
| 551 |
</listitem>
|
| 552 |
<listitem>
|
| 553 |
<para>
|
| 554 |
<ulink url="&debian-devel-ldo;">debian-devel@lists.debian.org mailing list</ulink>. (This mailing list is for the expert.)
|
| 555 |
</para>
|
| 556 |
</listitem>
|
| 557 |
<listitem>
|
| 558 |
<para>
|
| 559 |
<ulink url="&irc-debian;">IRC</ulink> such as <literal>#debian-mentors</literal>.
|
| 560 |
</para>
|
| 561 |
</listitem>
|
| 562 |
</itemizedlist>
|
| 563 |
<para>
|
| 564 |
The more experienced Debian developers will gladly help you, if you ask
|
| 565 |
properly after making your required efforts.
|
| 566 |
</para>
|
| 567 |
<para>
|
| 568 |
When you receive a bug report (yes, actual bug reports!), you will know that it
|
| 569 |
is time for you to dig into the
|
| 570 |
<ulink url="&bts;">Debian Bug Tracking System</ulink>
|
| 571 |
and read the documentation there, to be able to
|
| 572 |
deal with the reports efficiently. I highly recommend reading the
|
| 573 |
<ulink url="&devref-bug-handling;">Debian Developer's Reference, 5.8.
|
| 574 |
"Handling bugs"</ulink>.
|
| 575 |
</para>
|
| 576 |
<para>
|
| 577 |
Even if it all worked well, it's time to start praying. Why? Because in just
|
| 578 |
a few hours (or days) users from all around the world will start to use your
|
| 579 |
package, and if you made some critical error you'll get mailbombed by numerous
|
| 580 |
angry Debian users... Just kidding. :-)
|
| 581 |
</para>
|
| 582 |
<para>
|
| 583 |
Relax and be ready for bug reports, because there is a lot more work to be done
|
| 584 |
before your package will be fully in line with Debian policies and its best
|
| 585 |
practice guidelines (once again, read the <emphasis>real
|
| 586 |
documentation</emphasis> for details). Good luck!
|
| 587 |
</para>
|
| 588 |
</section>
|
| 589 |
</chapter>
|
| 590 |
<chapter id="first"><title>First steps</title>
|
| 591 |
<para>
|
| 592 |
Let's start by creating a package of your own (or, even better,
|
| 593 |
adopting an existing one).
|
| 594 |
</para>
|
| 595 |
<section id="workflow"><title>Debian package building workflow</title>
|
| 596 |
<para>
|
| 597 |
If you are making a Debian package with an upstream program, the
|
| 598 |
typical workflow of Debian package building involves generating several
|
| 599 |
specifically named files for each step as follows.
|
| 600 |
</para>
|
| 601 |
<itemizedlist>
|
| 602 |
<listitem>
|
| 603 |
<para>Get a copy of the upstream software, usually in a compressed tar format.</para>
|
| 604 |
<itemizedlist>
|
| 605 |
<listitem><literal><replaceable>package</replaceable>-<replaceable>version</replaceable>.tar.gz</literal></listitem>
|
| 606 |
</itemizedlist>
|
| 607 |
</listitem>
|
| 608 |
<listitem>
|
| 609 |
<para>
|
| 610 |
Add Debian-specific packaging modifications to the upstream program under the
|
| 611 |
<filename>debian</filename> directory, and create a non-native source package
|
| 612 |
(that is, the set of input files used for Debian package building) in
|
| 613 |
<literal>3.0 (quilt)</literal> format.
|
| 614 |
</para>
|
| 615 |
<itemizedlist>
|
| 616 |
<listitem><literal><replaceable>package</replaceable>_<replaceable>version</replaceable>.orig.tar.gz</literal></listitem>
|
| 617 |
<listitem><literal><replaceable>package</replaceable>_<replaceable>version</replaceable>-<replaceable>revision</replaceable>.debian.tar.gz</literal>
|
| 618 |
<footnote><para>For the older style of non-native Debian source packages in <literal>1.0</literal> format,
|
| 619 |
<literal><replaceable>package</replaceable>_<replaceable>version</replaceable>-<replaceable>revision</replaceable>.diff.gz</literal>
|
| 620 |
is used instead. </para></footnote></listitem>
|
| 621 |
<listitem><literal><replaceable>package</replaceable>_<replaceable>version</replaceable>-<replaceable>revision</replaceable>.dsc</literal></listitem>
|
| 622 |
</itemizedlist>
|
| 623 |
</listitem>
|
| 624 |
<listitem>
|
| 625 |
<para>
|
| 626 |
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.
|
| 627 |
</para>
|
| 628 |
<itemizedlist>
|
| 629 |
<listitem><literal><replaceable>package</replaceable>_<replaceable>version</replaceable>-<replaceable>revision</replaceable>_<replaceable>arch</replaceable>.deb</literal></listitem>
|
| 630 |
</itemizedlist>
|
| 631 |
</listitem>
|
| 632 |
</itemizedlist>
|
| 633 |
<para>
|
| 634 |
Please note that the character separating
|
| 635 |
<literal><replaceable>package</replaceable></literal> and
|
| 636 |
<literal><replaceable>version</replaceable></literal> was changed from
|
| 637 |
<literal>-</literal> (hyphen) in the tarball name to
|
| 638 |
<literal>_</literal> (underscore) in the Debian package filenames.
|
| 639 |
</para>
|
| 640 |
<para>
|
| 641 |
In the file names above, replace
|
| 642 |
the <literal><replaceable>package</replaceable></literal> part with the <emphasis role="strong">package name</emphasis>,
|
| 643 |
the <literal><replaceable>version</replaceable></literal> part with the <emphasis role="strong">upstream version</emphasis>,
|
| 644 |
the <literal><replaceable>revision</replaceable></literal> part with the <emphasis role="strong">Debian revision</emphasis>,
|
| 645 |
and the <literal><replaceable>arch</replaceable></literal> part with the <emphasis role="strong">package architecture</emphasis>,
|
| 646 |
as defined in the Debian Policy Manual.
|
| 647 |
<footnote> <para> See
|
| 648 |
<ulink url="&policy-source;">5.6.1 Source</ulink>,
|
| 649 |
<ulink url="&policy-package;">5.6.7 Package</ulink>, and
|
| 650 |
<ulink url="&policy-version;">5.6.12 Version</ulink>.
|
| 651 |
The <emphasis role="strong">package architecture</emphasis> follows the
|
| 652 |
Debian Policy Manual: <ulink url="&policy-architecture;">5.6.8 Architecture</ulink>
|
| 653 |
and is automatically assigned by the package build process.</para></footnote>
|
| 654 |
</para>
|
| 655 |
<para>
|
| 656 |
If instead you are making a Debian-specific package with no upstream, the
|
| 657 |
typical workflow of Debian package building is simpler.
|
| 658 |
</para>
|
| 659 |
<itemizedlist>
|
| 660 |
<listitem>
|
| 661 |
<para>
|
| 662 |
Create a native Debian source package in the <literal>3.0 (native)</literal>
|
| 663 |
format using a single compressed tar file in which all files are included.
|
| 664 |
</para>
|
| 665 |
<itemizedlist>
|
| 666 |
<listitem><literal><replaceable>package</replaceable>_<replaceable>version</replaceable>.tar.gz</literal></listitem>
|
| 667 |
<listitem><literal><replaceable>package</replaceable>_<replaceable>version</replaceable>.dsc</literal></listitem>
|
| 668 |
</itemizedlist>
|
| 669 |
</listitem>
|
| 670 |
<listitem>
|
| 671 |
<para>
|
| 672 |
Build Debian binary packages from the native Debian source package.
|
| 673 |
</para>
|
| 674 |
<itemizedlist>
|
| 675 |
<listitem><literal><replaceable>package</replaceable>_<replaceable>version</replaceable>_<replaceable>arch</replaceable>.deb</literal></listitem>
|
| 676 |
</itemizedlist>
|
| 677 |
</listitem>
|
| 678 |
</itemizedlist>
|
| 679 |
<para>
|
| 680 |
Each step of this outline is explained with detailed examples in later sections.
|
| 681 |
</para>
|
| 682 |
</section>
|
| 683 |
<section id="choose"><title>Choose your program</title>
|
| 684 |
<para>
|
| 685 |
You have probably chosen the package you want to create. The first thing you
|
| 686 |
need to do is check if the package is in the distribution archive already by
|
| 687 |
using the following.
|
| 688 |
</para>
|
| 689 |
<itemizedlist>
|
| 690 |
<listitem>
|
| 691 |
<para>the <command>aptitude</command> command</para>
|
| 692 |
</listitem>
|
| 693 |
<listitem>
|
| 694 |
<para>the <ulink url="&packages-do;">Debian packages</ulink> web page</para>
|
| 695 |
</listitem>
|
| 696 |
<listitem>
|
| 697 |
<para>the <ulink url="&packages-qa-do;">Debian Package Tracking System</ulink> web page</para>
|
| 698 |
</listitem>
|
| 699 |
</itemizedlist>
|
| 700 |
<para>
|
| 701 |
If the package already exists, well, install it! :-) If it happens to be
|
| 702 |
<emphasis role="strong">orphaned</emphasis> (that is, if its
|
| 703 |
maintainer is set to <ulink url="&qa-do;">Debian QA Group</ulink>),
|
| 704 |
you may be able to pick it up if it's still available. You may also
|
| 705 |
adopt a package whose maintainer has filed a Request for Adoption
|
| 706 |
(<emphasis role="strong">RFA</emphasis>).<footnote> <para>See
|
| 707 |
<ulink url="&devref-adopt;">Debian Developer's Reference 5.9.5.
|
| 708 |
"Adopting a package"</ulink>.</para> </footnote>
|
| 709 |
</para>
|
| 710 |
<para>
|
| 711 |
There are several package ownership status resources.
|
| 712 |
</para>
|
| 713 |
<itemizedlist>
|
| 714 |
<listitem>
|
| 715 |
<para> <ulink url="&wnpp-do;">Work-Needing and Prospective Packages</ulink> </para>
|
| 716 |
</listitem>
|
| 717 |
<listitem>
|
| 718 |
<para> <ulink url="&wnpp-bts;">Debian Bug report logs: Bugs in pseudo-package <systemitem role="package">wnpp</systemitem> in <literal>unstable</literal></ulink> </para>
|
| 719 |
</listitem>
|
| 720 |
<listitem>
|
| 721 |
<para> <ulink url="&wnpp-dn;">Debian Packages that Need Lovin'</ulink> </para>
|
| 722 |
</listitem>
|
| 723 |
<listitem>
|
| 724 |
<para> <ulink url="&wnpp-debtags;">Browse <systemitem role="package">wnpp</systemitem> bugs based on debtags</ulink> </para>
|
| 725 |
</listitem>
|
| 726 |
</itemizedlist>
|
| 727 |
<para>
|
| 728 |
As a side note, it's important to point out that Debian already has packages
|
| 729 |
for most kinds of programs, and the number of packages already in the Debian
|
| 730 |
archive is much larger than that of contributors with upload rights. Thus,
|
| 731 |
contributions to packages already in the archive are far more appreciated (and
|
| 732 |
more likely to receive sponsorship) by other developers <footnote><para> Having
|
| 733 |
said that, there will of course always be new programs that are worth
|
| 734 |
packaging. </para> </footnote>. You can contribute in various ways.
|
| 735 |
</para>
|
| 736 |
<itemizedlist>
|
| 737 |
<listitem>
|
| 738 |
<para>
|
| 739 |
taking over orphaned, yet actively used, packages
|
| 740 |
</para>
|
| 741 |
</listitem>
|
| 742 |
<listitem>
|
| 743 |
<para>
|
| 744 |
joining <ulink url="&teams;">packaging teams</ulink>
|
| 745 |
</para>
|
| 746 |
</listitem>
|
| 747 |
<listitem>
|
| 748 |
<para>
|
| 749 |
triaging bugs of very popular packages
|
| 750 |
</para>
|
| 751 |
</listitem>
|
| 752 |
<listitem>
|
| 753 |
<para>
|
| 754 |
preparing <ulink url="&devref-nmu;">QA or NMU uploads</ulink>
|
| 755 |
</para>
|
| 756 |
</listitem>
|
| 757 |
</itemizedlist>
|
| 758 |
<para>
|
| 759 |
If you are able to adopt the package, get the sources (with something like
|
| 760 |
<literal>apt-get source <replaceable>packagename</replaceable></literal>) and
|
| 761 |
examine them. This document unfortunately doesn't include comprehensive
|
| 762 |
information about adopting packages. Thankfully you shouldn't have a hard time
|
| 763 |
figuring out how the package works since someone has already done the initial
|
| 764 |
setup for you. Keep reading, though; a lot of the advice below will still be
|
| 765 |
applicable for your case.
|
| 766 |
</para>
|
| 767 |
<para>
|
| 768 |
If the package is new, and you decide you'd like to see it in Debian, proceed
|
| 769 |
as follows:
|
| 770 |
</para>
|
| 771 |
<itemizedlist>
|
| 772 |
<listitem>
|
| 773 |
<para>
|
| 774 |
First, you must know that the program works, and have tried it for some time to
|
| 775 |
confirm its usefulness.
|
| 776 |
</para>
|
| 777 |
</listitem>
|
| 778 |
<listitem>
|
| 779 |
<para>
|
| 780 |
You must check that no one else is already working on the package on the
|
| 781 |
<ulink url="&wnpp-do;">Work-Needing and Prospective Packages</ulink> site.
|
| 782 |
If no one else is working on it, file an ITP (Intent
|
| 783 |
To Package) bug report to the <systemitem role="package">wnpp</systemitem>
|
| 784 |
pseudo-package using <command>reportbug</command>. If someone's already on it,
|
| 785 |
contact them if you feel you need to. If not - find another interesting
|
| 786 |
program that nobody is maintaining.
|
| 787 |
</para>
|
| 788 |
</listitem>
|
| 789 |
<listitem>
|
| 790 |
<para>
|
| 791 |
The software <emphasis role="strong">must have a license</emphasis>.
|
| 792 |
</para>
|
| 793 |
<itemizedlist>
|
| 794 |
<listitem>
|
| 795 |
<para>
|
| 796 |
For the <literal>main</literal> section, Debian Policy requires it
|
| 797 |
<emphasis role="strong">to be fully compliant with the Debian Free Software
|
| 798 |
Guidelines</emphasis> (<ulink url="&dfsg;">DFSG</ulink>)
|
| 799 |
and <emphasis role="strong">not to require a package outside of
|
| 800 |
<literal>main</literal></emphasis> for compilation or execution. This
|
| 801 |
is the desired case.
|
| 802 |
</para>
|
| 803 |
</listitem>
|
| 804 |
<listitem>
|
| 805 |
<para>
|
| 806 |
For the <literal>contrib</literal> section, it must comply with the
|
| 807 |
DFSG but it may require a package outside of <literal>main</literal> for
|
| 808 |
compilation or execution.
|
| 809 |
</para>
|
| 810 |
</listitem>
|
| 811 |
<listitem>
|
| 812 |
<para>
|
| 813 |
For the <literal>non-free</literal> section, it may be non-compliant
|
| 814 |
with the DFSG but it <emphasis role="strong">must be distributable</emphasis>.
|
| 815 |
</para>
|
| 816 |
</listitem>
|
| 817 |
<listitem>
|
| 818 |
<para>
|
| 819 |
If you are unsure about where it should go, post the license text on
|
| 820 |
<ulink url="&debian-legal-ldo;">debian-legal@lists.debian.org</ulink>
|
| 821 |
and ask for advice.
|
| 822 |
</para>
|
| 823 |
</listitem>
|
| 824 |
</itemizedlist>
|
| 825 |
</listitem>
|
| 826 |
<listitem>
|
| 827 |
<para>
|
| 828 |
The program should <emphasis role="strong">not</emphasis> introduce security
|
| 829 |
and maintenance concerns to the Debian system.
|
| 830 |
</para>
|
| 831 |
<itemizedlist>
|
| 832 |
<listitem>
|
| 833 |
<para>
|
| 834 |
The program should be well documented and its code needs to be understandable
|
| 835 |
(i.e. not obfuscated).
|
| 836 |
</para>
|
| 837 |
</listitem>
|
| 838 |
<listitem>
|
| 839 |
<para>
|
| 840 |
You should contact the program's author(s) to check if they agree with packaging it
|
| 841 |
and are amicable to Debian. It is important to be able to consult with the author(s)
|
| 842 |
in case of any problems with the program, so don't try to package
|
| 843 |
unmaintained software.
|
| 844 |
</para>
|
| 845 |
</listitem>
|
| 846 |
<listitem>
|
| 847 |
<para>
|
| 848 |
The program certainly should <emphasis role="strong">not</emphasis> run setuid
|
| 849 |
root, or even better, it shouldn't need to be setuid or setgid to anything.
|
| 850 |
</para>
|
| 851 |
</listitem>
|
| 852 |
<listitem>
|
| 853 |
<para>
|
| 854 |
The program should not be a daemon, or go in an
|
| 855 |
<filename>*/sbin</filename> directory, or open a port as root.
|
| 856 |
</para>
|
| 857 |
</listitem>
|
| 858 |
</itemizedlist>
|
| 859 |
</listitem>
|
| 860 |
</itemizedlist>
|
| 861 |
<para>
|
| 862 |
Of course, the last one is just a safety measures, and intended to save you from
|
| 863 |
enraging users if you do something wrong in some setuid daemon... When you gain
|
| 864 |
more experience in packaging, you'll be able to package such software.
|
| 865 |
</para>
|
| 866 |
<para>
|
| 867 |
As a new maintainer, you are encouraged to get some experience in packaging
|
| 868 |
with easier packages and discouraged from creating complicated packages.
|
| 869 |
</para>
|
| 870 |
<itemizedlist>
|
| 871 |
<listitem><para>Simple packages</para>
|
| 872 |
<itemizedlist>
|
| 873 |
<listitem><para>single binary package, arch = all (collection of data such as wallpaper graphics)</para></listitem>
|
| 874 |
<listitem><para>single binary package, arch = all (executables written in an interpreted language such as POSIX shell)</para></listitem>
|
| 875 |
</itemizedlist>
|
| 876 |
</listitem>
|
| 877 |
<listitem><para>Intermediate complexity packages</para>
|
| 878 |
<itemizedlist>
|
| 879 |
<listitem><para>single binary package, arch = any (ELF binary executables compiled from languages such as C and C++)</para></listitem>
|
| 880 |
<listitem><para>multiple binary packages, arch = any + all (packages for ELF binary executables + documentation)</para></listitem>
|
| 881 |
<listitem><para>upstream source in a format other than <filename>tar.gz</filename> or <filename>tar.bz2</filename></para></listitem>
|
| 882 |
<listitem><para>upstream source containing undistributable contents</para></listitem>
|
| 883 |
</itemizedlist>
|
| 884 |
</listitem>
|
| 885 |
<listitem><para>High complexity packages</para>
|
| 886 |
<itemizedlist>
|
| 887 |
<listitem><para>interpreter module package used by other packages</para></listitem>
|
| 888 |
<listitem><para>generic ELF library package used by other packages</para></listitem>
|
| 889 |
<listitem><para>multiple binary packages including an ELF library package</para></listitem>
|
| 890 |
<listitem><para>source package with multiple upstream sources</para></listitem>
|
| 891 |
<listitem><para>kernel module packages</para></listitem>
|
| 892 |
<listitem><para>kernel patch packages</para></listitem>
|
| 893 |
<listitem><para>any package with non-trivial maintainer scripts</para></listitem>
|
| 894 |
</itemizedlist>
|
| 895 |
</listitem>
|
| 896 |
</itemizedlist>
|
| 897 |
<para>
|
| 898 |
Packaging high complexity packages is not too hard, but it requires a bit more
|
| 899 |
knowledge. You should seek specific guidance for every complex feature. For
|
| 900 |
example, some languages have their own sub-policy documents:
|
| 901 |
</para>
|
| 902 |
<itemizedlist>
|
| 903 |
<listitem><para><ulink url="&policy-perl;">Perl policy</ulink></para></listitem>
|
| 904 |
<listitem><para><ulink url="&policy-python;">Python policy</ulink></para></listitem>
|
| 905 |
<listitem><para><ulink url="&policy-java;">Java policy</ulink></para></listitem>
|
| 906 |
</itemizedlist>
|
| 907 |
<para>
|
| 908 |
There is another old Latin saying: <emphasis>fabricando fit faber</emphasis>
|
| 909 |
(practice makes perfect). It is <emphasis>highly</emphasis> recommended to
|
| 910 |
practice and experiment with all the steps of Debian packaging with simple packages
|
| 911 |
while reading this tutorial. A trivial upstream tarball
|
| 912 |
<filename>hello-sh-1.0.tar.gz</filename> created as followings may offer
|
| 913 |
a good starting point.<footnote><para>Do not worry about the missing
|
| 914 |
<filename>Makefile</filename>. You can install the <command>hello</command>
|
| 915 |
command by simply using <command>debhelper</command> as in
|
| 916 |
<xref linkend="install"/>, or by modifying the upstream source to add a new
|
| 917 |
<filename>Makefile</filename> with the <literal>install</literal> target as in
|
| 918 |
<xref linkend="modify"/>.</para></footnote>
|
| 919 |
</para>
|
| 920 |
<screen>
|
| 921 |
$ mkdir -p hello-sh/hello-sh-1.0; cd hello-sh/hello-sh-1.0
|
| 922 |
$ cat > hello <<EOF
|
| 923 |
#!/bin/sh
|
| 924 |
# (C) 2011 Foo Bar, GPL2+
|
| 925 |
echo "Hello!"
|
| 926 |
EOF
|
| 927 |
$ chmod 755 hello
|
| 928 |
$ cd ..
|
| 929 |
$ tar -cvzf hello-sh-1.0.tar.gz hello-sh-1.0
|
| 930 |
</screen>
|
| 931 |
</section>
|
| 932 |
<section id="getit"><title>Get the program, and try it out</title>
|
| 933 |
<para>
|
| 934 |
So the first thing to do is to find and download the original source code.
|
| 935 |
Presumably you already have the source file that you picked up at the
|
| 936 |
author's homepage. Sources for free Unix programs usually come in
|
| 937 |
<command>tar</command>+<command>gzip</command> format with the extension
|
| 938 |
<filename>.tar.gz</filename>,
|
| 939 |
<command>tar</command>+<command>bzip2</command> format with the extension
|
| 940 |
<filename>.tar.bz2</filename>, or
|
| 941 |
<command>tar</command>+<command>xz</command> format with the extension
|
| 942 |
<filename>.tar.xz</filename>. These usually contain a directory called
|
| 943 |
<filename><replaceable>package</replaceable>-<replaceable>version</replaceable></filename>
|
| 944 |
with all the sources inside.
|
| 945 |
</para>
|
| 946 |
<para>
|
| 947 |
If the latest version of the source is available through a VCS such as Git,
|
| 948 |
Subversion, or CVS, you need to get it with <literal>git
|
| 949 |
clone</literal>, <literal>svn co</literal>, or <literal>cvs co</literal> and
|
| 950 |
repack it into <command>tar</command>+<command>gzip</command> format yourself
|
| 951 |
by using the <literal>--exclude-vcs</literal> option.
|
| 952 |
</para>
|
| 953 |
<para>
|
| 954 |
If your program's source comes as some other sort of archive (for instance, the
|
| 955 |
filename ends in <filename>.Z</filename> or
|
| 956 |
<filename>.zip</filename><footnote><para> You can identify the archive format
|
| 957 |
using the <command>file</command> command when the file extension is not
|
| 958 |
enough. </para> </footnote>), you should also unpack it with the
|
| 959 |
appropriate tools and repack it.
|
| 960 |
</para>
|
| 961 |
<para>
|
| 962 |
If your program's source comes with some contents which do not comply with
|
| 963 |
DFSG, you should also unpack it to remove such contents and repack it with a
|
| 964 |
modified upstream version containing <literal>dfsg</literal>.
|
| 965 |
</para>
|
| 966 |
<para>
|
| 967 |
As an example, I'll use a program called <command>gentoo</command>, a GTK+
|
| 968 |
file manager.
|
| 969 |
<footnote><para> This program is already packaged. The
|
| 970 |
<ulink url="&gentoo-package;">current version</ulink> uses Autotools as its
|
| 971 |
build structure and is substantially different from the following examples,
|
| 972 |
which were based on version 0.9.12.</para>
|
| 973 |
</footnote>
|
| 974 |
</para>
|
| 975 |
<para>
|
| 976 |
Create a subdirectory under your home directory named
|
| 977 |
<filename>debian</filename> or <filename>deb</filename> or anything you find
|
| 978 |
appropriate (e.g. just <filename>~/gentoo</filename> would do fine in this
|
| 979 |
case). Place the downloaded archive in it, and extract it (with <literal>tar
|
| 980 |
xzf gentoo-0.9.12.tar.gz</literal>). Make sure there are no warning
|
| 981 |
messages, even <emphasis>irrelevant</emphasis> ones, because other
|
| 982 |
people's unpacking tools may or may not ignore these anomalies, so they
|
| 983 |
may have problems unpacking them. Your shell command line may look
|
| 984 |
something like this:
|
| 985 |
</para>
|
| 986 |
<screen>
|
| 987 |
$ mkdir ~/gentoo ; cd ~/gentoo
|
| 988 |
$ wget http://<replaceable>www.example.org</replaceable>/gentoo-0.9.12.tar.gz
|
| 989 |
$ tar xvzf gentoo-0.9.12.tar.gz
|
| 990 |
$ ls -F
|
| 991 |
gentoo-0.9.12/
|
| 992 |
gentoo-0.9.12.tar.gz
|
| 993 |
</screen>
|
| 994 |
<para>
|
| 995 |
Now you have another subdirectory, called <filename>gentoo-0.9.12</filename>.
|
| 996 |
Change to that directory and <emphasis>thoroughly</emphasis> read the provided
|
| 997 |
documentation. Usually there are files named <filename>README*</filename>,
|
| 998 |
<filename>INSTALL*</filename>, <filename>*.lsm</filename> or
|
| 999 |
<filename>*.html</filename>. You must find instructions on how to
|
| 1000 |
compile and install the program (most probably they'll assume you want to
|
| 1001 |
install to the <filename>/usr/local/bin</filename> directory; you won't be doing
|
| 1002 |
that, but more on that later in <xref linkend="destdir"/>).
|
| 1003 |
</para>
|
| 1004 |
<para>
|
| 1005 |
You should start packaging with a completely clean (pristine) source directory,
|
| 1006 |
or simply with freshly unpacked sources.
|
| 1007 |
</para>
|
| 1008 |
</section>
|
| 1009 |
<section id="simplemake"><title>Simple build systems</title>
|
| 1010 |
<para>
|
| 1011 |
Simple programs usually come with a <filename>Makefile</filename> and can
|
| 1012 |
be compiled just by invoking <literal>make</literal>.<footnote><para>
|
| 1013 |
Many modern programs come with a script <filename>configure</filename> which
|
| 1014 |
when executed creates a <filename>Makefile</filename> customized for
|
| 1015 |
your system.</para></footnote> Some of them support
|
| 1016 |
<literal>make check</literal>, which runs included self-tests. Installation
|
| 1017 |
to the destination directories is usually done with <literal>make
|
| 1018 |
install</literal>.
|
| 1019 |
</para>
|
| 1020 |
<para>
|
| 1021 |
Now try to compile and run your program, to make sure it works properly and
|
| 1022 |
doesn't break something else while it's installing or running.
|
| 1023 |
</para>
|
| 1024 |
<para>
|
| 1025 |
Also, you can usually run <literal>make clean</literal> (or better
|
| 1026 |
<literal>make distclean</literal>) to clean up the build directory. Sometimes
|
| 1027 |
there's even a <literal>make uninstall</literal> which can be used to remove
|
| 1028 |
all the installed files.
|
| 1029 |
</para>
|
| 1030 |
</section>
|
| 1031 |
<section id="portable"><title>Popular portable build systems</title>
|
| 1032 |
<para>
|
| 1033 |
A lot of free software programs are written in the <ulink url="&c-program;">C</ulink> and
|
| 1034 |
<ulink url="&cxx;">C++</ulink> languages. Many of these use Autotools or
|
| 1035 |
CMake to make them portable across different platforms. These build tools need
|
| 1036 |
to be used to generate the <filename>Makefile</filename> and other
|
| 1037 |
required source files first. Then, such programs are built using the usual
|
| 1038 |
<literal>make; make install</literal>.
|
| 1039 |
</para>
|
| 1040 |
<para>
|
| 1041 |
<ulink url="&gnu-build-system;">Autotools</ulink> is the GNU build
|
| 1042 |
system comprising <ulink url="&autoconf;">Autoconf</ulink>,
|
| 1043 |
<ulink url="&automake;">Automake</ulink>,
|
| 1044 |
<ulink url="&libtool;">Libtool</ulink>, and
|
| 1045 |
<ulink url="&gettext;">gettext</ulink>. You can recognize
|
| 1046 |
such sources by the <filename>configure.ac</filename>,
|
| 1047 |
<filename>Makefile.am</filename>, and <filename>Makefile.in</filename> files.
|
| 1048 |
<footnote><para>Autotools is too big to deal in this small tutorial. This
|
| 1049 |
section is meant to provide keywords and references only. Please make sure to read the
|
| 1050 |
<ulink url="&autotools-tutorial;">Autotools Tutorial</ulink> and
|
| 1051 |
the local copy of <filename>&autotools-readme;</filename>,
|
| 1052 |
if you need to use it.</para></footnote>
|
| 1053 |
</para>
|
| 1054 |
<para>
|
| 1055 |
The first step of the Autotools workflow is usually that upstream runs
|
| 1056 |
<literal>autoreconf -i -f</literal> in the source directory and
|
| 1057 |
distributes the generated files along with the source.
|
| 1058 |
</para>
|
| 1059 |
<screen>
|
| 1060 |
configure.ac-----+-> autoreconf -+-> configure
|
| 1061 |
Makefile.am -----+ | +-> Makefile.in
|
| 1062 |
src/Makefile.am -+ | +-> src/Makefile.in
|
| 1063 |
| +-> config.h.in
|
| 1064 |
automake
|
| 1065 |
aclocal
|
| 1066 |
aclocal.m4
|
| 1067 |
autoheader
|
| 1068 |
</screen>
|
| 1069 |
<para>
|
| 1070 |
Editing <filename>configure.ac</filename> and <filename>Makefile.am</filename>
|
| 1071 |
files requires some knowledge of <command>autoconf</command> and
|
| 1072 |
<command>automake</command>. See <literal>info autoconf</literal> and
|
| 1073 |
<literal>info automake</literal>.
|
| 1074 |
</para>
|
| 1075 |
<para>
|
| 1076 |
The second step of the Autotools workflow is usually that the user obtains this
|
| 1077 |
distributed source and runs <literal>./configure && make</literal> in
|
| 1078 |
the source directory to compile the program into an executable command
|
| 1079 |
<command><replaceable>binary</replaceable></command>.
|
| 1080 |
</para>
|
| 1081 |
<screen>
|
| 1082 |
Makefile.in -----+ +-> Makefile -----+-> make -> <replaceable>binary</replaceable>
|
| 1083 |
src/Makefile.in -+-> ./configure -+-> src/Makefile -+
|
| 1084 |
config.h.in -----+ +-> config.h -----+
|
| 1085 |
|
|
| 1086 |
config.status -+
|
| 1087 |
config.guess --+
|
| 1088 |
</screen>
|
| 1089 |
<para>
|
| 1090 |
You can change many things in the <filename>Makefile</filename>; for
|
| 1091 |
instance you can change the default location for file installation
|
| 1092 |
using the option <literal>./configure --prefix=/usr</literal>.
|
| 1093 |
</para>
|
| 1094 |
<para>
|
| 1095 |
Although it is not required, updating the <filename>configure</filename> and
|
| 1096 |
other files with <literal>autoreconf -i -f</literal> may improve
|
| 1097 |
the compatibility of the source.
|
| 1098 |
<footnote><para>You can automate this by using
|
| 1099 |
<systemitem role="package">dh-autoreconf</systemitem> package.
|
| 1100 |
See <xref linkend="customrules"/>.</para></footnote>
|
| 1101 |
</para>
|
| 1102 |
<para>
|
| 1103 |
<ulink url="&cmake;">CMake</ulink> is an alternative
|
| 1104 |
build system. You can recognize such sources by the
|
| 1105 |
<filename>CMakeLists.txt</filename> file.
|
| 1106 |
</para>
|
| 1107 |
</section>
|
| 1108 |
<section id="namever"><title>Package name and version</title>
|
| 1109 |
<para>
|
| 1110 |
If the upstream source comes as <filename>gentoo-0.9.12.tar.gz</filename>, you can
|
| 1111 |
take <literal>gentoo</literal> as the (source) <emphasis role="strong">package name</emphasis>
|
| 1112 |
and <literal>0.9.12</literal> as the <emphasis role="strong">upstream version</emphasis>.
|
| 1113 |
These are used in the <filename>debian/changelog</filename> file described later in
|
| 1114 |
<xref linkend="changelog"/>, too.
|
| 1115 |
</para>
|
| 1116 |
<para>
|
| 1117 |
Although this simple approach works most of the times, you may need to adjust
|
| 1118 |
<emphasis role="strong">package name</emphasis> and
|
| 1119 |
<emphasis role="strong">upstream version</emphasis> by renaming the upstream
|
| 1120 |
source to follow Debian Policy and existing convention.
|
| 1121 |
</para>
|
| 1122 |
<para>
|
| 1123 |
You must choose the <emphasis role="strong">package name</emphasis>
|
| 1124 |
to consist only of lower case letters (<literal>a-z</literal>), digits
|
| 1125 |
(<literal>0-9</literal>), plus (<literal>+</literal>) and minus
|
| 1126 |
(<literal>-</literal>) signs, and periods (<literal>.</literal>). It must be
|
| 1127 |
at least two characters long, must start with an alphanumeric character, and
|
| 1128 |
must not be the same as existing ones.
|
| 1129 |
It is a good idea to keep its length within 30 characters.
|
| 1130 |
<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>
|
| 1131 |
</para>
|
| 1132 |
<!--
|
| 1133 |
Osamu's archive stat (2011-04-23, sid, kfreebsd-amd64):
|
| 1134 |
=== stat for package name string length ===
|
| 1135 |
11 1947 36.9% mode
|
| 1136 |
14 1717 54.7% 50% median
|
| 1137 |
23 611 91.0% 90%
|
| 1138 |
32 89 99.0% 99%
|
| 1139 |
41 12 99.9% 99.9%
|
| 1140 |
52 1 100.0%
|
| 1141 |
Previous 20 chars is becoming too short for 17% of packages
|
| 1142 |
Default aptitude setting display up to 30 chars (98.3%).
|
| 1143 |
-->
|
| 1144 |
<para>
|
| 1145 |
If upstream uses some generic term such as <literal>test-suite</literal> for
|
| 1146 |
its name, it is a good idea to rename it to identify its contents explicitly and avoid namespace pollution.
|
| 1147 |
<footnote><para>If you follow the
|
| 1148 |
<ulink url="&devref-newpackage;">Debian Developer's Reference 5.1. "New packages"</ulink>,
|
| 1149 |
the ITP process will usually catch this kind of issues.</para></footnote>
|
| 1150 |
</para>
|
| 1151 |
<para>
|
| 1152 |
You should choose the <emphasis role="strong">upstream version</emphasis>
|
| 1153 |
to consist only of
|
| 1154 |
alphanumerics (<literal>0-9A-Za-z</literal>), plus (<literal>+</literal>),
|
| 1155 |
tildes (<literal>~</literal>), and periods (<literal>.</literal>). It must
|
| 1156 |
start with a digit (<literal>0-9</literal>). <footnote><para>This stricter
|
| 1157 |
rule should help you avoid confusing file names.</para></footnote>
|
| 1158 |
It is good idea to keep its length within 8 characters if possible.
|
| 1159 |
<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>
|
| 1160 |
</para>
|
| 1161 |
<!--
|
| 1162 |
Osamu's archive stat (2011-04-23, sid, kfreebsd-amd64):
|
| 1163 |
=== stat for upstream version string length ===
|
| 1164 |
5 9765 60.2% 50% median and mode
|
| 1165 |
6 3765 73.3%
|
| 1166 |
7 2789 82.9%
|
| 1167 |
8 1158 86.9%
|
| 1168 |
9 501 88.6%
|
| 1169 |
10 773 91.3% 90%
|
| 1170 |
18 55 99.1% 99%
|
| 1171 |
27 11 99.9% 99.9
|
| 1172 |
35 6 100.0%
|
| 1173 |
=== stat for debian revision string length ===
|
| 1174 |
1 22556 83.3% 50% median and mode
|
| 1175 |
2 1106 87.2%
|
| 1176 |
3 1312 91.7% 90%
|
| 1177 |
4 2127 99.1% 99%
|
| 1178 |
7 14 99.9% 99.9%
|
| 1179 |
|
| 1180 |
aptitude display 10 = 8char for up + 1char (for -) + 1char for deb
|
| 1181 |
90chars as max for file name of binary debs (package+up+deb+arch+.deb)
|
| 1182 |
-->
|
| 1183 |
<para>
|
| 1184 |
If upstream does not use a normal versioning scheme such as
|
| 1185 |
<literal>2.30.32</literal> but uses some kind of date such as
|
| 1186 |
<literal>11Apr29</literal>, a random codename string, or a VCS hash value as part
|
| 1187 |
of the version, make sure to remove them from the
|
| 1188 |
<emphasis role="strong">upstream version</emphasis>. Such information can be
|
| 1189 |
recorded in the <filename>debian/changelog</filename> file. If you need to
|
| 1190 |
invent a version string, use the <literal>YYYYMMDD</literal> format such as
|
| 1191 |
<literal>20110429</literal> as upstream version. This ensures that
|
| 1192 |
<command>dpkg</command> interprets later versions correctly as upgrades.
|
| 1193 |
If you need to ensure smooth transition to the normal version scheme such as
|
| 1194 |
<literal>0.1</literal> in future, use the <literal>0~YYMMDD</literal> format
|
| 1195 |
such as <literal>0~110429</literal> as upstream version, instead.
|
| 1196 |
</para>
|
| 1197 |
<para>
|
| 1198 |
Version strings <footnote><para>Version strings may be
|
| 1199 |
<emphasis role="strong">upstream version</emphasis>
|
| 1200 |
(<literal><replaceable>version</replaceable></literal>),
|
| 1201 |
<emphasis role="strong">Debian revision</emphasis>
|
| 1202 |
(<literal><replaceable>revision</replaceable></literal>), or
|
| 1203 |
<emphasis role="strong">version</emphasis>
|
| 1204 |
(<literal><replaceable>version</replaceable>-<replaceable>revision</replaceable></literal>).
|
| 1205 |
See <xref linkend="newrevision"/> for how the
|
| 1206 |
<emphasis role="strong">Debian revision</emphasis> is incremented.
|
| 1207 |
</para></footnote>
|
| 1208 |
can be compared using <citerefentry>
|
| 1209 |
<refentrytitle>dpkg</refentrytitle> <manvolnum>1</manvolnum> </citerefentry> as follows.
|
| 1210 |
</para>
|
| 1211 |
<screen>
|
| 1212 |
$ dpkg --compare-versions <replaceable>ver1</replaceable> <replaceable>op</replaceable> <replaceable>ver2</replaceable>
|
| 1213 |
</screen>
|
| 1214 |
<para>
|
| 1215 |
The version comparison rule can be summarized as:
|
| 1216 |
</para>
|
| 1217 |
<itemizedlist>
|
| 1218 |
<listitem><para>Strings are compared from the head to the tail.</para></listitem>
|
| 1219 |
<listitem><para>Letters are larger than digits.</para></listitem>
|
| 1220 |
<listitem><para>Numbers are compared as integers.</para></listitem>
|
| 1221 |
<listitem><para>Letters are compared in ASCII code order.</para></listitem>
|
| 1222 |
<listitem><para>There are special rules for period
|
| 1223 |
(<literal>.</literal>), plus (<literal>+</literal>), and tilde
|
| 1224 |
(<literal>~</literal>) characters, as follows.</para>
|
| 1225 |
<para>
|
| 1226 |
<literal>0.0</literal> <
|
| 1227 |
<literal>0.5</literal> <
|
| 1228 |
<literal>0.10</literal> <
|
| 1229 |
<literal>0.99</literal> <
|
| 1230 |
<literal>1</literal> <
|
| 1231 |
<literal>1.0~rc1</literal> <
|
| 1232 |
<literal>1.0</literal> <
|
| 1233 |
<literal>1.0+b1</literal> <
|
| 1234 |
<literal>1.0+nmu1</literal> <
|
| 1235 |
<literal>1.1</literal> <
|
| 1236 |
<literal>2.0</literal>
|
| 1237 |
</para>
|
| 1238 |
</listitem>
|
| 1239 |
</itemizedlist>
|
| 1240 |
<para>
|
| 1241 |
One tricky case occurs when upstream releases
|
| 1242 |
<filename>gentoo-0.9.12-ReleaseCandidate-99.tar.gz</filename> as the
|
| 1243 |
pre-release of <filename>gentoo-0.9.12.tar.gz</filename>. You need to make
|
| 1244 |
sure that the upgrade works properly by renaming the upstream source to
|
| 1245 |
<filename>gentoo-0.9.12~rc99.tar.gz</filename>.
|
| 1246 |
</para>
|
| 1247 |
</section>
|
| 1248 |
<section id="dh-make"><title>Setting up <command>dh_make</command></title>
|
| 1249 |
<para>
|
| 1250 |
Set up the shell environment variables <literal>$DEBEMAIL</literal> and
|
| 1251 |
<literal>$DEBFULLNAME</literal> so that various Debian maintenance
|
| 1252 |
tools recognize your email address and name to use for packages. <footnote><para> The
|
| 1253 |
following text assumes you are using Bash as your login shell. If you use
|
| 1254 |
some other login shell such as Z shell, use their corresponding
|
| 1255 |
configuration files instead of <filename>~/.bashrc</filename>. </para> </footnote>
|
| 1256 |
</para>
|
| 1257 |
<screen>
|
| 1258 |
$ cat >>~/.bashrc <<EOF
|
| 1259 |
DEBEMAIL="your.email.address@example.org"
|
| 1260 |
DEBFULLNAME="Firstname Lastname"
|
| 1261 |
export DEBEMAIL DEBFULLNAME
|
| 1262 |
EOF
|
| 1263 |
$ . ~/.bashrc
|
| 1264 |
</screen>
|
| 1265 |
</section>
|
| 1266 |
<section id="non-native-dh-make"><title>Initial non-native Debian package</title>
|
| 1267 |
<para>
|
| 1268 |
Normal Debian packages are non-native Debian packages made from upstream
|
| 1269 |
programs. If you wish to create a non-native Debian package of an upstream
|
| 1270 |
source <filename>gentoo-0.9.12.tar.gz</filename>, you can create an initial
|
| 1271 |
non-native Debian package for it by issuing the <command>dh_make</command>
|
| 1272 |
command as follows.
|
| 1273 |
</para>
|
| 1274 |
<screen>
|
| 1275 |
$ cd ~/gentoo
|
| 1276 |
$ wget http://example.org/gentoo-0.9.12.tar.gz
|
| 1277 |
$ tar -xvzf gentoo-0.9.12.tar.gz
|
| 1278 |
$ cd gentoo-0.9.12
|
| 1279 |
$ dh_make -f ../gentoo-0.9.12.tar.gz
|
| 1280 |
</screen>
|
| 1281 |
<para>
|
| 1282 |
Of course, replace the filename with the name of your original source archive.
|
| 1283 |
<footnote><para> If the upstream source provides the
|
| 1284 |
<filename>debian</filename> directory and its contents, run the
|
| 1285 |
<command>dh_make</command> command with the extra option
|
| 1286 |
<literal>--addmissing</literal>. The new source <literal>3.0 (quilt)</literal> format is
|
| 1287 |
robust enough not to break even for these packages. You may need to update the contents
|
| 1288 |
provided by the upstream for your Debian package. </para> </footnote> See
|
| 1289 |
<citerefentry> <refentrytitle>dh_make</refentrytitle> <manvolnum>8</manvolnum>
|
| 1290 |
</citerefentry> for details.
|
| 1291 |
</para>
|
| 1292 |
<para>
|
| 1293 |
You should see some output asking you what sort of package you want
|
| 1294 |
to create. Gentoo is a single binary package - it creates only one binary package, i.e,
|
| 1295 |
one <filename>.deb</filename> file - so we will select the first option
|
| 1296 |
(with the <literal>s</literal> key), check the information on the screen, and
|
| 1297 |
confirm by pressing <literal><replaceable>ENTER</replaceable></literal>.
|
| 1298 |
<footnote><para> There are several choices here: <literal>s</literal> for
|
| 1299 |
Single binary package, <literal>i</literal> for arch-Independent package, <literal>m</literal> for
|
| 1300 |
Multiple binary packages, <literal>l</literal> for Library package, <literal>k</literal> for
|
| 1301 |
Kernel module package, <literal>n</literal> for kernel patch package, and <literal>b</literal>
|
| 1302 |
for <systemitem role="package">cdbs</systemitem> package. This document focuses on the
|
| 1303 |
use of the <command>dh</command> command (from the package
|
| 1304 |
<systemitem role="package">debhelper</systemitem>) to create a single binary package,
|
| 1305 |
but also touches on how to use it for arch-independent or
|
| 1306 |
multiple binary packages. The package
|
| 1307 |
<systemitem role="package">cdbs</systemitem> offers an alternative packaging script
|
| 1308 |
infrastructure to the <command>dh</command> command and is outside the scope of
|
| 1309 |
this document. </para> </footnote>
|
| 1310 |
</para>
|
| 1311 |
<para>
|
| 1312 |
This execution of <command>dh_make</command> creates a copy of the upstream
|
| 1313 |
tarball as <filename>gentoo_0.9.12.orig.tar.gz</filename> in the
|
| 1314 |
parent directory to accommodate the creation of the non-native Debian source
|
| 1315 |
package with the name <filename>debian.tar.gz</filename> later.
|
| 1316 |
</para>
|
| 1317 |
<screen>
|
| 1318 |
$ cd ~/gentoo ; ls -F
|
| 1319 |
gentoo-0.9.12/
|
| 1320 |
gentoo-0.9.12.tar.gz
|
| 1321 |
gentoo_0.9.12.orig.tar.gz
|
| 1322 |
</screen>
|
| 1323 |
<para>
|
| 1324 |
Please note two key features of this filename
|
| 1325 |
<filename>gentoo_0.9.12.orig.tar.gz</filename>:
|
| 1326 |
</para>
|
| 1327 |
<itemizedlist>
|
| 1328 |
<listitem>
|
| 1329 |
<para>
|
| 1330 |
Package name and version are separated by the character <literal>_</literal>
|
| 1331 |
(underscore).
|
| 1332 |
</para>
|
| 1333 |
</listitem>
|
| 1334 |
<listitem>
|
| 1335 |
<para>
|
| 1336 |
The string <filename>.orig</filename> is inserted before the
|
| 1337 |
<filename>.tar.gz</filename>.
|
| 1338 |
</para>
|
| 1339 |
</listitem>
|
| 1340 |
</itemizedlist>
|
| 1341 |
<para>
|
| 1342 |
You should also notice that many template files are created in the source under
|
| 1343 |
the <filename>debian</filename> directory. These will be explained in
|
| 1344 |
<xref linkend="dreq"/> and <xref linkend="dother"/>. You should also understand
|
| 1345 |
that packaging cannot be a fully automated process. You will need to modify the upstream
|
| 1346 |
source for Debian (see <xref linkend="modify"/>). After this, you need to
|
| 1347 |
use the proper methods for building Debian packages (<xref linkend="build"/>),
|
| 1348 |
testing them (<xref linkend="checkit"/>), and uploading them (<xref linkend="upload"/>).
|
| 1349 |
All the steps will be explained.
|
| 1350 |
</para>
|
| 1351 |
<para>
|
| 1352 |
If you accidentally erased some template files while working on them, you can
|
| 1353 |
recover them by running <command>dh_make</command> with the
|
| 1354 |
<literal>--addmissing</literal> option again in a Debian package source tree.
|
| 1355 |
</para>
|
| 1356 |
<para>
|
| 1357 |
Updating an existing package may get complicated since it may be using older
|
| 1358 |
techniques. While learning the basics, please stick to creating a fresh
|
| 1359 |
package; further explanations are given in <xref linkend="update"/>.
|
| 1360 |
</para>
|
| 1361 |
<para>
|
| 1362 |
Please note that the source file does not need to contain any build system
|
| 1363 |
discussed in <xref linkend="simplemake"/> and <xref linkend="portable"/>. It
|
| 1364 |
could be just a collection of graphical data etc. Installation of files may be
|
| 1365 |
carried out using only <systemitem role="package">debhelper</systemitem> configuration
|
| 1366 |
files such as <filename>debian/install</filename> (see
|
| 1367 |
<xref linkend="install"/>).
|
| 1368 |
</para>
|
| 1369 |
</section>
|
| 1370 |
<section id="native-dh-make"><title>Initial native Debian package</title>
|
| 1371 |
<para>
|
| 1372 |
If a package contains source files you are only maintaining for Debian,
|
| 1373 |
possibly only for local use, it may be simpler to create it as a Debian
|
| 1374 |
native package. If you have source
|
| 1375 |
files in <filename>~/mypackage-1.0</filename>, you can create an initial native
|
| 1376 |
Debian package for it by issuing the <command>dh_make</command> command as
|
| 1377 |
follows.
|
| 1378 |
</para>
|
| 1379 |
<screen>
|
| 1380 |
$ cd ~/mypackage-1.0
|
| 1381 |
$ dh_make --native
|
| 1382 |
</screen>
|
| 1383 |
<para>
|
| 1384 |
Then the <filename>debian</filename> directory and its contents are created
|
| 1385 |
just like <xref linkend="non-native-dh-make"/>. This does not create a tarball
|
| 1386 |
since this is a native Debian package. But that is the only difference.
|
| 1387 |
The rest of the packaging activities are practically the same.
|
| 1388 |
</para>
|
| 1389 |
</section>
|
| 1390 |
</chapter>
|
| 1391 |
<chapter id="modify"><title>Modifying the source</title>
|
| 1392 |
<para>
|
| 1393 |
Please note that there isn't space here to go into <emphasis>all</emphasis> the
|
| 1394 |
details of fixing upstream sources, but here are some basic steps and problems
|
| 1395 |
people often run across.
|
| 1396 |
</para>
|
| 1397 |
<section id="quiltrc"><title>Setting up <command>quilt</command></title>
|
| 1398 |
<para>
|
| 1399 |
The program <command>quilt</command> offers a basic method for recording
|
| 1400 |
modifications to the upstream source for Debian packaging. It's
|
| 1401 |
useful to have a slightly customized default, so let's create an alias
|
| 1402 |
<command>dquilt</command> for Debian packaging by adding the following
|
| 1403 |
line to <filename>~/.bashrc</filename>.
|
| 1404 |
</para>
|
| 1405 |
<screen>
|
| 1406 |
alias dquilt="quilt --quiltrc=${HOME}/.quiltrc-dpkg"
|
| 1407 |
</screen>
|
| 1408 |
<para>
|
| 1409 |
Then let's create <filename>~/.quiltrc-dpkg</filename> as follows.
|
| 1410 |
</para>
|
| 1411 |
<screen>
|
| 1412 |
d=. ; while [ ! -d $d/debian -a `readlink -e $d` != / ]; do d=$d/..; done
|
| 1413 |
if [ -d $d/debian ] && [ -z $QUILT_PATCHES ]; then
|
| 1414 |
# if in Debian packaging tree with unset $QUILT_PATCHES
|
| 1415 |
QUILT_PATCHES="debian/patches"
|
| 1416 |
QUILT_PATCH_OPTS="--reject-format=unified"
|
| 1417 |
QUILT_DIFF_ARGS="-p ab --no-timestamps --no-index --color=auto"
|
| 1418 |
QUILT_REFRESH_ARGS="-p ab --no-timestamps --no-index"
|
| 1419 |
QUILT_COLORS="diff_hdr=1;32:diff_add=1;34:diff_rem=1;31:diff_hunk=1;33:diff_ctx=35:diff_cctx=33"
|
| 1420 |
if ! [ -d $d/debian/patches ]; then mkdir $d/debian/patches; fi
|
| 1421 |
fi
|
| 1422 |
</screen>
|
| 1423 |
<para>
|
| 1424 |
See <citerefentry> <refentrytitle>quilt</refentrytitle>
|
| 1425 |
<manvolnum>1</manvolnum> </citerefentry> and
|
| 1426 |
<ulink url="&quilt-pdf;">quilt.pdf</ulink> on how to use
|
| 1427 |
<command>quilt</command>.
|
| 1428 |
</para>
|
| 1429 |
</section>
|
| 1430 |
<section id="fixupstream"><title>Fixing upstream bugs</title>
|
| 1431 |
<para>
|
| 1432 |
Let's assume you find an error in the upstream <filename>Makefile</filename>
|
| 1433 |
as follows where <literal>install: gentoo</literal> should have been
|
| 1434 |
<literal>install: gentoo-target</literal>.
|
| 1435 |
</para>
|
| 1436 |
<screen>
|
| 1437 |
install: gentoo
|
| 1438 |
install ./gentoo $(BIN)
|
| 1439 |
install icons/* $(ICONS)
|
| 1440 |
install gentoorc-example $(HOME)/.gentoorc
|
| 1441 |
</screen>
|
| 1442 |
<para>
|
| 1443 |
Let's fix this and record it with the <command>dquilt</command> command as
|
| 1444 |
<filename>fix-gentoo-target.patch</filename>. <footnote><para> The
|
| 1445 |
<filename>debian/patches</filename> directory should exist now if you ran
|
| 1446 |
<command>dh_make</command> as described before. This example operation creates
|
| 1447 |
it just in case you are updating an existing package. </para> </footnote>
|
| 1448 |
</para>
|
| 1449 |
<screen>
|
| 1450 |
$ mkdir debian/patches
|
| 1451 |
$ dquilt new fix-gentoo-target.patch
|
| 1452 |
$ dquilt add Makefile
|
| 1453 |
</screen>
|
| 1454 |
<para>
|
| 1455 |
You change the <filename>Makefile</filename> file as follows.
|
| 1456 |
</para>
|
| 1457 |
<screen>
|
| 1458 |
install: gentoo-target
|
| 1459 |
install ./gentoo $(BIN)
|
| 1460 |
install icons/* $(ICONS)
|
| 1461 |
install gentoorc-example $(HOME)/.gentoorc
|
| 1462 |
</screen>
|
| 1463 |
<para>
|
| 1464 |
Ask <command>dquilt</command> to generate the patch to create
|
| 1465 |
<filename>debian/patches/fix-gentoo-target.patch</filename> and add its
|
| 1466 |
description following <ulink url="&dep3;">DEP-3: Patch Tagging Guidelines</ulink>.
|
| 1467 |
</para>
|
| 1468 |
<screen>
|
| 1469 |
$ dquilt refresh
|
| 1470 |
$ dquilt header -e
|
| 1471 |
... describe patch
|
| 1472 |
</screen>
|
| 1473 |
</section>
|
| 1474 |
<section id="destdir"><title>Installation of files to their destination</title>
|
| 1475 |
<para>
|
| 1476 |
Most third-party software installs itself in the <filename>/usr/local</filename>
|
| 1477 |
directory hierarchy. On Debian this is reserved for private use
|
| 1478 |
by the system administrator, so packages must not use directories such
|
| 1479 |
as <filename>/usr/local/bin</filename> but should instead use system
|
| 1480 |
directories such as <filename>/usr/bin</filename>, obeying the
|
| 1481 |
<ulink url="&fhs;">Filesystem Hierarchy Standard</ulink> (FHS).
|
| 1482 |
</para>
|
| 1483 |
<para>
|
| 1484 |
Normally, <citerefentry> <refentrytitle>make</refentrytitle>
|
| 1485 |
<manvolnum>1</manvolnum> </citerefentry> is used to automate building the
|
| 1486 |
program, and executing <literal>make install</literal> installs programs
|
| 1487 |
directly to the desired destination (following the
|
| 1488 |
<literal>install</literal> target in the
|
| 1489 |
<filename>Makefile</filename>). In order for Debian to provide
|
| 1490 |
pre-built installable packages, it modifies the build system to install
|
| 1491 |
programs into a file tree image created under a temporary directory
|
| 1492 |
instead of the actual destination.
|
| 1493 |
</para>
|
| 1494 |
<para>
|
| 1495 |
These two differences between normal program installation on one hand and the
|
| 1496 |
Debian packaging system on the other can be transparently addressed by the
|
| 1497 |
<systemitem role="package">debhelper</systemitem> package through the
|
| 1498 |
<command>dh_auto_configure</command> and <command>dh_auto_install</command>
|
| 1499 |
commands if the following conditions are met.
|
| 1500 |
</para>
|
| 1501 |
<itemizedlist>
|
| 1502 |
<listitem>
|
| 1503 |
<para>
|
| 1504 |
The <filename>Makefile</filename> must follow GNU conventions and
|
| 1505 |
support the <literal>$(DESTDIR)</literal> variable.
|
| 1506 |
<footnote><para> See <ulink url="&gnu-destdir;">GNU Coding Standards: 7.2.4 DESTDIR: Support for Staged Installs</ulink>.</para></footnote>
|
| 1507 |
</para>
|
| 1508 |
</listitem>
|
| 1509 |
<listitem>
|
| 1510 |
<para>
|
| 1511 |
The source must follow the Filesystem Hierarchy Standard (FHS).
|
| 1512 |
</para>
|
| 1513 |
</listitem>
|
| 1514 |
</itemizedlist>
|
| 1515 |
<para>
|
| 1516 |
Programs that use GNU <command>autoconf</command> follow the GNU conventions
|
| 1517 |
automatically, so they can be trivial to package. On the basis of
|
| 1518 |
this and other heuristics, it is estimated that the
|
| 1519 |
<systemitem role="package">debhelper</systemitem> package will work for
|
| 1520 |
about 90% of packages without making any intrusive changes to their
|
| 1521 |
build system. So packaging is not as complicated as it may seem.
|
| 1522 |
</para>
|
| 1523 |
<para>
|
| 1524 |
If you need to make changes in the <filename>Makefile</filename>, you
|
| 1525 |
should be careful to support the <literal>$(DESTDIR)</literal>
|
| 1526 |
variable. Although it is unset by default, the <literal>$(DESTDIR)</literal>
|
| 1527 |
variable is prepended to each file path used for the program
|
| 1528 |
installation. The packaging script will set
|
| 1529 |
<literal>$(DESTDIR)</literal> to the temporary directory.
|
| 1530 |
</para>
|
| 1531 |
<para>
|
| 1532 |
For a source package generating a single binary package, the temporary directory used
|
| 1533 |
by the <command>dh_auto_install</command> command will be set to
|
| 1534 |
<filename>debian/<replaceable>package</replaceable></filename>.
|
| 1535 |
<footnote><para> For a source package generating multiple binary packages, the
|
| 1536 |
<command>dh_auto_install</command> command uses <filename>debian/tmp</filename>
|
| 1537 |
as the temporary directory while the <command>dh_install</command> command with
|
| 1538 |
the help of
|
| 1539 |
<filename>debian/<replaceable>package-1</replaceable>.install</filename> and
|
| 1540 |
<filename>debian/<replaceable>package-2</replaceable>.install</filename> files
|
| 1541 |
will split the contents of <filename>debian/tmp</filename> into
|
| 1542 |
<filename>debian/<replaceable>package-1</replaceable></filename> and
|
| 1543 |
<filename>debian/<replaceable>package-2</replaceable></filename> temporary
|
| 1544 |
directories, to create
|
| 1545 |
<filename><replaceable>package-1</replaceable>_*.deb</filename> and
|
| 1546 |
<filename><replaceable>package-2</replaceable>_*.deb</filename> binary
|
| 1547 |
packages.
|
| 1548 |
</para> </footnote> Everything that is contained in the temporary directory
|
| 1549 |
will be installed on users' systems when they install your package; the only
|
| 1550 |
difference is that <command>dpkg</command> will be installing the
|
| 1551 |
files to paths relative to the root directory rather than your working
|
| 1552 |
directory.
|
| 1553 |
</para>
|
| 1554 |
<para>
|
| 1555 |
Bear in mind that even though your program installs in
|
| 1556 |
<filename>debian/<replaceable>package</replaceable></filename>, it still needs
|
| 1557 |
to behave correctly when installed from the <filename>.deb</filename>
|
| 1558 |
package under the root directory. So you must not allow the build
|
| 1559 |
system to hardcode strings like
|
| 1560 |
<literal>/home/me/deb/<replaceable>package</replaceable>-<replaceable>version</replaceable>/usr/share/<replaceable>package</replaceable></literal>
|
| 1561 |
into files in the package.
|
| 1562 |
</para>
|
| 1563 |
<para>
|
| 1564 |
Here's the relevant part of <systemitem role="package">gentoo</systemitem>'s
|
| 1565 |
<filename>Makefile</filename><footnote><para> This is just an example to
|
| 1566 |
show what a <filename>Makefile</filename> should look like. If the
|
| 1567 |
<filename>Makefile</filename> is created by the
|
| 1568 |
<command>./configure</command> command, the correct way to fix this kind of
|
| 1569 |
<filename>Makefile</filename> is to execute <command>./configure</command>
|
| 1570 |
from the <command>dh_auto_configure</command> command with default
|
| 1571 |
options including <literal>--prefix=/usr</literal>. </para> </footnote>:
|
| 1572 |
</para>
|
| 1573 |
<screen>
|
| 1574 |
# Where to put executable commands on 'make install'?
|
| 1575 |
BIN = /usr/local/bin
|
| 1576 |
# Where to put icons on 'make install'?
|
| 1577 |
ICONS = /usr/local/share/gentoo
|
| 1578 |
</screen>
|
| 1579 |
<para>
|
| 1580 |
We see that the files are set to install under <filename>/usr/local</filename>.
|
| 1581 |
As explained above, that directory hierarchy is reserved for local use on
|
| 1582 |
Debian, so change those paths to:
|
| 1583 |
</para>
|
| 1584 |
<screen>
|
| 1585 |
# Where to put executable commands on 'make install'?
|
| 1586 |
BIN = $(DESTDIR)/usr/bin
|
| 1587 |
# Where to put icons on 'make install'?
|
| 1588 |
ICONS = $(DESTDIR)/usr/share/gentoo
|
| 1589 |
</screen>
|
| 1590 |
<para>
|
| 1591 |
The exact locations that should be used for binaries, icons,
|
| 1592 |
documentation, etc. are specified in the Filesystem Hierarchy Standard
|
| 1593 |
(FHS). You should browse through it and read the sections relevant to
|
| 1594 |
your package.
|
| 1595 |
</para>
|
| 1596 |
<para>
|
| 1597 |
So, we should install executable commands in <filename>/usr/bin</filename> instead of
|
| 1598 |
<filename>/usr/local/bin</filename>, the manual page in
|
| 1599 |
<filename>/usr/share/man/man1</filename> instead of
|
| 1600 |
<filename>/usr/local/man/man1</filename>, and so on. Notice how there's no manual
|
| 1601 |
page mentioned in <systemitem role="package">gentoo</systemitem>'s
|
| 1602 |
<filename>Makefile</filename>, but since Debian Policy requires that every
|
| 1603 |
program has one, we'll make one later and install it in
|
| 1604 |
<filename>/usr/share/man/man1</filename>.
|
| 1605 |
</para>
|
| 1606 |
<para>
|
| 1607 |
Some programs don't use <filename>Makefile</filename> variables to define paths
|
| 1608 |
such as these. This means you might have to edit some real C sources in order
|
| 1609 |
to fix them to use the right locations. But where to search, and exactly what
|
| 1610 |
for? You can find this out by issuing:
|
| 1611 |
</para>
|
| 1612 |
<screen>
|
| 1613 |
$ grep -nr --include='*.[c|h]' -e 'usr/local/lib' .
|
| 1614 |
</screen>
|
| 1615 |
<para>
|
| 1616 |
<command>grep</command> will run recursively through the source tree and tell
|
| 1617 |
you the filename and the line number for all matches.
|
| 1618 |
</para>
|
| 1619 |
<para>
|
| 1620 |
Edit those files and in those lines replace <literal>usr/local/lib</literal>
|
| 1621 |
with <literal>usr/lib</literal>. This can be done automatically as follows:
|
| 1622 |
</para>
|
| 1623 |
<screen>
|
| 1624 |
$ sed -i -e 's#usr/local/lib#usr/lib#g' \
|
| 1625 |
$(find . -type f -name '*.[c|h]')
|
| 1626 |
</screen>
|
| 1627 |
<para>
|
| 1628 |
If you want to confirm each substitution instead, this can be done interactively as follows:
|
| 1629 |
</para>
|
| 1630 |
<screen>
|
| 1631 |
$ vim '+argdo %s#usr/local/lib#usr/lib#gce|update' +q \
|
| 1632 |
$(find . -type f -name '*.[c|h]')
|
| 1633 |
</screen>
|
| 1634 |
|
| 1635 |
<para>
|
| 1636 |
Next you should find the <literal>install</literal> target (searching
|
| 1637 |
for the line that starts with <literal>install:</literal> will usually
|
| 1638 |
work) and rename all references to directories other than ones defined
|
| 1639 |
at the top of the <filename>Makefile</filename>.
|
| 1640 |
</para>
|
| 1641 |
<para>
|
| 1642 |
Originally, <systemitem role="package">gentoo</systemitem>'s
|
| 1643 |
<literal>install</literal> target said:
|
| 1644 |
</para>
|
| 1645 |
<screen>
|
| 1646 |
install: gentoo-target
|
| 1647 |
install ./gentoo $(BIN)
|
| 1648 |
install icons/* $(ICONS)
|
| 1649 |
install gentoorc-example $(HOME)/.gentoorc
|
| 1650 |
</screen>
|
| 1651 |
<para>
|
| 1652 |
Let's fix this upstream bug and record it with the <command>dquilt</command> command as
|
| 1653 |
<filename>debian/patches/install.patch</filename>.
|
| 1654 |
</para>
|
| 1655 |
<screen>
|
| 1656 |
$ dquilt new install.patch
|
| 1657 |
$ dquilt add Makefile
|
| 1658 |
</screen>
|
| 1659 |
<para>
|
| 1660 |
In your editor, change this for the Debian package as follows:
|
| 1661 |
</para>
|
| 1662 |
<screen>
|
| 1663 |
install: gentoo-target
|
| 1664 |
install -d $(BIN) $(ICONS) $(DESTDIR)/etc
|
| 1665 |
install ./gentoo $(BIN)
|
| 1666 |
install -m644 icons/* $(ICONS)
|
| 1667 |
install -m644 gentoorc-example $(DESTDIR)/etc/gentoorc
|
| 1668 |
</screen>
|
| 1669 |
<para>
|
| 1670 |
You'll have noticed that there's now an <literal>install -d</literal> command
|
| 1671 |
before the other commands in the rule. The original
|
| 1672 |
<filename>Makefile</filename> didn't have it because usually
|
| 1673 |
<literal>/usr/local/bin</literal> and other directories already exist on the
|
| 1674 |
system where you are running <literal>make install</literal>. However, since we will
|
| 1675 |
be installing into a newly created private directory tree, we will have to
|
| 1676 |
create each and every one of those directories.
|
| 1677 |
</para>
|
| 1678 |
<para>
|
| 1679 |
We can also add in other things at the end of the rule, like the installation
|
| 1680 |
of additional documentation that the upstream authors sometimes omit:
|
| 1681 |
</para>
|
| 1682 |
<screen>
|
| 1683 |
install -d $(DESTDIR)/usr/share/doc/gentoo/html
|
| 1684 |
cp -a docs/* $(DESTDIR)/usr/share/doc/gentoo/html
|
| 1685 |
</screen>
|
| 1686 |
<para>
|
| 1687 |
Check carefully, and if everything is okay, ask <command>dquilt</command> to
|
| 1688 |
generate the patch to create <filename>debian/patches/install.patch</filename>
|
| 1689 |
and add its description.
|
| 1690 |
</para>
|
| 1691 |
<screen>
|
| 1692 |
$ dquilt refresh
|
| 1693 |
$ dquilt header -e
|
| 1694 |
... describe patch
|
| 1695 |
</screen>
|
| 1696 |
<para>
|
| 1697 |
Now you have a series of patches.
|
| 1698 |
</para>
|
| 1699 |
<orderedlist numeration="arabic">
|
| 1700 |
<listitem>
|
| 1701 |
<para>
|
| 1702 |
Upstream bug fix: <filename>debian/patches/fix-gentoo-target.patch</filename>
|
| 1703 |
</para>
|
| 1704 |
</listitem>
|
| 1705 |
<listitem>
|
| 1706 |
<para>
|
| 1707 |
Debian specific packaging modification:
|
| 1708 |
<filename>debian/patches/install.patch</filename>
|
| 1709 |
</para>
|
| 1710 |
</listitem>
|
| 1711 |
</orderedlist>
|
| 1712 |
<para>
|
| 1713 |
Whenever you make changes that are not specific to the Debian package
|
| 1714 |
such as <filename>debian/patches/fix-gentoo-target.patch</filename>, be sure to
|
| 1715 |
send them to the upstream maintainer so they can be included in the next
|
| 1716 |
version of the program and be useful to everyone else. Also remember
|
| 1717 |
to avoid making your fixes specific to Debian or Linux - or even Unix!
|
| 1718 |
Make them portable. This will make your fixes much easier to apply.
|
| 1719 |
</para>
|
| 1720 |
<para>
|
| 1721 |
Note that you don't have to send the <filename>debian/*</filename> files
|
| 1722 |
upstream.
|
| 1723 |
</para>
|
| 1724 |
</section>
|
| 1725 |
<section id="difflibs"><title>Differing libraries</title>
|
| 1726 |
<para>
|
| 1727 |
There is one other common problem: libraries are often different from platform
|
| 1728 |
to platform. For example, a <filename>Makefile</filename> can contain a
|
| 1729 |
reference to a library which doesn't exist on the Debian system. In that case, we
|
| 1730 |
need to change it to a library which does exist in Debian, and serves the same
|
| 1731 |
purpose.
|
| 1732 |
</para>
|
| 1733 |
<para>
|
| 1734 |
Let's assume a line in your program's <filename>Makefile</filename> (or
|
| 1735 |
<filename>Makefile.in</filename>) as the following.
|
| 1736 |
</para>
|
| 1737 |
<screen>
|
| 1738 |
LIBS = -lfoo -lbar
|
| 1739 |
</screen>
|
| 1740 |
<para>
|
| 1741 |
If your program doesn't compile since the <literal>foo</literal> library
|
| 1742 |
doesn't exist and its equivalent is provided by the <literal>foo2</literal>
|
| 1743 |
library on the Debian system, you can fix this build problem as
|
| 1744 |
<filename>debian/patches/foo2.patch</filename> by changing
|
| 1745 |
<literal>foo</literal> into <literal>foo2</literal>.<footnote><para>If there
|
| 1746 |
are API changes from the <literal>foo</literal> library to the
|
| 1747 |
<literal>foo2</literal> library, required changes to the source code need to be
|
| 1748 |
made to match the new API.</para> </footnote>
|
| 1749 |
</para>
|
| 1750 |
<screen>
|
| 1751 |
$ dquilt new foo2.patch
|
| 1752 |
$ dquilt add Makefile
|
| 1753 |
$ sed -i -e 's/-lfoo/-lfoo2/g' Makefile
|
| 1754 |
$ dquilt refresh
|
| 1755 |
$ dquilt header -e
|
| 1756 |
... describe patch
|
| 1757 |
</screen>
|
| 1758 |
</section>
|
| 1759 |
</chapter>
|
| 1760 |
<chapter id="dreq"><title>Required files under the <filename>debian</filename> directory</title>
|
| 1761 |
<para>
|
| 1762 |
There is a new subdirectory under the program's source directory, called
|
| 1763 |
<filename>debian</filename>. There are a number of files in this directory
|
| 1764 |
that we should edit in order to customize the behavior of the package. The
|
| 1765 |
most important of them are <filename>control</filename>,
|
| 1766 |
<filename>changelog</filename>, <filename>copyright</filename>, and
|
| 1767 |
<filename>rules</filename>, which are required for all packages.
|
| 1768 |
<footnote><para>
|
| 1769 |
In this chapter, files in the <filename>debian</filename> directory are
|
| 1770 |
referred to without the leading <filename>debian/</filename> for simplicity whenever
|
| 1771 |
the meaning is obvious.
|
| 1772 |
</para></footnote>
|
| 1773 |
</para>
|
| 1774 |
<section id="control"><title><filename>control</filename></title>
|
| 1775 |
<para>
|
| 1776 |
This file contains various values which <command>dpkg</command>,
|
| 1777 |
<command>dselect</command>, <command>apt-get</command>,
|
| 1778 |
<command>apt-cache</command>, <command>aptitude</command>, and other package
|
| 1779 |
management tools will use to manage the package. It is defined by the
|
| 1780 |
<ulink url="&policy-control;">Debian Policy Manual, 5 "Control files and their fields"</ulink>.
|
| 1781 |
</para>
|
| 1782 |
<para>
|
| 1783 |
Here is the <filename>control</filename> file <command>dh_make</command>
|
| 1784 |
created for us:
|
| 1785 |
</para>
|
| 1786 |
<screen>
|
| 1787 |
1 Source: gentoo
|
| 1788 |
2 Section: unknown
|
| 1789 |
3 Priority: extra
|
| 1790 |
4 Maintainer: Josip Rodin <joy-mg@debian.org>
|
| 1791 |
5 Build-Depends: debhelper (>= 7.0.50~)
|
| 1792 |
6 Standards-Version: 3.8.4
|
| 1793 |
7 Homepage: <insert the upstream URL, if relevant>
|
| 1794 |
8
|
| 1795 |
9 Package: gentoo
|
| 1796 |
10 Architecture: any
|
| 1797 |
11 Depends: ${shlibs:Depends}, ${misc:Depends}
|
| 1798 |
12 Description: <insert up to 60 chars description>
|
| 1799 |
13 <insert long description, indented with spaces>
|
| 1800 |
</screen>
|
| 1801 |
<para>
|
| 1802 |
(I've added the line numbers.)
|
| 1803 |
</para>
|
| 1804 |
<para>
|
| 1805 |
Lines 1-7 are the control information for the source package.
|
| 1806 |
Lines 9-13 are the control information for the binary package.
|
| 1807 |
</para>
|
| 1808 |
<para>
|
| 1809 |
Line 1 is the name of the source package.
|
| 1810 |
</para>
|
| 1811 |
<para>
|
| 1812 |
Line 2 is the section of the distribution the source package goes into.
|
| 1813 |
</para>
|
| 1814 |
<para>
|
| 1815 |
As you may have noticed, the Debian archive is divided into multiple areas:
|
| 1816 |
<literal>main</literal> (the free software), <literal>non-free</literal> (the
|
| 1817 |
not really free software) and <literal>contrib</literal> (free software that
|
| 1818 |
depends on non-free software). Each of these is divided into sections that
|
| 1819 |
classify packages into rough categories. So we have <literal>admin</literal>
|
| 1820 |
for administrator-only programs,
|
| 1821 |
<literal>devel</literal> for programmer tools, <literal>doc</literal> for
|
| 1822 |
documentation, <literal>libs</literal> for libraries, <literal>mail</literal>
|
| 1823 |
for email readers and daemons, <literal>net</literal> for network apps and
|
| 1824 |
daemons, <literal>x11</literal> for X11 programs that don't fit anywhere else,
|
| 1825 |
and many more.
|
| 1826 |
<footnote> <para>See
|
| 1827 |
<ulink url="&policy-subsections;">Debian Policy Manual, 2.4 "Sections"</ulink> and
|
| 1828 |
<ulink url="§ions-unstable;">List of sections in <literal>sid</literal></ulink>.</para>
|
| 1829 |
</footnote>
|
| 1830 |
</para>
|
| 1831 |
<para>
|
| 1832 |
Let's change it then to x11. (A <literal>main/</literal> prefix is implied so
|
| 1833 |
we can omit it.)
|
| 1834 |
</para>
|
| 1835 |
<para>
|
| 1836 |
Line 3 describes how important it is that the user installs this package.
|
| 1837 |
<footnote> <para>See
|
| 1838 |
<ulink url="&policy-priorities;">Debian Policy Manual, 2.5 "Priorities"</ulink>.
|
| 1839 |
</para>
|
| 1840 |
</footnote>
|
| 1841 |
</para>
|
| 1842 |
<itemizedlist>
|
| 1843 |
<listitem>
|
| 1844 |
<para>
|
| 1845 |
The <literal>optional</literal> priority will usually work for new packages
|
| 1846 |
that do not conflict with others claiming <literal>required</literal>,
|
| 1847 |
<literal>important</literal>, or <literal>standard</literal> priority.
|
| 1848 |
</para>
|
| 1849 |
</listitem>
|
| 1850 |
<listitem>
|
| 1851 |
<para>
|
| 1852 |
The <literal>extra</literal> priority will usually work for new packages that
|
| 1853 |
conflict with others with non-<literal>extra</literal> priorities.
|
| 1854 |
</para>
|
| 1855 |
</listitem>
|
| 1856 |
</itemizedlist>
|
| 1857 |
<para>
|
| 1858 |
Section and priority are used by front-ends like <command>aptitude</command>
|
| 1859 |
when they sort packages and select defaults. Once you upload the package to
|
| 1860 |
Debian, the value of these two fields can be overridden by the archive
|
| 1861 |
maintainers, in which case you will be notified by email.
|
| 1862 |
</para>
|
| 1863 |
<para>
|
| 1864 |
As this is a normal priority package and doesn't conflict with anything else,
|
| 1865 |
we will change the priority to <literal>optional</literal>.
|
| 1866 |
</para>
|
| 1867 |
<para>
|
| 1868 |
Line 4 is the name and email address of the maintainer. Make sure that this
|
| 1869 |
field includes a valid <literal>To</literal> header for email, because after
|
| 1870 |
you upload it, the bug tracking system will use it to deliver bug emails to
|
| 1871 |
you. Avoid using commas, ampersands, or parentheses.
|
| 1872 |
</para>
|
| 1873 |
<para>
|
| 1874 |
Line 5 includes the list of packages required to build your package as
|
| 1875 |
the <literal>Build-Depends</literal> field. You can also have the
|
| 1876 |
<literal>Build-Depends-Indep</literal> field as an additional line, here.
|
| 1877 |
<footnote><para>See
|
| 1878 |
<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>
|
| 1879 |
Some packages like
|
| 1880 |
<systemitem role="package">gcc</systemitem> and
|
| 1881 |
<systemitem role="package">make</systemitem> which are required by the
|
| 1882 |
<systemitem role="package">build-essential</systemitem> package are implied. If you need
|
| 1883 |
to have other tools to build your package, you should add them to these fields.
|
| 1884 |
Multiple entries are separated with commas; read on for the explanation of
|
| 1885 |
binary package dependencies to find out more about the syntax of these lines.
|
| 1886 |
</para>
|
| 1887 |
<itemizedlist>
|
| 1888 |
<listitem>
|
| 1889 |
<para>
|
| 1890 |
For all packages packaged with the <command>dh</command> command in the
|
| 1891 |
<filename>debian/rules</filename> file, you must have <literal>debhelper
|
| 1892 |
(>=7.0.50~)</literal> in the <literal>Build-Depends</literal> field to
|
| 1893 |
satisfy the Debian Policy requirement for the <literal>clean</literal> target.
|
| 1894 |
</para>
|
| 1895 |
</listitem>
|
| 1896 |
<listitem>
|
| 1897 |
<para>
|
| 1898 |
Source packages which have binary packages with <literal>Architecture:
|
| 1899 |
any</literal> are rebuilt by the autobuilder. Since this autobuilder
|
| 1900 |
procedure installs only the packages listed in the
|
| 1901 |
<literal>Build-Depends</literal> field before running
|
| 1902 |
<literal>debian/rules build</literal> (see <xref
|
| 1903 |
linkend="autobuilder"/>), the <literal>Build-Depends</literal> field
|
| 1904 |
needs to list practically all the required packages and
|
| 1905 |
<literal>Build-Depends-Indep</literal> is rarely used.
|
| 1906 |
</para>
|
| 1907 |
</listitem>
|
| 1908 |
<listitem>
|
| 1909 |
<para>
|
| 1910 |
For source packages with binary packages all of which are <literal>Architecture:
|
| 1911 |
all</literal>, the <literal>Build-Depends-Indep</literal> field may list all
|
| 1912 |
the required packages unless they are already listed in the
|
| 1913 |
<literal>Build-Depends</literal> field to satisfy the Debian Policy requirement
|
| 1914 |
for the <literal>clean</literal> target.
|
| 1915 |
</para>
|
| 1916 |
</listitem>
|
| 1917 |
</itemizedlist>
|
| 1918 |
<para>
|
| 1919 |
If you are not sure which one should be used, use the
|
| 1920 |
<literal>Build-Depends</literal> field to be on the safe side.
|
| 1921 |
<footnote><para> This somewhat strange situation is a feature well documented
|
| 1922 |
in the <ulink url="&policy-build-depends-indep;">Debian Policy
|
| 1923 |
Manual, Footnotes 55</ulink>. This is not due to the use of the
|
| 1924 |
<command>dh</command> command in the <filename>debian/rules</filename> file but
|
| 1925 |
due to how the <command>dpkg-buildpackage</command> works. The same situation
|
| 1926 |
applies to the <ulink url="https://bugs.launchpad.net/launchpad-buildd/+bug/238141">auto build system
|
| 1927 |
for Ubuntu</ulink>. </para> </footnote>
|
| 1928 |
</para>
|
| 1929 |
<para>
|
| 1930 |
To find out what packages your package needs to be built run the command:
|
| 1931 |
</para>
|
| 1932 |
<screen>
|
| 1933 |
$ dpkg-depcheck -d ./configure
|
| 1934 |
</screen>
|
| 1935 |
<para>
|
| 1936 |
To manually find exact build dependencies for
|
| 1937 |
<command><replaceable>/usr/bin/foo</replaceable></command>, execute
|
| 1938 |
</para>
|
| 1939 |
<screen>
|
| 1940 |
$ objdump -p <replaceable>/usr/bin/foo</replaceable> | grep NEEDED
|
| 1941 |
</screen>
|
| 1942 |
<para>
|
| 1943 |
and for each library listed, e.g., <command>libfoo.so.6</command>, execute
|
| 1944 |
</para>
|
| 1945 |
<screen>
|
| 1946 |
$ dpkg -S libfoo.so.6
|
| 1947 |
</screen>
|
| 1948 |
<para>
|
| 1949 |
Then just take the <literal>-dev</literal> version of every package as a
|
| 1950 |
<literal>Build-Depends</literal> entry. If you use <command>ldd</command> for
|
| 1951 |
this purpose, it will report indirect lib dependencies as well, resulting in
|
| 1952 |
the problem of excessive build dependencies.
|
| 1953 |
</para>
|
| 1954 |
<para>
|
| 1955 |
<systemitem role="package">gentoo</systemitem> also happens to require
|
| 1956 |
<systemitem role="package">xlibs-dev</systemitem>, <systemitem role="package">libgtk1.2-dev</systemitem> and <systemitem role="package">libglib1.2-dev</systemitem> to build, so we'll add them here
|
| 1957 |
next to <systemitem role="package">debhelper</systemitem>.
|
| 1958 |
</para>
|
| 1959 |
<para>
|
| 1960 |
Line 6 is the version of the <ulink url="&debian-policy;">Debian Policy
|
| 1961 |
Manual</ulink> standards this package follows, the one you read while making
|
| 1962 |
your package.
|
| 1963 |
</para>
|
| 1964 |
<para>
|
| 1965 |
On line 7 you can put the URL of the software's upstream homepage.
|
| 1966 |
</para>
|
| 1967 |
<para>
|
| 1968 |
Line 9 is the name of the binary package. This is usually the same as the name
|
| 1969 |
of the source package, but it doesn't necessarily have to be that way.
|
| 1970 |
</para>
|
| 1971 |
<para>
|
| 1972 |
Line 10 describes the architectures the binary package can be compiled for.
|
| 1973 |
This value is usually one of the following depending
|
| 1974 |
on the type of the binary package.
|
| 1975 |
<footnote><para>See
|
| 1976 |
<ulink url="&policy-architecture;">Debian Policy Manual 5.6.8 "Architecture"</ulink>
|
| 1977 |
for exact details.
|
| 1978 |
</para></footnote>
|
| 1979 |
</para>
|
| 1980 |
<itemizedlist>
|
| 1981 |
<listitem><para><literal>Architecture: any</literal></para>
|
| 1982 |
<itemizedlist>
|
| 1983 |
<listitem><para>The generated binary package is an architecture dependent one
|
| 1984 |
usually in a compiled language.</para></listitem>
|
| 1985 |
</itemizedlist>
|
| 1986 |
</listitem>
|
| 1987 |
<listitem><para><literal>Architecture: all</literal></para>
|
| 1988 |
<itemizedlist>
|
| 1989 |
<listitem><para>The generated binary package is an architecture independent
|
| 1990 |
one usually consisting of text, images, or scripts in an interpreted
|
| 1991 |
language.</para></listitem>
|
| 1992 |
</itemizedlist>
|
| 1993 |
</listitem>
|
| 1994 |
</itemizedlist>
|
| 1995 |
<para>
|
| 1996 |
We leave line 10 as is since this is written in C.
|
| 1997 |
<citerefentry><refentrytitle>dpkg-gencontrol</refentrytitle><manvolnum>1</manvolnum></citerefentry>
|
| 1998 |
will fill in the appropriate architecture value for any machine this source
|
| 1999 |
package gets compiled on.
|
| 2000 |
</para>
|
| 2001 |
<para>
|
| 2002 |
If your package is architecture independent (for example, a shell or Perl
|
| 2003 |
script, or a document), change this to <literal>all</literal>, and read later
|
| 2004 |
in <xref linkend="rules"/> about using the <literal>binary-indep</literal> rule
|
| 2005 |
instead of <literal>binary-arch</literal> for building the package.
|
| 2006 |
</para>
|
| 2007 |
<para>
|
| 2008 |
Line 11 shows one of the most powerful features of the Debian packaging system.
|
| 2009 |
Packages can relate to each other in various ways. Apart from
|
| 2010 |
<literal>Depends</literal>, other relationship fields are
|
| 2011 |
<literal>Recommends</literal>, <literal>Suggests</literal>,
|
| 2012 |
<literal>Pre-Depends</literal>, <literal>Breaks</literal>,
|
| 2013 |
<literal>Conflicts</literal>, <literal>Provides</literal>, and
|
| 2014 |
<literal>Replaces</literal>.
|
| 2015 |
</para>
|
| 2016 |
<para>
|
| 2017 |
The package management tools usually behave the same way when dealing with
|
| 2018 |
these relations; if not, it will be explained. (See <citerefentry>
|
| 2019 |
<refentrytitle>dpkg</refentrytitle> <manvolnum>8</manvolnum> </citerefentry>,
|
| 2020 |
<citerefentry> <refentrytitle>dselect</refentrytitle> <manvolnum>8</manvolnum>
|
| 2021 |
</citerefentry>, <citerefentry> <refentrytitle>apt</refentrytitle>
|
| 2022 |
<manvolnum>8</manvolnum> </citerefentry>, <citerefentry>
|
| 2023 |
<refentrytitle>aptitude</refentrytitle> <manvolnum>1</manvolnum>
|
| 2024 |
</citerefentry>, etc.)
|
| 2025 |
</para>
|
| 2026 |
<para>
|
| 2027 |
Here is a simplified description of package relationships.
|
| 2028 |
<footnote><para>See
|
| 2029 |
<ulink url="&policy-relationships;">Debian Policy Manual, 7 "Declaring relationships between packages"</ulink>.
|
| 2030 |
</para></footnote>
|
| 2031 |
</para>
|
| 2032 |
<itemizedlist>
|
| 2033 |
<listitem>
|
| 2034 |
<para>
|
| 2035 |
<literal>Depends</literal>
|
| 2036 |
</para>
|
| 2037 |
<para>
|
| 2038 |
The package will not be installed unless the packages it depends on are
|
| 2039 |
installed. Use this if your program absolutely will not run (or will cause
|
| 2040 |
severe breakage) unless a particular package is present.
|
| 2041 |
</para>
|
| 2042 |
</listitem>
|
| 2043 |
<listitem>
|
| 2044 |
<para>
|
| 2045 |
<literal>Recommends</literal>
|
| 2046 |
</para>
|
| 2047 |
<para>
|
| 2048 |
Use this for packages that are not strictly necessary but are typically used
|
| 2049 |
with your program. When a user installs your program, all front-ends will
|
| 2050 |
probably prompt them to install the recommended packages.
|
| 2051 |
<command>aptitude</command> and <command>apt-get</command> install recommended
|
| 2052 |
packages along with your package by default (but the user can disable this
|
| 2053 |
behavior). <command>dpkg</command> will ignore this field.
|
| 2054 |
</para>
|
| 2055 |
</listitem>
|
| 2056 |
<listitem>
|
| 2057 |
<para>
|
| 2058 |
<literal>Suggests</literal>
|
| 2059 |
</para>
|
| 2060 |
<para>
|
| 2061 |
Use this for packages which will work nicely with your program but are not at
|
| 2062 |
all necessary. When a user installs your program, they will probably not be
|
| 2063 |
prompted to install suggested packages. <command>aptitude</command> can
|
| 2064 |
be configured to install suggested packages along with your package but this is
|
| 2065 |
not its default. <command>dpkg</command> and <command>apt-get</command> will
|
| 2066 |
ignore this field.
|
| 2067 |
</para>
|
| 2068 |
</listitem>
|
| 2069 |
<listitem>
|
| 2070 |
<para>
|
| 2071 |
<literal>Pre-Depends</literal>
|
| 2072 |
</para>
|
| 2073 |
<para>
|
| 2074 |
This is stronger than <literal>Depends</literal>. The package will not be
|
| 2075 |
installed unless the packages it pre-depends on are installed and
|
| 2076 |
<emphasis>correctly configured</emphasis>. Use this <emphasis>very</emphasis>
|
| 2077 |
sparingly and only after discussing it on the <ulink url="&debian-devel-ldo;">debian-devel@lists.debian.org</ulink>
|
| 2078 |
mailing list. Read: don't use it at all. :-)
|
| 2079 |
</para>
|
| 2080 |
</listitem>
|
| 2081 |
<listitem>
|
| 2082 |
<para>
|
| 2083 |
<literal>Conflicts</literal>
|
| 2084 |
</para>
|
| 2085 |
<para>
|
| 2086 |
The package will not be installed until all the packages it conflicts with have
|
| 2087 |
been removed. Use this if your program absolutely will not run or will cause
|
| 2088 |
severe problems if a particular package is present.
|
| 2089 |
</para>
|
| 2090 |
</listitem>
|
| 2091 |
<listitem>
|
| 2092 |
<para>
|
| 2093 |
<literal>Breaks</literal>
|
| 2094 |
</para>
|
| 2095 |
<para>
|
| 2096 |
When installed the package will break all the listed packages.
|
| 2097 |
Normally a <literal>Breaks</literal> entry specifies that it applies to versions earlier than a certain value.
|
| 2098 |
The resolution is generally to use higher-level package management tools to upgrade the listed packages.
|
| 2099 |
</para>
|
| 2100 |
</listitem>
|
| 2101 |
<listitem>
|
| 2102 |
<para>
|
| 2103 |
<literal>Provides</literal>
|
| 2104 |
</para>
|
| 2105 |
<para>
|
| 2106 |
For some types of packages where there are multiple alternatives virtual names
|
| 2107 |
have been defined. You can get the full list in the
|
| 2108 |
<ulink url="&virtual-package;">virtual-package-names-list.txt.gz</ulink>
|
| 2109 |
file. Use this if your program provides a function of an existing virtual
|
| 2110 |
package.
|
| 2111 |
</para>
|
| 2112 |
</listitem>
|
| 2113 |
<listitem>
|
| 2114 |
<para>
|
| 2115 |
<literal>Replaces</literal>
|
| 2116 |
</para>
|
| 2117 |
<para>
|
| 2118 |
Use this when your program replaces files from another package, or completely
|
| 2119 |
replaces another package (used in conjunction with
|
| 2120 |
<literal>Conflicts</literal>). Files from the named packages will be
|
| 2121 |
overwritten with the files from your package.
|
| 2122 |
</para>
|
| 2123 |
</listitem>
|
| 2124 |
</itemizedlist>
|
| 2125 |
<para>
|
| 2126 |
All these fields have uniform syntax. They are a list of package names
|
| 2127 |
separated by commas. These package names may also be lists of alternative
|
| 2128 |
package names, separated by vertical bar symbols <literal>|</literal> (pipe
|
| 2129 |
symbols).
|
| 2130 |
</para>
|
| 2131 |
<para>
|
| 2132 |
The fields may restrict their applicability to particular versions of each
|
| 2133 |
named package. The restriction of each individual package is listed in
|
| 2134 |
parentheses after its name, and should contain a relation from the list below
|
| 2135 |
followed by a version number value.
|
| 2136 |
The relations allowed are: <literal><<</literal>,
|
| 2137 |
<literal><=</literal>, <literal>=</literal>, <literal>>=</literal>, and
|
| 2138 |
<literal>>></literal> for strictly lower, lower or equal, exactly equal,
|
| 2139 |
greater or equal, and strictly greater, respectively. For example,
|
| 2140 |
</para>
|
| 2141 |
<screen>
|
| 2142 |
Depends: foo (>= 1.2), libbar1 (= 1.3.4)
|
| 2143 |
Conflicts: baz
|
| 2144 |
Recommends: libbaz4 (>> 4.0.7)
|
| 2145 |
Suggests: quux
|
| 2146 |
Replaces: quux (<< 5), quux-foo (<= 7.6)
|
| 2147 |
</screen>
|
| 2148 |
<para>
|
| 2149 |
The last feature you need to know about is
|
| 2150 |
<literal>${shlibs:Depends}</literal>, <literal>${perl:Depends}</literal>,
|
| 2151 |
<literal>${misc:Depends}</literal>, etc.
|
| 2152 |
</para>
|
| 2153 |
<para>
|
| 2154 |
<citerefentry> <refentrytitle>dh_shlibdeps</refentrytitle>
|
| 2155 |
<manvolnum>1</manvolnum> </citerefentry> calculates shared library dependencies
|
| 2156 |
for binary packages. It generates a list of <ulink url="&elf;">ELF</ulink> executables and shared
|
| 2157 |
libraries it has found for each binary package. This list is used for
|
| 2158 |
substituting <literal>${shlibs:Depends}</literal>.
|
| 2159 |
</para>
|
| 2160 |
<para>
|
| 2161 |
<citerefentry> <refentrytitle>dh_perl</refentrytitle> <manvolnum>1</manvolnum>
|
| 2162 |
</citerefentry> calculates Perl dependencies. It generates a list of a
|
| 2163 |
dependencies on <literal>perl</literal> or <literal>perlapi</literal> for each binary package. This list is used for
|
| 2164 |
substituting <literal>${perl:Depends}</literal>.
|
| 2165 |
</para>
|
| 2166 |
<para>
|
| 2167 |
Some <systemitem role="package">debhelper</systemitem> commands may cause the
|
| 2168 |
generated package to depend on some additional packages. All such commands
|
| 2169 |
generate a list of required packages for each binary package.
|
| 2170 |
This list is used for substituting <literal>${misc:Depends}</literal>.
|
| 2171 |
</para>
|
| 2172 |
<para>
|
| 2173 |
<citerefentry> <refentrytitle>dh_gencontrol</refentrytitle>
|
| 2174 |
<manvolnum>1</manvolnum> </citerefentry> generates
|
| 2175 |
<filename>DEBIAN/control</filename> for each binary package while
|
| 2176 |
substituting <literal>${shlibs:Depends}</literal>,
|
| 2177 |
<literal>${perl:Depends}</literal>, <literal>${misc:Depends}</literal>, etc.
|
| 2178 |
</para>
|
| 2179 |
<para>
|
| 2180 |
Having said all that, we can leave the <literal>Depends</literal> field exactly
|
| 2181 |
as it is now, and insert another line after it saying <literal>Suggests:
|
| 2182 |
file</literal>, because <systemitem role="package">gentoo</systemitem> can use
|
| 2183 |
some features provided by the <systemitem role="package">file</systemitem>
|
| 2184 |
package.
|
| 2185 |
</para>
|
| 2186 |
<para> Line 9 is the Homepage URL. Let's assume this to be at
|
| 2187 |
<ulink url="&gentoo;"/>.
|
| 2188 |
</para>
|
| 2189 |
<para>
|
| 2190 |
Line 12 is the short description. Terminals are conventionally 80 columns wide so
|
| 2191 |
this shouldn't be longer than about 60 characters. I'll change it to
|
| 2192 |
<literal>fully GUI-configurable, two-pane X file manager</literal>.
|
| 2193 |
</para>
|
| 2194 |
<para>
|
| 2195 |
Line 13 is where the long description goes. This should be a paragraph which
|
| 2196 |
gives more details about the package. Column 1 of each line should be empty.
|
| 2197 |
There must be no blank lines, but you can put a single <literal>.</literal>
|
| 2198 |
(dot) in a column to simulate that. Also, there must be no more than one blank
|
| 2199 |
line after the long description. <footnote><para>These descriptions are in
|
| 2200 |
English. Translations of these descriptions are provided by
|
| 2201 |
<ulink url="&ddtp;">The Debian Description Translation Project - DDTP</ulink>.</para></footnote>
|
| 2202 |
</para>
|
| 2203 |
<para>
|
| 2204 |
We can insert <literal>Vcs-*</literal> fields to document the Version Control
|
| 2205 |
System (VCS) location between lines 6 and 7.
|
| 2206 |
<footnote><para>See
|
| 2207 |
<ulink url="&devref-bpp-vcs;">Debian Developer's Reference, 6.2.5. "Version Control System location"</ulink>.
|
| 2208 |
</para></footnote>
|
| 2209 |
Let's assume that the <systemitem role="package">gentoo</systemitem>
|
| 2210 |
package has its VCS located in the Debian Alioth Git Service at
|
| 2211 |
<literal>git://git.debian.org/git/collab-maint/gentoo.git</literal>.
|
| 2212 |
</para>
|
| 2213 |
<para>
|
| 2214 |
Finally, here is the updated <filename>control</filename> file:
|
| 2215 |
</para>
|
| 2216 |
<screen>
|
| 2217 |
1 Source: gentoo
|
| 2218 |
2 Section: x11
|
| 2219 |
3 Priority: optional
|
| 2220 |
4 Maintainer: Josip Rodin <joy-mg@debian.org>
|
| 2221 |
5 Build-Depends: debhelper (>= 7.0.5), xlibs-dev, libgtk1.2-dev, libglib1.2-dev
|
| 2222 |
6 Standards-Version: 3.8.4
|
| 2223 |
7 Vcs-Git: git://git.debian.org/git/collab-maint/gentoo.git
|
| 2224 |
8 Vcs-browser: http://git.debian.org/?p=collab-maint/gentoo.git
|
| 2225 |
9 Homepage: &gentoo;
|
| 2226 |
10
|
| 2227 |
11 Package: gentoo
|
| 2228 |
12 Architecture: any
|
| 2229 |
13 Depends: ${shlibs:Depends}, ${misc:Depends}
|
| 2230 |
14 Suggests: file
|
| 2231 |
15 Description: fully GUI-configurable, two-pane X file manager
|
| 2232 |
16 gentoo is a two-pane file manager for the X Window System. gentoo lets the
|
| 2233 |
17 user do (almost) all of the configuration and customizing from within the
|
| 2234 |
18 program itself. If you still prefer to hand-edit configuration files,
|
| 2235 |
19 they're fairly easy to work with since they are written in an XML format.
|
| 2236 |
20 .
|
| 2237 |
21 gentoo features a fairly complex and powerful file identification system,
|
| 2238 |
22 coupled to an object-oriented style system, which together give you a lot
|
| 2239 |
23 of control over how files of different types are displayed and acted upon.
|
| 2240 |
24 Additionally, over a hundred pixmap images are available for use in file
|
| 2241 |
25 type descriptions.
|
| 2242 |
26 .
|
| 2243 |
29 gentoo was written from scratch in ANSI C, and it utilizes the GTK+ toolkit
|
| 2244 |
30 for its interface.
|
| 2245 |
</screen>
|
| 2246 |
<para>
|
| 2247 |
(I've added the line numbers.)
|
| 2248 |
</para>
|
| 2249 |
</section>
|
| 2250 |
<section id="copyright"><title><filename>copyright</filename></title>
|
| 2251 |
<para>
|
| 2252 |
This file contains information about the copyright and license of the upstream sources.
|
| 2253 |
<ulink url="&policy-copyright;">Debian Policy Manual, 12.5 "Copyright information"</ulink>
|
| 2254 |
dictates its content and
|
| 2255 |
<ulink url="&dep5;">DEP-5: Machine-parseable <filename>debian/copyright</filename></ulink>
|
| 2256 |
provides guidelines for its format.
|
| 2257 |
</para>
|
| 2258 |
<para>
|
| 2259 |
<command>dh_make</command> can give you a template
|
| 2260 |
<filename>copyright</filename> file. Let's use the <literal>--copyright
|
| 2261 |
gpl2</literal> option here to get a template file for the <systemitem role="package">gentoo</systemitem> package released under GPL-2.
|
| 2262 |
</para>
|
| 2263 |
<para>
|
| 2264 |
You must fill in missing information to complete this file, such as the place you got the package
|
| 2265 |
from, the actual copyright notice, and the license. For certain
|
| 2266 |
common free software licenses (GNU GPL-1, GNU GPL-2, GNU GPL-3,
|
| 2267 |
LGPL-2, LGPL-2.1, LGPL-3, GNU FDL-1.2, GNU FDL-1.3, Apache-2.0, or the Artistic
|
| 2268 |
license), you can just refer to the appropriate file in the
|
| 2269 |
<filename>/usr/share/common-licenses/</filename> directory that exists on every
|
| 2270 |
Debian system. Otherwise, you must include the complete license.
|
| 2271 |
</para>
|
| 2272 |
<para>
|
| 2273 |
In short, here's what <systemitem role="package">gentoo</systemitem>'s
|
| 2274 |
<filename>copyright</filename> file should look like:
|
| 2275 |
</para>
|
| 2276 |
<screen>
|
| 2277 |
1 Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=135
|
| 2278 |
2 Name: gentoo
|
| 2279 |
3 Maintainer: Josip Rodin <joy-mg@debian.org>
|
| 2280 |
4 Source: http://sourceforge.net/projects/gentoo/files/
|
| 2281 |
5
|
| 2282 |
6 Copyright: 1998-2010 Emil Brink <emil@obsession.se>
|
| 2283 |
7 License: GPL-2+
|
| 2284 |
8
|
| 2285 |
9 Files: icons/*
|
| 2286 |
10 Copyright: 1998 Johan Hanson <johan@tiq.com>
|
| 2287 |
11 License: GPL-2+
|
| 2288 |
12
|
| 2289 |
13 Files: debian/*
|
| 2290 |
14 Copyright: 1998-2010 Josip Rodin <joy-mg@debian.org>
|
| 2291 |
15 License: GPL-2+
|
| 2292 |
16
|
| 2293 |
17 License: GPL-2+
|
| 2294 |
18 This program is free software; you can redistribute it and/or modify
|
| 2295 |
19 it under the terms of the GNU General Public License as published by
|
| 2296 |
20 the Free Software Foundation; either version 2 of the License, or
|
| 2297 |
21 (at your option) any later version.
|
| 2298 |
22 .
|
| 2299 |
23 This program is distributed in the hope that it will be useful,
|
| 2300 |
24 but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 2301 |
25 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 2302 |
26 GNU General Public License for more details.
|
| 2303 |
27 .
|
| 2304 |
28 You should have received a copy of the GNU General Public License along
|
| 2305 |
29 with this program; if not, write to the Free Software Foundation, Inc.,
|
| 2306 |
30 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
| 2307 |
31 .
|
| 2308 |
32 On Debian systems, the full text of the GNU General Public
|
| 2309 |
33 License version 2 can be found in the file
|
| 2310 |
34 `/usr/share/common-licenses/GPL-2'.
|
| 2311 |
</screen>
|
| 2312 |
<para>
|
| 2313 |
(I've added the line numbers.)
|
| 2314 |
</para>
|
| 2315 |
<para>
|
| 2316 |
Please follow the HOWTO provided by the ftpmasters and sent to
|
| 2317 |
debian-devel-announce: <ulink url="&howto-copyright;"/>.
|
| 2318 |
</para>
|
| 2319 |
</section>
|
| 2320 |
<section id="changelog"><title><filename>changelog</filename></title>
|
| 2321 |
<para>
|
| 2322 |
This is a required file, which has a special format described in
|
| 2323 |
<ulink url="&policy-dpkgchangelog;">Debian Policy Manual, 4.4 "debian/changelog"</ulink>.
|
| 2324 |
This format is used by <command>dpkg</command> and other programs to obtain the
|
| 2325 |
version number, revision, distribution, and urgency of your package.
|
| 2326 |
</para>
|
| 2327 |
<para>
|
| 2328 |
For you, it is also important, since it is good to have documented all changes
|
| 2329 |
you have done. It will help people downloading your package to see whether
|
| 2330 |
there are issues with the package that they should know about. It will be
|
| 2331 |
saved as <filename>/usr/share/doc/gentoo/changelog.Debian.gz</filename> in the
|
| 2332 |
binary package.
|
| 2333 |
</para>
|
| 2334 |
<para>
|
| 2335 |
<command>dh_make</command> created a default one, and this is what it looks
|
| 2336 |
like:
|
| 2337 |
</para>
|
| 2338 |
<screen>
|
| 2339 |
1 gentoo (0.9.12-1) unstable; urgency=low
|
| 2340 |
2
|
| 2341 |
3 * Initial release (Closes: #<replaceable>nnnn</replaceable>) <<replaceable>nnnn</replaceable> is the bug number of your ITP>
|
| 2342 |
4
|
| 2343 |
5 -- Josip Rodin <joy-mg@debian.org> Mon, 22 Mar 2010 00:37:31 +0100
|
| 2344 |
6
|
| 2345 |
</screen>
|
| 2346 |
<para>
|
| 2347 |
(I've added the line numbers.)
|
| 2348 |
</para>
|
| 2349 |
<para>
|
| 2350 |
Line 1 is the package name, version, distribution, and urgency. The name must
|
| 2351 |
match the source package name; distribution should be
|
| 2352 |
<literal>unstable</literal> (or even <literal>experimental</literal>)
|
| 2353 |
<footnote><para> Some people use invalid distribution values such as
|
| 2354 |
<literal>UNRELEASED</literal> to prevent a package being accidentally uploaded
|
| 2355 |
when updating a package in a shared VCS. </para> </footnote>, and urgency
|
| 2356 |
shouldn't be changed to anything higher than <literal>low</literal>. :-)
|
| 2357 |
</para>
|
| 2358 |
<para>
|
| 2359 |
Lines 3-5 are a log entry, where you document changes made in this package
|
| 2360 |
revision (not the upstream changes - there is a special file for that purpose,
|
| 2361 |
created by the upstream authors, which you will later install as
|
| 2362 |
<filename>/usr/share/doc/gentoo/changelog.gz</filename>). Let's assume your
|
| 2363 |
ITP (Intent To Package) bug report number was <literal>12345</literal>. New
|
| 2364 |
lines must be inserted just below the uppermost line that begins with
|
| 2365 |
<literal>*</literal> (asterisk). You can do it with <citerefentry>
|
| 2366 |
<refentrytitle>dch</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>, or
|
| 2367 |
manually with a text editor.
|
| 2368 |
</para>
|
| 2369 |
<para>
|
| 2370 |
You will end up with something like this:
|
| 2371 |
</para>
|
| 2372 |
<screen>
|
| 2373 |
1 gentoo (0.9.12-1) unstable; urgency=low
|
| 2374 |
2
|
| 2375 |
3 * Initial Release. Closes: #12345
|
| 2376 |
4 * This is my first Debian package.
|
| 2377 |
5 * Adjusted the Makefile to fix $(DESTDIR) problems.
|
| 2378 |
6
|
| 2379 |
7 -- Josip Rodin <joy-mg@debian.org> Mon, 22 Mar 2010 00:37:31 +0100
|
| 2380 |
8
|
| 2381 |
</screen>
|
| 2382 |
<para>
|
| 2383 |
(I've added the line numbers.)
|
| 2384 |
</para>
|
| 2385 |
<para>
|
| 2386 |
You can read more about updating the <filename>changelog</filename> file later
|
| 2387 |
in <xref linkend="update"/>.
|
| 2388 |
</para>
|
| 2389 |
</section>
|
| 2390 |
<section id="rules"><title><filename>rules</filename></title>
|
| 2391 |
<para>
|
| 2392 |
Now we need to take a look at the exact rules which <citerefentry>
|
| 2393 |
<refentrytitle>dpkg-buildpackage</refentrytitle> <manvolnum>1</manvolnum>
|
| 2394 |
</citerefentry> will use to actually create the package. This file is in fact
|
| 2395 |
another <filename>Makefile</filename>, but different from the one(s) in the
|
| 2396 |
upstream source. Unlike other files in <filename>debian</filename>, this one
|
| 2397 |
is marked as executable.
|
| 2398 |
</para>
|
| 2399 |
<section id="targets"><title>Targets of the <filename>rules</filename> file</title>
|
| 2400 |
<para>
|
| 2401 |
Every <filename>rules</filename> file, like any other
|
| 2402 |
<filename>Makefile</filename>, consists of several rules, each of
|
| 2403 |
which defines a target and how it is carried out.
|
| 2404 |
<footnote><para>You can start learning how to write <filename>Makefile</filename> from
|
| 2405 |
<ulink url="&debref-make;">Debian Reference, 12.2. "Make"</ulink>.
|
| 2406 |
The full documentation is available as
|
| 2407 |
<ulink url="&gnu-make;"></ulink> or as the
|
| 2408 |
<systemitem role="package">make-doc</systemitem> package in the <literal>non-free</literal> archive area.
|
| 2409 |
</para></footnote>
|
| 2410 |
A new rule begins with its target declaration in the first column. The
|
| 2411 |
following lines beginning with the TAB code (ASCII 9) specify the recipe for
|
| 2412 |
carrying out that target.
|
| 2413 |
Empty lines and lines beginning with <literal>#</literal> (hash) are treated as
|
| 2414 |
comments and ignored.
|
| 2415 |
<footnote><para><ulink url="&policy-debianrules;">Debian
|
| 2416 |
Policy Manual, 4.9 "Main building script: debian/rules"</ulink> explains the
|
| 2417 |
details.</para></footnote>
|
| 2418 |
</para>
|
| 2419 |
<para>
|
| 2420 |
A rule that you want to execute is invoked by its target name as a command line argument. For
|
| 2421 |
example, <literal>debian/rules <replaceable>build</replaceable></literal> and
|
| 2422 |
<literal>fakeroot make -f debian/rules <replaceable>binary</replaceable></literal>
|
| 2423 |
execute rules for <literal><replaceable>build</replaceable></literal> and
|
| 2424 |
<literal><replaceable>binary</replaceable></literal> targets respectively.
|
| 2425 |
</para>
|
| 2426 |
<para>
|
| 2427 |
Here is a simplified explanation of the targets:
|
| 2428 |
</para>
|
| 2429 |
<itemizedlist>
|
| 2430 |
<listitem>
|
| 2431 |
<para>
|
| 2432 |
<literal>clean</literal> target: to clean all compiled, generated, and useless
|
| 2433 |
files in the build-tree. (Required)
|
| 2434 |
</para>
|
| 2435 |
</listitem>
|
| 2436 |
<listitem>
|
| 2437 |
<para>
|
| 2438 |
<literal>build</literal> target: to build the source into compiled programs and
|
| 2439 |
formatted documents in the build-tree. (Required)
|
| 2440 |
</para>
|
| 2441 |
</listitem>
|
| 2442 |
<listitem>
|
| 2443 |
<para>
|
| 2444 |
<literal>install</literal> target: to install files into a file tree for each
|
| 2445 |
binary package under the <filename>debian</filename> directory. If defined,
|
| 2446 |
<literal>binary*</literal> targets effectively depend on this target.
|
| 2447 |
(Optional)
|
| 2448 |
</para>
|
| 2449 |
</listitem>
|
| 2450 |
<listitem>
|
| 2451 |
<para>
|
| 2452 |
<literal>binary</literal> target: to create all binary packages (effectively
|
| 2453 |
a combination of <literal>binary-arch</literal> and
|
| 2454 |
<literal>binary-indep</literal> targets). (Required)<footnote><para> This
|
| 2455 |
target is used by <literal>dpkg-buildpackage</literal> as in <xref linkend="completebuild"/>. </para> </footnote>
|
| 2456 |
</para>
|
| 2457 |
</listitem>
|
| 2458 |
<listitem>
|
| 2459 |
<para>
|
| 2460 |
<literal>binary-arch</literal> target: to create arch-dependent
|
| 2461 |
(<literal>Architecture: any</literal>) binary packages in the parent directory.
|
| 2462 |
(Required)<footnote><para> This target is used by <literal>dpkg-buildpackage
|
| 2463 |
-B</literal> as in <xref linkend="autobuilder"/>. </para> </footnote>
|
| 2464 |
</para>
|
| 2465 |
</listitem>
|
| 2466 |
<listitem>
|
| 2467 |
<para>
|
| 2468 |
<literal>binary-indep</literal> target: to create arch-independent
|
| 2469 |
(<literal>Architecture: all</literal>) binary packages in the parent directory.
|
| 2470 |
(Required)<footnote><para> This target is used by <literal>dpkg-buildpackage
|
| 2471 |
-A</literal>. </para> </footnote>
|
| 2472 |
</para>
|
| 2473 |
</listitem>
|
| 2474 |
<listitem>
|
| 2475 |
<para>
|
| 2476 |
<literal>get-orig-source</literal> target: to obtain the most recent version of
|
| 2477 |
the original source package from an upstream archive. (Optional)
|
| 2478 |
</para>
|
| 2479 |
</listitem>
|
| 2480 |
</itemizedlist>
|
| 2481 |
<para>
|
| 2482 |
You are probably overwhelmed by now, but things are much simpler upon examination of the
|
| 2483 |
<filename>rules</filename> file that <command>dh_make</command> gives us as a
|
| 2484 |
default.
|
| 2485 |
</para>
|
| 2486 |
</section>
|
| 2487 |
<section id="defaultrules"><title>Default <filename>rules</filename> file</title>
|
| 2488 |
<para>
|
| 2489 |
Newer <command>dh_make</command> generates a very simple but powerful default
|
| 2490 |
<filename>rules</filename> file using the <command>dh</command> command:
|
| 2491 |
</para>
|
| 2492 |
<screen>
|
| 2493 |
1 #!/usr/bin/make -f
|
| 2494 |
2 # -*- makefile -*-
|
| 2495 |
3 # Sample debian/rules that uses debhelper.
|
| 2496 |
4 # This file was originally written by Joey Hess and Craig Small.
|
| 2497 |
5 # As a special exception, when this file is copied by dh-make into a
|
| 2498 |
6 # dh-make output file, you may use that output file without restriction.
|
| 2499 |
7 # This special exception was added by Craig Small in version 0.37 of dh-make.
|
| 2500 |
8
|
| 2501 |
9 # Uncomment this to turn on verbose mode.
|
| 2502 |
10 #export DH_VERBOSE=1
|
| 2503 |
11
|
| 2504 |
12 %:
|
| 2505 |
13 dh $@
|
| 2506 |
</screen>
|
| 2507 |
<para>
|
| 2508 |
(I've added the line numbers. In the actual <filename>rules</filename> file,
|
| 2509 |
the leading spaces are a TAB code.)
|
| 2510 |
</para>
|
| 2511 |
<para>
|
| 2512 |
You are probably familiar with lines like line 1 from shell and Perl scripts.
|
| 2513 |
It tells the operating system that this file is to be processed with
|
| 2514 |
<filename>/usr/bin/make</filename>.
|
| 2515 |
</para>
|
| 2516 |
<para>
|
| 2517 |
Line 10 can be uncommented to set the <literal>DH_VERBOSE</literal> variable to 1,
|
| 2518 |
so that the <command>dh</command> command outputs which
|
| 2519 |
<command>dh_*</command> commands it is executing.
|
| 2520 |
You can also add a line <literal>export DH_OPTIONS=-v</literal> here,
|
| 2521 |
so that each <command>dh_*</command> command outputs which commands it
|
| 2522 |
is executing. This helps you to understand
|
| 2523 |
exactly what is going on behind this simple <filename>rules</filename> file and
|
| 2524 |
to debug its problems. This new <command>dh</command> is designed to form a core part of the
|
| 2525 |
<systemitem role="package">debhelper</systemitem> tools, and not to hide
|
| 2526 |
anything from you.
|
| 2527 |
</para>
|
| 2528 |
<para>
|
| 2529 |
Lines 12 and 13 are where all the work is done with an implicit rule using the pattern rule. The percent sign means "any
|
| 2530 |
targets", which then call a single program, <command>dh</command>, with the target
|
| 2531 |
name. <footnote><para> This uses the new <systemitem role="package">debhelper</systemitem> v7 features. Its design concepts are
|
| 2532 |
explained in <ulink url="&debhelper-slides;">Not Your
|
| 2533 |
Grandpa's Debhelper</ulink> presented at DebConf9 by the <systemitem role="package">debhelper</systemitem> upstream. Under
|
| 2534 |
<literal>lenny</literal>, <command>dh_make</command> created a much more
|
| 2535 |
complicated <filename>rules</filename> file with explicit rules
|
| 2536 |
and many <command>dh_*</command> scripts listed for each one, most of
|
| 2537 |
which are now unnecessary (and show the package's age). The new <command>dh</command> command is
|
| 2538 |
simpler and frees us from doing the routine work "manually". You still have full power to
|
| 2539 |
customize the process with <literal>override_dh_*</literal> targets. See <xref linkend="customrules"/>. It is based only on the <systemitem role="package">debhelper</systemitem> package and does not obfuscate the
|
| 2540 |
package building process as the <systemitem role="package">cdbs</systemitem>
|
| 2541 |
package tends to. </para> </footnote> The <command>dh</command> command is a wrapper
|
| 2542 |
script which runs appropriate sequences of <command>dh_*</command> programs
|
| 2543 |
depending on its argument. <footnote><para> You can verify the actual sequences of
|
| 2544 |
<command>dh_*</command> programs invoked for a given
|
| 2545 |
<literal><replaceable>target</replaceable></literal> without really running them by invoking <literal>dh --no-act
|
| 2546 |
<replaceable>target</replaceable></literal> or <literal>debian/rules --
|
| 2547 |
'--no-act <replaceable>target</replaceable>'</literal>. </para> </footnote>
|
| 2548 |
</para>
|
| 2549 |
<itemizedlist>
|
| 2550 |
<listitem>
|
| 2551 |
<para>
|
| 2552 |
<literal>debian/rules clean</literal> runs <literal>dh clean</literal>, which
|
| 2553 |
in turn runs the following:
|
| 2554 |
</para>
|
| 2555 |
<screen>
|
| 2556 |
dh_testdir
|
| 2557 |
dh_auto_clean
|
| 2558 |
dh_clean
|
| 2559 |
</screen>
|
| 2560 |
</listitem>
|
| 2561 |
<listitem>
|
| 2562 |
<para>
|
| 2563 |
<literal>debian/rules build</literal> runs <literal>dh build</literal>; which
|
| 2564 |
in turn runs the following:
|
| 2565 |
</para>
|
| 2566 |
<screen>
|
| 2567 |
dh_testdir
|
| 2568 |
dh_auto_configure
|
| 2569 |
dh_auto_build
|
| 2570 |
dh_auto_test
|
| 2571 |
</screen>
|
| 2572 |
</listitem>
|
| 2573 |
<listitem>
|
| 2574 |
<para>
|
| 2575 |
<literal>fakeroot debian/rules binary</literal> runs <literal>fakeroot dh
|
| 2576 |
binary</literal>; which in turn runs the following<footnote><para>The following
|
| 2577 |
example assumes your <filename>debian/compat</filename> has a value equal or
|
| 2578 |
more than 9 to avoid invoking any python support commands automatically.
|
| 2579 |
</para>
|
| 2580 |
</footnote>:
|
| 2581 |
</para>
|
| 2582 |
<screen>
|
| 2583 |
dh_testroot
|
| 2584 |
dh_prep
|
| 2585 |
dh_installdirs
|
| 2586 |
dh_auto_install
|
| 2587 |
dh_install
|
| 2588 |
dh_installdocs
|
| 2589 |
dh_installchangelogs
|
| 2590 |
dh_installexamples
|
| 2591 |
dh_installman
|
| 2592 |
dh_installcatalogs
|
| 2593 |
dh_installcron
|
| 2594 |
dh_installdebconf
|
| 2595 |
dh_installemacsen
|
| 2596 |
dh_installifupdown
|
| 2597 |
dh_installinfo
|
| 2598 |
dh_installinit
|
| 2599 |
dh_installmenu
|
| 2600 |
dh_installmime
|
| 2601 |
dh_installmodules
|
| 2602 |
dh_installlogcheck
|
| 2603 |
dh_installlogrotate
|
| 2604 |
dh_installpam
|
| 2605 |
dh_installppp
|
| 2606 |
dh_installudev
|
| 2607 |
dh_installwm
|
| 2608 |
dh_installxfonts
|
| 2609 |
dh_bugfiles
|
| 2610 |
dh_lintian
|
| 2611 |
dh_gconf
|
| 2612 |
dh_icons
|
| 2613 |
dh_perl
|
| 2614 |
dh_usrlocal
|
| 2615 |
dh_link
|
| 2616 |
dh_compress
|
| 2617 |
dh_fixperms
|
| 2618 |
dh_strip
|
| 2619 |
dh_makeshlibs
|
| 2620 |
dh_shlibdeps
|
| 2621 |
dh_installdeb
|
| 2622 |
dh_gencontrol
|
| 2623 |
dh_md5sums
|
| 2624 |
dh_builddeb
|
| 2625 |
</screen>
|
| 2626 |
</listitem>
|
| 2627 |
<listitem>
|
| 2628 |
<para>
|
| 2629 |
<literal>fakeroot debian/rules binary-arch</literal> runs <literal>fakeroot dh
|
| 2630 |
binary-arch</literal>; which in turn runs the same sequence as
|
| 2631 |
<literal>fakeroot dh binary</literal> but with the <literal>-a</literal> option
|
| 2632 |
appended for each command.
|
| 2633 |
</para>
|
| 2634 |
</listitem>
|
| 2635 |
<listitem>
|
| 2636 |
<para>
|
| 2637 |
<literal>fakeroot debian/rules binary-indep</literal> runs <literal>fakeroot dh
|
| 2638 |
binary-indep</literal>; which in turn runs almost the same sequence as
|
| 2639 |
<literal>fakeroot dh binary</literal> but excluding
|
| 2640 |
<command>dh_strip</command>, <command>dh_makeshlibs</command>, and
|
| 2641 |
<command>dh_shlibdeps</command> with the <literal>-i</literal> option appended
|
| 2642 |
for each remaining command.
|
| 2643 |
</para>
|
| 2644 |
</listitem>
|
| 2645 |
</itemizedlist>
|
| 2646 |
<para>
|
| 2647 |
The functions of <command>dh_*</command> commands are largely self-evident from
|
| 2648 |
their names. <footnote><para> For complete information on what all these
|
| 2649 |
<command>dh_*</command> scripts do exactly, and what their other options are,
|
| 2650 |
please read their respective manual pages and the <systemitem role="package">debhelper</systemitem> documentation. </para> </footnote> There
|
| 2651 |
are a few notable ones that are worth giving (over)simplified explanations here assuming
|
| 2652 |
a typical build environment based on a <filename>Makefile</filename>.
|
| 2653 |
<footnote><para> These commands support other build environments such as
|
| 2654 |
<filename>setup.py</filename> which can be listed by executing
|
| 2655 |
<literal>dh_auto_build --list</literal> in a package source directory. </para>
|
| 2656 |
</footnote>
|
| 2657 |
</para>
|
| 2658 |
<itemizedlist>
|
| 2659 |
<listitem>
|
| 2660 |
<para>
|
| 2661 |
<command>dh_auto_clean</command> usually executes the following if a
|
| 2662 |
<filename>Makefile</filename> exists with the <literal>distclean</literal>
|
| 2663 |
target. <footnote><para> It actually looks for the first available target
|
| 2664 |
in the <filename>Makefile</filename> out of
|
| 2665 |
<literal>distclean</literal>, <literal>realclean</literal>, or
|
| 2666 |
<literal>clean</literal>, and executes that.
|
| 2667 |
</para> </footnote>
|
| 2668 |
</para>
|
| 2669 |
<screen>
|
| 2670 |
make distclean
|
| 2671 |
</screen>
|
| 2672 |
</listitem>
|
| 2673 |
<listitem>
|
| 2674 |
<para>
|
| 2675 |
<command>dh_auto_configure</command> usually executes the following if
|
| 2676 |
<filename>./configure</filename> exists (arguments abbreviated for
|
| 2677 |
readability).
|
| 2678 |
</para>
|
| 2679 |
<screen>
|
| 2680 |
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var ...
|
| 2681 |
</screen>
|
| 2682 |
</listitem>
|
| 2683 |
<listitem>
|
| 2684 |
<para>
|
| 2685 |
<command>dh_auto_build</command> usually executes the following to execute the
|
| 2686 |
first target of <filename>Makefile</filename> if it exists.
|
| 2687 |
</para>
|
| 2688 |
<screen>
|
| 2689 |
make
|
| 2690 |
</screen>
|
| 2691 |
</listitem>
|
| 2692 |
<listitem>
|
| 2693 |
<para>
|
| 2694 |
<command>dh_auto_test</command> usually executes the following if a
|
| 2695 |
<filename>Makefile</filename> exists with the <literal>test</literal> target.
|
| 2696 |
<footnote><para> It actually looks for the first available target in
|
| 2697 |
the <filename>Makefile</filename> out of <literal>test</literal> or
|
| 2698 |
<literal>check</literal>, and executes that.</para> </footnote>
|
| 2699 |
</para>
|
| 2700 |
<screen>
|
| 2701 |
make test
|
| 2702 |
</screen>
|
| 2703 |
</listitem>
|
| 2704 |
<listitem>
|
| 2705 |
<para>
|
| 2706 |
<command>dh_auto_install</command> usually executes the following if a
|
| 2707 |
<filename>Makefile</filename> exists with the <literal>install</literal> target
|
| 2708 |
(line folded for readability).
|
| 2709 |
</para>
|
| 2710 |
<screen>
|
| 2711 |
make install \
|
| 2712 |
DESTDIR=<replaceable>/path/to</replaceable>/<replaceable>package</replaceable>_<replaceable>version</replaceable>-<replaceable>revision</replaceable>/debian/<replaceable>package</replaceable>
|
| 2713 |
</screen>
|
| 2714 |
</listitem>
|
| 2715 |
</itemizedlist>
|
| 2716 |
<para>
|
| 2717 |
All targets which require the <command>fakeroot</command> command will contain
|
| 2718 |
<command>dh_testroot</command>, which exits with an error if you are not
|
| 2719 |
using this command to pretend to be root.
|
| 2720 |
</para>
|
| 2721 |
<para>
|
| 2722 |
The important part to know about the <filename>rules</filename> file created by
|
| 2723 |
<command>dh_make</command> is that it is just a suggestion. It will work for
|
| 2724 |
most packages but for more complicated ones, don't be afraid to customize it to
|
| 2725 |
fit your needs.
|
| 2726 |
</para>
|
| 2727 |
<para>
|
| 2728 |
Although <literal>install</literal> is not a required target, it is supported.
|
| 2729 |
<literal>fakeroot dh install</literal> behaves like <literal>fakeroot dh
|
| 2730 |
binary</literal> but stops after <command>dh_fixperms</command>.
|
| 2731 |
</para>
|
| 2732 |
</section>
|
| 2733 |
<section id="customrules"><title>Customization of <filename>rules</filename> file</title>
|
| 2734 |
<para>
|
| 2735 |
There are many ways to customize the <filename>rules</filename> file created
|
| 2736 |
with the new <command>dh</command> command.
|
| 2737 |
</para>
|
| 2738 |
<para>
|
| 2739 |
The <literal>dh $@</literal> command can be customized as follows.
|
| 2740 |
<footnote><para> If a package installs the
|
| 2741 |
<filename>/usr/share/perl5/Debian/Debhelper/Sequence/<replaceable>custom_name</replaceable>.pm</filename>
|
| 2742 |
file, you should activate its customization function by <literal>dh $@ --with
|
| 2743 |
<replaceable>custom-name</replaceable></literal>. </para> </footnote>
|
| 2744 |
</para>
|
| 2745 |
<itemizedlist>
|
| 2746 |
<listitem>
|
| 2747 |
<para>
|
| 2748 |
Add support for the <command>dh_python2</command> command. (The best choice
|
| 2749 |
for Python.) <footnote><para> Use of the <command>dh_python2</command> command
|
| 2750 |
is preferred over use of <command>dh_pysupport</command> or
|
| 2751 |
<command>dh_pycentral</command> commands. Do not use the
|
| 2752 |
<command>dh_python</command> command. </para> </footnote>
|
| 2753 |
</para>
|
| 2754 |
<itemizedlist>
|
| 2755 |
<listitem>
|
| 2756 |
<para>
|
| 2757 |
Include the <systemitem role="package">python</systemitem> package in
|
| 2758 |
<literal>Build-Depends</literal>.
|
| 2759 |
</para>
|
| 2760 |
</listitem>
|
| 2761 |
<listitem>
|
| 2762 |
<para>
|
| 2763 |
Use <literal>dh $@ --with python2</literal>.
|
| 2764 |
</para>
|
| 2765 |
</listitem>
|
| 2766 |
<listitem>
|
| 2767 |
<para>
|
| 2768 |
This handles Python modules using the <systemitem role="package">python</systemitem> framework.
|
| 2769 |
</para>
|
| 2770 |
</listitem>
|
| 2771 |
</itemizedlist>
|
| 2772 |
</listitem>
|
| 2773 |
<listitem>
|
| 2774 |
<para>
|
| 2775 |
Add support for the <command>dh_pysupport</command> command. (deprecated)
|
| 2776 |
</para>
|
| 2777 |
<itemizedlist>
|
| 2778 |
<listitem>
|
| 2779 |
<para>
|
| 2780 |
Include the <systemitem role="package">python-support</systemitem> package in
|
| 2781 |
<literal>Build-Depends</literal>.
|
| 2782 |
</para>
|
| 2783 |
</listitem>
|
| 2784 |
<listitem>
|
| 2785 |
<para>
|
| 2786 |
Use <literal>dh $@ --with pysupport</literal>.
|
| 2787 |
</para>
|
| 2788 |
</listitem>
|
| 2789 |
<listitem>
|
| 2790 |
<para>
|
| 2791 |
This handles Python modules using the <systemitem role="package">python-support</systemitem> framework.
|
| 2792 |
</para>
|
| 2793 |
</listitem>
|
| 2794 |
</itemizedlist>
|
| 2795 |
</listitem>
|
| 2796 |
<listitem>
|
| 2797 |
<para>
|
| 2798 |
Add support for the <command>dh_pycentral</command> command. (deprecated)
|
| 2799 |
</para>
|
| 2800 |
<itemizedlist>
|
| 2801 |
<listitem>
|
| 2802 |
<para>
|
| 2803 |
Include the <systemitem role="package">python-central</systemitem> package in
|
| 2804 |
<literal>Build-Depends</literal>.
|
| 2805 |
</para>
|
| 2806 |
</listitem>
|
| 2807 |
<listitem>
|
| 2808 |
<para>
|
| 2809 |
Use <literal>dh $@ --with python-central</literal> instead.
|
| 2810 |
</para>
|
| 2811 |
</listitem>
|
| 2812 |
<listitem>
|
| 2813 |
<para>
|
| 2814 |
This also deactivates the <command>dh_pysupport</command> command.
|
| 2815 |
</para>
|
| 2816 |
</listitem>
|
| 2817 |
<listitem>
|
| 2818 |
<para>
|
| 2819 |
This handles Python modules using the <systemitem role="package">python-central</systemitem> framework.
|
| 2820 |
</para>
|
| 2821 |
</listitem>
|
| 2822 |
</itemizedlist>
|
| 2823 |
</listitem>
|
| 2824 |
<listitem>
|
| 2825 |
<para>
|
| 2826 |
Add support for the <command>dh_installtex</command> command.
|
| 2827 |
</para>
|
| 2828 |
<itemizedlist>
|
| 2829 |
<listitem>
|
| 2830 |
<para>
|
| 2831 |
Include the <systemitem role="package">tex-common</systemitem> package in
|
| 2832 |
<literal>Build-Depends</literal>.
|
| 2833 |
</para>
|
| 2834 |
</listitem>
|
| 2835 |
<listitem>
|
| 2836 |
<para>
|
| 2837 |
Use <literal>dh $@ --with tex</literal> instead.
|
| 2838 |
</para>
|
| 2839 |
</listitem>
|
| 2840 |
<listitem>
|
| 2841 |
<para>
|
| 2842 |
This registers Type 1 fonts, hyphenation patterns, and formats with TeX.
|
| 2843 |
</para>
|
| 2844 |
</listitem>
|
| 2845 |
</itemizedlist>
|
| 2846 |
</listitem>
|
| 2847 |
<listitem>
|
| 2848 |
<para>
|
| 2849 |
Add support for the <command>dh_quilt_patch</command> and
|
| 2850 |
<command>dh_quilt_unpatch</command> commands.
|
| 2851 |
</para>
|
| 2852 |
<itemizedlist>
|
| 2853 |
<listitem>
|
| 2854 |
<para>
|
| 2855 |
Include the <systemitem role="package">quilt</systemitem> package in
|
| 2856 |
<literal>Build-Depends</literal>.
|
| 2857 |
</para>
|
| 2858 |
</listitem>
|
| 2859 |
<listitem>
|
| 2860 |
<para>
|
| 2861 |
Use <literal>dh $@ --with quilt</literal> instead.
|
| 2862 |
</para>
|
| 2863 |
</listitem>
|
| 2864 |
<listitem>
|
| 2865 |
<para>
|
| 2866 |
This applies and un-applies patches to the upstream source from files in the
|
| 2867 |
<filename>debian/patches</filename> directory for a source package in the <literal>1.0</literal> format.
|
| 2868 |
</para>
|
| 2869 |
</listitem>
|
| 2870 |
<listitem>
|
| 2871 |
<para>
|
| 2872 |
This is not needed if you use the new <literal>3.0 (quilt)</literal> source
|
| 2873 |
package format.
|
| 2874 |
</para>
|
| 2875 |
</listitem>
|
| 2876 |
</itemizedlist>
|
| 2877 |
</listitem>
|
| 2878 |
<listitem>
|
| 2879 |
<para>
|
| 2880 |
Add support for the <command>dh_dkms</command> command.
|
| 2881 |
</para>
|
| 2882 |
<itemizedlist>
|
| 2883 |
<listitem>
|
| 2884 |
<para>
|
| 2885 |
Include the <systemitem role="package">dkms</systemitem> package in
|
| 2886 |
<literal>Build-Depends</literal>.
|
| 2887 |
</para>
|
| 2888 |
</listitem>
|
| 2889 |
<listitem>
|
| 2890 |
<para>
|
| 2891 |
Use <literal>dh $@ --with dkms</literal> instead.
|
| 2892 |
</para>
|
| 2893 |
</listitem>
|
| 2894 |
<listitem>
|
| 2895 |
<para>
|
| 2896 |
This correctly handles DKMS usage by kernel module packages.
|
| 2897 |
</para>
|
| 2898 |
</listitem>
|
| 2899 |
</itemizedlist>
|
| 2900 |
</listitem>
|
| 2901 |
<listitem>
|
| 2902 |
<para>
|
| 2903 |
Add support for the <command>dh_autotools-dev_updateconfig</command> and
|
| 2904 |
<command>dh_autotools-dev_restoreconfig</command> commands.
|
| 2905 |
</para>
|
| 2906 |
<itemizedlist>
|
| 2907 |
<listitem>
|
| 2908 |
<para>
|
| 2909 |
Include the <systemitem role="package">autotools-dev</systemitem> package in
|
| 2910 |
<literal>Build-Depends</literal>.
|
| 2911 |
</para>
|
| 2912 |
</listitem>
|
| 2913 |
<listitem>
|
| 2914 |
<para>
|
| 2915 |
Use <literal>dh $@ --with autotools-dev</literal> instead.
|
| 2916 |
</para>
|
| 2917 |
</listitem>
|
| 2918 |
<listitem>
|
| 2919 |
<para>
|
| 2920 |
This updates and restores <filename>config.sub</filename> and
|
| 2921 |
<filename>config.guess</filename>.
|
| 2922 |
</para>
|
| 2923 |
</listitem>
|
| 2924 |
</itemizedlist>
|
| 2925 |
</listitem>
|
| 2926 |
<listitem>
|
| 2927 |
<para>
|
| 2928 |
Add support for the <command>dh_autoreconf</command> and
|
| 2929 |
<command>dh_autoreconf_clean</command> commands.
|
| 2930 |
</para>
|
| 2931 |
<itemizedlist>
|
| 2932 |
<listitem>
|
| 2933 |
<para>
|
| 2934 |
Include the <systemitem role="package">dh-autoreconf</systemitem> package in
|
| 2935 |
<literal>Build-Depends</literal>.
|
| 2936 |
</para>
|
| 2937 |
</listitem>
|
| 2938 |
<listitem>
|
| 2939 |
<para>
|
| 2940 |
Use <literal>dh $@ --with autoreconf</literal> instead.
|
| 2941 |
</para>
|
| 2942 |
</listitem>
|
| 2943 |
<listitem>
|
| 2944 |
<para>
|
| 2945 |
This updates the GNU Build System files and restores them after the build.
|
| 2946 |
</para>
|
| 2947 |
</listitem>
|
| 2948 |
</itemizedlist>
|
| 2949 |
</listitem>
|
| 2950 |
<listitem>
|
| 2951 |
<para>
|
| 2952 |
Add support for the <command>bash</command> completion feature.
|
| 2953 |
</para>
|
| 2954 |
<itemizedlist>
|
| 2955 |
<listitem>
|
| 2956 |
<para>
|
| 2957 |
Includes the <systemitem role="package">bash-completion</systemitem> package in
|
| 2958 |
<literal>Build-Depends</literal>.
|
| 2959 |
</para>
|
| 2960 |
</listitem>
|
| 2961 |
<listitem>
|
| 2962 |
<para>
|
| 2963 |
Use <literal>dh $@ --with bash-completion</literal> instead.
|
| 2964 |
</para>
|
| 2965 |
</listitem>
|
| 2966 |
<listitem>
|
| 2967 |
<para>
|
| 2968 |
This installs <command>bash</command> completions using a configuration file at
|
| 2969 |
<filename>debian/<replaceable>package</replaceable>.bash-completion</filename>.
|
| 2970 |
</para>
|
| 2971 |
</listitem>
|
| 2972 |
</itemizedlist>
|
| 2973 |
</listitem>
|
| 2974 |
</itemizedlist>
|
| 2975 |
<para>
|
| 2976 |
Many <command>dh_*</command> commands invoked by the new <command>dh</command>
|
| 2977 |
command can be customized by the corresponding configuration files in the
|
| 2978 |
<filename>debian</filename> directory. See <xref linkend="dother"/> and the
|
| 2979 |
manpage of each command for the customization of such features.
|
| 2980 |
</para>
|
| 2981 |
<para>
|
| 2982 |
You may need to run <command>dh_*</command> commands invoked via the new <command>dh</command>
|
| 2983 |
with added arguments, or to run additional commands with them, or to skip them.
|
| 2984 |
For such cases, you create an
|
| 2985 |
<literal>override_dh_<replaceable>foo</replaceable></literal> target with its
|
| 2986 |
rule in the <filename>rules</filename> file defining an
|
| 2987 |
<literal>override_dh_<replaceable>foo</replaceable></literal> target for the
|
| 2988 |
<command>dh_<replaceable>foo</replaceable></command> command you want to
|
| 2989 |
change. It basically says <emphasis>run me instead</emphasis>.
|
| 2990 |
<footnote><para> Under <literal>lenny</literal>, if you wanted to change the
|
| 2991 |
behavior of a <command>dh_*</command> script you found the relevant line in the
|
| 2992 |
<filename>rules</filename> file and adjusted it. </para> </footnote>
|
| 2993 |
</para>
|
| 2994 |
<para>
|
| 2995 |
Please note that the <command>dh_auto_*</command> commands tend to do more than
|
| 2996 |
what has been discussed in this (over)simplified explanation to take care of all the
|
| 2997 |
corner cases. It is a bad idea to use <literal>override_dh_*</literal> targets
|
| 2998 |
to substitute simplified equivalent commands (except for the
|
| 2999 |
<literal>override_dh_auto_clean</literal> target) since it may
|
| 3000 |
bypass such smart <systemitem role="package">debhelper</systemitem> features.
|
| 3001 |
</para>
|
| 3002 |
<para>
|
| 3003 |
So, for instance, if you want to store system configuration data in the
|
| 3004 |
<filename>/etc/gentoo</filename> directory instead of the usual
|
| 3005 |
<filename>/etc</filename> directory for the recent
|
| 3006 |
<systemitem role="package">gentoo</systemitem> package using Autotools, you can override the default
|
| 3007 |
<literal>--sysconfig=/etc</literal> argument given by the
|
| 3008 |
<command>dh_auto_configure</command> command to the
|
| 3009 |
<command>./configure</command> command by the following.
|
| 3010 |
</para>
|
| 3011 |
<screen>
|
| 3012 |
override_dh_auto_configure:
|
| 3013 |
dh_auto_configure -- --sysconfig=/etc/gentoo
|
| 3014 |
</screen>
|
| 3015 |
<para>
|
| 3016 |
The arguments given after <literal>--</literal> are appended to the default
|
| 3017 |
arguments of the auto-executed program to override them. Using the
|
| 3018 |
<command>dh_auto_configure</command> command is better than directly invoking the
|
| 3019 |
<command>./configure</command> command here since it will only override the
|
| 3020 |
<literal>--sysconfig</literal> argument and retains any other, benign arguments
|
| 3021 |
to the <command>./configure</command> command.
|
| 3022 |
</para>
|
| 3023 |
<para>
|
| 3024 |
If the <filename>Makefile</filename> in the source for <systemitem role="package">gentoo</systemitem> requires you to specify
|
| 3025 |
<literal>build</literal> as its target to build it <footnote><para>
|
| 3026 |
<command>dh_auto_build</command> without any arguments will execute the first
|
| 3027 |
target in the <filename>Makefile</filename>. </para> </footnote>, you
|
| 3028 |
create an <literal>override_dh_auto_build</literal> target to enable this.
|
| 3029 |
</para>
|
| 3030 |
<screen>
|
| 3031 |
override_dh_auto_build:
|
| 3032 |
dh_auto_build -- build
|
| 3033 |
</screen>
|
| 3034 |
<para>
|
| 3035 |
This ensures <literal>$(MAKE)</literal> is run with all the default arguments given by the
|
| 3036 |
<command>dh_auto_build</command> command plus the <literal>build</literal> argument.
|
| 3037 |
</para>
|
| 3038 |
<para>
|
| 3039 |
If the <filename>Makefile</filename> in the source for <systemitem role="package">gentoo</systemitem> requires you to specify the
|
| 3040 |
<literal>packageclean</literal> target to clean it for the Debian package instead
|
| 3041 |
of using <literal>distclean</literal> or <literal>clean</literal> targets,
|
| 3042 |
you can create an
|
| 3043 |
<literal>override_dh_auto_clean</literal> target to enable thit.
|
| 3044 |
</para>
|
| 3045 |
<screen>
|
| 3046 |
override_dh_auto_clean:
|
| 3047 |
$(MAKE) packageclean
|
| 3048 |
</screen>
|
| 3049 |
<para>
|
| 3050 |
If the <filename>Makefile</filename> in the source for <systemitem role="package">gentoo</systemitem> contains a <literal>test</literal> target
|
| 3051 |
which you do not want to run for the Debian package building process, you can
|
| 3052 |
use an empty <literal>override_dh_auto_test</literal> target to skip it.
|
| 3053 |
</para>
|
| 3054 |
<screen>
|
| 3055 |
override_dh_auto_test:
|
| 3056 |
</screen>
|
| 3057 |
<para>
|
| 3058 |
If <systemitem role="package">gentoo</systemitem> has an unusual upstream
|
| 3059 |
changelog file called <filename>FIXES</filename>,
|
| 3060 |
<command>dh_installchangelogs</command> will not install that file by default.
|
| 3061 |
The <command>dh_installchangelogs</command> command requires
|
| 3062 |
<filename>FIXES</filename> as its argument to install it. <footnote><para> The
|
| 3063 |
<filename>debian/changelog</filename> and <filename>debian/NEWS</filename>
|
| 3064 |
files are always automatically installed. The upstream changelog is found
|
| 3065 |
by converting filenames to lower case and matching them against
|
| 3066 |
<filename>changelog</filename>, <filename>changes</filename>,
|
| 3067 |
<filename>changelog.txt</filename>, and <filename>changes.txt</filename>.
|
| 3068 |
</para> </footnote>
|
| 3069 |
</para>
|
| 3070 |
<screen>
|
| 3071 |
override_dh_installchangelogs:
|
| 3072 |
dh_installchangelogs FIXES
|
| 3073 |
</screen>
|
| 3074 |
<para>
|
| 3075 |
When you use the new <command>dh</command> command, use of explicit targets
|
| 3076 |
such as the ones listed in <xref linkend="targets"/>, other than the
|
| 3077 |
<literal>get-orig-source</literal> target, may make it difficult to understand
|
| 3078 |
their exact effects. Please limit explicit targets to
|
| 3079 |
<literal>override_dh_*</literal> targets and completely independent ones, if
|
| 3080 |
possible.
|
| 3081 |
</para>
|
| 3082 |
</section>
|
| 3083 |
</section>
|
| 3084 |
</chapter>
|
| 3085 |
<chapter id="dother"><title>Other files under the <filename>debian</filename> directory</title>
|
| 3086 |
<para>
|
| 3087 |
To control most of what <systemitem role="package">debhelper</systemitem> does
|
| 3088 |
while building the package, you put optional configuration files under the
|
| 3089 |
<filename>debian</filename> directory. This chapter will provide an overview of
|
| 3090 |
what each of these does and its format. Please read the <ulink url="&debian-policy;">Debian Policy
|
| 3091 |
Manual</ulink> and <ulink url="&developers-reference;">Debian Developer's
|
| 3092 |
Reference</ulink> for guidelines for packaging.
|
| 3093 |
</para>
|
| 3094 |
<para>
|
| 3095 |
The <command>dh_make</command> command will create some template configuration
|
| 3096 |
files under the <filename>debian</filename> directory. Most of them come with
|
| 3097 |
filenames suffixed by <literal>.ex</literal>. Some of them come with filenames
|
| 3098 |
prefixed by the binary package name such as
|
| 3099 |
<literal><replaceable>package</replaceable></literal>. Take a look at all of
|
| 3100 |
them.
|
| 3101 |
<footnote><para>
|
| 3102 |
In this chapter, files in the <filename>debian</filename> directory are
|
| 3103 |
referred to without the leading <filename>debian/</filename> for simplicity whenever
|
| 3104 |
the meaning is obvious.
|
| 3105 |
</para></footnote>
|
| 3106 |
</para>
|
| 3107 |
<para>
|
| 3108 |
Some template configuration files for <systemitem role="package">debhelper</systemitem>
|
| 3109 |
may not be created by the <command>dh_make</command> command. In
|
| 3110 |
such cases, you need to create them with an editor.
|
| 3111 |
</para>
|
| 3112 |
<para>
|
| 3113 |
If you wish or need to activate any of these, please do the following:
|
| 3114 |
</para>
|
| 3115 |
<itemizedlist>
|
| 3116 |
<listitem>
|
| 3117 |
<para>
|
| 3118 |
rename template files by removing the <literal>.ex</literal> or
|
| 3119 |
<literal>.EX</literal> suffix if they have one;
|
| 3120 |
</para>
|
| 3121 |
</listitem>
|
| 3122 |
<listitem>
|
| 3123 |
<para>
|
| 3124 |
rename the configuration files to use the actual binary package
|
| 3125 |
name in place of <literal><replaceable>package</replaceable></literal>;
|
| 3126 |
</para>
|
| 3127 |
</listitem>
|
| 3128 |
<listitem>
|
| 3129 |
<para>
|
| 3130 |
modify template file contents to suit your needs;
|
| 3131 |
</para>
|
| 3132 |
</listitem>
|
| 3133 |
<listitem>
|
| 3134 |
<para>
|
| 3135 |
remove template files which you do not need;
|
| 3136 |
</para>
|
| 3137 |
</listitem>
|
| 3138 |
<listitem>
|
| 3139 |
<para>
|
| 3140 |
modify the <filename>control</filename> file (see <xref linkend="control"/>),
|
| 3141 |
if necessary;
|
| 3142 |
</para>
|
| 3143 |
</listitem>
|
| 3144 |
<listitem>
|
| 3145 |
<para>
|
| 3146 |
modify the <filename>rules</filename> file (see <xref linkend="rules"/>), if
|
| 3147 |
necessary.
|
| 3148 |
</para>
|
| 3149 |
</listitem>
|
| 3150 |
</itemizedlist>
|
| 3151 |
<para>
|
| 3152 |
Any <systemitem role="package">debhelper</systemitem> configuration files
|
| 3153 |
without a <filename><replaceable>package</replaceable></filename> prefix, such as
|
| 3154 |
<filename>install</filename>, apply to the first binary package. When there are
|
| 3155 |
many binary packages, their configurations can be specified by prefixing their
|
| 3156 |
name to their configuration filenames such as
|
| 3157 |
<filename><replaceable>package-1</replaceable>.install</filename>,
|
| 3158 |
<filename><replaceable>package-2</replaceable>.install</filename>, etc.
|
| 3159 |
</para>
|
| 3160 |
<section id="readme"><title><filename>README.Debian</filename></title>
|
| 3161 |
<para>
|
| 3162 |
Any extra details or discrepancies between the original package and your Debian
|
| 3163 |
version should be documented here.
|
| 3164 |
</para>
|
| 3165 |
<para>
|
| 3166 |
<command>dh_make</command> created a default one; this is what it looks like:
|
| 3167 |
</para>
|
| 3168 |
<screen>
|
| 3169 |
gentoo for Debian
|
| 3170 |
-----------------
|
| 3171 |
<possible notes regarding this package - if none, delete this file>
|
| 3172 |
-- Josip Rodin <joy-mg@debian.org>, Wed, 11 Nov 1998 21:02:14 +0100
|
| 3173 |
</screen>
|
| 3174 |
<para>
|
| 3175 |
If you have nothing to be documented, remove this file. See <citerefentry>
|
| 3176 |
<refentrytitle>dh_installdocs</refentrytitle> <manvolnum>1</manvolnum>
|
| 3177 |
</citerefentry>.
|
| 3178 |
</para>
|
| 3179 |
</section>
|
| 3180 |
<section id="compat"><title><filename>compat</filename></title>
|
| 3181 |
<para>
|
| 3182 |
The <filename>compat</filename> file defines the <systemitem role="package">debhelper</systemitem> compatibility level. Currently, you
|
| 3183 |
should set it to the <systemitem role="package">debhelper</systemitem> v7 as
|
| 3184 |
follows:
|
| 3185 |
</para>
|
| 3186 |
<screen>
|
| 3187 |
$ echo 7 > debian/compat
|
| 3188 |
</screen>
|
| 3189 |
</section>
|
| 3190 |
<section id="conffiles"><title><filename>conffiles</filename></title>
|
| 3191 |
<para>
|
| 3192 |
One of the most annoying things about software is when you spend a great deal
|
| 3193 |
of time and effort customizing a program, only to have an upgrade stomp all
|
| 3194 |
over your changes. Debian solves this problem by marking such configuration files as conffiles.
|
| 3195 |
<footnote><para>See <citerefentry> <refentrytitle>dpkg</refentrytitle>
|
| 3196 |
<manvolnum>1</manvolnum> </citerefentry> and
|
| 3197 |
<ulink url="&policy-conffiles;">Debian Policy Manual "D.2.5 Conffiles"</ulink>.
|
| 3198 |
</para></footnote>
|
| 3199 |
When you upgrade a package, you'll be asked whether you want to keep
|
| 3200 |
your old configuration files or not.
|
| 3201 |
</para>
|
| 3202 |
<para>
|
| 3203 |
<citerefentry><refentrytitle>dh_installdeb</refentrytitle> <manvolnum>1</manvolnum>
|
| 3204 |
</citerefentry> <emphasis>automatically</emphasis> flags any files under
|
| 3205 |
the <filename>/etc</filename> directory as conffiles, so if your program only
|
| 3206 |
has conffiles there you do not need to specify them in this file. For most
|
| 3207 |
package types, the only place conffiles should ever be is under
|
| 3208 |
<filename>/etc</filename>, and so this file doesn't need to exist.
|
| 3209 |
</para>
|
| 3210 |
<para>
|
| 3211 |
If your program uses configuration files but also rewrites them on its own,
|
| 3212 |
it's best not to make them conffiles because <command>dpkg</command> will
|
| 3213 |
then prompt users to verify the changes all the time.
|
| 3214 |
</para>
|
| 3215 |
<para>
|
| 3216 |
If the program you're packaging requires every user to modify the configuration
|
| 3217 |
files in the <filename>/etc</filename> directory, there are two popular ways to
|
| 3218 |
arrange for them to not be conffiles, keeping <command>dpkg</command> quiet.
|
| 3219 |
</para>
|
| 3220 |
<itemizedlist>
|
| 3221 |
<listitem>
|
| 3222 |
<para>
|
| 3223 |
Create a symlink under the <filename>/etc</filename> directory pointing to a
|
| 3224 |
file under the <filename>/var</filename> directory generated by the
|
| 3225 |
maintainer scripts.
|
| 3226 |
</para>
|
| 3227 |
</listitem>
|
| 3228 |
<listitem>
|
| 3229 |
<para>
|
| 3230 |
Create a file generated by the maintainer scripts under the <filename>/etc</filename> directory.
|
| 3231 |
</para>
|
| 3232 |
</listitem>
|
| 3233 |
</itemizedlist>
|
| 3234 |
<para>
|
| 3235 |
For information on maintainer scripts, see <xref linkend="maintscripts"/>.
|
| 3236 |
</para>
|
| 3237 |
</section>
|
| 3238 |
<section id="crond"><title><filename><replaceable>package</replaceable>.cron.*</filename></title>
|
| 3239 |
<para>
|
| 3240 |
If your package requires regularly scheduled tasks to operate properly, you can
|
| 3241 |
use these files to set that up. You can set up regular tasks that either happen
|
| 3242 |
hourly, daily, weekly, or monthly, or alternatively happen at any other time that
|
| 3243 |
you wish. The filenames are:
|
| 3244 |
</para>
|
| 3245 |
<itemizedlist>
|
| 3246 |
<listitem>
|
| 3247 |
<para>
|
| 3248 |
<filename><replaceable>package</replaceable>.cron.hourly</filename> - Installed as
|
| 3249 |
<filename>/etc/cron.hourly/<replaceable>package</replaceable></filename>; run
|
| 3250 |
once an hour.
|
| 3251 |
</para>
|
| 3252 |
</listitem>
|
| 3253 |
<listitem>
|
| 3254 |
<para>
|
| 3255 |
<filename><replaceable>package</replaceable>.cron.daily</filename> - Installed as
|
| 3256 |
<filename>/etc/cron.daily/<replaceable>package</replaceable></filename>; run
|
| 3257 |
once a day.
|
| 3258 |
</para>
|
| 3259 |
</listitem>
|
| 3260 |
<listitem>
|
| 3261 |
<para>
|
| 3262 |
<filename><replaceable>package</replaceable>.cron.weekly</filename> - Installed as
|
| 3263 |
<filename>/etc/cron.weekly/<replaceable>package</replaceable></filename>; run
|
| 3264 |
once a week.
|
| 3265 |
</para>
|
| 3266 |
</listitem>
|
| 3267 |
<listitem>
|
| 3268 |
<para>
|
| 3269 |
<filename><replaceable>package</replaceable>.cron.monthly</filename> - Installed as
|
| 3270 |
<filename>/etc/cron.monthly/<replaceable>package</replaceable></filename>: run
|
| 3271 |
once a month.
|
| 3272 |
</para>
|
| 3273 |
</listitem>
|
| 3274 |
<listitem>
|
| 3275 |
<para>
|
| 3276 |
<filename><replaceable>package</replaceable>.cron.d</filename> - Installed as
|
| 3277 |
<filename>/etc/cron.d/<replaceable>package</replaceable></filename>: for any
|
| 3278 |
other time.
|
| 3279 |
</para>
|
| 3280 |
</listitem>
|
| 3281 |
</itemizedlist>
|
| 3282 |
<para>
|
| 3283 |
Most of these files are shell scripts, with the exception of
|
| 3284 |
<filename><replaceable>package</replaceable>.cron.d</filename> which follows
|
| 3285 |
the format of <citerefentry> <refentrytitle>crontab</refentrytitle>
|
| 3286 |
<manvolnum>5</manvolnum> </citerefentry>.
|
| 3287 |
</para>
|
| 3288 |
<para>
|
| 3289 |
No explicit <filename>cron.*</filename> file is needed to set up log rotation;
|
| 3290 |
for that, see
|
| 3291 |
<citerefentry><refentrytitle>dh_installlogrotate</refentrytitle>
|
| 3292 |
<manvolnum>1</manvolnum></citerefentry> and
|
| 3293 |
<citerefentry><refentrytitle>logrotate</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
|
| 3294 |
</para>
|
| 3295 |
</section>
|
| 3296 |
<section id="dirs"><title><filename>dirs</filename></title>
|
| 3297 |
<para>
|
| 3298 |
This file specifies any directories which we need but which are not created by the normal installation
|
| 3299 |
procedure (<literal>make install DESTDIR=...</literal> invoked by
|
| 3300 |
<literal>dh_auto_install</literal>). This generally
|
| 3301 |
means there is a problem with the <filename>Makefile</filename>.
|
| 3302 |
</para>
|
| 3303 |
<para>
|
| 3304 |
Files listed in an <filename>install</filename> file don't need their
|
| 3305 |
directories created first. See <xref linkend="install"/>.
|
| 3306 |
</para>
|
| 3307 |
<para>
|
| 3308 |
It is best to try to run the installation first and only use this if you
|
| 3309 |
run into trouble. There is no preceding slash on the directory names listed in
|
| 3310 |
the <filename>dirs</filename> file.
|
| 3311 |
</para>
|
| 3312 |
</section>
|
| 3313 |
<section id="doc-base"><title><filename><replaceable>package</replaceable>.doc-base</filename></title>
|
| 3314 |
<para>
|
| 3315 |
If your package has documentation other than manual and info pages, you
|
| 3316 |
should use the <systemitem role="package">doc-base</systemitem> file to
|
| 3317 |
register it, so the user can find it with e.g. <citerefentry>
|
| 3318 |
<refentrytitle>dhelp</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>,
|
| 3319 |
<citerefentry> <refentrytitle>dwww</refentrytitle> <manvolnum>1</manvolnum>
|
| 3320 |
</citerefentry>, or <citerefentry> <refentrytitle>doccentral</refentrytitle>
|
| 3321 |
<manvolnum>1</manvolnum> </citerefentry>.
|
| 3322 |
</para>
|
| 3323 |
<para>
|
| 3324 |
This usually includes HTML, PS and PDF files, shipped in
|
| 3325 |
<filename>/usr/share/doc/<replaceable>packagename</replaceable>/</filename>.
|
| 3326 |
</para>
|
| 3327 |
<para>
|
| 3328 |
This is what <systemitem role="package">gentoo</systemitem>'s doc-base file
|
| 3329 |
<filename>gentoo.doc-base</filename> looks like:
|
| 3330 |
</para>
|
| 3331 |
<screen>
|
| 3332 |
Document: gentoo
|
| 3333 |
Title: Gentoo Manual
|
| 3334 |
Author: Emil Brink
|
| 3335 |
Abstract: This manual describes what Gentoo is, and how it can be used.
|
| 3336 |
Section: File Management
|
| 3337 |
Format: HTML
|
| 3338 |
Index: /usr/share/doc/gentoo/html/index.html
|
| 3339 |
Files: /usr/share/doc/gentoo/html/*.html
|
| 3340 |
</screen>
|
| 3341 |
<para>
|
| 3342 |
For information on the file format, see <citerefentry>
|
| 3343 |
<refentrytitle>install-docs</refentrytitle> <manvolnum>8</manvolnum>
|
| 3344 |
</citerefentry> and the Debian <systemitem role="package">doc-base</systemitem>
|
| 3345 |
Manual at the local copy <filename>&doc-base;</filename> provided by the
|
| 3346 |
<systemitem role="package">doc-base</systemitem> package.
|
| 3347 |
</para>
|
| 3348 |
<para>
|
| 3349 |
For more details on installing additional documentation, look in <xref linkend="destdir"/>.
|
| 3350 |
</para>
|
| 3351 |
</section>
|
| 3352 |
<section id="docs"><title><filename>docs</filename></title>
|
| 3353 |
<para>
|
| 3354 |
This file specifies the file names of documentation files we can have
|
| 3355 |
<citerefentry> <refentrytitle>dh_installdocs</refentrytitle>
|
| 3356 |
<manvolnum>1</manvolnum> </citerefentry> install into the temporary directory
|
| 3357 |
for us.
|
| 3358 |
</para>
|
| 3359 |
<para>
|
| 3360 |
By default, it will include all existing files in the top-level source
|
| 3361 |
directory that are called <filename>BUGS</filename>,
|
| 3362 |
<filename>README*</filename>, <filename>TODO</filename> etc.
|
| 3363 |
</para>
|
| 3364 |
<para>
|
| 3365 |
For <systemitem role="package">gentoo</systemitem>, some other files
|
| 3366 |
are also included:
|
| 3367 |
</para>
|
| 3368 |
<screen>
|
| 3369 |
BUGS
|
| 3370 |
CONFIG-CHANGES
|
| 3371 |
CREDITS
|
| 3372 |
NEWS
|
| 3373 |
README
|
| 3374 |
README.gtkrc
|
| 3375 |
TODO
|
| 3376 |
</screen>
|
| 3377 |
</section>
|
| 3378 |
<section id="emacsen"><title><filename>emacsen-*</filename></title>
|
| 3379 |
<para>
|
| 3380 |
If your package supplies Emacs files that can be bytecompiled at package
|
| 3381 |
installation time, you can use these files to set it up.
|
| 3382 |
</para>
|
| 3383 |
<para>
|
| 3384 |
They are installed into the temporary directory by <citerefentry>
|
| 3385 |
<refentrytitle>dh_installemacsen</refentrytitle> <manvolnum>1</manvolnum>
|
| 3386 |
</citerefentry>.
|
| 3387 |
</para>
|
| 3388 |
<para>
|
| 3389 |
If you don't need these, remove them.
|
| 3390 |
</para>
|
| 3391 |
</section>
|
| 3392 |
<section id="examples"><title><filename><replaceable>package</replaceable>.examples</filename></title>
|
| 3393 |
<para>
|
| 3394 |
The <citerefentry> <refentrytitle>dh_installexamples</refentrytitle>
|
| 3395 |
<manvolnum>1</manvolnum> </citerefentry> command installs files and directories
|
| 3396 |
listed in this file as example files.
|
| 3397 |
</para>
|
| 3398 |
</section>
|
| 3399 |
<section id="initd"><title><filename><replaceable>package</replaceable>.init</filename> and <filename><replaceable>package</replaceable>.default</filename></title>
|
| 3400 |
<para>
|
| 3401 |
If your package is a daemon that needs to be run at system start-up, you've
|
| 3402 |
obviously disregarded my initial recommendation, haven't you? :-)
|
| 3403 |
</para>
|
| 3404 |
<para>
|
| 3405 |
The <filename><replaceable>package</replaceable>.init</filename> file is
|
| 3406 |
installed as the
|
| 3407 |
<filename>/etc/init.d/<replaceable>package</replaceable></filename> script
|
| 3408 |
which starts and stops the daemon.
|
| 3409 |
Its fairly generic skeleton template is provided by the
|
| 3410 |
<command>dh_make</command> command as <filename>init.d.ex</filename>. You'll
|
| 3411 |
likely have to rename and edit it, a lot, while making sure to provide
|
| 3412 |
<ulink url="&lsb;">Linux Standard Base</ulink> (LSB) compliant headers. It
|
| 3413 |
gets installed into the temporary directory by <citerefentry>
|
| 3414 |
<refentrytitle>dh_installinit</refentrytitle> <manvolnum>1</manvolnum>
|
| 3415 |
</citerefentry>.
|
| 3416 |
</para>
|
| 3417 |
<para>
|
| 3418 |
The <filename><replaceable>package</replaceable>.default</filename> file will
|
| 3419 |
be installed as
|
| 3420 |
<filename>/etc/default/<replaceable>package</replaceable></filename>. This
|
| 3421 |
file sets defaults that are sourced by the init script. This
|
| 3422 |
<filename><replaceable>package</replaceable>.default</filename> file
|
| 3423 |
is most often used to disable running a daemon, or to set some default flags or
|
| 3424 |
timeouts. If your init script has certain configurable
|
| 3425 |
features, you can set them in the <filename><replaceable>package</replaceable>.default</filename> file,
|
| 3426 |
instead of in the init script itself.
|
| 3427 |
</para>
|
| 3428 |
<para>
|
| 3429 |
If your upstream program provides a file for the init script, you can either use it or not. If you
|
| 3430 |
don't use their init script then create a new one in
|
| 3431 |
<filename><replaceable>package</replaceable>.init</filename>. However
|
| 3432 |
if the upstream init script looks fine and installs in the right place you
|
| 3433 |
still need to set up the <filename>rc*</filename> symlinks. To do this you will
|
| 3434 |
need to override <command>dh_installinit</command> in the
|
| 3435 |
<filename>rules</filename> file with the following lines:
|
| 3436 |
</para>
|
| 3437 |
<screen>
|
| 3438 |
override_dh_installinit:
|
| 3439 |
dh_installinit --onlyscripts
|
| 3440 |
</screen>
|
| 3441 |
<para>
|
| 3442 |
If you don't need this, remove the files.
|
| 3443 |
</para>
|
| 3444 |
</section>
|
| 3445 |
<section id="install"><title><filename>install</filename></title>
|
| 3446 |
<para>
|
| 3447 |
If there are files that need to be installed into your package but your
|
| 3448 |
standard <literal>make install</literal> won't do it, put the filenames and
|
| 3449 |
destinations into this <filename>install</filename> file. They are installed
|
| 3450 |
by <citerefentry> <refentrytitle>dh_install</refentrytitle>
|
| 3451 |
<manvolnum>1</manvolnum> </citerefentry>.<footnote><para> This replaces the
|
| 3452 |
deprecated <citerefentry> <refentrytitle>dh_movefiles</refentrytitle>
|
| 3453 |
<manvolnum>1</manvolnum> </citerefentry> command which is configured by the
|
| 3454 |
<filename>files</filename> file. </para> </footnote> You should first check
|
| 3455 |
there is not a more specific tool to use. For example, documents should be in
|
| 3456 |
the <filename>docs</filename> file and not in this one.
|
| 3457 |
</para>
|
| 3458 |
<para>
|
| 3459 |
This <filename>install</filename> file has one line per file installed, with
|
| 3460 |
the name of the file (relative to the top build directory) then a space then
|
| 3461 |
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
|
| 3462 |
<filename>install</filename> file might look like:
|
| 3463 |
</para>
|
| 3464 |
<screen>
|
| 3465 |
src/<replaceable>bar</replaceable> usr/bin
|
| 3466 |
</screen>
|
| 3467 |
<para>
|
| 3468 |
This means when this package is installed, there will be an executable command
|
| 3469 |
<filename>/usr/bin/<replaceable>bar</replaceable></filename>.
|
| 3470 |
</para>
|
| 3471 |
<para>
|
| 3472 |
Alternatively, this <filename>install</filename> can have the name of the file
|
| 3473 |
only without the installation directory when the relative directory path does
|
| 3474 |
not change. This format is usually used for a large package that splits the
|
| 3475 |
output of its build into multiple binary packages using
|
| 3476 |
<filename><replaceable>package-1</replaceable>.install</filename>,
|
| 3477 |
<filename><replaceable>package-2</replaceable>.install</filename>, etc.
|
| 3478 |
</para>
|
| 3479 |
<para>
|
| 3480 |
The <command>dh_install</command> command will fall back to looking in
|
| 3481 |
<filename>debian/tmp</filename> for files, if it doesn't find them in the
|
| 3482 |
current directory (or wherever you've told it to look using
|
| 3483 |
<literal>--sourcedir</literal>).
|
| 3484 |
</para>
|
| 3485 |
</section>
|
| 3486 |
<section id="info"><title><filename><replaceable>package</replaceable>.info</filename></title>
|
| 3487 |
<para>
|
| 3488 |
If your package has info pages, you should install them using <citerefentry>
|
| 3489 |
<refentrytitle>dh_installinfo</refentrytitle> <manvolnum>1</manvolnum>
|
| 3490 |
</citerefentry> by listing them in a
|
| 3491 |
<filename><replaceable>package</replaceable>.info</filename> file.
|
| 3492 |
</para>
|
| 3493 |
</section>
|
| 3494 |
<section id="lintian"><title><filename>{<replaceable>package</replaceable>.,source/}lintian-overrides</filename></title>
|
| 3495 |
<para>
|
| 3496 |
If <systemitem role="package">lintian</systemitem> reports an erroneous
|
| 3497 |
diagnostic for a case where Debian policy allows exceptions to some rule, you can
|
| 3498 |
use <filename><replaceable>package</replaceable>.lintian-overrides</filename>
|
| 3499 |
or <filename>source/lintian-overrides</filename> to quieten it. Please read
|
| 3500 |
Lintian User's Manual (<filename>&lintian-doc;</filename>) and refrain
|
| 3501 |
from abusing this.
|
| 3502 |
</para>
|
| 3503 |
<para>
|
| 3504 |
<filename><replaceable>package</replaceable>.lintian-overrides</filename> is
|
| 3505 |
for the binary package named <systemitem role="package"><replaceable>package</replaceable></systemitem> and is installed
|
| 3506 |
into
|
| 3507 |
<filename>usr/share/lintian/overrides/<replaceable>package</replaceable></filename>
|
| 3508 |
by the <command>dh_lintian</command> command.
|
| 3509 |
</para>
|
| 3510 |
<para>
|
| 3511 |
<filename>source/lintian-overrides</filename> is for the source package. This
|
| 3512 |
is not installed.
|
| 3513 |
</para>
|
| 3514 |
</section>
|
| 3515 |
<section id="manpage"><title><filename>manpage.*</filename></title>
|
| 3516 |
<para>
|
| 3517 |
Your program(s) should have a manual page. If they don't, you should create
|
| 3518 |
them. The <command>dh_make</command> command creates some template files for
|
| 3519 |
manual pages. These need to be copied and edited for each command missing its
|
| 3520 |
manual page. Please make sure to remove unused templates.
|
| 3521 |
</para>
|
| 3522 |
<section id="manpage1"><title><filename>manpage.1.ex</filename></title>
|
| 3523 |
<para>
|
| 3524 |
Manual pages are normally written in <citerefentry>
|
| 3525 |
<refentrytitle>nroff</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>.
|
| 3526 |
The <filename>manpage.1.ex</filename> template is written in
|
| 3527 |
<command>nroff</command>, too. See the <citerefentry>
|
| 3528 |
<refentrytitle>man</refentrytitle> <manvolnum>7</manvolnum> </citerefentry>
|
| 3529 |
manual page for a brief description of how to edit such a file.
|
| 3530 |
</para>
|
| 3531 |
<para>
|
| 3532 |
The final manual page file name should give the name of the program it is
|
| 3533 |
documenting, so we will rename it from <literal>manpage</literal> to
|
| 3534 |
<literal>gentoo</literal>. The file name also includes <literal>.1</literal>
|
| 3535 |
as the first suffix, which means it's a manual page for a user command. Be
|
| 3536 |
sure to verify that this section is indeed the correct one. Here's a short
|
| 3537 |
list of manual page sections:
|
| 3538 |
</para>
|
| 3539 |
<informaltable id="manpage-sections" pgwide="0" frame="topbot" rowsep="1" colsep="1">
|
| 3540 |
<tgroup cols="3">
|
| 3541 |
<colspec colwidth="8*" align="left"/> <colspec colwidth="24*" align="left"/> <colspec colwidth="40*" align="left"/>
|
| 3542 |
<thead>
|
| 3543 |
<row> <entry>Section</entry> <entry>Description</entry> <entry>Notes</entry> </row>
|
| 3544 |
</thead>
|
| 3545 |
<tbody>
|
| 3546 |
<row> <entry>1</entry> <entry>User command</entry> <entry>Executable commands or scripts</entry> </row>
|
| 3547 |
<row> <entry>2</entry> <entry>System calls</entry> <entry>Functions provided by the kernel</entry> </row>
|
| 3548 |
<row> <entry>3</entry> <entry>Library calls</entry> <entry>Functions within system libraries</entry> </row>
|
| 3549 |
<row> <entry>4</entry> <entry>Special files</entry> <entry>Usually found in <filename>/dev</filename></entry> </row>
|
| 3550 |
<row> <entry>5</entry> <entry>File formats</entry> <entry>E.g. <filename>/etc/passwd</filename>'s format</entry> </row>
|
| 3551 |
<row> <entry>6</entry> <entry>Games</entry> <entry>Games or other frivolous programs</entry> </row>
|
| 3552 |
<row> <entry>7</entry> <entry>Macro packages</entry> <entry>Such as <command>man</command> macros</entry> </row>
|
| 3553 |
<row> <entry>8</entry> <entry>System administration</entry> <entry>Programs typically only run by root</entry> </row>
|
| 3554 |
<row> <entry>9</entry> <entry>Kernel routines</entry> <entry>Non-standard calls and internals</entry> </row>
|
| 3555 |
</tbody>
|
| 3556 |
</tgroup>
|
| 3557 |
</informaltable>
|
| 3558 |
<para>
|
| 3559 |
So <systemitem role="package">gentoo</systemitem>'s man page should be called
|
| 3560 |
<filename>gentoo.1</filename>. If there was no <filename>gentoo.1</filename>
|
| 3561 |
man page in the original source, you should create it by renaming the
|
| 3562 |
<filename>manpage.1.ex</filename> template to <filename>gentoo.1</filename> and
|
| 3563 |
editing it using information from the example and from the upstream docs.
|
| 3564 |
</para>
|
| 3565 |
<para>
|
| 3566 |
You can use the <command>help2man</command> command to generate a man page out
|
| 3567 |
of the <literal>--help</literal> and <literal>--version</literal> output of each
|
| 3568 |
program, too. <footnote><para> Note that <command>help2man</command>'s
|
| 3569 |
placeholder man page will claim that more detailed documentation is
|
| 3570 |
available in the info system. If the command is missing an
|
| 3571 |
<command>info</command> page, you
|
| 3572 |
should manually edit the man page created by the
|
| 3573 |
<command>help2man</command> command. </para> </footnote>
|
| 3574 |
</para>
|
| 3575 |
</section>
|
| 3576 |
<section id="manpagesgml"><title><filename>manpage.sgml.ex</filename></title>
|
| 3577 |
<para>
|
| 3578 |
If on the other hand you prefer writing SGML instead of
|
| 3579 |
<command>nroff</command>, you can use the <filename>manpage.sgml.ex</filename>
|
| 3580 |
template. If you do this, you have to:
|
| 3581 |
</para>
|
| 3582 |
<itemizedlist>
|
| 3583 |
<listitem>
|
| 3584 |
<para>
|
| 3585 |
rename the file to something like <filename>gentoo.sgml</filename>.
|
| 3586 |
</para>
|
| 3587 |
</listitem>
|
| 3588 |
<listitem>
|
| 3589 |
<para>
|
| 3590 |
install the <systemitem role="package">docbook-to-man</systemitem> package
|
| 3591 |
</para>
|
| 3592 |
</listitem>
|
| 3593 |
<listitem>
|
| 3594 |
<para>
|
| 3595 |
add <literal>docbook-to-man</literal> to the <literal>Build-Depends</literal>
|
| 3596 |
line in the <filename>control</filename> file
|
| 3597 |
</para>
|
| 3598 |
</listitem>
|
| 3599 |
<listitem>
|
| 3600 |
<para>
|
| 3601 |
add an <literal>override_dh_auto_build</literal> target to your
|
| 3602 |
<filename>rules</filename> file:
|
| 3603 |
</para>
|
| 3604 |
<screen>
|
| 3605 |
override_dh_auto_build:
|
| 3606 |
docbook-to-man debian/gentoo.sgml > debian/gentoo.1
|
| 3607 |
dh_auto_build
|
| 3608 |
</screen>
|
| 3609 |
</listitem>
|
| 3610 |
</itemizedlist>
|
| 3611 |
</section>
|
| 3612 |
<section id="manpagexml"><title><filename>manpage.xml.ex</filename></title>
|
| 3613 |
<para>
|
| 3614 |
If you prefer XML over SGML, you can use the <literal>manpage.xml.ex</literal>
|
| 3615 |
template. If you do this, you have to:
|
| 3616 |
</para>
|
| 3617 |
<itemizedlist>
|
| 3618 |
<listitem>
|
| 3619 |
<para>
|
| 3620 |
rename the source file to something like <literal>gentoo.1.xml</literal>
|
| 3621 |
</para>
|
| 3622 |
</listitem>
|
| 3623 |
<listitem>
|
| 3624 |
<para>
|
| 3625 |
install the <systemitem role="package">docbook-xsl</systemitem> package and an
|
| 3626 |
XSLT processor like <systemitem role="package">xsltproc</systemitem>
|
| 3627 |
(recommended)
|
| 3628 |
</para>
|
| 3629 |
</listitem>
|
| 3630 |
<listitem>
|
| 3631 |
<para>
|
| 3632 |
add the <literal>docbook-xsl</literal>, <literal>docbook-xml</literal>, and
|
| 3633 |
<literal>xsltproc</literal> packages to the <literal>Build-Depends</literal>
|
| 3634 |
line in the <literal>control</literal> file
|
| 3635 |
</para>
|
| 3636 |
</listitem>
|
| 3637 |
<listitem>
|
| 3638 |
<para>
|
| 3639 |
add an <literal>override_dh_auto_build</literal> target to your
|
| 3640 |
<filename>rules</filename> file:
|
| 3641 |
</para>
|
| 3642 |
<screen>
|
| 3643 |
override_dh_auto_build:
|
| 3644 |
xsltproc --nonet \
|
| 3645 |
--param make.year.ranges 1 \
|
| 3646 |
--param make.single.year.ranges 1 \
|
| 3647 |
--param man.charmap.use.subset 0 \
|
| 3648 |
-o debian/ \
|
| 3649 |
http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl\
|
| 3650 |
debian/gentoo.1.xml
|
| 3651 |
dh_auto_build
|
| 3652 |
</screen>
|
| 3653 |
</listitem>
|
| 3654 |
</itemizedlist>
|
| 3655 |
</section>
|
| 3656 |
</section>
|
| 3657 |
<section id="manpages"><title><filename><replaceable>package</replaceable>.manpages</filename></title>
|
| 3658 |
<para>
|
| 3659 |
If your package has manual pages, you should install them using <citerefentry>
|
| 3660 |
<refentrytitle>dh_installman</refentrytitle> <manvolnum>1</manvolnum>
|
| 3661 |
</citerefentry> by listing them in a
|
| 3662 |
<filename><replaceable>package</replaceable>.manpages</filename> file.
|
| 3663 |
</para>
|
| 3664 |
<para>
|
| 3665 |
To install <filename>docs/gentoo.1</filename> as a manpage for the <systemitem role="package">gentoo</systemitem> package, create a
|
| 3666 |
<filename>gentoo.manpages</filename> file as follows.
|
| 3667 |
</para>
|
| 3668 |
<screen>
|
| 3669 |
docs/gentoo.1
|
| 3670 |
</screen>
|
| 3671 |
</section>
|
| 3672 |
<section id="menu"><title><filename>menu</filename></title>
|
| 3673 |
<para>
|
| 3674 |
X Window System users usually have a window manager with a menu that can be
|
| 3675 |
customized to launch programs. If they have installed the Debian <systemitem role="package">menu</systemitem> package, a set of menus for every program on
|
| 3676 |
the system will be created for them.
|
| 3677 |
</para>
|
| 3678 |
<para>
|
| 3679 |
Here's the default <filename>menu.ex</filename> file that
|
| 3680 |
<command>dh_make</command> created.
|
| 3681 |
</para>
|
| 3682 |
<screen>
|
| 3683 |
?package(gentoo):needs=X11|text|vc|wm \
|
| 3684 |
section=Applications/see-menu-manual\
|
| 3685 |
title=gentoo command=/usr/bin/gentoo
|
| 3686 |
</screen>
|
| 3687 |
<para>
|
| 3688 |
The first field after the colon character is <literal>needs</literal>, and it
|
| 3689 |
specifies what kind of interface the program needs. Change this to one of the
|
| 3690 |
listed alternatives, e.g. <literal>text</literal> or <literal>X11</literal>.
|
| 3691 |
</para>
|
| 3692 |
<para>
|
| 3693 |
The next is the <literal>section</literal> that the menu and submenu entry
|
| 3694 |
should appear in.
|
| 3695 |
<footnote><para> The current list of sections is in
|
| 3696 |
<ulink url="&menu-structure;">The Debian Menu sub-policy 2.1 "Preferred menu structure"</ulink>.
|
| 3697 |
There was a major reorganization of menu structure for <literal>squeeze</literal>.
|
| 3698 |
</para> </footnote>
|
| 3699 |
</para>
|
| 3700 |
<para>
|
| 3701 |
The <literal>title</literal> field is the name of the program. You can start
|
| 3702 |
this one in uppercase if you like. Just keep it short.
|
| 3703 |
</para>
|
| 3704 |
<para>
|
| 3705 |
Finally, the <literal>command</literal> field is the command that runs the
|
| 3706 |
program.
|
| 3707 |
</para>
|
| 3708 |
<para>
|
| 3709 |
Let's change the file name to <filename>menu</filename> and change the menu
|
| 3710 |
entry to this:
|
| 3711 |
</para>
|
| 3712 |
<screen>
|
| 3713 |
?package(gentoo): needs=X11 \
|
| 3714 |
section=Applications/Tools \
|
| 3715 |
title=Gentoo command=gentoo
|
| 3716 |
</screen>
|
| 3717 |
<para>
|
| 3718 |
You can also add other fields like <literal>longtitle</literal>,
|
| 3719 |
<literal>icon</literal>, <literal>hints</literal> etc. See <citerefentry>
|
| 3720 |
<refentrytitle>dh_installmenu</refentrytitle> <manvolnum>1</manvolnum>
|
| 3721 |
</citerefentry>, <citerefentry> <refentrytitle>menufile</refentrytitle>
|
| 3722 |
<manvolnum>5</manvolnum> </citerefentry>, <citerefentry>
|
| 3723 |
<refentrytitle>update-menus</refentrytitle> <manvolnum>1</manvolnum>
|
| 3724 |
</citerefentry>, and
|
| 3725 |
<ulink url="&policy-menu;">The Debian Menu sub-policy</ulink> for more
|
| 3726 |
information.
|
| 3727 |
</para>
|
| 3728 |
</section>
|
| 3729 |
<section id="news"><title><filename>NEWS</filename></title>
|
| 3730 |
<para>
|
| 3731 |
The <citerefentry> <refentrytitle>dh_installchangelogs</refentrytitle>
|
| 3732 |
<manvolnum>1</manvolnum> </citerefentry> command installs this.
|
| 3733 |
</para>
|
| 3734 |
</section>
|
| 3735 |
<section id="maintscripts"><title><filename>{pre,post}{inst,rm}</filename></title>
|
| 3736 |
<para>
|
| 3737 |
These <filename>postinst</filename>, <filename>preinst</filename>,
|
| 3738 |
<filename>postrm</filename>, and <filename>prerm</filename> files
|
| 3739 |
<footnote><para> Despite this use of the <command>bash</command>
|
| 3740 |
shorthand expression <filename>{pre,post}{inst,rm}</filename> to indicate these
|
| 3741 |
filenames, you should use pure POSIX syntax for these maintainer scripts for
|
| 3742 |
compatibility with <command>dash</command> as the system shell. </para> </footnote> are
|
| 3743 |
called <emphasis>maintainer scripts</emphasis>. They are scripts which are put
|
| 3744 |
in the control area of the package and run by <command>dpkg</command> when your
|
| 3745 |
package is installed, upgraded, or removed.
|
| 3746 |
</para>
|
| 3747 |
<para>
|
| 3748 |
As a novice maintainer, you should avoid any manual editing of
|
| 3749 |
maintainer scripts because they are problematic. For more
|
| 3750 |
information refer to the <ulink url="&policy-mantainerscripts;">Debian
|
| 3751 |
Policy Manual, 6 "Package maintainer scripts and installation
|
| 3752 |
procedure"</ulink>, and take a look at the example files provided by
|
| 3753 |
<command>dh_make</command>.
|
| 3754 |
</para>
|
| 3755 |
<para>
|
| 3756 |
If you did not listen to me and have created custom maintainer
|
| 3757 |
scripts for a package, you should make sure to test them not only
|
| 3758 |
for <emphasis role="strong">install</emphasis> and
|
| 3759 |
<emphasis role="strong">upgrade</emphasis> but also for
|
| 3760 |
<emphasis role="strong">remove</emphasis> and
|
| 3761 |
<emphasis role="strong">purge</emphasis>.
|
| 3762 |
</para>
|
| 3763 |
<para>
|
| 3764 |
Upgrades to the new version should be silent and non-intrusive (existing users
|
| 3765 |
should not notice the upgrade except by discovering that old bugs have been
|
| 3766 |
fixed and perhaps that there are new features).
|
| 3767 |
</para>
|
| 3768 |
<para>
|
| 3769 |
When the upgrade is necessarily intrusive (eg., config files scattered through
|
| 3770 |
various home directories with totally different structure), you may
|
| 3771 |
consider as the last resort switching the package to a safe fallback state
|
| 3772 |
(e.g., disabling a service) and providing the proper documentation
|
| 3773 |
required by policy (<filename>README.Debian</filename> and
|
| 3774 |
<filename>NEWS.Debian</filename>). Don't bother the user with
|
| 3775 |
<command>debconf</command> notes invoked from these maintainer scripts
|
| 3776 |
for upgrades.
|
| 3777 |
</para>
|
| 3778 |
<para>
|
| 3779 |
The <systemitem role="package">ucf</systemitem> package provides a
|
| 3780 |
<emphasis>conffile-like</emphasis> handling infrastructure to preserve user
|
| 3781 |
changes for files that may not be labeled as <emphasis>conffiles</emphasis> such
|
| 3782 |
as those managed by the maintainer scripts. This should
|
| 3783 |
minimize issues associated with them.
|
| 3784 |
</para>
|
| 3785 |
<para>
|
| 3786 |
These maintainer scripts are among the Debian enhancements that
|
| 3787 |
explain <emphasis role="strong">why people choose Debian</emphasis>. You must
|
| 3788 |
be very careful not to turn them into a source of annoyance.
|
| 3789 |
</para>
|
| 3790 |
</section>
|
| 3791 |
<section id="todo"><title><filename>TODO</filename></title>
|
| 3792 |
<para>
|
| 3793 |
The <citerefentry> <refentrytitle>dh_installdocs</refentrytitle>
|
| 3794 |
<manvolnum>1</manvolnum> </citerefentry> command installs this.
|
| 3795 |
</para>
|
| 3796 |
</section>
|
| 3797 |
<section id="watch"><title><filename>watch</filename></title>
|
| 3798 |
<para>
|
| 3799 |
The <filename>watch</filename> file format is documented in the <citerefentry>
|
| 3800 |
<refentrytitle>uscan</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>
|
| 3801 |
manpage. The <filename>watch</filename> file configures the
|
| 3802 |
<command>uscan</command> program (in the <systemitem role="package">devscripts</systemitem> package) to watch the site where you
|
| 3803 |
originally got the source from. This is also used by the
|
| 3804 |
<ulink url="&dehs;">Debian External Health Status (DEHS)</ulink> service.
|
| 3805 |
</para>
|
| 3806 |
<para>
|
| 3807 |
Here are its contents:
|
| 3808 |
</para>
|
| 3809 |
<screen>
|
| 3810 |
# watch control file for uscan
|
| 3811 |
version=3
|
| 3812 |
&sf-net;/gentoo/gentoo-(.+)\.tar\.gz debian uupdate
|
| 3813 |
</screen>
|
| 3814 |
<para>
|
| 3815 |
Normally with a <filename>watch</filename> file, the URL at
|
| 3816 |
<literal>&sf-net;/gentoo</literal> is downloaded and searched for links of
|
| 3817 |
the form <literal><a href=...></literal>. The basename (just the part
|
| 3818 |
after the final <literal>/</literal>) of each linked URL is compared against
|
| 3819 |
the Perl regular expression pattern (see <citerefentry> <refentrytitle>perlre</refentrytitle>
|
| 3820 |
<manvolnum>1</manvolnum> </citerefentry>)
|
| 3821 |
<literal>gentoo-(.+)\.tar\.gz</literal>. Out of the files that match, the one with
|
| 3822 |
the greatest version number is downloaded and the <command>uupdate</command>
|
| 3823 |
program is run to create an updated source tree.
|
| 3824 |
</para>
|
| 3825 |
<para>
|
| 3826 |
Although this is true for other sites, the SourceForge download service at
|
| 3827 |
<ulink url="&sf-net;"/> is an exception. When the
|
| 3828 |
<filename>watch</filename> file has an URL matching the Perl regexp
|
| 3829 |
<literal>^http://sf\.net/</literal>, the <command>uscan</command> program
|
| 3830 |
replaces it with <literal>&qa-do;watch/sf.php/</literal> and
|
| 3831 |
then applies this rule. The URL redirector service at <ulink url="&qa-do;"/> is designed to offer
|
| 3832 |
a stable redirect service to the desired file for any
|
| 3833 |
<filename>watch</filename> pattern of the form
|
| 3834 |
<literal>&sf-net;/<replaceable>project</replaceable>/<replaceable>tar-name</replaceable>-(.+)\.tar\.gz</literal>.
|
| 3835 |
This solves issues related to periodically changing SourceForge URLs.
|
| 3836 |
</para>
|
| 3837 |
</section>
|
| 3838 |
<section id="sourcef"><title><filename>source/format</filename></title>
|
| 3839 |
<para>
|
| 3840 |
In the <filename>debian/source/format</filename> file, there should be a single
|
| 3841 |
line indicating the desired format for the source package (check <citerefentry>
|
| 3842 |
<refentrytitle>dpkg-source</refentrytitle> <manvolnum>1</manvolnum>
|
| 3843 |
</citerefentry> for an exhaustive list). After <literal>squeeze</literal>, it
|
| 3844 |
should say either:
|
| 3845 |
</para>
|
| 3846 |
<itemizedlist>
|
| 3847 |
<listitem>
|
| 3848 |
<para>
|
| 3849 |
<literal>3.0 (native)</literal> for Debian native packages or
|
| 3850 |
</para>
|
| 3851 |
</listitem>
|
| 3852 |
<listitem>
|
| 3853 |
<para>
|
| 3854 |
<literal>3.0 (quilt)</literal> for everything else.
|
| 3855 |
</para>
|
| 3856 |
</listitem>
|
| 3857 |
</itemizedlist>
|
| 3858 |
<para>
|
| 3859 |
The newer <literal>3.0 (quilt)</literal> source format records modifications in
|
| 3860 |
a <command>quilt</command> patch series within
|
| 3861 |
<filename>debian/patches</filename>. Those changes are then automatically
|
| 3862 |
applied during extraction of the source package. <footnote><para> See
|
| 3863 |
<ulink url="&debsrc3;">DebSrc3.0</ulink> for a summary on the switch to the new <literal>3.0
|
| 3864 |
(quilt)</literal> and <literal>3.0 (native)</literal> source formats. </para>
|
| 3865 |
</footnote> The Debian modifications are simply stored in a
|
| 3866 |
<filename>debian.tar.gz</filename> archive containing all files under the
|
| 3867 |
<filename>debian</filename> directory. This new format supports inclusion of
|
| 3868 |
binary files such as PNG icons by the package maintainer without requiring
|
| 3869 |
tricks. <footnote><para>Actually, this new format also supports multiple
|
| 3870 |
upstream tarballs and more compression methods. These are beyond the scope of
|
| 3871 |
this document.</para> </footnote>
|
| 3872 |
</para>
|
| 3873 |
<para>
|
| 3874 |
When <command>dpkg-source</command> extracts a source package in <literal>3.0
|
| 3875 |
(quilt)</literal> source format, it automatically applies all patches listed in
|
| 3876 |
<filename>debian/patches/series</filename>. You can avoid applying patches at
|
| 3877 |
the end of the extraction with the <literal>--skip-patches</literal> option.
|
| 3878 |
</para>
|
| 3879 |
</section>
|
| 3880 |
<section id="sourcel"><title><filename>source/local-options</filename></title>
|
| 3881 |
<para>
|
| 3882 |
When you want to manage Debian packaging activities under a VCS, you typically
|
| 3883 |
create one branch (e.g. <literal>upstream</literal>) tracking the upstream
|
| 3884 |
source and another branch (e.g. typically <literal>master</literal> for Git)
|
| 3885 |
tracking the Debian package. For the latter, you usually want to have
|
| 3886 |
unpatched upstream source with your <filename>debian/*</filename> files for the
|
| 3887 |
Debian packaging to ease merging of the new upstream source.
|
| 3888 |
</para>
|
| 3889 |
<para>
|
| 3890 |
After you build a package, the source is normally left patched. You need to
|
| 3891 |
unpatch it manually by running <literal>dquilt pop -a</literal> before
|
| 3892 |
committing to the <literal>master</literal> branch. You can automate this by
|
| 3893 |
adding the optional <filename>debian/source/local-options</filename> file
|
| 3894 |
containing <literal>unapply-patches</literal>. This file is not included in
|
| 3895 |
the generated source package and changes the local build behavior only. This
|
| 3896 |
file may contain <literal>abort-on-upstream-changes</literal>, too (see
|
| 3897 |
<citerefentry> <refentrytitle>dpkg-source</refentrytitle>
|
| 3898 |
<manvolnum>1</manvolnum> </citerefentry>).
|
| 3899 |
</para>
|
| 3900 |
<screen>
|
| 3901 |
unapply-patches
|
| 3902 |
abort-on-upstream-changes
|
| 3903 |
</screen>
|
| 3904 |
</section>
|
| 3905 |
<section id="sourceopt"><title><filename>source/options</filename></title>
|
| 3906 |
<para>
|
| 3907 |
The autogenerated files in the source tree can be quite annoying for packaging
|
| 3908 |
since they generate meaningless large patch files. There are custom modules
|
| 3909 |
such as <command>dh_autoreconf</command> to ease this problem as described in
|
| 3910 |
<xref linkend="customrules"/>.
|
| 3911 |
</para>
|
| 3912 |
<para>
|
| 3913 |
You can provide a Perl regular expression to the
|
| 3914 |
<literal>--extend-diff-ignore</literal> option argument of <citerefentry>
|
| 3915 |
<refentrytitle>dpkg-source</refentrytitle><manvolnum>1</manvolnum>
|
| 3916 |
</citerefentry> to ignore changes made to the autogenerated files while
|
| 3917 |
creating the source package.
|
| 3918 |
</para>
|
| 3919 |
<para>
|
| 3920 |
As a general solution to address this problem of the autogenerated files,
|
| 3921 |
you can store such a <command>dpkg-source</command> option argument in the
|
| 3922 |
<filename>source/options</filename> file of the source package. The following
|
| 3923 |
will skip creating patch files for <filename>config.sub</filename>,
|
| 3924 |
<filename>config.guess</filename>, and <filename>Makefile</filename>.
|
| 3925 |
</para>
|
| 3926 |
<screen>
|
| 3927 |
extend-diff-ignore = "(^|/)(config\.sub|config\.guess|Makefile)$"
|
| 3928 |
</screen>
|
| 3929 |
</section>
|
| 3930 |
<section id="patches"><title><filename>patches/*</filename></title>
|
| 3931 |
<para>
|
| 3932 |
The old <literal>1.0</literal> source format created a single large
|
| 3933 |
<filename>diff.gz</filename> file containing package maintenance files in
|
| 3934 |
<filename>debian</filename> and patch files for the source. Such a package is a
|
| 3935 |
bit cumbersome to inspect and understand for each source tree modification
|
| 3936 |
later. This is not so nice.
|
| 3937 |
</para>
|
| 3938 |
<para>
|
| 3939 |
The newer <literal>3.0 (quilt)</literal> source format stores patches in
|
| 3940 |
<filename>debian/patches/*</filename> files using the <command>quilt</command>
|
| 3941 |
command. These patches and other package data which are all contained under
|
| 3942 |
the <filename>debian</filename> directory are packaged as the
|
| 3943 |
<filename>debian.tar.gz</filename> file. Since the
|
| 3944 |
<command>dpkg-source</command> command can handle <command>quilt</command>
|
| 3945 |
formatted patch data in the <literal>3.0 (quilt)</literal> source without the
|
| 3946 |
<systemitem role="package">quilt</systemitem> package, it does not need a
|
| 3947 |
<literal>Build-Depends</literal> on <systemitem role="package">quilt</systemitem>.
|
| 3948 |
<footnote><para> Several methods of patch set maintenance have been proposed and are in use for Debian
|
| 3949 |
packages. The <command>quilt</command> system is the preferred maintenance
|
| 3950 |
system in use. Others include <command>dpatch</command>,
|
| 3951 |
<command>dbs</command>, and <command>cdbs</command>. Many of these keep such
|
| 3952 |
patches as <filename>debian/patches/*</filename> files. </para> </footnote>
|
| 3953 |
</para>
|
| 3954 |
<para>
|
| 3955 |
The <command>quilt</command> command is explained in <citerefentry>
|
| 3956 |
<refentrytitle>quilt</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>.
|
| 3957 |
It records modifications to the source as a stack of <literal>-p1</literal>
|
| 3958 |
patch files in the <filename>debian/patches</filename> directory and the source
|
| 3959 |
tree is untouched outside of the <filename>debian</filename> directory. The
|
| 3960 |
order of these patches is recorded in the
|
| 3961 |
<filename>debian/patches/series</filename> file. You can apply (=push),
|
| 3962 |
un-apply (=pop), and refresh patches easily. <footnote><para> If you are
|
| 3963 |
asking a sponsor to upload your package, this kind of clear separation and
|
| 3964 |
documentation of your changes is very important to expedite the package review
|
| 3965 |
by your sponsor. </para> </footnote>
|
| 3966 |
</para>
|
| 3967 |
<para>
|
| 3968 |
For <xref linkend="modify"/>, we created three patches in
|
| 3969 |
<filename>debian/patches</filename>.
|
| 3970 |
</para>
|
| 3971 |
<para>
|
| 3972 |
Since Debian patches are located in <filename>debian/patches</filename>, please
|
| 3973 |
make sure to set up the <command>dquilt</command> command properly as described
|
| 3974 |
in <xref linkend="quiltrc"/>.
|
| 3975 |
</para>
|
| 3976 |
<para>
|
| 3977 |
When anyone (including yourself) provides a patch
|
| 3978 |
<filename><replaceable>foo</replaceable>.patch</filename> to the source later,
|
| 3979 |
modifying a <literal>3.0 (quilt)</literal> source package is
|
| 3980 |
quite simple:
|
| 3981 |
</para>
|
| 3982 |
<screen>
|
| 3983 |
$ dpkg-source -x gentoo_0.9.12.dsc
|
| 3984 |
$ cd gentoo-0.9.12
|
| 3985 |
$ dquilt import ../<replaceable>foo</replaceable>.patch
|
| 3986 |
$ dquilt push
|
| 3987 |
$ dquilt refresh
|
| 3988 |
$ dquilt header -e
|
| 3989 |
... describe patch
|
| 3990 |
</screen>
|
| 3991 |
<para>
|
| 3992 |
The patches stored in the newer <literal>3.0 (quilt)</literal> source format
|
| 3993 |
must be <emphasis>fuzz</emphasis> free. You can ensure this with <literal>dquilt
|
| 3994 |
pop -a; while dquilt push; do dquilt refresh; done</literal>.
|
| 3995 |
</para>
|
| 3996 |
</section>
|
| 3997 |
</chapter>
|
| 3998 |
<chapter id="build"><title>Building the package</title>
|
| 3999 |
<para>
|
| 4000 |
We should now be ready to build the package.
|
| 4001 |
</para>
|
| 4002 |
<section id="completebuild"><title>Complete (re)build</title>
|
| 4003 |
<para>
|
| 4004 |
In order to perform a complete (re)build of a package properly, you
|
| 4005 |
need to make sure you have installed
|
| 4006 |
</para>
|
| 4007 |
<itemizedlist>
|
| 4008 |
<listitem>
|
| 4009 |
<para>
|
| 4010 |
the <systemitem role="package">build-essential</systemitem> package,
|
| 4011 |
</para>
|
| 4012 |
</listitem>
|
| 4013 |
<listitem>
|
| 4014 |
<para>
|
| 4015 |
packages listed in the <literal>Build-Depends</literal> field (see <xref linkend="control"/>), and
|
| 4016 |
</para>
|
| 4017 |
</listitem>
|
| 4018 |
<listitem>
|
| 4019 |
<para>
|
| 4020 |
packages listed in the <literal>Build-Depends-indep</literal> field (see <xref linkend="control"/>).
|
| 4021 |
</para>
|
| 4022 |
</listitem>
|
| 4023 |
</itemizedlist>
|
| 4024 |
<para>
|
| 4025 |
Then you issue the following command in the source directory:
|
| 4026 |
</para>
|
| 4027 |
<screen>
|
| 4028 |
$ dpkg-buildpackage
|
| 4029 |
</screen>
|
| 4030 |
<para>
|
| 4031 |
This will do everything to make full binary and source packages for you. It
|
| 4032 |
will:
|
| 4033 |
</para>
|
| 4034 |
<itemizedlist>
|
| 4035 |
<listitem>
|
| 4036 |
<para>
|
| 4037 |
clean the source tree (<literal>debian/rules clean</literal>)
|
| 4038 |
</para>
|
| 4039 |
</listitem>
|
| 4040 |
<listitem>
|
| 4041 |
<para>
|
| 4042 |
build the source package (<literal>dpkg-source -b</literal>)
|
| 4043 |
</para>
|
| 4044 |
</listitem>
|
| 4045 |
<listitem>
|
| 4046 |
<para>
|
| 4047 |
build the program (<literal>debian/rules build</literal>)
|
| 4048 |
</para>
|
| 4049 |
</listitem>
|
| 4050 |
<listitem>
|
| 4051 |
<para>
|
| 4052 |
build binary packages (<literal>fakeroot debian/rules binary</literal>)
|
| 4053 |
</para>
|
| 4054 |
</listitem>
|
| 4055 |
<listitem>
|
| 4056 |
<para>
|
| 4057 |
sign the source <filename>.dsc</filename> file, using <command>gpg</command>
|
| 4058 |
</para>
|
| 4059 |
</listitem>
|
| 4060 |
<listitem>
|
| 4061 |
<para>
|
| 4062 |
create and sign the upload <filename>.changes</filename> file, using
|
| 4063 |
<command>dpkg-genchanges</command> and <command>gpg</command>
|
| 4064 |
</para>
|
| 4065 |
</listitem>
|
| 4066 |
</itemizedlist>
|
| 4067 |
<para>
|
| 4068 |
The only input that will be required of you is your GPG secret pass phrase,
|
| 4069 |
twice.
|
| 4070 |
<footnote><para>
|
| 4071 |
This GPG key must be signed by a Debian developer to get connected to the web
|
| 4072 |
of trust and must be registered to <ulink url="&keyring;">the Debian
|
| 4073 |
keyring</ulink>. This enables your uploaded packages to be accepted to the
|
| 4074 |
Debian archives. See
|
| 4075 |
<ulink url="&keycreate;">Creating a new GPG key</ulink> and
|
| 4076 |
<ulink url="&keysigning; ">Debian Wiki on Keysigning</ulink>.
|
| 4077 |
</para></footnote>
|
| 4078 |
If you are building Debian packages only for your own local use, you can skip
|
| 4079 |
promptings for the GPG signatures on the <filename>.dsc</filename> file and the
|
| 4080 |
<filename>.changes</filename> file like this:
|
| 4081 |
</para>
|
| 4082 |
<screen>
|
| 4083 |
$ dpkg-buildpackage -us -uc
|
| 4084 |
</screen>
|
| 4085 |
<para>
|
| 4086 |
For a non-native Debian package, e.g.,
|
| 4087 |
<systemitem role="package">gentoo</systemitem>, you will see the following
|
| 4088 |
files in the parent directory (<filename>~/gentoo</filename>) after building
|
| 4089 |
packages:
|
| 4090 |
</para>
|
| 4091 |
<itemizedlist>
|
| 4092 |
<listitem>
|
| 4093 |
<para>
|
| 4094 |
<filename>gentoo_0.9.12.orig.tar.gz</filename>
|
| 4095 |
</para>
|
| 4096 |
<para>
|
| 4097 |
This is the original upstream source code tarball, merely renamed to the above so that
|
| 4098 |
it adheres to the Debian standard. Note that this was created initially by the
|
| 4099 |
<literal>dh_make -f ../gentoo-0.9.12.tar.gz</literal>.
|
| 4100 |
</para>
|
| 4101 |
</listitem>
|
| 4102 |
<listitem>
|
| 4103 |
<para>
|
| 4104 |
<filename>gentoo_0.9.12-1.dsc</filename>
|
| 4105 |
</para>
|
| 4106 |
<para>
|
| 4107 |
This is a summary of the contents of the source code. The file is generated
|
| 4108 |
from your <filename>control</filename> file, and is used when unpacking the
|
| 4109 |
source with <citerefentry> <refentrytitle>dpkg-source</refentrytitle>
|
| 4110 |
<manvolnum>1</manvolnum> </citerefentry>. This file is GPG signed, so that
|
| 4111 |
people can be sure that it's really yours.
|
| 4112 |
</para>
|
| 4113 |
</listitem>
|
| 4114 |
<listitem>
|
| 4115 |
<para>
|
| 4116 |
<filename>gentoo_0.9.12-1.debian.tar.gz</filename>
|
| 4117 |
</para>
|
| 4118 |
<para>
|
| 4119 |
This compressed tarball contains your <filename>debian</filename> directory
|
| 4120 |
contents. Each and every addition you made to the original source code is
|
| 4121 |
stored as a <command>quilt</command> patch in
|
| 4122 |
<filename>debian/patches</filename>.
|
| 4123 |
</para>
|
| 4124 |
<para>
|
| 4125 |
If someone else wants to re-create your package from scratch, they can easily
|
| 4126 |
do so using the above three files. The extraction procedure is trivial: just
|
| 4127 |
copy the three files somewhere else and run <literal>dpkg-source -x
|
| 4128 |
gentoo_0.9.12-1.dsc</literal>. <footnote><para> You can avoid applying
|
| 4129 |
<command>quilt</command> patches in the <literal>3.0 (quilt)</literal> source
|
| 4130 |
format at the end of the extraction with the <literal>--skip-patches</literal>
|
| 4131 |
option. Alternatively, you can run <literal>dquilt pop -a</literal> after
|
| 4132 |
normal operation. </para> </footnote>
|
| 4133 |
</para>
|
| 4134 |
</listitem>
|
| 4135 |
<listitem>
|
| 4136 |
<para>
|
| 4137 |
<filename>gentoo_0.9.12-1_i386.deb</filename>
|
| 4138 |
</para>
|
| 4139 |
<para>
|
| 4140 |
This is your completed binary package. You can use <command>dpkg</command> to
|
| 4141 |
install and remove this just like any other package.
|
| 4142 |
</para>
|
| 4143 |
</listitem>
|
| 4144 |
<listitem>
|
| 4145 |
<para>
|
| 4146 |
<filename>gentoo_0.9.12-1_i386.changes</filename>
|
| 4147 |
</para>
|
| 4148 |
<para>
|
| 4149 |
This file describes all the changes made in the current package revision;
|
| 4150 |
it is used by the Debian FTP archive maintenance programs to install the binary
|
| 4151 |
and source packages. It is partly generated from the
|
| 4152 |
<filename>changelog</filename> file and the <filename>.dsc</filename> file.
|
| 4153 |
This file is GPG signed, so that people can be sure that it's really yours.
|
| 4154 |
</para>
|
| 4155 |
<para>
|
| 4156 |
As you keep working on the package, its behavior will change and new features will
|
| 4157 |
be added. People downloading your package can look at this file and quickly
|
| 4158 |
see what has changed. Debian archive maintenance programs will also post the
|
| 4159 |
contents of this file to the <ulink url="&debian-devel-announce-ldo;">debian-devel-announce@lists.debian.org</ulink>
|
| 4160 |
mailing list.
|
| 4161 |
</para>
|
| 4162 |
</listitem>
|
| 4163 |
</itemizedlist>
|
| 4164 |
<para>
|
| 4165 |
The long strings of numbers in the <filename>.dsc</filename> and
|
| 4166 |
<filename>.changes</filename> files are SHA1/SHA256 checksums for the files
|
| 4167 |
mentioned. Anyone downloading your files can test them with <citerefentry>
|
| 4168 |
<refentrytitle>sha1sum</refentrytitle> <manvolnum>1</manvolnum>
|
| 4169 |
</citerefentry> or <citerefentry> <refentrytitle>sha256sum</refentrytitle>
|
| 4170 |
<manvolnum>1</manvolnum> </citerefentry> and if the numbers don't match,
|
| 4171 |
they'll know the file is corrupt or has been tampered with.
|
| 4172 |
</para>
|
| 4173 |
<para>
|
| 4174 |
For a native Debian package, e.g.,
|
| 4175 |
<systemitem role="package">mypackage</systemitem>, you will see the following
|
| 4176 |
files in the parent directory after building packages:
|
| 4177 |
</para>
|
| 4178 |
<itemizedlist>
|
| 4179 |
<listitem>
|
| 4180 |
<para>
|
| 4181 |
<filename>mypackage_1.0.tar.gz</filename>
|
| 4182 |
</para>
|
| 4183 |
<para>
|
| 4184 |
This is the source code tarball created from the
|
| 4185 |
<filename>mypackage-1.0</filename> directory by the
|
| 4186 |
<command>dpkg-source</command> command. (Its suffix is not <filename>orig.tar.gz</filename>.)
|
| 4187 |
</para>
|
| 4188 |
</listitem>
|
| 4189 |
<listitem>
|
| 4190 |
<para>
|
| 4191 |
<filename>mypackage_1.0.dsc</filename>
|
| 4192 |
</para>
|
| 4193 |
<para>
|
| 4194 |
This is a summary of the contents of the source code as in the non-native
|
| 4195 |
Debian package. (There is no Debian revision.)
|
| 4196 |
</para>
|
| 4197 |
</listitem>
|
| 4198 |
<listitem>
|
| 4199 |
<para>
|
| 4200 |
<filename>mypackage_1.0_i386.deb</filename>
|
| 4201 |
</para>
|
| 4202 |
<para>
|
| 4203 |
This is your completed binary package as in the non-native Debian package.
|
| 4204 |
(There is no Debian revision.)
|
| 4205 |
</para>
|
| 4206 |
</listitem>
|
| 4207 |
<listitem>
|
| 4208 |
<para>
|
| 4209 |
<filename>mypackage_1.0_i386.changes</filename>
|
| 4210 |
</para>
|
| 4211 |
<para>
|
| 4212 |
This file describes all the changes made in the current package version as in
|
| 4213 |
the non-native Debian package. (There is no Debian revision.)
|
| 4214 |
</para>
|
| 4215 |
</listitem>
|
| 4216 |
</itemizedlist>
|
| 4217 |
</section>
|
| 4218 |
<section id="autobuilder"><title>Autobuilder</title>
|
| 4219 |
<para>
|
| 4220 |
Debian supports many <ulink url="&ports;">ports</ulink>
|
| 4221 |
with the <ulink url="&buildd;">autobuilder
|
| 4222 |
network</ulink> running <command>buildd</command> daemons on computers
|
| 4223 |
of many different architectures. Although you do not need to do this yourself, you
|
| 4224 |
should be aware of what will happen to your packages. Let's look into roughly
|
| 4225 |
how they rebuild your packages for multiple architectures.
|
| 4226 |
<footnote><para> The actual autobuilder system involves much more complicated
|
| 4227 |
schemes than the one documented here. Such details are beyond the scope of
|
| 4228 |
this document. </para> </footnote>
|
| 4229 |
</para>
|
| 4230 |
<para>
|
| 4231 |
For <literal>Architecture: any</literal> packages, the autobuilder system
|
| 4232 |
performs a rebuild. It ensures the installation of
|
| 4233 |
</para>
|
| 4234 |
<itemizedlist>
|
| 4235 |
<listitem>
|
| 4236 |
<para>
|
| 4237 |
the <systemitem role="package">build-essential</systemitem> package, and
|
| 4238 |
</para>
|
| 4239 |
</listitem>
|
| 4240 |
<listitem>
|
| 4241 |
<para>
|
| 4242 |
packages listed in the <literal>Build-Depends</literal> field (see <xref linkend="control"/>).
|
| 4243 |
</para>
|
| 4244 |
</listitem>
|
| 4245 |
</itemizedlist>
|
| 4246 |
<para>
|
| 4247 |
Then it issues the following command in the source directory:
|
| 4248 |
</para>
|
| 4249 |
<screen>
|
| 4250 |
$ dpkg-buildpackage -B
|
| 4251 |
</screen>
|
| 4252 |
<para>
|
| 4253 |
This will do everything to make architecture dependent binary packages on
|
| 4254 |
another architecture. It will:
|
| 4255 |
</para>
|
| 4256 |
<itemizedlist>
|
| 4257 |
<listitem>
|
| 4258 |
<para>
|
| 4259 |
clean the source tree (<literal>debian/rules clean</literal>)
|
| 4260 |
</para>
|
| 4261 |
</listitem>
|
| 4262 |
<listitem>
|
| 4263 |
<para>
|
| 4264 |
build the program (<literal>debian/rules build</literal>)
|
| 4265 |
</para>
|
| 4266 |
</listitem>
|
| 4267 |
<listitem>
|
| 4268 |
<para>
|
| 4269 |
build architecture dependent binary packages (<literal>fakeroot debian/rules
|
| 4270 |
binary-arch</literal>)
|
| 4271 |
</para>
|
| 4272 |
</listitem>
|
| 4273 |
<listitem>
|
| 4274 |
<para>
|
| 4275 |
sign the source <filename>.dsc</filename> file, using <command>gpg</command>
|
| 4276 |
</para>
|
| 4277 |
</listitem>
|
| 4278 |
<listitem>
|
| 4279 |
<para>
|
| 4280 |
create and sign the upload <filename>.changes</filename> file, using
|
| 4281 |
<command>dpkg-genchanges</command> and <command>gpg</command>
|
| 4282 |
</para>
|
| 4283 |
</listitem>
|
| 4284 |
</itemizedlist>
|
| 4285 |
<para>
|
| 4286 |
This is why you see your package for other architectures.
|
| 4287 |
</para>
|
| 4288 |
<para>
|
| 4289 |
Although packages listed in the <literal>Build-Depends-Indep</literal> field
|
| 4290 |
are required to be installed for our normal packaging work (see
|
| 4291 |
<xref linkend="completebuild"/>), they are not required to be installed for the
|
| 4292 |
autobuilder system since it builds only architecture dependent binary packages.
|
| 4293 |
<footnote><para> Unlike under the <systemitem role="package">pbuilder</systemitem> package, the <command>chroot</command>
|
| 4294 |
environment under the <systemitem role="package">sbuild</systemitem> package
|
| 4295 |
used by the autobuilder system does not enforce the use of a minimal
|
| 4296 |
system and may have many leftover packages installed. </para>
|
| 4297 |
</footnote> This distinction between normal packaging and autobuilding
|
| 4298 |
procedures is what dictates whether you should record such required
|
| 4299 |
packages in the <literal>Build-Depends</literal> or
|
| 4300 |
<literal>Build-Depends-Indep</literal> fields of the
|
| 4301 |
<filename>debian/control</filename> file (see <xref linkend="control"/>).
|
| 4302 |
</para>
|
| 4303 |
</section>
|
| 4304 |
<section id="debuild"><title><command>debuild</command> command</title>
|
| 4305 |
<para>
|
| 4306 |
You can automate the <command>dpkg-buildpackage</command> command's
|
| 4307 |
package build process further with the
|
| 4308 |
<command>debuild</command> command. See <citerefentry>
|
| 4309 |
<refentrytitle>debuild</refentrytitle> <manvolnum>1</manvolnum>
|
| 4310 |
</citerefentry>.
|
| 4311 |
</para>
|
| 4312 |
<para>
|
| 4313 |
Customization of the <command>debuild</command> command can be done through
|
| 4314 |
<filename>/etc/devscripts.conf</filename> or
|
| 4315 |
<filename>~/.devscripts</filename>. I would suggest at least the following items:
|
| 4316 |
</para>
|
| 4317 |
<screen>
|
| 4318 |
DEBSIGN_KEYID=Your_GPG_keyID
|
| 4319 |
DEBUILD_LINTIAN_OPTS=-i -I --show-overrides
|
| 4320 |
</screen>
|
| 4321 |
<para>
|
| 4322 |
With these, packages are signed by your specified GPG key ID (good for
|
| 4323 |
sponsoring packages) and checked in detail by the <command>lintian</command> command.
|
| 4324 |
</para>
|
| 4325 |
<para>
|
| 4326 |
Cleaning the source and rebuilding the package from your user account is as simple as:
|
| 4327 |
</para>
|
| 4328 |
<screen>
|
| 4329 |
$ debuild
|
| 4330 |
</screen>
|
| 4331 |
<para>
|
| 4332 |
Here, if you are building Debian packages only for your own local use, you can skip
|
| 4333 |
promptings for the GPG signatures on the <filename>.dsc</filename> file and the
|
| 4334 |
<filename>.changes</filename> file like this:
|
| 4335 |
</para>
|
| 4336 |
<screen>
|
| 4337 |
$ debuild -us -uc
|
| 4338 |
</screen>
|
| 4339 |
<para>
|
| 4340 |
You can clean the source tree as simply as:
|
| 4341 |
</para>
|
| 4342 |
<screen>
|
| 4343 |
$ debuild clean
|
| 4344 |
</screen>
|
| 4345 |
</section>
|
| 4346 |
<section id="pbuilder"><title><systemitem role="package">pbuilder</systemitem> package</title>
|
| 4347 |
<para>
|
| 4348 |
For a clean room (<command>chroot</command>) build environment to verify the
|
| 4349 |
build dependencies, the <systemitem role="package">pbuilder</systemitem>
|
| 4350 |
package is very useful. <footnote><para> Since the <systemitem
|
| 4351 |
role="package">pbuilder</systemitem> package is still evolving, you should
|
| 4352 |
check the actual configuration situation by consulting the latest official
|
| 4353 |
documentation.</para> </footnote> This ensures a clean build from the source
|
| 4354 |
under the <literal>sid</literal> auto-builder for different architectures and
|
| 4355 |
avoids a severity serious FTBFS (Fails To Build From Source) bug which is
|
| 4356 |
always in the RC (release critical) category.
|
| 4357 |
<footnote><para>See <ulink url="&buildd-do;"/> for more on
|
| 4358 |
Debian package auto-building.</para></footnote>
|
| 4359 |
</para>
|
| 4360 |
<para>
|
| 4361 |
Let's customize the <systemitem role="package">pbuilder</systemitem> package as
|
| 4362 |
follows:
|
| 4363 |
</para>
|
| 4364 |
<itemizedlist>
|
| 4365 |
<listitem>
|
| 4366 |
<para>
|
| 4367 |
setting the <filename>/var/cache/pbuilder/result</filename> directory writable by
|
| 4368 |
for your user account.
|
| 4369 |
</para>
|
| 4370 |
</listitem>
|
| 4371 |
<listitem>
|
| 4372 |
<para>
|
| 4373 |
creating a directory, e.g.
|
| 4374 |
<filename><replaceable>/var/cache/pbuilder/hooks</replaceable></filename>,
|
| 4375 |
writable by the user, to place hook scripts in.
|
| 4376 |
</para>
|
| 4377 |
</listitem>
|
| 4378 |
<listitem>
|
| 4379 |
<para>
|
| 4380 |
configuring <filename>~/.pbuilderrc</filename> or
|
| 4381 |
<filename>/etc/pbuilderrc</filename> to include the followsing.
|
| 4382 |
</para>
|
| 4383 |
<screen>
|
| 4384 |
AUTO_DEBSIGN=${AUTO_DEBSIGN:-yes}
|
| 4385 |
HOOKDIR=<replaceable>/var/cache/pbuilder/hooks</replaceable>
|
| 4386 |
</screen>
|
| 4387 |
</listitem>
|
| 4388 |
</itemizedlist>
|
| 4389 |
<para>
|
| 4390 |
This will allow you to sign generated packages with your secret GPG key in the
|
| 4391 |
<filename>~/.gnupg/</filename> directory.
|
| 4392 |
</para>
|
| 4393 |
<para>
|
| 4394 |
First let's initialize the local <systemitem role="package">pbuilder</systemitem> <command>chroot</command> system as
|
| 4395 |
follows.
|
| 4396 |
</para>
|
| 4397 |
<screen>
|
| 4398 |
$ sudo pbuilder create
|
| 4399 |
</screen>
|
| 4400 |
<para>
|
| 4401 |
If you already have a completed source package, issue the following commands
|
| 4402 |
in the directory where the
|
| 4403 |
<filename><replaceable>foo</replaceable>.orig.tar.gz</filename>,
|
| 4404 |
<filename><replaceable>foo</replaceable>.debian.tar.gz</filename>, and
|
| 4405 |
<filename><replaceable>foo</replaceable>.dsc</filename> files exist to update
|
| 4406 |
the local <systemitem role="package">pbuilder</systemitem>
|
| 4407 |
<command>chroot</command> system and to build binary packages in it.
|
| 4408 |
</para>
|
| 4409 |
<screen>
|
| 4410 |
$ sudo pbuilder --update
|
| 4411 |
$ sudo pbuilder --build <replaceable>foo_version</replaceable>.dsc
|
| 4412 |
</screen>
|
| 4413 |
<para>
|
| 4414 |
The newly built packages without the GPG signatures will be located in
|
| 4415 |
<filename>/var/cache/pbuilder/result/</filename> with non-root ownership.
|
| 4416 |
</para>
|
| 4417 |
<para>
|
| 4418 |
The GPG signatures on the <filename>.dsc</filename> file and the
|
| 4419 |
<filename>.changes</filename> file can be generated as:
|
| 4420 |
</para>
|
| 4421 |
<screen>
|
| 4422 |
$ cd /var/cache/pbuilder/result/
|
| 4423 |
$ debsign <replaceable>foo_version</replaceable>.dsc
|
| 4424 |
$ debsign <replaceable>foo_version_arch</replaceable>.changes
|
| 4425 |
</screen>
|
| 4426 |
<para>
|
| 4427 |
If you have an updated source tree but have not generated the matching
|
| 4428 |
source package, issue the following commands in the source directory where the
|
| 4429 |
<filename>debian</filename> directory exists, instead.
|
| 4430 |
</para>
|
| 4431 |
<screen>
|
| 4432 |
$ sudo pbuilder --update
|
| 4433 |
$ pdebuild
|
| 4434 |
</screen>
|
| 4435 |
<para>
|
| 4436 |
Here, if you are building Debian packages only for your local use, you can skip
|
| 4437 |
promptings for the GPG signatures on the <filename>.dsc</filename> file and the
|
| 4438 |
<filename>.changes</filename> file as:
|
| 4439 |
</para>
|
| 4440 |
<screen>
|
| 4441 |
$ AUTO_DEBSIGN=no pdebuild
|
| 4442 |
</screen>
|
| 4443 |
<para>
|
| 4444 |
You can log into its <command>chroot</command> environment with the
|
| 4445 |
<literal>pbuilder --login --save-after-login</literal> command and configure it
|
| 4446 |
as you wish. This environment can be saved by leaving its shell prompt with
|
| 4447 |
<literal>^D</literal> (Control-D).
|
| 4448 |
</para>
|
| 4449 |
<para>
|
| 4450 |
The latest version of the <command>lintian</command> command can be executed in
|
| 4451 |
the <literal>chroot</literal> environment using the hook script
|
| 4452 |
<filename><replaceable>/var/cache/pbuilder/hooks</replaceable>/B90lintian</filename>
|
| 4453 |
configured as follows. <footnote><para> This assumes
|
| 4454 |
<literal>HOOKDIR=/var/cache/pbuilder/hooks</literal>. You can find many
|
| 4455 |
examples of hook scripts in the
|
| 4456 |
<filename>/usr/share/doc/pbuilder/examples</filename> directory. </para>
|
| 4457 |
</footnote>
|
| 4458 |
</para>
|
| 4459 |
<screen>
|
| 4460 |
#!/bin/sh
|
| 4461 |
set -e
|
| 4462 |
install_packages() {
|
| 4463 |
apt-get -y --force-yes install "$@"
|
| 4464 |
}
|
| 4465 |
install_packages lintian
|
| 4466 |
echo "+++ lintian output +++"
|
| 4467 |
su -c "lintian -i -I --show-overrides /tmp/buildd/*.changes" - pbuilder
|
| 4468 |
# use this version if you don't want lintian to fail the build
|
| 4469 |
#su -c "lintian -i -I --show-overrides /tmp/buildd/*.changes; :" - pbuilder
|
| 4470 |
echo "+++ end of lintian output +++"
|
| 4471 |
</screen>
|
| 4472 |
<para>
|
| 4473 |
You need to have access to the latest <literal>sid</literal> environment to
|
| 4474 |
build packages properly for <literal>sid</literal>. In practice,
|
| 4475 |
<literal>sid</literal> may be experiencing issues which makes it undesirable
|
| 4476 |
for you to migrate your whole system. The <systemitem role="package">pbuilder</systemitem> package can help you to cope with this
|
| 4477 |
kind of situation.
|
| 4478 |
</para>
|
| 4479 |
<para>
|
| 4480 |
You may need to update your <literal>stable</literal> packages after their
|
| 4481 |
release for <literal>stable-proposed-updates</literal>,
|
| 4482 |
<literal>stable/updates</literal>, etc. <footnote><para> There are some
|
| 4483 |
restrictions for such updates of your <literal>stable</literal> package.
|
| 4484 |
</para> </footnote> For such occasions, the fact you may be running a <literal>sid</literal>
|
| 4485 |
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
|
| 4486 |
environments of almost any Debian derivative distribution of the same
|
| 4487 |
architecture.
|
| 4488 |
</para>
|
| 4489 |
<para>
|
| 4490 |
See <ulink url="&pbuilder;"/>,
|
| 4491 |
<citerefentry> <refentrytitle>pdebuild</refentrytitle> <manvolnum>1</manvolnum>
|
| 4492 |
</citerefentry>, <citerefentry> <refentrytitle>pbuilderrc</refentrytitle>
|
| 4493 |
<manvolnum>5</manvolnum> </citerefentry>, and <citerefentry>
|
| 4494 |
<refentrytitle>pbuilder</refentrytitle> <manvolnum>8</manvolnum>
|
| 4495 |
</citerefentry>.
|
| 4496 |
</para>
|
| 4497 |
</section>
|
| 4498 |
<section id="git-buildpackage"><title><command>git-buildpackage</command> command and similars</title>
|
| 4499 |
<para>
|
| 4500 |
If your upstream uses a source code management system (VCS)
|
| 4501 |
<footnote><para>See <ulink url="&debref-vcs;">Version control systems</ulink> for more.</para></footnote>
|
| 4502 |
to maintain their code, you should consider using it as well. This makes merging
|
| 4503 |
and cherry-picking upstream patches much easier. There are several specialized
|
| 4504 |
wrapper script packages for Debian package building for each VCS.
|
| 4505 |
</para>
|
| 4506 |
<itemizedlist>
|
| 4507 |
<listitem>
|
| 4508 |
<para>
|
| 4509 |
<systemitem role="package">git-buildpackage</systemitem>: a suite to help with
|
| 4510 |
Debian packages in Git repositories.
|
| 4511 |
</para>
|
| 4512 |
</listitem>
|
| 4513 |
<listitem>
|
| 4514 |
<para>
|
| 4515 |
<systemitem role="package">svn-buildpackage</systemitem>: helper programs to
|
| 4516 |
maintain Debian packages with Subversion.
|
| 4517 |
</para>
|
| 4518 |
</listitem>
|
| 4519 |
<listitem>
|
| 4520 |
<para>
|
| 4521 |
<systemitem role="package">cvs-buildpackage</systemitem>: a set of Debian
|
| 4522 |
package scripts for CVS source trees.
|
| 4523 |
</para>
|
| 4524 |
</listitem>
|
| 4525 |
</itemizedlist>
|
| 4526 |
<para>
|
| 4527 |
For advanced audiences, there are packages which <emphasis>automate</emphasis>
|
| 4528 |
the building of packages under a VCS-managed source tree. I will not explain them
|
| 4529 |
in this tutorial.
|
| 4530 |
<footnote><para> Here are some web resources available for advanced audiences. </para>
|
| 4531 |
<itemizedlist>
|
| 4532 |
<listitem> <para> Building Debian Packages with git-buildpackage (<filename>&git-buildpackage-doc;</filename>)</para> </listitem>
|
| 4533 |
<listitem> <para> <ulink url="&debian-packages-git;">debian packages in git</ulink> </para> </listitem>
|
| 4534 |
<listitem> <para> <ulink url="&git-debian-packaging;">Using Git for Debian Packaging</ulink> </para> </listitem>
|
| 4535 |
<listitem> <para> <ulink url="&git-dpm;">git-dpm: Debian packages in Git manager</ulink> </para> </listitem>
|
| 4536 |
<listitem> <para> <ulink url="&topgit;">Using TopGit to generate quilt series for Debian packaging</ulink> </para> </listitem>
|
| 4537 |
</itemizedlist>
|
| 4538 |
</footnote>
|
| 4539 |
</para>
|
| 4540 |
</section>
|
| 4541 |
<section id="quickrebuild"><title>Quick rebuild</title>
|
| 4542 |
<para>
|
| 4543 |
With a large package, you may not want to rebuild from scratch every time while
|
| 4544 |
you're tuning details in <filename>debian/rules</filename>. For testing purposes,
|
| 4545 |
you can make a <filename>.deb</filename> file without rebuilding the upstream
|
| 4546 |
sources like this<footnote><para> Environment variables which are normally
|
| 4547 |
configured to proper values are not set by this method. Never create real
|
| 4548 |
packages to be uploaded using this <emphasis role="strong">quick</emphasis>
|
| 4549 |
method. </para> </footnote>:
|
| 4550 |
</para>
|
| 4551 |
<screen>
|
| 4552 |
$ fakeroot debian/rules binary
|
| 4553 |
</screen>
|
| 4554 |
<para>
|
| 4555 |
Or simply do the following to see if it builds or not:
|
| 4556 |
</para>
|
| 4557 |
<screen>
|
| 4558 |
$ fakeroot debian/rules build
|
| 4559 |
</screen>
|
| 4560 |
<para>
|
| 4561 |
Once you are finished with your tuning, remember to rebuild following the
|
| 4562 |
proper procedure. You may not be able to upload correctly if you try to upload
|
| 4563 |
<filename>.deb</filename> files built this way.
|
| 4564 |
</para>
|
| 4565 |
</section>
|
| 4566 |
</chapter>
|
| 4567 |
<chapter id="checkit"><title>Checking the package for errors</title>
|
| 4568 |
<para>
|
| 4569 |
There are some techniques you should know for checking a package for errors
|
| 4570 |
before uploading it to the public archives.
|
| 4571 |
</para>
|
| 4572 |
<para>
|
| 4573 |
It's also a good idea to carry out testing on a machine other than your own. You must watch
|
| 4574 |
closely for any warnings or errors for all the tests described here.
|
| 4575 |
</para>
|
| 4576 |
<section id="inadvent"><title>Suspicious changes</title>
|
| 4577 |
<para>
|
| 4578 |
If you find a new autogenerated patch file such as
|
| 4579 |
<filename>debian-changes-*</filename> in the
|
| 4580 |
<filename>debian/patches</filename> directory after building your non-native
|
| 4581 |
Debian package in <literal>3.0 (quilt)</literal> format, chances are you
|
| 4582 |
changed some files by accident or the build script modified the upstream
|
| 4583 |
source. If it is your mistake, fix it. If it is caused by the build script,
|
| 4584 |
fix the root cause with <command>dh-autoreconf</command> as in
|
| 4585 |
<xref linkend="customrules"/> or work around it with
|
| 4586 |
<filename>source/options</filename> as in <xref linkend="sourceopt"/>.
|
| 4587 |
</para>
|
| 4588 |
</section>
|
| 4589 |
<section id="pinstall"><title>Verifying a package's installation</title>
|
| 4590 |
<para>
|
| 4591 |
You must test your package for whether it installs without problem. The <citerefentry>
|
| 4592 |
<refentrytitle>debi</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>
|
| 4593 |
command helps you to test installing all the generated binary packages.
|
| 4594 |
</para>
|
| 4595 |
<screen>
|
| 4596 |
$ sudo debi gentoo_0.9.12-1_i386.changes
|
| 4597 |
</screen>
|
| 4598 |
<para>
|
| 4599 |
To prevent installation problem on different systems, you must make
|
| 4600 |
sure that there are no filenames conflicting with other existing packages,
|
| 4601 |
using the
|
| 4602 |
<filename>Contents-<replaceable>i386</replaceable></filename> file downloaded
|
| 4603 |
from the Debian archive.
|
| 4604 |
The <command>apt-file</command> command may be handy for this task. If there
|
| 4605 |
are collisions, please take action to avoid this real problem, whether by
|
| 4606 |
renaming the file, moving a common file to a separate package that
|
| 4607 |
multiple packages can depend on, using the alternatives mechanism (see
|
| 4608 |
<citerefentry><refentrytitle>update-alternatives</refentrytitle>
|
| 4609 |
<manvolnum>1</manvolnum></citerefentry>) in coordination with the
|
| 4610 |
maintainers of other affected packages, or declaring a
|
| 4611 |
<literal>Conflicts</literal> relationship in the
|
| 4612 |
<filename>debian/control</filename> file.
|
| 4613 |
</para>
|
| 4614 |
</section>
|
| 4615 |
<section id="pmaintscripts"><title>Verifying a package's maintainer scripts</title>
|
| 4616 |
<para>
|
| 4617 |
All maintainer scripts (that is,
|
| 4618 |
<filename>preinst</filename>, <filename>prerm</filename>,
|
| 4619 |
<filename>postinst</filename>, and <filename>postrm</filename> files) are
|
| 4620 |
hard to write correctly unless they are auto-generated by the
|
| 4621 |
<systemitem role="package">debhelper</systemitem> programs. So do not use them if you are
|
| 4622 |
a novice maintainer (see <xref linkend="maintscripts"/>).
|
| 4623 |
</para>
|
| 4624 |
<para>
|
| 4625 |
If the package makes use of these non-trivial maintainer scripts, be sure to test not only for install but also for remove,
|
| 4626 |
purge, and upgrade processes. Many maintainer script bugs show up
|
| 4627 |
when packages are removed or purged. Use the <command>dpkg</command> command
|
| 4628 |
as follows to test them.
|
| 4629 |
</para>
|
| 4630 |
<screen>
|
| 4631 |
$ sudo dpkg -r gentoo
|
| 4632 |
$ sudo dpkg -P gentoo
|
| 4633 |
$ sudo dpkg -i gentoo_<replaceable>version</replaceable>-<replaceable>revision</replaceable>_<replaceable>i386</replaceable>.deb
|
| 4634 |
</screen>
|
| 4635 |
<para>
|
| 4636 |
This should be done with sequences such as the following.
|
| 4637 |
</para>
|
| 4638 |
<itemizedlist>
|
| 4639 |
<listitem>
|
| 4640 |
<para>
|
| 4641 |
install the previous version (if needed).
|
| 4642 |
</para>
|
| 4643 |
</listitem>
|
| 4644 |
<listitem>
|
| 4645 |
<para>
|
| 4646 |
upgrade it from the previous version.
|
| 4647 |
</para>
|
| 4648 |
</listitem>
|
| 4649 |
<listitem>
|
| 4650 |
<para>
|
| 4651 |
downgrade it back to the previous version (optional).
|
| 4652 |
</para>
|
| 4653 |
</listitem>
|
| 4654 |
<listitem>
|
| 4655 |
<para>
|
| 4656 |
purge it.
|
| 4657 |
</para>
|
| 4658 |
</listitem>
|
| 4659 |
<listitem>
|
| 4660 |
<para>
|
| 4661 |
install the new package.
|
| 4662 |
</para>
|
| 4663 |
</listitem>
|
| 4664 |
<listitem>
|
| 4665 |
<para>
|
| 4666 |
remove it.
|
| 4667 |
</para>
|
| 4668 |
</listitem>
|
| 4669 |
<listitem>
|
| 4670 |
<para>
|
| 4671 |
install it again.
|
| 4672 |
</para>
|
| 4673 |
</listitem>
|
| 4674 |
<listitem>
|
| 4675 |
<para>
|
| 4676 |
purge it.
|
| 4677 |
</para>
|
| 4678 |
</listitem>
|
| 4679 |
</itemizedlist>
|
| 4680 |
<para>
|
| 4681 |
If this is your first package, you should create dummy packages with different
|
| 4682 |
versions to test your package in advance to prevent future problems.
|
| 4683 |
</para>
|
| 4684 |
<para>
|
| 4685 |
Bear in mind that if your package has previously been released in Debian,
|
| 4686 |
people will often be upgrading to your package from the version that was in the
|
| 4687 |
last Debian release. Remember to test upgrades from that version too.
|
| 4688 |
</para>
|
| 4689 |
<para>
|
| 4690 |
Although downgrading is not officially supported, supporting it is a
|
| 4691 |
friendly gesture.
|
| 4692 |
</para>
|
| 4693 |
</section>
|
| 4694 |
<section id="lintians"><title>Using <systemitem role="package">lintian</systemitem></title>
|
| 4695 |
<para>
|
| 4696 |
Run <citerefentry> <refentrytitle>lintian</refentrytitle>
|
| 4697 |
<manvolnum>1</manvolnum> </citerefentry> on your <filename>.changes</filename>
|
| 4698 |
file. The <command>lintian</command> command runs many test scripts to check
|
| 4699 |
for many common packaging errors. <footnote><para> You do not need to provide
|
| 4700 |
the <command>lintian</command> option <literal>-i -I --show-overrides</literal>
|
| 4701 |
if you customized <filename>/etc/devscripts.conf</filename> or
|
| 4702 |
<filename>~/.devscripts</filename> as described in <xref linkend="debuild"/>.
|
| 4703 |
</para> </footnote>
|
| 4704 |
</para>
|
| 4705 |
<screen>
|
| 4706 |
$ lintian -i -I --show-overrides gentoo_0.9.12-1_i386.changes
|
| 4707 |
</screen>
|
| 4708 |
<para>
|
| 4709 |
Of course, replace the filename with the name of the
|
| 4710 |
<filename>.changes</filename> file generated for your package. The output of
|
| 4711 |
the <command>lintian</command> command uses the following flags.
|
| 4712 |
</para>
|
| 4713 |
<itemizedlist>
|
| 4714 |
<listitem>
|
| 4715 |
<para>
|
| 4716 |
<literal>E:</literal> for error; a sure policy violation or packaging error.
|
| 4717 |
</para>
|
| 4718 |
</listitem>
|
| 4719 |
<listitem>
|
| 4720 |
<para>
|
| 4721 |
<literal>W:</literal> for warning; a possible policy violation or packaging
|
| 4722 |
error.
|
| 4723 |
</para>
|
| 4724 |
</listitem>
|
| 4725 |
<listitem>
|
| 4726 |
<para>
|
| 4727 |
<literal>I:</literal> for info; information on certain aspects of packaging.
|
| 4728 |
</para>
|
| 4729 |
</listitem>
|
| 4730 |
<listitem>
|
| 4731 |
<para>
|
| 4732 |
<literal>N:</literal> for note; a detailed message to help your debugging.
|
| 4733 |
</para>
|
| 4734 |
</listitem>
|
| 4735 |
<listitem>
|
| 4736 |
<para>
|
| 4737 |
<literal>O:</literal> for overridden; a message overridden by the
|
| 4738 |
<filename>lintian-overrides</filename> files but displayed by the
|
| 4739 |
<literal>--show-overrides</literal> option.
|
| 4740 |
</para>
|
| 4741 |
</listitem>
|
| 4742 |
</itemizedlist>
|
| 4743 |
<para>
|
| 4744 |
When you see warnings, tune the package to avoid them or verify that the warnings are
|
| 4745 |
spurious. If spurious, set up <filename>lintian-overrides</filename> files as
|
| 4746 |
described in <xref linkend="lintian"/>.
|
| 4747 |
</para>
|
| 4748 |
<para>
|
| 4749 |
Note that you can build the package with <command>dpkg-buildpackage</command>
|
| 4750 |
and run <command>lintian</command> on it in one command, if you use <citerefentry>
|
| 4751 |
<refentrytitle>debuild</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>
|
| 4752 |
or <citerefentry> <refentrytitle>pdebuild</refentrytitle>
|
| 4753 |
<manvolnum>1</manvolnum> </citerefentry>.
|
| 4754 |
</para>
|
| 4755 |
</section>
|
| 4756 |
<section id="debc"><title>The <command>debc</command> command</title>
|
| 4757 |
<para>
|
| 4758 |
You can list files in the binary Debian package with the <citerefentry>
|
| 4759 |
<refentrytitle>debc</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>
|
| 4760 |
command.
|
| 4761 |
</para>
|
| 4762 |
<screen>
|
| 4763 |
$ debc <replaceable>package</replaceable>.changes
|
| 4764 |
</screen>
|
| 4765 |
</section>
|
| 4766 |
<section id="debdiff"><title>The <command>debdiff</command> command</title>
|
| 4767 |
<para>
|
| 4768 |
You can compare file contents in two source Debian packages with the
|
| 4769 |
<citerefentry> <refentrytitle>debdiff</refentrytitle> <manvolnum>1</manvolnum>
|
| 4770 |
</citerefentry> command.
|
| 4771 |
</para>
|
| 4772 |
<screen>
|
| 4773 |
$ debdiff <replaceable>old-package</replaceable>.dsc <replaceable>new-package</replaceable>.dsc
|
| 4774 |
</screen>
|
| 4775 |
<para>
|
| 4776 |
You can also compare file lists in two sets of binary Debian packages with the
|
| 4777 |
<citerefentry> <refentrytitle>debdiff</refentrytitle> <manvolnum>1</manvolnum>
|
| 4778 |
</citerefentry> command.
|
| 4779 |
</para>
|
| 4780 |
<screen>
|
| 4781 |
$ debdiff <replaceable>old-package</replaceable>.changes <replaceable>new-package</replaceable>.changes
|
| 4782 |
</screen>
|
| 4783 |
<para>
|
| 4784 |
These are useful to identify what has been changed in the source packages
|
| 4785 |
and to check for inadvertent changes made when updating binary
|
| 4786 |
packages, such as unintentionally misplacing or removing files.
|
| 4787 |
</para>
|
| 4788 |
</section>
|
| 4789 |
<section id="interdiff"><title>The <command>interdiff</command> command</title>
|
| 4790 |
<para>
|
| 4791 |
You can compare two <filename>diff.gz</filename> files with the <citerefentry>
|
| 4792 |
<refentrytitle>interdiff</refentrytitle> <manvolnum>1</manvolnum>
|
| 4793 |
</citerefentry> command. This is useful for verifying that no inadvertent
|
| 4794 |
changes were made to the source by the maintainer when updating packages in the
|
| 4795 |
old <literal>1.0</literal> source format.
|
| 4796 |
</para>
|
| 4797 |
<screen>
|
| 4798 |
$ interdiff -z <replaceable>old-package</replaceable>.diff.gz <replaceable>new-package</replaceable>.diff.gz
|
| 4799 |
</screen>
|
| 4800 |
<para>
|
| 4801 |
The new <literal>3.0</literal> source format stores changes in multiple patch
|
| 4802 |
files as described in <xref linkend="patches"/>. You can trace changes of each
|
| 4803 |
<filename>debian/patches/*</filename> file using <command>interdiff</command>, too.
|
| 4804 |
</para>
|
| 4805 |
</section>
|
| 4806 |
<section id="mc"><title>The <command>mc</command> command</title>
|
| 4807 |
<para>
|
| 4808 |
Many of these file inspection operations can be made into an intuitive process
|
| 4809 |
by using a file manager like <citerefentry> <refentrytitle>mc</refentrytitle>
|
| 4810 |
<manvolnum>1</manvolnum> </citerefentry> which will let you browse not only the
|
| 4811 |
contents of <filename>*.deb</filename> package files but also
|
| 4812 |
<filename>*.udeb</filename>, <filename>*.debian.tar.gz</filename>,
|
| 4813 |
<filename>*.diff.gz</filename>, and <filename>*.orig.tar.gz</filename> files.
|
| 4814 |
</para>
|
| 4815 |
<para>
|
| 4816 |
Be on the lookout for extra unneeded files or zero length files, both in the
|
| 4817 |
binary and source package. Often cruft doesn't get cleaned up properly; adjust
|
| 4818 |
your <filename>rules</filename> file to compensate for this.
|
| 4819 |
</para>
|
| 4820 |
</section>
|
| 4821 |
</chapter>
|
| 4822 |
<chapter id="upload"><title>Uploading the package</title>
|
| 4823 |
<para>
|
| 4824 |
Now that you have tested your new package thoroughly, you want to release it to
|
| 4825 |
a public archive to share it.
|
| 4826 |
</para>
|
| 4827 |
<section id="upload-debian"><title>Uploading to the Debian archive</title>
|
| 4828 |
<para>
|
| 4829 |
Once you become an official developer,
|
| 4830 |
<footnote><para>
|
| 4831 |
See <xref linkend="socialdynamics"/>.
|
| 4832 |
</para></footnote>
|
| 4833 |
you can upload the package to the Debian archive.
|
| 4834 |
<footnote><para>
|
| 4835 |
There are publicly accessible archives such as <ulink url="&mentors-dn;"/>
|
| 4836 |
which work almost the same way as the Debian archive and provide an upload area for
|
| 4837 |
non-DDs. You can set up an equivalent archive by yourself using the tools
|
| 4838 |
listed at <ulink url="&deb-archive;"/>. So this section is useful for
|
| 4839 |
non-DDs, too.
|
| 4840 |
</para></footnote>
|
| 4841 |
You can do this manually, but it's easier to use the existing
|
| 4842 |
automated tools, like <citerefentry> <refentrytitle>dupload</refentrytitle>
|
| 4843 |
<manvolnum>1</manvolnum> </citerefentry> or <citerefentry>
|
| 4844 |
<refentrytitle>dput</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>.
|
| 4845 |
We'll describe how it's done with <command>dupload</command>. <footnote><para>
|
| 4846 |
The <systemitem role="package">dput</systemitem> package seems to come with
|
| 4847 |
more features and to be becoming more popular than the <systemitem role="package">dupload</systemitem> package. It uses the
|
| 4848 |
file <filename>/etc/dput</filename> for its global configuration and the
|
| 4849 |
file <filename>~/.dput.cf</filename> for per-user configuration. It supports
|
| 4850 |
Ubuntu-related services out-of-the-box, too. </para> </footnote>
|
| 4851 |
</para>
|
| 4852 |
<para>
|
| 4853 |
First you have to set up <command>dupload</command>'s config file. You can
|
| 4854 |
either edit the system-wide <filename>/etc/dupload.conf</filename> file, or
|
| 4855 |
have your own <filename>~/.dupload.conf</filename> file override the few things
|
| 4856 |
you want to change.
|
| 4857 |
</para>
|
| 4858 |
<para>
|
| 4859 |
You can read the <citerefentry> <refentrytitle>dupload.conf</refentrytitle>
|
| 4860 |
<manvolnum>5</manvolnum> </citerefentry> manual page to understand what each of
|
| 4861 |
these options means.
|
| 4862 |
</para>
|
| 4863 |
<para>
|
| 4864 |
The <literal>$default_host</literal> option determines which of the upload
|
| 4865 |
queues will be used by default. <literal>anonymous-ftp-master</literal> is the
|
| 4866 |
primary one, but it's possible that you will want to use another one.
|
| 4867 |
<footnote><para>See <ulink url="&devref-upload;">Debian Developer's Reference 5.6. "Uploading a package"</ulink>.</para></footnote>
|
| 4868 |
</para>
|
| 4869 |
<para>
|
| 4870 |
While connected to the Internet, you can upload your package as follows:
|
| 4871 |
</para>
|
| 4872 |
<screen>
|
| 4873 |
$ dupload gentoo_0.9.12-1_i386.changes
|
| 4874 |
</screen>
|
| 4875 |
<para>
|
| 4876 |
<command>dupload</command> checks that the SHA1/SHA256 file checksums
|
| 4877 |
match those listed in the <filename>.changes</filename> file. If they do not
|
| 4878 |
match, it will warn you to rebuild it as described in <xref linkend="completebuild"/> so it can be properly uploaded.
|
| 4879 |
</para>
|
| 4880 |
<!--
|
| 4881 |
No more use of ftp-master nor faster queue. It is not so
|
| 4882 |
useful these days. If you upload to ftp-master, <command>dupload</command>
|
| 4883 |
will ask for your password on Debian machines, and then upload the packages.
|
| 4884 |
-->
|
| 4885 |
<para>
|
| 4886 |
If you encounter an upload problem at <ulink url="&uploadqueue;"/>, you can fix this
|
| 4887 |
by manually uploading a GPG-signed <filename>*.commands</filename> file to there
|
| 4888 |
with <command>ftp</command>. <footnote><para> See <ulink url="&uploadqueue-readme;"/>. Alternatively, you can
|
| 4889 |
use the <command>dcut</command> command from the <systemitem
|
| 4890 |
role="package">dput</systemitem> package. </para> </footnote> For example, using
|
| 4891 |
<filename>hello.commands</filename>:
|
| 4892 |
</para>
|
| 4893 |
<screen>
|
| 4894 |
-----BEGIN PGP SIGNED MESSAGE-----
|
| 4895 |
Hash: SHA1
|
| 4896 |
Uploader: Foo Bar <Foo.Bar@example.org>
|
| 4897 |
Commands:
|
| 4898 |
rm hello_1.0-1_i386.deb
|
| 4899 |
mv hello_1.0-1.dsx hello_1.0-1.dsc
|
| 4900 |
-----BEGIN PGP SIGNATURE-----
|
| 4901 |
Version: GnuPG v1.4.10 (GNU/Linux)
|
| 4902 |
|
| 4903 |
[...]
|
| 4904 |
-----END PGP SIGNATURE-----
|
| 4905 |
</screen>
|
| 4906 |
</section>
|
| 4907 |
<section id="option-sa"><title>Including <filename>orig.tar.gz</filename> for upload</title>
|
| 4908 |
<para>
|
| 4909 |
When you first upload the package to the archive, you need to include the
|
| 4910 |
original <filename>orig.tar.gz</filename> source, too. If the Debian revision
|
| 4911 |
number of this package is neither <literal>1</literal> nor
|
| 4912 |
<literal>0</literal>, you must provide the <command>dpkg-buildpackage</command>
|
| 4913 |
option <literal>-sa</literal>.
|
| 4914 |
</para>
|
| 4915 |
<para>
|
| 4916 |
For the <command>dpkg-buildpackage</command> command:
|
| 4917 |
</para>
|
| 4918 |
<screen>
|
| 4919 |
$ dpkg-buildpackage -sa
|
| 4920 |
</screen>
|
| 4921 |
<para>
|
| 4922 |
For the <command>debuild</command> command:
|
| 4923 |
</para>
|
| 4924 |
<screen>
|
| 4925 |
$ debuild -sa
|
| 4926 |
</screen>
|
| 4927 |
<para>
|
| 4928 |
For the <command>pdebuild</command> command:
|
| 4929 |
</para>
|
| 4930 |
<screen>
|
| 4931 |
$ pdebuild --debbuildopts -sa
|
| 4932 |
</screen>
|
| 4933 |
<para>
|
| 4934 |
On the other hand, the <literal>-sd</literal> option will force the exclusion
|
| 4935 |
of the original <filename>orig.tar.gz</filename> source.
|
| 4936 |
</para>
|
| 4937 |
</section>
|
| 4938 |
<section id="skipped-uploads"><title>Skipped uploads</title>
|
| 4939 |
<para>
|
| 4940 |
If you created multiple entries in <filename>debian/changelog</filename> by
|
| 4941 |
skipping uploads, you must create a proper <filename>*_.changes</filename> file
|
| 4942 |
which includes all changes from the last upload.
|
| 4943 |
This can be done by specifying the <command>dpkg-buildpackage</command> option
|
| 4944 |
<literal>-v</literal> with the version, e.g.,
|
| 4945 |
<literal><replaceable>1.2</replaceable></literal>.
|
| 4946 |
</para>
|
| 4947 |
<para>
|
| 4948 |
For the <command>dpkg-buildpackage</command> command:
|
| 4949 |
</para>
|
| 4950 |
<screen>
|
| 4951 |
$ dpkg-buildpackage -v<replaceable>1.2</replaceable>
|
| 4952 |
</screen>
|
| 4953 |
<para>
|
| 4954 |
For the <command>debuild</command> command:
|
| 4955 |
</para>
|
| 4956 |
<screen>
|
| 4957 |
$ debuild -v<replaceable>1.2</replaceable>
|
| 4958 |
</screen>
|
| 4959 |
<para>
|
| 4960 |
For the <command>pdebuild</command> command:
|
| 4961 |
</para>
|
| 4962 |
<screen>
|
| 4963 |
$ pdebuild --debbuildopts "-v<replaceable>1.2</replaceable>"
|
| 4964 |
</screen>
|
| 4965 |
</section>
|
| 4966 |
</chapter>
|
| 4967 |
<chapter id="update"><title>Updating the package</title>
|
| 4968 |
<para>
|
| 4969 |
After you release a package, you will soon need to update it.
|
| 4970 |
</para>
|
| 4971 |
<section id="newrevision"><title>New Debian revision</title>
|
| 4972 |
<para>
|
| 4973 |
Let's say that a bug report was filed against your package as
|
| 4974 |
<literal>#654321</literal>, and it describes a problem that you can solve.
|
| 4975 |
Here's what you need to do to create a new Debian revision of the package.
|
| 4976 |
</para>
|
| 4977 |
<itemizedlist>
|
| 4978 |
<listitem>
|
| 4979 |
<para>
|
| 4980 |
If this is to be recorded as a new patch, do the following.
|
| 4981 |
</para>
|
| 4982 |
<itemizedlist>
|
| 4983 |
<listitem>
|
| 4984 |
<para>
|
| 4985 |
<literal>dquilt new <replaceable>bugname.patch</replaceable></literal> to set
|
| 4986 |
the patch name;
|
| 4987 |
</para>
|
| 4988 |
</listitem>
|
| 4989 |
<listitem>
|
| 4990 |
<para>
|
| 4991 |
<literal>dquilt add <replaceable>buggy-file</replaceable></literal> to declare
|
| 4992 |
the file to be modified;
|
| 4993 |
</para>
|
| 4994 |
</listitem>
|
| 4995 |
<listitem>
|
| 4996 |
<para>
|
| 4997 |
Correct the problem in the package source for the upstream bug;
|
| 4998 |
</para>
|
| 4999 |
</listitem>
|
| 5000 |
<listitem>
|
| 5001 |
<para>
|
| 5002 |
<literal>dquilt refresh</literal> to record it to
|
| 5003 |
<filename><replaceable>bugname.patch</replaceable></filename>;
|
| 5004 |
</para>
|
| 5005 |
</listitem>
|
| 5006 |
<listitem>
|
| 5007 |
<para>
|
| 5008 |
<literal>dquilt header -e</literal> to add its description;
|
| 5009 |
</para>
|
| 5010 |
</listitem>
|
| 5011 |
</itemizedlist>
|
| 5012 |
</listitem>
|
| 5013 |
<listitem>
|
| 5014 |
<para>
|
| 5015 |
If this is to update an existing patch, do the following.
|
| 5016 |
</para>
|
| 5017 |
<itemizedlist>
|
| 5018 |
<listitem>
|
| 5019 |
<para>
|
| 5020 |
<literal>dquilt pop <replaceable>foo.patch</replaceable></literal> to recall
|
| 5021 |
the existing <filename><replaceable>foo.patch</replaceable></filename>;
|
| 5022 |
</para>
|
| 5023 |
</listitem>
|
| 5024 |
<listitem>
|
| 5025 |
<para>
|
| 5026 |
Correct the problem in the old
|
| 5027 |
<filename><replaceable>foo.patch</replaceable></filename>;
|
| 5028 |
</para>
|
| 5029 |
</listitem>
|
| 5030 |
<listitem>
|
| 5031 |
<para>
|
| 5032 |
<literal>dquilt refresh</literal> to update
|
| 5033 |
<filename><replaceable>foo.patch</replaceable></filename>;
|
| 5034 |
</para>
|
| 5035 |
</listitem>
|
| 5036 |
<listitem>
|
| 5037 |
<para>
|
| 5038 |
<literal>dquilt header -e</literal> to update its description;
|
| 5039 |
</para>
|
| 5040 |
</listitem>
|
| 5041 |
<listitem>
|
| 5042 |
<para>
|
| 5043 |
<literal>while dquilt push; do dquilt refresh; done</literal> to apply all
|
| 5044 |
patches while removing <emphasis>fuzz</emphasis>;
|
| 5045 |
</para>
|
| 5046 |
</listitem>
|
| 5047 |
</itemizedlist>
|
| 5048 |
</listitem>
|
| 5049 |
<listitem>
|
| 5050 |
<para>
|
| 5051 |
Add a new revision at the top of the Debian <filename>changelog</filename>
|
| 5052 |
file, for example with <literal>dch -i</literal>, or explicitly with
|
| 5053 |
<literal>dch -v
|
| 5054 |
<replaceable>version</replaceable>-<replaceable>revision</replaceable></literal>
|
| 5055 |
and then insert the comments using your preferred editor. <footnote><para>To
|
| 5056 |
get the date in the required format, use <literal>LANG=C date -R</literal>.
|
| 5057 |
</para> </footnote>
|
| 5058 |
</para>
|
| 5059 |
</listitem>
|
| 5060 |
<listitem>
|
| 5061 |
<para>
|
| 5062 |
Include a short description of the bug and the solution in the changelog entry,
|
| 5063 |
followed by <literal>Closes: #654321</literal>. That way, the bug report will
|
| 5064 |
be <emphasis>automagically</emphasis> closed by the archive maintenance
|
| 5065 |
software the moment your package gets accepted into the Debian archive.
|
| 5066 |
</para>
|
| 5067 |
</listitem>
|
| 5068 |
<listitem>
|
| 5069 |
<para>
|
| 5070 |
Repeat what you did in the above to fix more bugs while updating the Debian
|
| 5071 |
<filename>changelog</filename> file with <literal>dch</literal> as needed.
|
| 5072 |
</para>
|
| 5073 |
</listitem>
|
| 5074 |
<listitem>
|
| 5075 |
<para>
|
| 5076 |
Repeat what you did in <xref linkend="completebuild"/>, <xref linkend="checkit"/>, and <xref linkend="upload"/>. The difference is that
|
| 5077 |
this time, the original source archive won't be included, as it hasn't been
|
| 5078 |
changed and it already exists in the Debian archive.
|
| 5079 |
</para>
|
| 5080 |
</listitem>
|
| 5081 |
</itemizedlist>
|
| 5082 |
<para>
|
| 5083 |
One tricky case can occur when you make a local package to experiment with
|
| 5084 |
the packaging before uploading the normal version to the official archive,
|
| 5085 |
e.g.,
|
| 5086 |
<literal><replaceable>1.0.1</replaceable>-<replaceable>1</replaceable></literal>.
|
| 5087 |
For smoother upgrades, it is a good idea to create a
|
| 5088 |
<filename>changelog</filename> entry with a version string as
|
| 5089 |
<literal><replaceable>1.0.1</replaceable>-<replaceable>1~rc1</replaceable></literal>.
|
| 5090 |
You may unclutter <filename>changelog</filename>
|
| 5091 |
by consolidating such local change entries into a single entry for the official package.
|
| 5092 |
See <xref linkend="namever"/> for the order of version strings.
|
| 5093 |
</para>
|
| 5094 |
<para>
|
| 5095 |
</para>
|
| 5096 |
</section>
|
| 5097 |
<section id="inspectnewupstream"><title>Inspection of the new upstream release</title>
|
| 5098 |
<para>
|
| 5099 |
When preparing packages of a new upstream release for the Debian archive, you
|
| 5100 |
must check the new upstream release, first.
|
| 5101 |
</para>
|
| 5102 |
<para>
|
| 5103 |
Start by reading the upstream <filename>changelog</filename>,
|
| 5104 |
<filename>NEWS</filename>, and whatever other documentation they may have
|
| 5105 |
released with the new version.
|
| 5106 |
</para>
|
| 5107 |
<para>
|
| 5108 |
You can then inspect changes between the old and new upstream sources as follows,
|
| 5109 |
watching out for anything suspicious.
|
| 5110 |
</para>
|
| 5111 |
<screen>
|
| 5112 |
$ diff -urN <replaceable>foo</replaceable>-<replaceable>oldversion</replaceable> <replaceable>foo</replaceable>-<replaceable>newversion</replaceable>
|
| 5113 |
</screen>
|
| 5114 |
<para>
|
| 5115 |
Changes to some auto-generated files by Autotools such as
|
| 5116 |
<filename>missing</filename>, <filename>aclocal.m4</filename>,
|
| 5117 |
<filename>config.guess</filename>, <filename>config.h.in</filename>,
|
| 5118 |
<filename>config.sub</filename>, <filename>configure</filename>,
|
| 5119 |
<filename>depcomp</filename>, <filename>install-sh</filename>,
|
| 5120 |
<filename>ltmain.sh</filename>, and <filename>Makefile.in</filename> may be
|
| 5121 |
ignored. You may delete them before running <command>diff</command> on the
|
| 5122 |
source for inspection.
|
| 5123 |
</para>
|
| 5124 |
</section>
|
| 5125 |
<section id="newupstream"><title>New upstream release</title>
|
| 5126 |
<para>
|
| 5127 |
If a package <systemitem role="package"><replaceable>foo</replaceable></systemitem> is properly packaged
|
| 5128 |
in the newer <literal>3.0 (native)</literal> or <literal>3.0 (quilt)</literal>
|
| 5129 |
formats, packaging a new upstream version is essentially moving the old
|
| 5130 |
<filename>debian</filename> directory to the new source. This can be done by
|
| 5131 |
running <literal>tar xvzf
|
| 5132 |
/<replaceable>path</replaceable>/<replaceable>to</replaceable>/<replaceable>foo</replaceable>_<replaceable>oldversion</replaceable>.debian.tar.gz</literal>
|
| 5133 |
in the new extracted source. <footnote><para> If a package <systemitem role="package"><replaceable>foo</replaceable></systemitem> is packaged in the
|
| 5134 |
old <literal>1.0</literal> format, this can be done by running <literal>zcat
|
| 5135 |
/<replaceable>path</replaceable>/<replaceable>to</replaceable>/<replaceable>foo</replaceable>_<replaceable>oldversion</replaceable>.diff.gz|patch
|
| 5136 |
-p1</literal> in the new extracted source, instead. </para> </footnote> Of
|
| 5137 |
course, you need to do some obvious chores.
|
| 5138 |
</para>
|
| 5139 |
<itemizedlist>
|
| 5140 |
<listitem>
|
| 5141 |
<para>
|
| 5142 |
Create a copy of the upstream source as the
|
| 5143 |
<filename>foo_<replaceable>newversion</replaceable>.tar.gz</filename> file.
|
| 5144 |
</para>
|
| 5145 |
</listitem>
|
| 5146 |
<listitem>
|
| 5147 |
<para>
|
| 5148 |
Update the Debian <filename>changelog</filename> file with <literal>dch -v
|
| 5149 |
<replaceable>newversion</replaceable>-<replaceable>1</replaceable></literal>.
|
| 5150 |
</para>
|
| 5151 |
<itemizedlist>
|
| 5152 |
<listitem>
|
| 5153 |
<para>
|
| 5154 |
Add an entry with <literal>New upstream release</literal>.
|
| 5155 |
</para>
|
| 5156 |
</listitem>
|
| 5157 |
<listitem>
|
| 5158 |
<para>
|
| 5159 |
Describe concisely the changes <emphasis>in the new upstream release</emphasis>
|
| 5160 |
that fix reported bugs and close those bugs by adding <literal>Closes: #<replaceable>bug_number</replaceable></literal>.
|
| 5161 |
</para>
|
| 5162 |
</listitem>
|
| 5163 |
<listitem>
|
| 5164 |
<para>
|
| 5165 |
Describe concisely the changes <emphasis>to the new upstream release</emphasis>
|
| 5166 |
by the maintainer that fix reported bugs and close those bugs by adding <literal>Closes: #<replaceable>bug_number</replaceable></literal>.
|
| 5167 |
</para>
|
| 5168 |
</listitem>
|
| 5169 |
</itemizedlist>
|
| 5170 |
</listitem>
|
| 5171 |
<listitem>
|
| 5172 |
<para>
|
| 5173 |
<literal>while dquilt push; do dquilt refresh; done</literal> to apply all
|
| 5174 |
patches while removing <emphasis>fuzz</emphasis>.
|
| 5175 |
</para>
|
| 5176 |
</listitem>
|
| 5177 |
</itemizedlist>
|
| 5178 |
<para>
|
| 5179 |
If the patch/merge did not apply cleanly, inspect the situation (clues are left
|
| 5180 |
in <filename>.rej</filename> files).
|
| 5181 |
</para>
|
| 5182 |
<itemizedlist>
|
| 5183 |
<listitem>
|
| 5184 |
<para>
|
| 5185 |
If a patch you applied to the source was integrated into the upstream source,
|
| 5186 |
</para>
|
| 5187 |
<itemizedlist>
|
| 5188 |
<listitem>
|
| 5189 |
<para>
|
| 5190 |
<literal>dquilt delete</literal> to remove it.
|
| 5191 |
</para>
|
| 5192 |
</listitem>
|
| 5193 |
</itemizedlist>
|
| 5194 |
</listitem>
|
| 5195 |
<listitem>
|
| 5196 |
<para>
|
| 5197 |
If a patch you applied to the source conflicted with new changes in the
|
| 5198 |
upstream source,
|
| 5199 |
</para>
|
| 5200 |
<itemizedlist>
|
| 5201 |
<listitem>
|
| 5202 |
<para>
|
| 5203 |
<literal>dquilt push -f</literal> to apply old patches while forcing rejects as
|
| 5204 |
<filename><replaceable>baz</replaceable>.rej</filename>.
|
| 5205 |
</para>
|
| 5206 |
</listitem>
|
| 5207 |
<listitem>
|
| 5208 |
<para>
|
| 5209 |
Edit the <filename><replaceable>baz</replaceable></filename> file manually to
|
| 5210 |
bring about the intended effect of
|
| 5211 |
<filename><replaceable>baz</replaceable>.rej</filename>.
|
| 5212 |
</para>
|
| 5213 |
</listitem>
|
| 5214 |
<listitem>
|
| 5215 |
<para>
|
| 5216 |
<literal>dquilt refresh</literal> to update the patch.
|
| 5217 |
</para>
|
| 5218 |
</listitem>
|
| 5219 |
</itemizedlist>
|
| 5220 |
</listitem>
|
| 5221 |
<listitem>
|
| 5222 |
<para>
|
| 5223 |
Continue as usual with <literal>while dquilt push; do dquilt refresh; done</literal>.
|
| 5224 |
</para>
|
| 5225 |
</listitem>
|
| 5226 |
</itemizedlist>
|
| 5227 |
<para>
|
| 5228 |
This process can be automated using the <citerefentry>
|
| 5229 |
<refentrytitle>uupdate</refentrytitle> <manvolnum>1</manvolnum> </citerefentry>
|
| 5230 |
command as follows:
|
| 5231 |
</para>
|
| 5232 |
<screen>
|
| 5233 |
$ apt-get source <replaceable>foo</replaceable>
|
| 5234 |
...
|
| 5235 |
dpkg-source: info: extracting <replaceable>foo</replaceable> in <replaceable>foo</replaceable>-<replaceable>oldversion</replaceable>
|
| 5236 |
dpkg-source: info: unpacking <replaceable>foo</replaceable>_<replaceable>oldversion</replaceable>.orig.tar.gz
|
| 5237 |
dpkg-source: info: applying <replaceable>foo</replaceable>_<replaceable>oldversion</replaceable>-1.debian.tar.gz
|
| 5238 |
$ ls -F
|
| 5239 |
<replaceable>foo</replaceable>-<replaceable>oldversion</replaceable>/
|
| 5240 |
<replaceable>foo</replaceable>_<replaceable>oldversion</replaceable>-1.debian.tar.gz
|
| 5241 |
<replaceable>foo</replaceable>_<replaceable>oldversion</replaceable>-1.dsc
|
| 5242 |
<replaceable>foo</replaceable>_<replaceable>oldversion</replaceable>.orig.tar.gz
|
| 5243 |
$ wget http://example.org/<replaceable>foo</replaceable>/<replaceable>foo</replaceable>-<replaceable>newversion</replaceable>.tar.gz
|
| 5244 |
$ cd <replaceable>foo</replaceable>-<replaceable>oldversion</replaceable>
|
| 5245 |
$ uupdate -v <replaceable>newversion</replaceable> ../<replaceable>foo</replaceable>-<replaceable>newversion</replaceable>.tar.gz
|
| 5246 |
$ cd ../<replaceable>foo</replaceable>-<replaceable>newversion</replaceable>
|
| 5247 |
$ while dquilt push; do dquilt refresh; done
|
| 5248 |
$ dch
|
| 5249 |
... document changes made
|
| 5250 |
</screen>
|
| 5251 |
<para>
|
| 5252 |
If you set up a <filename>debian/watch</filename> file as described in <xref linkend="watch"/>, you can skip the <command>wget</command> command. You
|
| 5253 |
simply run <citerefentry> <refentrytitle>uscan</refentrytitle>
|
| 5254 |
<manvolnum>1</manvolnum> </citerefentry> in the
|
| 5255 |
<filename><replaceable>foo</replaceable>-<replaceable>oldversion</replaceable></filename>
|
| 5256 |
directory instead of the <command>uupdate</command> command. This will
|
| 5257 |
<emphasis>automagically</emphasis> look for the updated source, download it,
|
| 5258 |
and run the <command>uupdate</command> command. <footnote><para> If the
|
| 5259 |
<command>uscan</command> command downloads the updated source but it does not
|
| 5260 |
run the <command>uupdate</command> command, you should correct the
|
| 5261 |
<filename>debian/watch</filename> file to have <literal>debian
|
| 5262 |
uupdate</literal> at the end of the URL. </para> </footnote>
|
| 5263 |
</para>
|
| 5264 |
<para>
|
| 5265 |
You can release this updated source by repeating what you did in <xref linkend="completebuild"/>, <xref linkend="checkit"/>, and <xref linkend="upload"/>.
|
| 5266 |
</para>
|
| 5267 |
</section>
|
| 5268 |
<section id="packagestyle"><title>Updating the packaging style</title>
|
| 5269 |
<para>
|
| 5270 |
Updating the package style is not a required activity for the update of a
|
| 5271 |
package. However, doing so lets you use the full capabilities of the modern
|
| 5272 |
<systemitem role="package">debhelper</systemitem> system and the <literal>3.0</literal>
|
| 5273 |
source format. <footnote><para> If your sponsor or other
|
| 5274 |
maintainers object to updating the existing packaging style, don't bother
|
| 5275 |
arguing. There are more important things to do. </para>
|
| 5276 |
</footnote>
|
| 5277 |
</para>
|
| 5278 |
<itemizedlist>
|
| 5279 |
<listitem>
|
| 5280 |
<para>
|
| 5281 |
If you need to recreate deleted template files for any reason, you can run
|
| 5282 |
<command>dh_make</command> again in the same Debian package source tree with
|
| 5283 |
the <literal>--addmissing</literal> option. Then edit them appropriately.
|
| 5284 |
</para>
|
| 5285 |
</listitem>
|
| 5286 |
<listitem>
|
| 5287 |
<para>
|
| 5288 |
If the package has not been updated to use the <systemitem role="package">debhelper</systemitem> v7 <command>dh</command> syntax for the
|
| 5289 |
<filename>debian/rules</filename> file, update it to use <command>dh</command>.
|
| 5290 |
Update the <filename>debian/control</filename> file accordingly.
|
| 5291 |
</para>
|
| 5292 |
</listitem>
|
| 5293 |
<listitem>
|
| 5294 |
<para>
|
| 5295 |
If you want to update the <filename>rules</filename> file created with the
|
| 5296 |
<filename>Makefile</filename> inclusion mechanism of the Common Debian Build
|
| 5297 |
System (<systemitem role="package">cdbs</systemitem>) to the
|
| 5298 |
<command>dh</command> syntax, see the following to understand its
|
| 5299 |
<literal>DEB_*</literal> configuration variables.
|
| 5300 |
</para>
|
| 5301 |
<itemizedlist>
|
| 5302 |
<listitem><para>local copy of <filename>&cdbs-doc;</filename></para></listitem>
|
| 5303 |
<listitem><para><ulink url="&cdbs-tutorial;">The Common Debian Build System (CDBS), FOSDEM 2009</ulink></para></listitem>
|
| 5304 |
</itemizedlist>
|
| 5305 |
<!--
|
| 5306 |
<footnote><para> In the
|
| 5307 |
<systemitem role="package">cdbs</systemitem> (0.4.74) package, there are some
|
| 5308 |
negative descriptions of the <filename>rules</filename> file created by the
|
| 5309 |
<command>dh_make</command> command for the non-<systemitem role="package">cdbs</systemitem> choices. Do not worry about it. It applies
|
| 5310 |
only for <literal>lenny</literal> which created explicit targets with long lists
|
| 5311 |
of <command>dh_*</command> commands. </para> </footnote>
|
| 5312 |
-->
|
| 5313 |
</listitem>
|
| 5314 |
<listitem>
|
| 5315 |
<para>
|
| 5316 |
If you have a <literal>1.0</literal> source package without the
|
| 5317 |
<filename><replaceable>foo</replaceable>.diff.gz</filename> file, you can
|
| 5318 |
update it to the newer <literal>3.0 (native)</literal> source format by
|
| 5319 |
creating <filename>debian/source/format</filename> with <literal>3.0
|
| 5320 |
(native)</literal>. The rest of the <filename>debian/*</filename> files can just be
|
| 5321 |
copied.
|
| 5322 |
</para>
|
| 5323 |
</listitem>
|
| 5324 |
<listitem>
|
| 5325 |
<para>
|
| 5326 |
If you have a <literal>1.0</literal> source package with the
|
| 5327 |
<filename><replaceable>foo</replaceable>.diff.gz</filename> file, you can
|
| 5328 |
update it to the newer <literal>3.0 (quilt)</literal> source format by creating
|
| 5329 |
<filename>debian/source/format</filename> with <literal>3.0 (quilt)</literal>.
|
| 5330 |
The rest of the <filename>debian/*</filename> files can just be copied. Import the
|
| 5331 |
<filename>big.diff</filename> file generated by the command <literal>filterdiff -z -x
|
| 5332 |
'*/debian/*' <replaceable>foo</replaceable>.diff.gz > big.diff</literal>
|
| 5333 |
to your <command>quilt</command> system, if needed. <footnote><para>
|
| 5334 |
You can split <filename>big.diff</filename> into many small incremental patches
|
| 5335 |
using the <command>splitdiff</command> command. </para> </footnote>
|
| 5336 |
</para>
|
| 5337 |
</listitem>
|
| 5338 |
<listitem>
|
| 5339 |
<para>
|
| 5340 |
If it was packaged using another patch system such as <systemitem role="package">dpatch</systemitem>, <systemitem role="package">dbs</systemitem>, or <systemitem role="package">cdbs</systemitem> with <literal>-p0</literal>,
|
| 5341 |
<literal>-p1</literal>, or <literal>-p2</literal>, convert it to the
|
| 5342 |
<systemitem role="package">quilt</systemitem> command using
|
| 5343 |
<filename>deb3</filename> at <ulink url="&deb3;"/>.
|
| 5344 |
</para>
|
| 5345 |
</listitem>
|
| 5346 |
<listitem>
|
| 5347 |
<para>
|
| 5348 |
If it was packaged with the <command>dh</command> command with the
|
| 5349 |
<literal>--with quilt</literal> option or with the
|
| 5350 |
<command>dh_quilt_patch</command> and <command>dh_quilt_unpatch</command>
|
| 5351 |
commands, remove these and make it use the newer <literal>3.0
|
| 5352 |
(native)</literal> source format.
|
| 5353 |
</para>
|
| 5354 |
</listitem>
|
| 5355 |
</itemizedlist>
|
| 5356 |
<para>
|
| 5357 |
You need to do the other tasks described in <xref linkend="newupstream"/>, too.
|
| 5358 |
</para>
|
| 5359 |
</section>
|
| 5360 |
<section id="reminders"><title>Reminders for updating packages</title>
|
| 5361 |
<para>
|
| 5362 |
Here are few reminders for updating packages.
|
| 5363 |
</para>
|
| 5364 |
<itemizedlist>
|
| 5365 |
<listitem>
|
| 5366 |
<para>
|
| 5367 |
Preserve old <filename>changelog</filename> entries (sounds obvious, but there
|
| 5368 |
have been cases of people typing <literal>dch</literal> when they should have typed
|
| 5369 |
<literal>dch -i</literal>.)
|
| 5370 |
</para>
|
| 5371 |
</listitem>
|
| 5372 |
<listitem>
|
| 5373 |
<para>
|
| 5374 |
Existing Debian changes need to be reevaluated; throw away stuff that upstream
|
| 5375 |
has incorporated (in one form or another) and remember to keep stuff that
|
| 5376 |
hasn't been incorporated by upstream, unless there is a compelling reason not
|
| 5377 |
to.
|
| 5378 |
</para>
|
| 5379 |
</listitem>
|
| 5380 |
<listitem>
|
| 5381 |
<para>
|
| 5382 |
If any changes were made to the build system (hopefully you'd know from
|
| 5383 |
inspecting upstream changes) then update the <filename>debian/rules</filename>
|
| 5384 |
and <filename>debian/control</filename> build dependencies if necessary.
|
| 5385 |
</para>
|
| 5386 |
</listitem>
|
| 5387 |
<listitem>
|
| 5388 |
<para>
|
| 5389 |
Check the <ulink url="&bts;">Debian Bug Tracking
|
| 5390 |
System (BTS)</ulink> to see if someone has provided patches to bugs that are
|
| 5391 |
currently open.
|
| 5392 |
</para>
|
| 5393 |
</listitem>
|
| 5394 |
<listitem>
|
| 5395 |
<para>
|
| 5396 |
Check the contents of the <filename>.changes</filename> file to make sure you
|
| 5397 |
are uploading to the correct distribution, the proper bug closures are listed
|
| 5398 |
in the <literal>Closes</literal> field, the <literal>Maintainer</literal> and
|
| 5399 |
<literal>Changed-By</literal> fields match, the file is GPG-signed, etc.
|
| 5400 |
</para>
|
| 5401 |
</listitem>
|
| 5402 |
</itemizedlist>
|
| 5403 |
</section>
|
| 5404 |
</chapter>
|
| 5405 |
</book>
|