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