| 1 |
<!-- retain these comments for translator revision tracking -->
|
| 2 |
<!-- Original version: $Revision: 1.24 $ -->
|
| 3 |
<chapt id="pkg_basics">Basics of the Debian package management system
|
| 4 |
|
| 5 |
<p>This chapter touches on some lower level internals of Debian package
|
| 6 |
management. If you're interested mainly in <em>usage</em> of the relevant
|
| 7 |
tools, skip to chapters <ref id="pkgtools"> and/or <ref id="uptodate">.
|
| 8 |
|
| 9 |
<sect id="package">What is a Debian package?
|
| 10 |
|
| 11 |
<p>Packages generally contain all of the files necessary to implement
|
| 12 |
a set of related commands or features. There are two types of Debian
|
| 13 |
packages:
|
| 14 |
<list>
|
| 15 |
<item><em>Binary packages</em>, which contain executables, configuration
|
| 16 |
files, man/info pages, copyright information, and other documentation.
|
| 17 |
These packages are distributed in a Debian-specific archive format
|
| 18 |
(see <ref id="deb-format">); they are usually distinguished by having
|
| 19 |
a '.deb' file extension. Binary packages can be unpacked using the Debian
|
| 20 |
utility <tt>dpkg</tt> (possibly via a frontend like <prgn/aptitude/);
|
| 21 |
details are given in its manual page.
|
| 22 |
|
| 23 |
<item><em>Source packages</em>, which consist of a <tt>.dsc</tt> file
|
| 24 |
describing the source package (including the names of the following
|
| 25 |
files), a <tt>.orig.tar.gz</tt> file that contains the original
|
| 26 |
unmodified source in gzip-compressed tar format and usually a
|
| 27 |
<tt>.diff.gz</tt> file that contains the Debian-specific changes to the
|
| 28 |
original source. The utility <tt>dpkg-source</tt> packs and unpacks
|
| 29 |
Debian source archives; details are provided in its manual page. (The
|
| 30 |
program <prgn/apt-get/ can get used a frontend for <tt>dpkg-source</tt>.)
|
| 31 |
</list>
|
| 32 |
|
| 33 |
<p>Installation of software by the package system uses "dependencies" which
|
| 34 |
are carefully designed by the package maintainers. These dependencies are
|
| 35 |
documented in the <tt>control</tt> file associated with each package.
|
| 36 |
For example, the package containing the GNU C compiler (<package/gcc/)
|
| 37 |
"depends" on the package <package/binutils/ which includes the linker and
|
| 38 |
assembler. If a user attempts to install <package/gcc/ without having first
|
| 39 |
installed <package/binutils/, the package management system (dpkg) will send
|
| 40 |
an error message that it also needs <package/binutils/, and stop installing
|
| 41 |
<package/gcc/. (However, this facility can be overridden by the insistent
|
| 42 |
user, see <manref name="dpkg" section="8">.) See more in <ref id="depends">
|
| 43 |
below.
|
| 44 |
|
| 45 |
<p>Debian's packaging tools can be used to:
|
| 46 |
<list>
|
| 47 |
<item>manipulate and manage packages or parts of packages,
|
| 48 |
<item>administer local overrides of files in a package,
|
| 49 |
<item>aid developers in the construction of package archives, and
|
| 50 |
<item>aid users in the installation of packages which reside on a remote
|
| 51 |
FTP site.
|
| 52 |
</list>
|
| 53 |
|
| 54 |
<sect id="deb-format">What is the format of a Debian binary package?
|
| 55 |
|
| 56 |
<p>A Debian "package", or a Debian archive file, contains the executable
|
| 57 |
files, libraries, and documentation associated with a particular suite of
|
| 58 |
program or set of related programs. Normally, a Debian archive file has
|
| 59 |
a filename that ends in <tt>.deb</tt>.
|
| 60 |
|
| 61 |
<p>The internals of this Debian binary packages format are described in the
|
| 62 |
<manref name="deb" section="5"> manual page. This internal format is subject to
|
| 63 |
change (between major releases of &debian;), therefore please always use
|
| 64 |
<manref name="dpkg-deb" section="1"> if you need to do lowlevel manipulations
|
| 65 |
on <tt>.deb</tt> files.
|
| 66 |
|
| 67 |
<sect id="pkgname">Why are Debian package file names so long?
|
| 68 |
|
| 69 |
<p>The Debian binary package file names conform to the following convention:
|
| 70 |
<foo>_<VersionNumber>-<DebianRevisionNumber>_<DebianArchitecture>.deb
|
| 71 |
|
| 72 |
<p>Note that <tt>foo</tt> is supposed to be the package name. As a check,
|
| 73 |
one can learn the package name associated with a particular Debian archive
|
| 74 |
file (.deb file) in one of these ways:
|
| 75 |
<list>
|
| 76 |
<item>inspect the "Packages" file in the directory where it was stored
|
| 77 |
at a Debian FTP archive site. This file contains a stanza describing
|
| 78 |
each package; the first field in each stanza is the formal package name.
|
| 79 |
<item>use the command <tt>dpkg --info foo_VVV-RRR_AAA.deb</tt> (where VVV,
|
| 80 |
RRR and AAA are the version, revision and architecture of the package in question, respectively).
|
| 81 |
This displays, among other things, the package name corresponding to the
|
| 82 |
archive file being unpacked.
|
| 83 |
</list>
|
| 84 |
|
| 85 |
<p>The <tt>VVV</tt> component is the version number specified by the
|
| 86 |
upstream developer. There are no standards in place here, so the version
|
| 87 |
number may have formats as different as "19990513" and "1.3.8pre1".
|
| 88 |
|
| 89 |
<p>The <tt>RRR</tt> component is the Debian revision number, and is
|
| 90 |
specified by the Debian developer (or an individual user if he chooses
|
| 91 |
to build the package himself). This number corresponds to the revision
|
| 92 |
level of the Debian package, thus, a new revision level usually signifies
|
| 93 |
changes in the Debian Makefile (<tt>debian/rules</tt>), the Debian control
|
| 94 |
file (<tt>debian/control</tt>), the installation or removal scripts
|
| 95 |
(<tt>debian/p*</tt>), or in the configuration files used with the package.
|
| 96 |
|
| 97 |
<p>The <tt>AAA</tt> component identifies the processor for which
|
| 98 |
the package was built. This is commonly <tt>i386</tt>, which refers to
|
| 99 |
chips compatible to Intel's 386 or later versions. For other
|
| 100 |
possibilities review Debian's FTP directory structure at <ref id="dirtree">.
|
| 101 |
For details, see the description of "Debian architecture" in the manual page
|
| 102 |
<manref name="dpkg-architecture" section="1">.
|
| 103 |
|
| 104 |
<sect id="controlfile">What is a Debian control file?
|
| 105 |
|
| 106 |
<p>Specifics regarding the contents of a Debian control file are provided
|
| 107 |
in the Debian Policy Manual, section 5, see <ref id="debiandocs">.
|
| 108 |
|
| 109 |
<p>Briefly, a sample control file is shown below for the Debian package hello:
|
| 110 |
<example>
|
| 111 |
Package: hello
|
| 112 |
Priority: optional
|
| 113 |
Section: devel
|
| 114 |
Installed-Size: 45
|
| 115 |
Maintainer: Adam Heath <doogie@debian.org>
|
| 116 |
Architecture: i386
|
| 117 |
Version: 1.3-16
|
| 118 |
Depends: libc6 (>= 2.1)
|
| 119 |
Description: The classic greeting, and a good example
|
| 120 |
The GNU hello program produces a familiar, friendly greeting. It
|
| 121 |
<!-- XXX below 'non-programmers' were better, but this is a verbatim copy -->
|
| 122 |
allows nonprogrammers to use a classic computer science tool which
|
| 123 |
would otherwise be unavailable to them.
|
| 124 |
.
|
| 125 |
Seriously, though: this is an example of how to do a Debian package.
|
| 126 |
It is the Debian version of the GNU Project's `hello world' program
|
| 127 |
(which is itself an example for the GNU Project).
|
| 128 |
</example>
|
| 129 |
|
| 130 |
<p>The Package field gives the package name. This is the name by which the
|
| 131 |
package can be manipulated by the package tools, and usually similar
|
| 132 |
to but not necessarily the same as the first component string in the
|
| 133 |
Debian archive file name.
|
| 134 |
|
| 135 |
<p>The Version field gives both the upstream developer's version number
|
| 136 |
and (in the last component) the revision level of the Debian package of
|
| 137 |
this program as explained in <ref id="pkgname">. <!-- XXX missing name -->
|
| 138 |
|
| 139 |
<p>The Architecture field specifies the chip for which this particular
|
| 140 |
binary was compiled.
|
| 141 |
|
| 142 |
<p>The Depends field gives a list of packages that have to be
|
| 143 |
installed in order to install this package successfully.
|
| 144 |
|
| 145 |
<p>The Installed-Size indicates how much disk space the installed package
|
| 146 |
will consume. This is intended to be used by installation front-ends in
|
| 147 |
order to show whether there is enough disk space available to install the
|
| 148 |
program.
|
| 149 |
|
| 150 |
<p>The Section line gives the "section" where this Debian package is stored
|
| 151 |
at the Debian FTP sites.
|
| 152 |
|
| 153 |
<p>The Priority indicates how important is this package for installation, so
|
| 154 |
that semi-intelligent software like dselect or aptitude can sort the
|
| 155 |
package into a category of e.g. packages optionally installed. See
|
| 156 |
<ref id="priority">.
|
| 157 |
|
| 158 |
<p>The Maintainer field gives the e-mail address of the person who is
|
| 159 |
currently responsible for maintaining this package.
|
| 160 |
|
| 161 |
<p>The Description field gives a brief summary of the package's features.
|
| 162 |
|
| 163 |
<p>For more information about all possible fields a package can have, please
|
| 164 |
see the Debian Policy Manual, section 5, "Control files and their fields", see
|
| 165 |
<ref id="debiandocs">.
|
| 166 |
|
| 167 |
<sect id="conffile">What is a Debian conffile?
|
| 168 |
|
| 169 |
<p>Conffiles is a list of configuration files (usually placed in <tt>/etc</tt>)
|
| 170 |
that the package management system will not overwrite when the package is
|
| 171 |
upgraded. This ensures that local values for the contents of these files
|
| 172 |
will be preserved, and is a critical feature enabling the in-place upgrade
|
| 173 |
of packages on a running system.
|
| 174 |
|
| 175 |
<p>To determine exactly which files are preserved during an upgrade, run:
|
| 176 |
<example>dpkg --status package</example>
|
| 177 |
And look under "Conffiles:".
|
| 178 |
|
| 179 |
<sect id="maintscripts">What is a Debian preinst, postinst, prerm, and postrm
|
| 180 |
script?
|
| 181 |
|
| 182 |
<p>These files are executable scripts which are automatically run before
|
| 183 |
or after a package is installed. Along with a file named <tt>control</tt>,
|
| 184 |
all of these files are part of the "control" section of a Debian archive file.
|
| 185 |
|
| 186 |
<p>The individual files are:
|
| 187 |
<taglist>
|
| 188 |
<tag/preinst/
|
| 189 |
<item>This script executes before that package will be unpacked from its
|
| 190 |
Debian archive (".deb") file. Many 'preinst' scripts stop services for
|
| 191 |
packages which are being upgraded until their installation or upgrade is
|
| 192 |
completed (following the successful execution of the 'postinst' script).
|
| 193 |
|
| 194 |
<tag/postinst/
|
| 195 |
<item>This script typically completes any required configuration of the
|
| 196 |
package <tt>foo</tt> once <tt>foo</tt> has been unpacked from its Debian
|
| 197 |
archive (".deb") file. Often, 'postinst' scripts ask the user for input,
|
| 198 |
and/or warn the user that if he accepts default values, he should remember
|
| 199 |
to go back and re-configure that package as the situation warrants.
|
| 200 |
Many 'postinst' scripts then execute any commands necessary to start or
|
| 201 |
restart a service once a new package has been installed or upgraded.
|
| 202 |
|
| 203 |
<tag/prerm/
|
| 204 |
<item>This script typically stops any daemons which are associated with
|
| 205 |
a package. It is executed before the removal of files associated with
|
| 206 |
the package.
|
| 207 |
|
| 208 |
<tag/postrm/
|
| 209 |
<item>This script typically modifies links or other files associated with
|
| 210 |
<tt>foo</tt>, and/or removes files created by the package. (Also see
|
| 211 |
<ref id="virtual">.)
|
| 212 |
</taglist>
|
| 213 |
|
| 214 |
<p>Currently all of the control files can be found in directory
|
| 215 |
<tt>/var/lib/dpkg/info</tt>. The files relevant to package <tt>foo</tt>
|
| 216 |
begin with the name "foo" and have file extensions of "preinst", "postinst",
|
| 217 |
etc., as appropriate. The file <tt>foo.list</tt> in that directory
|
| 218 |
lists all of the files that were installed with the package <tt>foo</tt>.
|
| 219 |
(Note that the location of these files is a dpkg internal; you should not
|
| 220 |
rely on it.)
|
| 221 |
|
| 222 |
<sect id="priority">What is an <em/Essential/, <em/Required/, <em/Important/, <em/Standard/,
|
| 223 |
<em/Optional/, or <em/Extra/ package?
|
| 224 |
|
| 225 |
<p>Each Debian package is assigned a <em>priority</em> by the distribution
|
| 226 |
maintainers, as an aid to the package management system. The priorities are:
|
| 227 |
|
| 228 |
<list>
|
| 229 |
<item><strong>Required</strong>: packages that are necessary for the proper
|
| 230 |
functioning of the system.
|
| 231 |
<p>This includes all tools that are necessary to repair system defects.
|
| 232 |
You must not remove these packages or your system may become totally broken
|
| 233 |
and you may probably not even be able to use dpkg to put things back.
|
| 234 |
Systems with only the Required packages are probably unusable, but they do
|
| 235 |
have enough functionality to allow the sysadmin to boot and install more
|
| 236 |
software.
|
| 237 |
<item><strong>Important</strong> packages should be found on any Unix-like
|
| 238 |
system.
|
| 239 |
<p>Other packages which the system will not run well or be usable without
|
| 240 |
will be here. This does <em>NOT</em> include Emacs or X or TeX or any
|
| 241 |
other large applications. These packages only constitute the bare
|
| 242 |
infrastructure.
|
| 243 |
<item><strong>Standard</strong> packages are standard on any Linux system,
|
| 244 |
including a reasonably small but not too limited character-mode system.
|
| 245 |
Tools are included to be able to browse the web (using w3m), send e-mail
|
| 246 |
(with mutt) and download files from FTP servers.
|
| 247 |
<p>This is what will install by default if users do not select anything
|
| 248 |
else. It does not include many large applications, but it does include
|
| 249 |
the Python interpreter and some server software like OpenSSH (for
|
| 250 |
remote administration), Exim (for mail delivery, although it can
|
| 251 |
be configured for local delivery only), an identd server (pidentd) and the
|
| 252 |
RPC portmapper (<tt>portmap</tt>). It also includes some common
|
| 253 |
generic documentation that most users will find helpful.
|
| 254 |
<item><strong>Optional</strong> packages include all those that you might
|
| 255 |
reasonably want to install if you did not know what it was, or do not
|
| 256 |
have specialized requirements.
|
| 257 |
<p>This includes X, a full TeX distribution, and lots of applications.
|
| 258 |
<item><strong>Extra</strong>: packages that either conflict with others
|
| 259 |
with higher priorities, are only likely to be useful if you already know
|
| 260 |
what they are, or have specialized requirements that make them
|
| 261 |
unsuitable for "Optional".
|
| 262 |
</list>
|
| 263 |
|
| 264 |
<p>If you do a default Debian installation all the packages of
|
| 265 |
priority <strong>Standard</strong> or higher will be installed in your
|
| 266 |
system. If you select pre-defined tasks you will get lower
|
| 267 |
priority packages too.
|
| 268 |
|
| 269 |
<p>Additionally, some packages are marked as <strong>Essential</strong>
|
| 270 |
since they are absolutely necessary for the proper functioning of the system.
|
| 271 |
The package management tools will refuse to remove these.
|
| 272 |
|
| 273 |
<sect id="virtual">What is a Virtual Package?
|
| 274 |
|
| 275 |
<p>A virtual package is a generic name that applies to any one of a group
|
| 276 |
of packages, all of which provide similar basic functionality. For example,
|
| 277 |
both the <tt>tin</tt> and <tt>trn</tt> programs are news readers, and
|
| 278 |
should therefore satisfy any dependency of a program that required a news
|
| 279 |
reader on a system, in order to work or to be useful.
|
| 280 |
They are therefore both said to provide the "virtual package" called
|
| 281 |
<tt>news-reader</tt>.
|
| 282 |
|
| 283 |
<p>Similarly, <tt>smail</tt> and <tt>sendmail</tt> both provide the
|
| 284 |
functionality of a mail transport agent. They are therefore said to
|
| 285 |
provide the virtual package, "mail transport agent".
|
| 286 |
If either one is installed, then any program depending on the
|
| 287 |
installation of a <tt>mail-transport-agent</tt> will be satisfied by
|
| 288 |
the existence of this virtual package.
|
| 289 |
|
| 290 |
<p>Debian provides a mechanism so that, if more than one package which
|
| 291 |
provide the same virtual package is installed on a system, then system
|
| 292 |
administrators can set one as the preferred package. The relevant command
|
| 293 |
is <tt>update-alternatives</tt>, and is described further in
|
| 294 |
<ref id="diverse">.
|
| 295 |
|
| 296 |
<sect id="depends">What is meant by saying that a package <em/Depends/,
|
| 297 |
<em/Recommends/, <em/Suggests/, <em/Conflicts/, <em/Replaces/, <em/Breaks/ or
|
| 298 |
<em/Provides/ another package?
|
| 299 |
|
| 300 |
<p>The Debian package system has a range of package "dependencies"
|
| 301 |
which are designed to indicate (in a single flag) the level at which
|
| 302 |
Program A can operate independently of the existence of Program B on
|
| 303 |
a given system:
|
| 304 |
<list>
|
| 305 |
<item>Package A <em>depends</em> on Package B if B absolutely must
|
| 306 |
be installed in order to run A. In some cases, A depends not only
|
| 307 |
on B, but on a version of B. In this case, the version dependency is
|
| 308 |
usually a lower limit, in the sense that A depends on any version
|
| 309 |
of B more recent than some specified version.
|
| 310 |
<item>Package A <em>recommends</em> Package B, if the package maintainer
|
| 311 |
judges that most users would not want A without also having the
|
| 312 |
functionality provided by B.
|
| 313 |
<item>Package A <em>suggests</em> Package B if B contains files that
|
| 314 |
are related to (and usually enhance) the functionality of A.
|
| 315 |
<item>Package A <em>conflicts</em> with Package B when A will not
|
| 316 |
operate if B is installed on the system. Most often, conflicts are
|
| 317 |
cases where A contains files which are an improvement over those in B.
|
| 318 |
"Conflicts" are often combined with "replaces".
|
| 319 |
<item>Package A <em>replaces</em> Package B when files installed
|
| 320 |
by B are removed and (in some cases) over-written by files in A.
|
| 321 |
<item>Package A <em>breaks</em> Package B when both cannot packages
|
| 322 |
cannot be simultaneously configured in a system. The package management
|
| 323 |
system will refuse to install one if the other one is already installed and
|
| 324 |
configured in the system.
|
| 325 |
<item>Package A <em>provides</em> Package B when all of the files and
|
| 326 |
functionality of B are incorporated into A. This mechanism provides
|
| 327 |
a way for users with constrained disk space to get only that part of
|
| 328 |
package A which they really need.
|
| 329 |
</list>
|
| 330 |
|
| 331 |
<p>More detailed information on the use of each these terms can be found
|
| 332 |
in the Debian Policy manual, section 7.2, "Binary Dependencies", see
|
| 333 |
<ref id="debiandocs">.
|
| 334 |
|
| 335 |
<sect id="pre-depends">What is meant by Pre-Depends?
|
| 336 |
|
| 337 |
<p>"Pre-Depends" is a special dependency. In the case of most packages,
|
| 338 |
<tt>dpkg</tt> will unpack its archive file (i.e., its <tt>.deb</tt> file)
|
| 339 |
independently of whether or not the files on which it depends exist on the
|
| 340 |
system. Simplistically, unpacking means that <tt>dpkg</tt> will extract
|
| 341 |
the files from the archive file that were meant to be installed on your
|
| 342 |
file system, and put them in place. If those packages <em>depend</em> on
|
| 343 |
the existence of some other packages on your system, <tt>dpkg</tt> will
|
| 344 |
refuse to complete the installation (by executing its "configure" action)
|
| 345 |
until the other packages are installed.
|
| 346 |
|
| 347 |
<p>However, for some packages, <tt>dpkg</tt> will refuse even to unpack
|
| 348 |
them until certain dependencies are resolved. Such packages are said
|
| 349 |
to "Pre-depend" on the presence of some other packages.
|
| 350 |
The Debian project provided this mechanism to support the safe upgrading
|
| 351 |
of systems from <tt>a.out</tt> format to <tt>ELF</tt> format, where
|
| 352 |
the <em>order</em> in which packages were unpacked was critical. There are
|
| 353 |
other large upgrade situations where this method is useful, e.g. the
|
| 354 |
packages with the required priority and their LibC dependency.
|
| 355 |
|
| 356 |
<p>As before, more detailed information about this can be found in the
|
| 357 |
Policy manual.
|
| 358 |
|
| 359 |
<sect id="pkgstatus">What is meant by <em/unknown/, <em/install/, <em/remove/,
|
| 360 |
<em/purge/ and <em/hold/ in the package status?
|
| 361 |
|
| 362 |
<p>These "want" flags tell what the user wanted to do with a package (as
|
| 363 |
indicated either by the user's actions in the "Select" section of
|
| 364 |
<tt>dselect</tt>, or by the user's direct invocations of <tt>dpkg</tt>).
|
| 365 |
|
| 366 |
<p>Their meanings are:
|
| 367 |
<list>
|
| 368 |
<item>unknown - the user has never indicated whether he wants the package
|
| 369 |
<item>install - the user wants the package installed or upgraded
|
| 370 |
<item>remove - the user wants the package removed, but does not want to
|
| 371 |
remove any existing configuration files.
|
| 372 |
<item>purge - the user wants the package to be removed completely,
|
| 373 |
including its configuration files.
|
| 374 |
<item>hold - the user wants this package not to be processed, i.e., he
|
| 375 |
wants to keep the current version with the current status whatever that is.
|
| 376 |
</list>
|
| 377 |
|
| 378 |
<sect id="puttingonhold">How do I put a package on hold?
|
| 379 |
|
| 380 |
<p>There are three ways of holding back packages, with dpkg, aptitude
|
| 381 |
or with dselect.
|
| 382 |
|
| 383 |
<p>With dpkg, you have to export the list of package selections, with:
|
| 384 |
<example>dpkg --get-selections \* > selections.txt</example>
|
| 385 |
Then edit the resulting file <file/selections.txt/, change the line
|
| 386 |
containing the package you wish to hold, e.g. <package/libc6/, from this:
|
| 387 |
<example>libc6 install</example>
|
| 388 |
to this:
|
| 389 |
<example>libc6 hold</example>
|
| 390 |
Save the file, and reload it into dpkg database with:
|
| 391 |
<example>dpkg --set-selections < selections.txt</example>
|
| 392 |
|
| 393 |
<p>With aptitude, you can hold a package using
|
| 394 |
<example>aptitude hold package_name</example>
|
| 395 |
and remove the hold with
|
| 396 |
<example>aptitude unhold package_name</example>
|
| 397 |
|
| 398 |
<p>With dselect, you have to enter the [S]elect screen, find the
|
| 399 |
package you wish to hold in its present state, and press the `=' key (or
|
| 400 |
`H'). The changes will go live immediately after you exit the [S]elect
|
| 401 |
screen.
|
| 402 |
|
| 403 |
<sect id="sourcepkgs">How do I install a source package?
|
| 404 |
|
| 405 |
<p>Debian source packages can't actually be "installed", they are just
|
| 406 |
unpacked in whatever directory you want to build the binary packages they
|
| 407 |
produce.
|
| 408 |
|
| 409 |
<p>Source packages are distributed on most of the same mirrors where you can
|
| 410 |
obtain the binary packages. If you set up your APT's
|
| 411 |
<manref name="sources.list" section="5"> to include the appropriate
|
| 412 |
"deb-src" lines, you'll be able to easily download any source packages
|
| 413 |
by running
|
| 414 |
|
| 415 |
<example>apt-get source foo</example>
|
| 416 |
|
| 417 |
<p>To help you in actually building the source package, Debian source
|
| 418 |
package provide the so-called build-dependencies mechanism. This means that
|
| 419 |
the source package maintainer keeps a list of other packages that are
|
| 420 |
required to build their package. To see how this is useful, run
|
| 421 |
|
| 422 |
<example>apt-get build-dep foo</example>
|
| 423 |
|
| 424 |
before building the source.
|
| 425 |
|
| 426 |
<sect id="sourcebuild">How do I build binary packages from a source package?
|
| 427 |
|
| 428 |
<p>The preferred way to do this is by using various wrapper tools. We'll show
|
| 429 |
how it's done using the <tt>devscripts</tt> tools. Install this package if you
|
| 430 |
haven't done so already.
|
| 431 |
|
| 432 |
<p>Now, first get the source package:
|
| 433 |
|
| 434 |
<example>apt-get source foo</example>
|
| 435 |
|
| 436 |
and change to the source tree:
|
| 437 |
|
| 438 |
<example>cd foo-*</example>
|
| 439 |
|
| 440 |
Then install needed build-dependencies (if any):
|
| 441 |
|
| 442 |
<example>sudo apt-get build-dep foo</example>
|
| 443 |
|
| 444 |
Then create a dedicated version of your own build (so that you won't get
|
| 445 |
confused later when Debian itself releases a new version)
|
| 446 |
|
| 447 |
<example>dch -l local 'Blah blah blah'</example>
|
| 448 |
|
| 449 |
And finally build your package
|
| 450 |
|
| 451 |
<example>debuild -us -uc</example>
|
| 452 |
|
| 453 |
If everything worked out fine, you should now be able to install your
|
| 454 |
package by running
|
| 455 |
|
| 456 |
<example>sudo dpkg -i ../*.deb</example>
|
| 457 |
|
| 458 |
<p>If you prefer to do things manually, and don't want to use
|
| 459 |
<tt>devscripts</tt>, follow this procedure:</p>
|
| 460 |
|
| 461 |
<p>You will need all of foo_*.dsc, foo_*.tar.gz and foo_*.diff.gz to compile
|
| 462 |
the source (note: there is no .diff.gz for some packages that are native
|
| 463 |
to Debian).
|
| 464 |
|
| 465 |
<p>Once you have them (<ref id="sourcepkgs">), if you have the
|
| 466 |
<package/dpkg-dev/ package installed,
|
| 467 |
the following command:
|
| 468 |
<example>dpkg-source -x foo_version-revision.dsc</example>
|
| 469 |
will extract the package into a directory called <tt>foo-version</tt>.
|
| 470 |
|
| 471 |
<p>If you want just to compile the package, you may cd into
|
| 472 |
<tt>foo-version</tt> directory and issue the command
|
| 473 |
<example>dpkg-buildpackage -rfakeroot -b</example>
|
| 474 |
to build the package (note that this also requires the
|
| 475 |
<package/fakeroot/ package), and then
|
| 476 |
<example>dpkg -i ../foo_version-revision_arch.deb</example>
|
| 477 |
to install the newly-built package(s).
|
| 478 |
|
| 479 |
<sect id="creatingdebs">How do I create Debian packages myself?
|
| 480 |
|
| 481 |
<p>For a more detailed description on this, read the New Maintainers' Guide,
|
| 482 |
available in the <package/maint-guide/ package, or at
|
| 483 |
<url id="http://www.debian.org/doc/devel-manuals#maint-guide">.
|