apt_preferences.5.xml 26 KB

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