apt_preferences.5.sgml 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <!-- -*- mode: sgml; mode: fold -*- -->
  2. <!doctype refentry PUBLIC "-//OASIS//DTD DocBook V3.1//EN" [
  3. <!ENTITY % aptent SYSTEM "apt.ent">
  4. %aptent;
  5. ]>
  6. <refentry>
  7. &apt-docinfo;
  8. <refmeta>
  9. <refentrytitle>apt_preferences</>
  10. <manvolnum>5</>
  11. </refmeta>
  12. <!-- Man page title -->
  13. <refnamediv>
  14. <refname>apt_preferences</>
  15. <refpurpose>Preference control file for APT</>
  16. </refnamediv>
  17. <RefSect1><Title>Description</>
  18. <para>
  19. The APT preferences file controls various aspects of the APT system.
  20. It is ment to be user editable and manipulatable from software. The file
  21. consists of a number of records formed like the dpkg status file, space
  22. seperated sections of text with at the start of each line tags seperated
  23. by a colon. It is stored in <filename>/etc/apt/preferences</>.
  24. </RefSect1>
  25. <RefSect1><Title>Versioning</>
  26. <para>
  27. One purpose of the preferences file is to let the user select which version
  28. of a package will be installed. This selection can be made in a number of
  29. ways that fall into three categories, version, release and origin.
  30. <para>
  31. Selection by version can be done by exact match or prefix match. The format
  32. is <literal/2.1.2/ or <literal/2.2*/ for a prefix match. Matching by prefix
  33. can be used to ignore the <literal/r/ in the Debian release versioning, like
  34. <literal/2.1r*/ or to ignore Debian specific revisions, <literal/1.1-*/.
  35. When matching versions with a prefix the highest matching version will
  36. always be picked.
  37. <para>
  38. Selection by release is more complicated and has three forms. The primary
  39. purpose of release selections is to identify a set of packages that match
  40. a specific vendor, or release (ie Debian 2.1). The first two forms are
  41. shortcuts intended for quick command line use. If the first character of the
  42. specification is a digit then it is considered to be a release version match,
  43. otherwise a release label match. Specifications which contain equals are
  44. full release data matches and are a comma seperated list of one letter keys
  45. followed by an equals then by the string. Examples:
  46. <informalexample><programlisting>
  47. v=2.1*,o=Debian,c=main
  48. l=Debian
  49. a=stable
  50. </programlisting></informalexample>
  51. <para>
  52. The data for these matches are taken from the <filename/Release/ files
  53. that APT downloads during an <literal/update/. The available keys are:
  54. <VariableList>
  55. <VarListEntry><term>a= Archive</term>
  56. <ListItem><Para>
  57. This is the common name we give our archives, such as <literal/stable/ or
  58. <literal/unstable/. The special name <literal/now/ is used to designate
  59. the set of packages that are currently installed.
  60. </VarListEntry>
  61. <VarListEntry><term>c= Component</term>
  62. <ListItem><Para>
  63. Referes to the sub-component of the archive, <literal/main/,
  64. <literal/contrib/ etc. Component may be omitted if there are no
  65. components for this archive.
  66. </VarListEntry>
  67. <VarListEntry><term>v= Version</term>
  68. <ListItem><Para>
  69. This is a version string with the same properties as in the Packages file.
  70. It represents the release level of the archive. Typical Debian release
  71. numbers look like <literal/2.1r2/ with the r designating the release of
  72. 2.1. New releases are limited to security updates.
  73. </VarListEntry>
  74. <VarListEntry><term>o= Origin</term>
  75. <ListItem><Para>
  76. This specifies who is providing this archive. In the case of Debian the
  77. string will read <literal/Debian/. Other providers may use their own
  78. string.
  79. </VarListEntry>
  80. <VarListEntry><term><term>l= Label</term>
  81. <ListItem><Para>
  82. This carries the encompassing name of the distribution. For Debian proper
  83. this field reads <literal/Debian/. For derived distributions it should
  84. contain their proper name.
  85. </VarListEntry>
  86. </VariableList>
  87. <para>
  88. The final selection method is by origin. This is simply the site name
  89. of the originating package files. The empty string is used for file URIs.
  90. <para>
  91. Version selection, particularly the latter two methods, are used in may
  92. different part of APT, not just the preferences file.
  93. </RefSect1>
  94. <RefSect1><Title>Candidate Version Policy</>
  95. <para>
  96. Interaly APT maintains a list of all available versions for all packages.
  97. If you place multiple releases or vendors in your &sources-list; file then
  98. these features are available. By default APT selects the highest version
  99. from all automatic sources. Some sources, such as
  100. <filename>project/experimental</> are marked Not Automatic - these fall
  101. to the bottom of the selection pile.
  102. <para>
  103. When deciding what version to use APT assigns a priority to each available
  104. version of the package. It then does two things, first it selects
  105. the highest priorty version that is newer than the installed version of the
  106. package, then it selects the highest priority version that is older than
  107. the installed version. Next, if the older versions have a priority greater
  108. than 1000 they are compared with the priority of the upgrade set, the larger
  109. becomes the selected result. Otherwise the downgrade versions are ignored
  110. and the highest priority of the ugprade set is selected.
  111. <para>
  112. It is possible to think of the priorities in strata:
  113. <VariableList>
  114. <VarListEntry><term>1000 and up</term>
  115. <ListItem><Para>
  116. Downgradable priorities
  117. </VarListEntry>
  118. <VarListEntry><term>1000</term>
  119. <ListItem><Para>
  120. The downgrade prevention barrier
  121. </VarListEntry>
  122. <VarListEntry><term>100 to 1000</term>
  123. <ListItem><Para>
  124. Standard priorities. 990 is the priority set by the
  125. <option/--target-release / &apt-get; option. 989 is the start for auto
  126. priorities and 500 are all the default package files.
  127. </VarListEntry>
  128. <VarListEntry><term>100</term>
  129. <ListItem><Para>
  130. The currently installed version
  131. </VarListEntry>
  132. <VarListEntry><term>0 to 100</term>
  133. <ListItem><Para>
  134. Non automatic priorities. These are only used if the package
  135. is not installed and there is no other version available.
  136. </VarListEntry>
  137. <VarListEntry><term>less than 0</term>
  138. <ListItem><Para>
  139. The version is never selected.
  140. </VarListEntry>
  141. </VariableList>
  142. <para>
  143. Giving a pin a priority greater than 1000 will allow APT to downgrade
  144. in order to get to that version.
  145. <para>
  146. Each package may be pinned to a specific version and each Package file
  147. has a priority for every package inside. The highest priority assigned
  148. to a package is the one that is used.
  149. <para>
  150. A package pin looks like this:
  151. <informalexample><programlisting>
  152. Package: apt
  153. Pin: version 0.4.0
  154. Pin-Priority: 1001
  155. </programlisting></informalexample>
  156. The first line specifies the package, the second gives the Pin specification
  157. and the last gives the priority of this pin. The first word of the pin
  158. specification may be version, release or origin, the remainder of the field
  159. is described in the Versioning sectin above.
  160. <para>
  161. A default pin is how the priorities of package files are set. Any number
  162. of default pins may be specified, the first matching default will select
  163. the priority of the package file. Only release or origin may be used in
  164. the Pin specification since they match Package files.
  165. <informalexample><programlisting>
  166. Package: *
  167. Pin: release v=2.1*
  168. Pin-Priority: 998
  169. </programlisting></informalexample>
  170. <para>
  171. If the Pin-Priorty field is omitted then the priority defaults to 989 for
  172. both cases.
  173. <RefSect2><title>Interesting Effects</>
  174. <para>
  175. Due to the downgrade prevention barrier at priority 1000 it is possible
  176. that a lower priority version will be selected if the higher priority
  177. would casue a downgrade. For instance, if package foo has versions
  178. <literal/1.2/, <literal/1.1/ and <literal/1.0/ installed, with
  179. <literal/1.1/ being the currently installed version and the priorities of
  180. each version being 900, 100 and 950 repectively the winning version will be
  181. <literal/1.2/.
  182. <para>
  183. In practice this is often desired. A user may use a default pin to
  184. make the stable distribution the default and then use the
  185. <option/--target-dist/ option with &apt-get; to select newer versions
  186. from unstable. The packages that have been upgraded to unstable will
  187. continue to follow the versions that are available in unstable since
  188. the stable versions now fall below the downgrade prevention barrier.
  189. <para>
  190. If this is not desired then a default pin should be used to make unstable
  191. have a priority less than 100.
  192. <para>
  193. Users of 3rd party add ons such as Helix GNOME can use this mechanism to
  194. force the usage of Helix packages, or force the usage of Debian packages
  195. by setting the priority of that source sufficiently high. It is even
  196. possible to mass downgrade from one set of packages to another by
  197. using a priority larger than 1000.
  198. </RefSect2>
  199. </RefSect1>
  200. <RefSect1><Title>See Also</>
  201. <para>
  202. &apt-cache; &apt-conf;
  203. </RefSect1>
  204. &manbugs;
  205. &manauthor;
  206. </refentry>