files.dbk 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- -*- DocBook -*- -->
  3. <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  4. "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  5. <!ENTITY % aptverbatiment SYSTEM "apt-verbatim.ent"> %aptverbatiment;
  6. ]>
  7. <book lang="en">
  8. <title>APT Files</title>
  9. <bookinfo>
  10. <authorgroup>
  11. <author>
  12. <personname>Jason Gunthorpe</personname><email>jgg@debian.org</email>
  13. </author>
  14. </authorgroup>
  15. <releaseinfo>Version &apt-product-version;</releaseinfo>
  16. <abstract>
  17. <para>
  18. This document describes the complete implementation and format of the installed
  19. APT directory structure. It also serves as guide to how APT views the Debian
  20. archive.
  21. </para>
  22. </abstract>
  23. <copyright><year>1998-1999</year><holder>Jason Gunthorpe</holder></copyright>
  24. <legalnotice>
  25. <title>License Notice</title>
  26. <para>
  27. "APT" and this document are free software; you can redistribute them and/or
  28. modify them under the terms of the GNU General Public License as published by
  29. the Free Software Foundation; either version 2 of the License, or (at your
  30. option) any later version.
  31. </para>
  32. <para>
  33. For more details, on Debian systems, see the file
  34. /usr/share/common-licenses/GPL for the full license.
  35. </para>
  36. </legalnotice>
  37. </bookinfo>
  38. <chapter id="ch1"><title>Introduction</title>
  39. <section id="s1.1"><title>General</title>
  40. <para>
  41. This document serves two purposes. The first is to document the installed
  42. directory structure and the format and purpose of each file. The second
  43. purpose is to document how APT views the Debian archive and deals with multiple
  44. package files.
  45. </para>
  46. <para>
  47. The var directory structure is as follows:
  48. </para>
  49. <screen>
  50. /var/lib/apt/
  51. lists/
  52. partial/
  53. periodic/
  54. extended_states
  55. cdroms.list
  56. /var/cache/apt/
  57. archives/
  58. partial/
  59. pkgcache.bin
  60. srcpkgcache.bin
  61. /etc/apt/
  62. sources.list.d/
  63. apt.conf.d/
  64. preferences.d/
  65. trusted.gpg.d/
  66. sources.list
  67. apt.conf
  68. apt_preferences
  69. trusted.gpg
  70. /usr/lib/apt/
  71. methods/
  72. bzip2
  73. cdrom
  74. copy
  75. file
  76. ftp
  77. gpgv
  78. gzip
  79. http
  80. https
  81. lzma
  82. rred
  83. rsh
  84. ssh
  85. </screen>
  86. <para>
  87. As is specified in the FHS 2.1 /var/lib/apt is used for application data that
  88. is not expected to be user modified. /var/cache/apt is used for regeneratable
  89. data and is where the package cache and downloaded .debs go. /etc/apt is the
  90. place where configuration should happen and /usr/lib/apt is the place where the
  91. apt and other packages can place binaries which can be used by the acquire
  92. system of APT.
  93. </para>
  94. </section>
  95. </chapter>
  96. <chapter id="ch2"><title>Files</title>
  97. <section id="s2.1"><title>Files and fragment directories in /etc/apt</title>
  98. <para>
  99. All files in /etc/apt are used to modify specific aspects of APT. To enable
  100. other packages to ship needed configuration herself all these files have a
  101. fragment directory packages can place their files in instead of mangling with
  102. the main files. The main files are therefore considered to be only used by the
  103. user and not by a package. The documentation omits this directories most of
  104. the time to be easier readable, so every time the documentation includes a
  105. reference to a main file it really means the file or the fragment directories.
  106. </para>
  107. </section>
  108. <section id="s2.2"><title>Distribution Source list (sources.list)</title>
  109. <para>
  110. The distribution source list is used to locate archives of the debian
  111. distribution. It is designed to support any number of active sources and to
  112. support a mix of source media. The file lists one source per line, with the
  113. fastest source listed first. The format of each line is:
  114. </para>
  115. <para>
  116. <replaceable>type uri args</replaceable>
  117. </para>
  118. <para>
  119. The first item, <replaceable>type</replaceable>, indicates the format for the
  120. remainder of the line. It is designed to indicate the structure of the
  121. distribution the line is talking about. Currently the only defined values are
  122. <emphasis>deb</emphasis> and <emphasis>deb-src</emphasis> which indicate a
  123. standard debian (source) archive with a dists directory. More about these
  124. types and the URI specification can be found in the sources.list manpage.
  125. </para>
  126. <section id="s2.2.1"><title>Hashing the URI</title>
  127. <para>
  128. All permanent information acquired from any of the sources is stored in the
  129. lists directory. Thus, there must be a way to relate the filename in the lists
  130. directory to a line in the sourcelist. To simplify things this is done by
  131. quoting the URI and treating _'s as quoteable characters and converting /
  132. to _. The URI spec says this is done by converting a sensitive character
  133. into %xx where xx is the hexadecimal representation from the ASCII character
  134. set. Examples:
  135. </para>
  136. <screen>
  137. http://www.debian.org/archive/dists/stable/binary-i386/Packages
  138. /var/lib/apt/lists/www.debian.org_archive_dists_stable_binary-i386_Packages
  139. cdrom:Debian 1.3/debian/Packages
  140. /var/lib/apt/info/Debian%201.3_debian_Packages
  141. </screen>
  142. <para>
  143. The other alternative that was considered was to use a deep directory structure
  144. but this poses two problems, it makes it very difficult to prune directories
  145. back when sources are no longer used and complicates the handling of the
  146. partial directory. This gives a very simple way to deal with all of the
  147. situations that can arise. Also note that the same rules described in the
  148. <emphasis>Archive Directory</emphasis> section regarding the partial sub dir
  149. apply here as well.
  150. </para>
  151. </section>
  152. </section>
  153. <section id="s2.3"><title>Extended States File (extended_states)</title>
  154. <para>
  155. The extended_states file serves the same purpose as the normal dpkg status
  156. file (/var/lib/dpkg/status) except that it stores information unique to
  157. apt. This includes currently only the autoflag but is open to store more
  158. unique data that come up over time. It duplicates nothing from the normal
  159. dpkg status file. Please see other APT documentation for a discussion of
  160. the exact internal behavior of these fields. The Package and the Architecture
  161. field are placed directly before the new fields to indicate which package
  162. they apply to. The new fields are as follows:
  163. </para>
  164. <variablelist>
  165. <varlistentry>
  166. <term>Auto-Installed</term>
  167. <listitem>
  168. <para>
  169. The Auto flag can be 1 (Yes) or 0 (No) and controls whether the package was
  170. automatical installed to satisfy a dependency or if the user requested the
  171. installation
  172. </para>
  173. </listitem>
  174. </varlistentry>
  175. </variablelist>
  176. </section>
  177. <section id="s2.4"><title>Binary Package Cache (srcpkgcache.bin and pkgcache.bin)</title>
  178. <para>
  179. Please see cache.sgml for a complete description of what this file
  180. is. The cache file is updated whenever the contents of the lists
  181. directory changes. If the cache is erased, corrupted or of a non-matching
  182. version it will be automatically rebuilt by all of the tools that need
  183. it. <emphasis>srcpkgcache.bin</emphasis> contains a cache of all of the
  184. package files in the source list. This allows regeneration of the cache
  185. when the status files change to use a prebuilt version for greater speed.
  186. </para>
  187. </section>
  188. <section id="s2.5"><title>Downloads Directory (archives)</title>
  189. <para>
  190. The archives directory is where all downloaded .deb archives go. When the file
  191. transfer is initiated the deb is placed in partial. Once the file is fully
  192. downloaded and its MD5 hash and size are verified it is moved from partial
  193. into archives/. Any files found in archives/ can be assumed to be verified.
  194. </para>
  195. <para>
  196. No directory structure is transferred from the receiving site and all .deb file
  197. names conform to debian conventions. No short (msdos) filename should be
  198. placed in archives. If the need arises .debs should be unpacked, scanned and
  199. renamed to their correct internal names. This is mostly to prevent file name
  200. conflicts but other programs may depend on this if convenient. A conforming
  201. .deb is one of the form, name_version_arch.deb. Our archive scripts do not
  202. handle epochs, but they are necessary and should be re-inserted. If necessary
  203. _'s and :'s in the fields should be quoted using the % convention. It must be
  204. possible to extract all 3 fields by examining the file name. Downloaded .debs
  205. must be found in one of the package lists with an exact name + version match..
  206. </para>
  207. </section>
  208. <section id="s2.6"><title>The Methods Directory (/usr/lib/apt/methods)</title>
  209. <para>
  210. The Methods directory is more fully described in the APT Methods interface
  211. document.
  212. </para>
  213. </section>
  214. <section id="s2.7"><title>The Configuration File (/etc/apt/apt.conf)</title>
  215. <para>
  216. The configuration file (and the associated fragments directory
  217. /etc/apt/apt.conf.d/) is described in the apt.conf manpage.
  218. </para>
  219. </section>
  220. <section id="s2.8"><title>The trusted.gpg File (/etc/apt/trusted.gpg)</title>
  221. <para>
  222. The trusted.gpg file (and the files in the associated fragments directory
  223. /etc/apt/trusted.gpg.d/) is a binary file including the keyring used by apt to
  224. validate that the information (e.g. the Release file) it downloads are really
  225. from the distributor it clams to be and is unmodified and is therefore the last
  226. step in the chain of trust between the archive and the end user. This security
  227. system is described in the apt-secure manpage.
  228. </para>
  229. </section>
  230. <section id="s2.9"><title>The Release File</title>
  231. <para>
  232. This file plays an important role in how APT presents the archive to the
  233. user. Its main purpose is to present a descriptive name for the source of
  234. each version of each package. It also is used to detect when new versions
  235. of debian are released. It augments the package file it is associated with
  236. by providing meta information about the entire archive which the Packages
  237. file describes.
  238. </para>
  239. <para>
  240. The full name of the distribution for presentation to the user is formed as
  241. 'label version archive', with a possible extended name being 'label version
  242. archive component'.
  243. </para>
  244. <para>
  245. The file is formed as the package file (RFC-822) with the following tags
  246. defined:
  247. </para>
  248. <variablelist>
  249. <varlistentry>
  250. <term>Archive</term>
  251. <listitem>
  252. <para>
  253. This is the common name we give our archives, such as
  254. <emphasis>stable</emphasis> or <emphasis>unstable</emphasis>.
  255. </para>
  256. </listitem>
  257. </varlistentry>
  258. <varlistentry>
  259. <term>Component</term>
  260. <listitem>
  261. <para>
  262. Refers to the sub-component of the archive, <emphasis>main</emphasis>,
  263. <emphasis>contrib</emphasis> etc. Component may be omitted if there are no
  264. components for this archive.
  265. </para>
  266. </listitem>
  267. </varlistentry>
  268. <varlistentry>
  269. <term>Version</term>
  270. <listitem>
  271. <para>
  272. This is a version string with the same properties as in the Packages file. It
  273. represents the release level of the archive.
  274. </para>
  275. </listitem>
  276. </varlistentry>
  277. <varlistentry>
  278. <term>Origin</term>
  279. <listitem>
  280. <para>
  281. This specifies who is providing this archive. In the case of Debian the string
  282. will read 'Debian'. Other providers may use their own string
  283. </para>
  284. </listitem>
  285. </varlistentry>
  286. <varlistentry>
  287. <term>Label</term>
  288. <listitem>
  289. <para>
  290. This carries the encompassing name of the distribution. For Debian proper this
  291. field reads 'Debian'. For derived distributions it should contain their proper
  292. name.
  293. </para>
  294. </listitem>
  295. </varlistentry>
  296. <varlistentry>
  297. <term>Architecture</term>
  298. <listitem>
  299. <para>
  300. When the archive has packages for a single architecture then the Architecture
  301. is listed here. If a mixed set of systems are represented then this should
  302. contain the keyword <emphasis>mixed</emphasis>.
  303. </para>
  304. </listitem>
  305. </varlistentry>
  306. <varlistentry>
  307. <term>NotAutomatic</term>
  308. <listitem>
  309. <para>
  310. A Yes/No flag indicating that the archive is extremely unstable and its
  311. version's should never be automatically selected. This is to be used by
  312. experimental.
  313. </para>
  314. </listitem>
  315. </varlistentry>
  316. <varlistentry>
  317. <term>Description</term>
  318. <listitem>
  319. <para>
  320. Description is used to describe the release. For instance experimental would
  321. contain a warning that the packages have problems.
  322. </para>
  323. </listitem>
  324. </varlistentry>
  325. </variablelist>
  326. <para>
  327. The location of the Release file in the archive is very important, it must be
  328. located in the same location as the packages file so that it can be located in
  329. all situations. The following is an example for the current stable release,
  330. 1.3.1r6
  331. </para>
  332. <screen>
  333. Archive: stable
  334. Component: main
  335. Version: 1.3.1r6
  336. Origin: Debian
  337. Label: Debian
  338. Architecture: i386
  339. </screen>
  340. <para>
  341. This is an example of experimental,
  342. </para>
  343. <screen>
  344. Archive: experimental
  345. Version: 0
  346. Origin: Debian
  347. Label: Debian
  348. Architecture: mixed
  349. NotAutomatic: Yes
  350. </screen>
  351. <para>
  352. And unstable,
  353. </para>
  354. <screen>
  355. Archive: unstable
  356. Component: main
  357. Version: 2.1
  358. Origin: Debian
  359. Label: Debian
  360. Architecture: i386
  361. </screen>
  362. </section>
  363. </chapter>
  364. </book>