]> git.saurik.com Git - apt.git/blame - doc/apt_preferences.5.xml
merge with debian-sid release 0.8.15
[apt.git] / doc / apt_preferences.5.xml
CommitLineData
24f6490f
AL
1<?xml version="1.0" encoding="utf-8" standalone="no"?>
2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
b2e465d6
AL
4
5<!ENTITY % aptent SYSTEM "apt.ent">
6%aptent;
7
0c1a7101
DK
8<!ENTITY % aptverbatiment SYSTEM "apt-verbatim.ent">
9%aptverbatiment;
10
b2e465d6
AL
11]>
12
13<refentry>
ec2853a7 14
5e80de29
AL
15 <refentryinfo>
16 &apt-author.team;
17 &apt-email;
18 &apt-product;
19 <!-- The last update date -->
d9dedf30 20 <date>16 February 2010</date>
5e80de29
AL
21 </refentryinfo>
22
b2e465d6 23 <refmeta>
24f6490f
AL
24 <refentrytitle>apt_preferences</refentrytitle>
25 <manvolnum>5</manvolnum>
f0599b9c 26 <refmiscinfo class="manual">APT</refmiscinfo>
b2e465d6 27 </refmeta>
ec2853a7 28
b2e465d6
AL
29 <!-- Man page title -->
30 <refnamediv>
24f6490f
AL
31 <refname>apt_preferences</refname>
32 <refpurpose>Preference control file for APT</refpurpose>
b2e465d6 33 </refnamediv>
b2e465d6 34
24f6490f
AL
35<refsect1>
36<title>Description</title>
37<para>The APT preferences file <filename>/etc/apt/preferences</filename>
daa4aa52
DK
38and the fragment files in the <filename>/etc/apt/preferences.d/</filename>
39folder can be used to control which versions of packages will be selected
24f6490f 40for installation.</para>
ec2853a7 41
24f6490f 42<para>Several versions of a package may be available for installation when
ec2853a7 43the &sources-list; file contains references to more than one distribution
5b9d504e
AL
44(for example, <literal>stable</literal> and <literal>testing</literal>).
45APT assigns a priority to each version that is available.
46Subject to dependency constraints, <command>apt-get</command> selects the
408a8e0a 47version with the highest priority for installation.
5b9d504e
AL
48The APT preferences file overrides the priorities that APT assigns to
49package versions by default, thus giving the user control over which
24f6490f
AL
50one is selected for installation.</para>
51
52<para>Several instances of the same version of a package may be available when
408a8e0a
AL
53the &sources-list; file contains references to more than one source.
54In this case <command>apt-get</command> downloads the instance listed
5b9d504e 55earliest in the &sources-list; file.
408a8e0a 56The APT preferences file does not affect the choice of instance, only
24f6490f 57the choice of version.</para>
ec2853a7 58
d9dedf30
DK
59<para>Preferences are a strong power in the hands of a system administrator
60but they can become also their biggest nightmare if used without care!
61APT will not questioning the preferences so wrong settings will therefore
62lead to uninstallable packages or wrong decisions while upgrading packages.
63Even more problems will arise if multiply distribution releases are mixed
64without a good understanding of the following paragraphs.
37049546
DK
65Packages included in a specific release aren't tested in and
66therefore doesn't always work as expected in older or newer releases or
67together with other packages from different releases.
d9dedf30
DK
68You have been warned.</para>
69
e29a6bb1
DK
70<para>Note that the files in the <filename>/etc/apt/preferences.d</filename>
71directory are parsed in alphanumeric ascending order and need to obey the
1fc8c922
MV
72following naming convention: The files have either no or "<literal>pref</literal>"
73as filename extension and only contain alphanumeric, hyphen (-),
7376837d
DK
74underscore (_) and period (.) characters.
75Otherwise APT will print a notice that it has ignored a file if the file
76doesn't match a pattern in the <literal>Dir::Ignore-Files-Silently</literal>
77configuration list - in this case it will be silently ignored.</para>
e29a6bb1 78
24f6490f 79<refsect2><title>APT's Default Priority Assignments</title>
ec2853a7 80
24f6490f 81<para>If there is no preferences file or if there is no entry in the file
408a8e0a
AL
82that applies to a particular version then the priority assigned to that
83version is the priority of the distribution to which that version
84belongs. It is possible to single out a distribution, "the target release",
85which receives a higher priority than other distributions do by default.
86The target release can be set on the <command>apt-get</command> command
87line or in the APT configuration file <filename>/etc/apt/apt.conf</filename>.
99fc3e08
LB
88Note that this has precedence over any general priority you set in the
89<filename>/etc/apt/preferences</filename> file described later, but not
90over specifically pinned packages.
408a8e0a 91For example,
24f6490f 92
408a8e0a
AL
93<programlisting>
94<command>apt-get install -t testing <replaceable>some-package</replaceable></command>
95</programlisting>
96<programlisting>
97APT::Default-Release "stable";
98</programlisting>
ec2853a7
AL
99</para>
100
24f6490f 101<para>If the target release has been specified then APT uses the following
408a8e0a 102algorithm to set the priorities of the versions of a package. Assign:
24f6490f 103
ec2853a7 104<variablelist>
10df254b
DK
105<varlistentry>
106<term>priority 1</term>
107<listitem><simpara>to the versions coming from archives which in their <filename>Release</filename>
fcaf14fe
DK
108files are marked as "NotAutomatic: yes" but <emphasis>not</emphasis> as "ButAutomaticUpgrades: yes"
109like the debian <literal>experimental</literal> archive.</simpara></listitem>
10df254b
DK
110</varlistentry>
111
ec2853a7
AL
112<varlistentry>
113<term>priority 100</term>
fcaf14fe
DK
114<listitem><simpara>to the version that is already installed (if any) and to the versions coming
115from archives which in their <filename>Release</filename> files are marked as "NotAutomatic: yes" and
116"ButAutomaticUpgrades: yes" like the debian backports archive since <literal>squeeze-backports</literal>.
117</simpara></listitem>
ec2853a7 118</varlistentry>
24f6490f 119
ec2853a7
AL
120<varlistentry>
121<term>priority 500</term>
5b9d504e 122<listitem><simpara>to the versions that are not installed and do not belong to the target release.</simpara></listitem>
ec2853a7 123</varlistentry>
24f6490f 124
ec2853a7
AL
125<varlistentry>
126<term>priority 990</term>
5b9d504e 127<listitem><simpara>to the versions that are not installed and belong to the target release.</simpara></listitem>
ec2853a7
AL
128</varlistentry>
129</variablelist>
130</para>
131
24f6490f 132<para>If the target release has not been specified then APT simply assigns
5b9d504e 133priority 100 to all installed package versions and priority 500 to all
a0a1ce6d 134uninstalled package versions, except versions coming from archives which
10df254b 135in their <filename>Release</filename> files are marked as "NotAutomatic: yes" -
fcaf14fe
DK
136these versions get the priority 1 or priority 100 if it is additionally marked
137as "ButAutomaticUpgrades: yes".</para>
ec2853a7 138
24f6490f 139<para>APT then applies the following rules, listed in order of precedence,
5b9d504e 140to determine which version of a package to install.
ec2853a7 141<itemizedlist>
5b9d504e
AL
142<listitem><simpara>Never downgrade unless the priority of an available
143version exceeds 1000. ("Downgrading" is installing a less recent version
144of a package in place of a more recent version. Note that none of APT's
145default priorities exceeds 1000; such high priorities can only be set in
146the preferences file. Note also that downgrading a package
147can be risky.)</simpara></listitem>
148<listitem><simpara>Install the highest priority version.</simpara></listitem>
149<listitem><simpara>If two or more versions have the same priority,
150install the most recent one (that is, the one with the higher version
151number).</simpara></listitem>
152<listitem><simpara>If two or more versions have the same priority and
153version number but either the packages differ in some of their metadata or the
24f6490f 154<literal>--reinstall</literal> option is given, install the uninstalled one.</simpara></listitem>
ec2853a7
AL
155</itemizedlist>
156</para>
157
24f6490f 158<para>In a typical situation, the installed version of a package (priority 100)
5b9d504e
AL
159is not as recent as one of the versions available from the sources listed in
160the &sources-list; file (priority 500 or 990). Then the package will be upgraded
161when <command>apt-get install <replaceable>some-package</replaceable></command>
162or <command>apt-get upgrade</command> is executed.
ec2853a7
AL
163</para>
164
24f6490f 165<para>More rarely, the installed version of a package is <emphasis>more</emphasis> recent
5b9d504e
AL
166than any of the other available versions. The package will not be downgraded
167when <command>apt-get install <replaceable>some-package</replaceable></command>
24f6490f 168or <command>apt-get upgrade</command> is executed.</para>
ec2853a7 169
24f6490f 170<para>Sometimes the installed version of a package is more recent than the
ec2853a7 171version belonging to the target release, but not as recent as a version
5b9d504e
AL
172belonging to some other distribution. Such a package will indeed be upgraded
173when <command>apt-get install <replaceable>some-package</replaceable></command>
174or <command>apt-get upgrade</command> is executed,
24f6490f
AL
175because at least <emphasis>one</emphasis> of the available versions has a higher
176priority than the installed version.</para>
177</refsect2>
ec2853a7 178
24f6490f 179<refsect2><title>The Effect of APT Preferences</title>
ec2853a7 180
24f6490f 181<para>The APT preferences file allows the system administrator to control the
5b9d504e
AL
182assignment of priorities. The file consists of one or more multi-line records
183separated by blank lines. Records can have one of two forms, a specific form
184and a general form.
ec2853a7
AL
185<itemizedlist>
186<listitem>
1c62ab24
MV
187<simpara>The specific form assigns a priority (a "Pin-Priority") to one or more
188specified packages and specified version or version range. For example,
5b9d504e 189the following record assigns a high priority to all versions of
1c62ab24
MV
190the <filename>perl</filename> package whose version number begins with "<literal>5.8</literal>".
191Multiple packages can be separated by spaces.</simpara>
ec2853a7
AL
192
193<programlisting>
194Package: perl
195Pin: version 5.8*
196Pin-Priority: 1001
197</programlisting>
198</listitem>
199
24f6490f 200<listitem><simpara>The general form assigns a priority to all of the package versions in a
ec2853a7 201given distribution (that is, to all the versions of packages that are
24f6490f 202listed in a certain <filename>Release</filename> file) or to all of the package
5b9d504e 203versions coming from a particular Internet site, as identified by the
24f6490f 204site's fully qualified domain name.</simpara>
ec2853a7 205
24f6490f 206<simpara>This general-form entry in the APT preferences file applies only
5b9d504e 207to groups of packages. For example, the following record assigns a high
24f6490f 208priority to all package versions available from the local site.</simpara>
ec2853a7
AL
209
210<programlisting>
211Package: *
212Pin: origin ""
213Pin-Priority: 999
214</programlisting>
215
4fb6fdaf
DK
216<simpara>A note of caution: the keyword used here is "<literal>origin</literal>"
217which can be used to match a hostname. The following record will assign a high priority
218to all versions available from the server identified by the hostname "ftp.de.debian.org"</simpara>
219<programlisting>
220Package: *
221Pin: origin "ftp.de.debian.org"
222Pin-Priority: 999
223</programlisting>
224<simpara>This should <emphasis>not</emphasis> be confused with the Origin of a distribution as
24f6490f
AL
225specified in a <filename>Release</filename> file. What follows the "Origin:" tag
226in a <filename>Release</filename> file is not an Internet address
227but an author or vendor name, such as "Debian" or "Ximian".</simpara>
ec2853a7 228
24f6490f
AL
229<simpara>The following record assigns a low priority to all package versions
230belonging to any distribution whose Archive name is "<literal>unstable</literal>".</simpara>
ec2853a7
AL
231
232<programlisting>
233Package: *
234Pin: release a=unstable
704c39d6 235Pin-Priority: 50
ec2853a7
AL
236</programlisting>
237
efc487fb 238<simpara>The following record assigns a high priority to all package versions
e1dd65c9 239belonging to any distribution whose Codename is "<literal>&testing-codename;</literal>".</simpara>
efc487fb
DK
240
241<programlisting>
242Package: *
e1dd65c9 243Pin: release n=&testing-codename;
efc487fb
DK
244Pin-Priority: 900
245</programlisting>
246
24f6490f
AL
247<simpara>The following record assigns a high priority to all package versions
248belonging to any release whose Archive name is "<literal>stable</literal>"
249and whose release Version number is "<literal>3.0</literal>".</simpara>
ec2853a7
AL
250
251<programlisting>
252Package: *
0493db1e
MZ
253Pin: release a=stable, v=3.0
254Pin-Priority: 500
ec2853a7
AL
255</programlisting>
256</listitem>
257</itemizedlist>
258</para>
259
24f6490f 260</refsect2>
ec2853a7 261
1a4c9766
JAK
262<refsect2><title>Regular expressions and glob() syntax</title>
263<para>
264APT also supports pinning by glob() expressions and regular
265expressions surrounded by /. For example, the following
266example assigns the priority 500 to all packages from
267experimental where the name starts with gnome (as a glob()-like
1fc8c922 268expression) or contains the word kde (as a POSIX extended regular
1a4c9766
JAK
269expression surrounded by slashes).
270</para>
271
272<programlisting>
273Package: gnome* /kde/
274Pin: release n=experimental
275Pin-Priority: 500
276</programlisting>
277
278<para>
279The rule for those expressions is that they can occur anywhere
1fc8c922 280where a string can occur. Thus, the following pin assigns the
1a4c9766
JAK
281priority 990 to all packages from a release starting with karmic.
282</para>
283
284<programlisting>
285Package: *
286Pin: release n=karmic*
287Pin-Priority: 990
288</programlisting>
289
290If a regular expression occurs in a <literal>Package</literal> field,
291the behavior is the same as if this regular expression were replaced
292with a list of all package names it matches. It is undecided whether
293this will change in the future, thus you should always list wild-card
294pins first, so later specific pins override it.
295
296The pattern "<literal>*</literal>" in a Package field is not considered
297a glob() expression in itself.
298
299</refsect2>
300
301
302
303
304
24f6490f
AL
305<refsect2>
306<title>How APT Interprets Priorities</title>
ec2853a7 307
5b9d504e
AL
308<para>
309Priorities (P) assigned in the APT preferences file must be positive
ec2853a7
AL
310or negative integers. They are interpreted as follows (roughly speaking):
311
312<variablelist>
5b9d504e
AL
313<varlistentry>
314<term>P &gt; 1000</term>
315<listitem><simpara>causes a version to be installed even if this
316constitutes a downgrade of the package</simpara></listitem>
ec2853a7 317</varlistentry>
5b9d504e
AL
318<varlistentry>
319<term>990 &lt; P &lt;=1000</term>
320<listitem><simpara>causes a version to be installed
ec2853a7 321even if it does not come from the target release,
5b9d504e 322unless the installed version is more recent</simpara></listitem>
ec2853a7 323</varlistentry>
5b9d504e
AL
324<varlistentry>
325<term>500 &lt; P &lt;=990</term>
326<listitem><simpara>causes a version to be installed
327unless there is a version available belonging to the target release
328or the installed version is more recent</simpara></listitem>
ec2853a7 329</varlistentry>
5b9d504e
AL
330<varlistentry>
331<term>100 &lt; P &lt;=500</term>
332<listitem><simpara>causes a version to be installed
333unless there is a version available belonging to some other
334distribution or the installed version is more recent</simpara></listitem>
24f6490f 335</varlistentry>
5b9d504e 336<varlistentry>
56298634 337<term>0 &lt; P &lt;=100</term>
5b9d504e
AL
338<listitem><simpara>causes a version to be installed
339only if there is no installed version of the package</simpara></listitem>
ec2853a7 340</varlistentry>
5b9d504e
AL
341<varlistentry>
342<term>P &lt; 0</term>
343<listitem><simpara>prevents the version from being installed</simpara></listitem>
ec2853a7
AL
344</varlistentry>
345</variablelist>
346</para>
347
24f6490f 348<para>If any specific-form records match an available package version then the
5b9d504e
AL
349first such record determines the priority of the package version.
350Failing that,
351if any general-form records match an available package version then the
24f6490f 352first such record determines the priority of the package version.</para>
ec2853a7 353
24f6490f
AL
354<para>For example, suppose the APT preferences file contains the three
355records presented earlier:</para>
ec2853a7
AL
356
357<programlisting>
358Package: perl
359Pin: version 5.8*
b2e465d6 360Pin-Priority: 1001
ec2853a7 361
b2e465d6 362Package: *
ec2853a7
AL
363Pin: origin ""
364Pin-Priority: 999
365
366Package: *
367Pin: release unstable
368Pin-Priority: 50
369</programlisting>
370
24f6490f 371<para>Then:
ec2853a7 372<itemizedlist>
24f6490f 373<listitem><simpara>The most recent available version of the <literal>perl</literal>
ec2853a7 374package will be installed, so long as that version's version number begins
24f6490f
AL
375with "<literal>5.8</literal>". If <emphasis>any</emphasis> 5.8* version of <literal>perl</literal> is
376available and the installed version is 5.9*, then <literal>perl</literal> will be
ec2853a7 377downgraded.</simpara></listitem>
24f6490f 378<listitem><simpara>A version of any package other than <literal>perl</literal>
5b9d504e
AL
379that is available from the local system has priority over other versions,
380even versions belonging to the target release.
ec2853a7 381</simpara></listitem>
5b9d504e
AL
382<listitem><simpara>A version of a package whose origin is not the local
383system but some other site listed in &sources-list; and which belongs to
24f6490f 384an <literal>unstable</literal> distribution is only installed if it is selected
5b9d504e 385for installation and no version of the package is already installed.
ec2853a7
AL
386</simpara></listitem>
387</itemizedlist>
388</para>
24f6490f 389</refsect2>
ec2853a7 390
24f6490f
AL
391<refsect2>
392<title>Determination of Package Version and Distribution Properties</title>
ec2853a7 393
24f6490f 394<para>The locations listed in the &sources-list; file should provide
ec2853a7 395<filename>Packages</filename> and <filename>Release</filename> files
24f6490f 396to describe the packages available at that location. </para>
ec2853a7 397
24f6490f 398<para>The <filename>Packages</filename> file is normally found in the directory
ec2853a7
AL
399<filename>.../dists/<replaceable>dist-name</replaceable>/<replaceable>component</replaceable>/<replaceable>arch</replaceable></filename>:
400for example, <filename>.../dists/stable/main/binary-i386/Packages</filename>.
401It consists of a series of multi-line records, one for each package available
402in that directory. Only two lines in each record are relevant for setting
403APT priorities:
404<variablelist>
405<varlistentry>
24f6490f 406<term>the <literal>Package:</literal> line</term>
ec2853a7
AL
407<listitem><simpara>gives the package name</simpara></listitem>
408</varlistentry>
409<varlistentry>
24f6490f 410<term>the <literal>Version:</literal> line</term>
ec2853a7
AL
411<listitem><simpara>gives the version number for the named package</simpara></listitem>
412</varlistentry>
413</variablelist>
414</para>
415
24f6490f 416<para>The <filename>Release</filename> file is normally found in the directory
ec2853a7
AL
417<filename>.../dists/<replaceable>dist-name</replaceable></filename>:
418for example, <filename>.../dists/stable/Release</filename>,
e1dd65c9 419or <filename>.../dists/&stable-codename;/Release</filename>.
24f6490f 420It consists of a single multi-line record which applies to <emphasis>all</emphasis> of
5b9d504e 421the packages in the directory tree below its parent. Unlike the
24f6490f 422<filename>Packages</filename> file, nearly all of the lines in a <filename>Release</filename>
ec2853a7
AL
423file are relevant for setting APT priorities:
424
425<variablelist>
426<varlistentry>
efc487fb 427<term>the <literal>Archive:</literal> or <literal>Suite:</literal> line</term>
5b9d504e 428<listitem><simpara>names the archive to which all the packages
ec2853a7 429in the directory tree belong. For example, the line
efc487fb
DK
430"Archive: stable" or
431"Suite: stable"
5b9d504e 432specifies that all of the packages in the directory
24f6490f
AL
433tree below the parent of the <filename>Release</filename> file are in a
434<literal>stable</literal> archive. Specifying this value in the APT preferences file
ec2853a7
AL
435would require the line:
436</simpara>
ec2853a7
AL
437<programlisting>
438Pin: release a=stable
439</programlisting>
440</listitem>
441</varlistentry>
442
efc487fb
DK
443<varlistentry>
444<term>the <literal>Codename:</literal> line</term>
445<listitem><simpara>names the codename to which all the packages
446in the directory tree belong. For example, the line
e1dd65c9 447"Codename: &testing-codename;"
efc487fb
DK
448specifies that all of the packages in the directory
449tree below the parent of the <filename>Release</filename> file belong to a version named
e1dd65c9 450<literal>&testing-codename;</literal>. Specifying this value in the APT preferences file
efc487fb
DK
451would require the line:
452</simpara>
453<programlisting>
e1dd65c9 454Pin: release n=&testing-codename;
efc487fb
DK
455</programlisting>
456</listitem>
457</varlistentry>
458
ec2853a7 459<varlistentry>
24f6490f 460<term>the <literal>Version:</literal> line</term>
ec2853a7 461<listitem><simpara>names the release version. For example, the
5b9d504e
AL
462packages in the tree might belong to Debian GNU/Linux release
463version 3.0. Note that there is normally no version number for the
24f6490f 464<literal>testing</literal> and <literal>unstable</literal> distributions because they
5b9d504e
AL
465have not been released yet. Specifying this in the APT preferences
466file would require one of the following lines.
ec2853a7
AL
467</simpara>
468
469<programlisting>
470Pin: release v=3.0
f6271220 471Pin: release a=stable, v=3.0
ec2853a7
AL
472Pin: release 3.0
473</programlisting>
474
475</listitem>
476</varlistentry>
477
478<varlistentry>
24f6490f 479<term>the <literal>Component:</literal> line</term>
ec2853a7 480<listitem><simpara>names the licensing component associated with the
24f6490f 481packages in the directory tree of the <filename>Release</filename> file.
5b9d504e 482For example, the line "Component: main" specifies that
24f6490f 483all the packages in the directory tree are from the <literal>main</literal>
5b9d504e
AL
484component, which entails that they are licensed under terms listed
485in the Debian Free Software Guidelines. Specifying this component
486in the APT preferences file would require the line:
ec2853a7 487</simpara>
ec2853a7
AL
488<programlisting>
489Pin: release c=main
490</programlisting>
491</listitem>
492</varlistentry>
493
494<varlistentry>
24f6490f 495<term>the <literal>Origin:</literal> line</term>
5b9d504e 496<listitem><simpara>names the originator of the packages in the
24f6490f
AL
497directory tree of the <filename>Release</filename> file. Most commonly, this is
498<literal>Debian</literal>. Specifying this origin in the APT preferences file
ec2853a7
AL
499would require the line:
500</simpara>
ec2853a7
AL
501<programlisting>
502Pin: release o=Debian
503</programlisting>
504</listitem>
505</varlistentry>
506
507<varlistentry>
24f6490f 508<term>the <literal>Label:</literal> line</term>
5b9d504e 509<listitem><simpara>names the label of the packages in the directory tree
24f6490f
AL
510of the <filename>Release</filename> file. Most commonly, this is
511<literal>Debian</literal>. Specifying this label in the APT preferences file
ec2853a7
AL
512would require the line:
513</simpara>
ec2853a7
AL
514<programlisting>
515Pin: release l=Debian
516</programlisting>
517</listitem>
518</varlistentry>
519</variablelist>
520</para>
521
24f6490f 522<para>All of the <filename>Packages</filename> and <filename>Release</filename>
5b9d504e 523files retrieved from locations listed in the &sources-list; file are stored
ec2853a7 524in the directory <filename>/var/lib/apt/lists</filename>, or in the file named
24f6490f 525by the variable <literal>Dir::State::Lists</literal> in the <filename>apt.conf</filename> file.
ec2853a7
AL
526For example, the file
527<filename>debian.lcs.mit.edu_debian_dists_unstable_contrib_binary-i386_Release</filename>
528contains the <filename>Release</filename> file retrieved from the site
24f6490f
AL
529<literal>debian.lcs.mit.edu</literal> for <literal>binary-i386</literal> architecture
530files from the <literal>contrib</literal> component of the <literal>unstable</literal>
531distribution.</para>
532</refsect2>
ec2853a7 533
24f6490f
AL
534<refsect2>
535<title>Optional Lines in an APT Preferences Record</title>
ec2853a7 536
24f6490f
AL
537<para>Each record in the APT preferences file can optionally begin with
538one or more lines beginning with the word <literal>Explanation:</literal>.
539This provides a place for comments.</para>
24f6490f
AL
540</refsect2>
541</refsect1>
ec2853a7 542
24f6490f
AL
543<refsect1>
544<title>Examples</title>
545<refsect2>
546<title>Tracking Stable</title>
ec2853a7 547
24f6490f 548<para>The following APT preferences file will cause APT to assign a
ec2853a7 549priority higher than the default (500) to all package versions belonging
24f6490f
AL
550to a <literal>stable</literal> distribution and a prohibitively low priority to
551package versions belonging to other <literal>Debian</literal> distributions.
ec2853a7
AL
552
553<programlisting>
5b9d504e
AL
554Explanation: Uninstall or do not install any Debian-originated
555Explanation: package versions other than those in the stable distro
ec2853a7
AL
556Package: *
557Pin: release a=stable
558Pin-Priority: 900
559
ec2853a7
AL
560Package: *
561Pin: release o=Debian
562Pin-Priority: -10
563</programlisting>
564</para>
565
24f6490f 566<para>With a suitable &sources-list; file and the above preferences file,
ec2853a7 567any of the following commands will cause APT to upgrade to the
24f6490f 568latest <literal>stable</literal> version(s).
ec2853a7
AL
569
570<programlisting>
571apt-get install <replaceable>package-name</replaceable>
572apt-get upgrade
573apt-get dist-upgrade
574</programlisting>
575</para>
576
24f6490f
AL
577<para>The following command will cause APT to upgrade the specified
578package to the latest version from the <literal>testing</literal> distribution;
5b9d504e
AL
579the package will not be upgraded again unless this command is given
580again.
ec2853a7
AL
581
582<programlisting>
583apt-get install <replaceable>package</replaceable>/testing
584</programlisting>
24f6490f
AL
585</para>
586</refsect2>
ec2853a7 587
24f6490f
AL
588 <refsect2>
589 <title>Tracking Testing or Unstable</title>
ec2853a7 590
24f6490f
AL
591<para>The following APT preferences file will cause APT to assign
592a high priority to package versions from the <literal>testing</literal>
5b9d504e 593distribution, a lower priority to package versions from the
24f6490f
AL
594<literal>unstable</literal> distribution, and a prohibitively low priority
595to package versions from other <literal>Debian</literal> distributions.
ec2853a7
AL
596
597<programlisting>
598Package: *
599Pin: release a=testing
600Pin-Priority: 900
601
602Package: *
603Pin: release a=unstable
604Pin-Priority: 800
605
606Package: *
607Pin: release o=Debian
608Pin-Priority: -10
609</programlisting>
610</para>
611
24f6490f 612<para>With a suitable &sources-list; file and the above preferences file,
5b9d504e 613any of the following commands will cause APT to upgrade to the latest
24f6490f 614<literal>testing</literal> version(s).
ec2853a7
AL
615
616<programlisting>
617apt-get install <replaceable>package-name</replaceable>
618apt-get upgrade
619apt-get dist-upgrade
620</programlisting>
621</para>
622
623<para>The following command will cause APT to upgrade the specified
24f6490f 624package to the latest version from the <literal>unstable</literal> distribution.
5b9d504e 625Thereafter, <command>apt-get upgrade</command> will upgrade
24f6490f 626the package to the most recent <literal>testing</literal> version if that is
5b9d504e 627more recent than the installed version, otherwise, to the most recent
24f6490f 628<literal>unstable</literal> version if that is more recent than the installed
5b9d504e 629version.
ec2853a7
AL
630
631<programlisting>
632apt-get install <replaceable>package</replaceable>/unstable
633</programlisting>
634</para>
efc487fb
DK
635</refsect2>
636
637
638<refsect2>
639<title>Tracking the evolution of a codename release</title>
640
641<para>The following APT preferences file will cause APT to assign a
642priority higher than the default (500) to all package versions belonging
643to a specified codename of a distribution and a prohibitively low priority to
644package versions belonging to other <literal>Debian</literal> distributions,
645codenames and archives.
646Note that with this APT preference APT will follow the migration of a release
647from the archive <literal>testing</literal> to <literal>stable</literal> and
648later <literal>oldstable</literal>. If you want to follow for example the progress
649in <literal>testing</literal> notwithstanding the codename changes you should use
650the example configurations above.
651
652<programlisting>
653Explanation: Uninstall or do not install any Debian-originated package versions
e1dd65c9 654Explanation: other than those in the distribution codenamed with &testing-codename; or sid
efc487fb 655Package: *
e1dd65c9 656Pin: release n=&testing-codename;
efc487fb
DK
657Pin-Priority: 900
658
659Explanation: Debian unstable is always codenamed with sid
660Package: *
4a2bb9e6 661Pin: release n=sid
efc487fb
DK
662Pin-Priority: 800
663
664Package: *
665Pin: release o=Debian
666Pin-Priority: -10
667</programlisting>
668</para>
669
670<para>With a suitable &sources-list; file and the above preferences file,
671any of the following commands will cause APT to upgrade to the
e1dd65c9 672latest version(s) in the release codenamed with <literal>&testing-codename;</literal>.
efc487fb
DK
673
674<programlisting>
675apt-get install <replaceable>package-name</replaceable>
676apt-get upgrade
677apt-get dist-upgrade
678</programlisting>
679</para>
680
681<para>The following command will cause APT to upgrade the specified
682package to the latest version from the <literal>sid</literal> distribution.
683Thereafter, <command>apt-get upgrade</command> will upgrade
e1dd65c9 684the package to the most recent <literal>&testing-codename;</literal> version if that is
efc487fb
DK
685more recent than the installed version, otherwise, to the most recent
686<literal>sid</literal> version if that is more recent than the installed
687version.
ec2853a7 688
efc487fb
DK
689<programlisting>
690apt-get install <replaceable>package</replaceable>/sid
691</programlisting>
692</para>
24f6490f
AL
693</refsect2>
694</refsect1>
ec2853a7 695
daa4aa52
DK
696<refsect1>
697<title>Files</title>
698 <variablelist>
699 &file-preferences;
700 </variablelist>
701</refsect1>
702
24f6490f
AL
703<refsect1>
704<title>See Also</title>
5e80de29 705<para>&apt-get; &apt-cache; &apt-conf; &sources-list;
5b9d504e 706</para>
24f6490f 707</refsect1>
b2e465d6
AL
708
709 &manbugs;
ec2853a7 710
b2e465d6 711</refentry>