files.sgml 12 KB

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