Datasheet

96
Part I The Fundamentals
Package Repositories and /etc/apt/sources.list
Although Debian’s package repositories are very large and complete, they don’t
quite contain everything. The two primary reasons for using unofficial package
repositories are to get patent-encumbered software, or to retrieve newer versions
of packages than are available in sarge, without using the sid development tree.
Though specifics differ from repository to repository, the general idea is the same:
add one or more lines to
/etc/apt/sources.list. Since /etc/apt/sources.list
is the file apt-get update and aptitude update read to determine which package
lists to download, it’s worth discussing the makeup of that file.
Each line describes a single repository and is made up of three parts: the
binary/source keyword, the repository’s URL, and the components within that
repository. Standard lines look like the following:
deb http://http.us.debian.org/debian stable main
deb-src http://http.us.debian.org/debian stable main
The first word in the line is the binary/source indicator. deb means the repository
contains binary packages you can install, and
deb-src is for source packages. Most
archives have both binary and source, so lines are often added in pairs. The second
part of the line is simply the URL to the repository. Everything after the URL reflects
the components of the repository. Though the components you want to add are
repository specific, there needs to be some text there. The examples here refer to
a standard Debian package repository for the stable distribution sarge, in this
case and the main portion of that repository.
Whenever you change anything in /etc/apt/sources.list, run aptitude
update or apt-get update.
apt Pinning
The ability to add multiple sources to /etc/apt/sources.list makes it possible
to seamlessly integrate unofficial repositories of Debian packages. These reposito-
ries may contain packages not found in Debian or newer or enhanced versions of
official packages.
What happens if the same package exists in two or more repositories? (As far as the
packaging system is concerned, it is the same package if it has the same name,
regardless of the contents.) By default,
apt will use the package with the higher ver-
sion number. If two packages have the same version number,
apt will select the one
that best fits your current release (that is, sarge), which in most cases will be the
official Debian package. If the packages have the same version number and belong
to the same release,
apt will pick the first one it comes across in its database, or in
other words, essentially pick one at random.
Note
09_576445 ch04.qxd 7/5/05 3:10 PM Page 96