files.sgml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  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 GNU/Linux 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 value is <em>deb</em>
  106. which indicates a standard debian archive with a dists dir.
  107. <sect1>The deb Type
  108. <p>
  109. The <em>deb</em> type is to be a typical two level debian distributions,
  110. dist/<var>distribution</var>/<var>component</var>. Typically distribution
  111. is one of stable, unstable or testing while component is one of main,
  112. contrib, non-free or non-us. The format for the deb line is as follows:
  113. <p>
  114. deb <var>uri</var> <var>distribution</var> <var>component</var>
  115. [<var>component</var> ...]
  116. <p>
  117. <var>uri</var> for the <em>deb</em> type must specify the base of the
  118. debian distribution. APT will automatically generate the proper longer
  119. URIs to get the information it needs. <var>distribution</var> can specify
  120. an exact path, in this case the components must be omitted and
  121. <var>distribution</var> must end in a slash.
  122. <p>
  123. Since only one distribution can be specified per deb line it may be
  124. necessary to list a number of deb lines for the same URI. APT will
  125. sort the URI list after it has generated a complete set to allow
  126. connection reuse. It is important to order things in the sourcelist
  127. from most preferred to least preferred (fastest to slowest).
  128. </sect1>
  129. <sect1>URI specification
  130. <p>
  131. URIs in the source list support a large number of access schemes which
  132. are listed in the sources.list manpage and can be further extended by
  133. transport binaries placed in /usr/lib/apt/methods. The most important
  134. builtin schemes are:
  135. <taglist>
  136. <tag>cdrom<item>
  137. The cdrom scheme is special in that If Modified Since queries are never
  138. performed and that APT knows how to match a cdrom to the name it
  139. was given when first inserted. APT also knows all of the possible
  140. mount points the cdrom drives and that the user should be prompted
  141. to insert a CD if it cannot be found. The path is relative to an
  142. arbitrary mount point (of APT's choosing) and must not start with a
  143. slash. The first pathname component is the given name and is purely
  144. descriptive and of the users choice. However, if a file in the root of
  145. the cdrom is called '.disk/info' its contents will be used instead of
  146. prompting. The name serves as a tag for the cdrom and should be unique.
  147. <example>
  148. cdrom:Debian 1.3/debian
  149. </example>
  150. <tag>http<item>
  151. This scheme specifies a HTTP server for the debian archive. HTTP is preferred
  152. over FTP because If Modified Since queries against the Package file are
  153. possible as well as deep pipelining and resume capabilities.
  154. <example>
  155. http://www.debian.org/archive
  156. </example>
  157. <tag>ftp<item>
  158. This scheme specifies a FTP connection to the server. FTP is limited because
  159. there is no support for IMS and is hard to proxy over firewalls.
  160. <example>
  161. ftp://ftp.debian.org/debian
  162. </example>
  163. <tag>file<item>
  164. The file scheme allows an arbitrary directory in the file system to be
  165. considered as a debian archive. This is useful for NFS mounts and
  166. local mirrors/archives.
  167. <example>
  168. file:/var/debian
  169. </example>
  170. </taglist>
  171. </sect1>
  172. <sect1>Hashing the URI
  173. <p>
  174. All permanent information acquired from any of the sources is stored in the
  175. lists directory. Thus, there must be a way to relate the filename in the
  176. lists directory to a line in the sourcelist. To simplify things this is
  177. done by quoting the URI and treating _'s as quoteable characters and
  178. converting / to _. The URI spec says this is done by converting a
  179. sensitive character into %xx where xx is the hexadecimal representation
  180. from the ASCII character set. Examples:
  181. <example>
  182. http://www.debian.org/archive/dists/stable/binary-i386/Packages
  183. /var/lib/apt/lists/www.debian.org_archive_dists_stable_binary-i386_Packages
  184. cdrom:Debian 1.3/debian/Packages
  185. /var/lib/apt/info/Debian%201.3_debian_Packages
  186. </example>
  187. <p>
  188. The other alternative that was considered was to use a deep directory
  189. structure but this poses two problems, it makes it very difficult to prune
  190. directories back when sources are no longer used and complicates the handling
  191. of the partial directory. This gives a very simple way to deal with all
  192. of the situations that can arise. Also note that the same rules described in
  193. the <em>Archive Directory</> section regarding the partial sub dir apply
  194. here as well.
  195. </sect1>
  196. </sect>
  197. <!-- }}} -->
  198. <!-- Extended Status {{{ -->
  199. <!-- ===================================================================== -->
  200. <sect>Extended States File (extended_states)
  201. <p>
  202. The extended_states file serves the same purpose as the normal dpkg status file
  203. (/var/lib/dpkg/status) except that it stores information unique to apt.
  204. This includes currently only the autoflag but is open to store more
  205. unique data that come up over time. It duplicates nothing from the normal
  206. dpkg status file. Please see other APT documentation for a discussion
  207. of the exact internal behaviour of these fields. The Package and the
  208. Architecture field are placed directly before the new fields to indicate
  209. which package they apply to. The new fields are as follows:
  210. <taglist>
  211. <tag>Auto-Installed<item>
  212. The Auto flag can be 1 (Yes) or 0 (No) and controls whether the package
  213. was automatical installed to satisfy a dependency or if the user requested
  214. the installation
  215. </taglist>
  216. </sect>
  217. <!-- }}} -->
  218. <!-- Binary Package Cache {{{ -->
  219. <!-- ===================================================================== -->
  220. <sect>Binary Package Cache (srcpkgcache.bin and pkgcache.bin)
  221. <p>
  222. Please see cache.sgml for a complete description of what this file is. The
  223. cache file is updated whenever the contents of the lists directory changes.
  224. If the cache is erased, corrupted or of a non-matching version it will
  225. be automatically rebuilt by all of the tools that need it.
  226. <em>srcpkgcache.bin</> contains a cache of all of the package files in the
  227. source list. This allows regeneration of the cache when the status files
  228. change to use a prebuilt version for greater speed.
  229. </sect>
  230. <!-- }}} -->
  231. <!-- Downloads Directory {{{ -->
  232. <!-- ===================================================================== -->
  233. <sect>Downloads Directory (archives)
  234. <p>
  235. The archives directory is where all downloaded .deb archives go. When the
  236. file transfer is initiated the deb is placed in partial. Once the file
  237. is fully downloaded and its MD5 hash and size are verified it is moved
  238. from partial into archives/. Any files found in archives/ can be assumed
  239. to be verified.
  240. <p>
  241. No directory structure is transfered from the receiving site and all .deb
  242. file names conform to debian conventions. No short (msdos) filename should
  243. be placed in archives. If the need arises .debs should be unpacked, scanned
  244. and renamed to their correct internal names. This is mostly to prevent
  245. file name conflicts but other programs may depend on this if convenient.
  246. A conforming .deb is one of the form, name_version_arch.deb. Our archive
  247. scripts do not handle epochs, but they are necessary and should be re-inserted.
  248. If necessary _'s and :'s in the fields should be quoted using the % convention.
  249. It must be possible to extract all 3 fields by examining the file name.
  250. Downloaded .debs must be found in one of the package lists with an exact
  251. name + version match..
  252. </sect>
  253. <!-- }}} -->
  254. <!-- The Methods Directory {{{ -->
  255. <!-- ===================================================================== -->
  256. <sect> The Methods Directory (/usr/lib/apt/methods)
  257. <p>
  258. The Methods directory is more fully described in the APT Methods interface
  259. document.
  260. </sect>
  261. <!-- }}} -->
  262. <!-- The Configuration File {{{ -->
  263. <!-- ===================================================================== -->
  264. <sect> The Configuration File (/etc/apt/apt.conf)
  265. <p>
  266. The configuration file (and the associated fragments directory
  267. /etc/apt/apt.conf.d/) is described in the apt.conf manpage.
  268. </sect>
  269. <!-- }}} -->
  270. <!-- The trusted.gpg File {{{ -->
  271. <!-- ===================================================================== -->
  272. <sect> The trusted.gpg File (/etc/apt/trusted.gpg)
  273. <p>
  274. The trusted.gpg file (and the files in the associated fragments directory
  275. /etc/apt/trusted.gpg.d/) is a binary file including the keyring used
  276. by apt to validate that the information (e.g. the Release file) it
  277. downloads are really from the distributor it clams to be and is
  278. unmodified and is therefore the last step in the chain of trust between
  279. the archive and the end user. This security system is described in the
  280. apt-secure manpage.
  281. </sect>
  282. <!-- }}} -->
  283. <!-- The Release File {{{ -->
  284. <!-- ===================================================================== -->
  285. <sect> The Release File
  286. <p>
  287. This file plays an important role in how APT presents the archive to the
  288. user. Its main purpose is to present a descriptive name for the source
  289. of each version of each package. It also is used to detect when new versions
  290. of debian are released. It augments the package file it is associated with
  291. by providing meta information about the entire archive which the Packages
  292. file describes.
  293. <p>
  294. The full name of the distribution for presentation to the user is formed
  295. as 'label version archive', with a possible extended name being
  296. 'label version archive component'.
  297. <p>
  298. The file is formed as the package file (RFC-822) with the following tags
  299. defined:
  300. <taglist>
  301. <tag>Archive<item>
  302. This is the common name we give our archives, such as <em>stable</> or
  303. <em>unstable</>.
  304. <tag>Component<item>
  305. Refers to the sub-component of the archive, <em>main</>, <em>contrib</>
  306. etc. Component may be omitted if there are no components for this archive.
  307. <tag>Version<item>
  308. This is a version string with the same properties as in the Packages file.
  309. It represents the release level of the archive.
  310. <tag>Origin<item>
  311. This specifies who is providing this archive. In the case of Debian the
  312. string will read 'Debian'. Other providers may use their own string
  313. <tag>Label<item>
  314. This carries the encompassing name of the distribution. For Debian proper
  315. this field reads 'Debian'. For derived distributions it should contain their
  316. proper name.
  317. <tag>Architecture<item>
  318. When the archive has packages for a single architecture then the Architecture
  319. is listed here. If a mixed set of systems are represented then this should
  320. contain the keyword <em>mixed</em>.
  321. <tag>NotAutomatic<item>
  322. A Yes/No flag indicating that the archive is extremely unstable and its
  323. version's should never be automatically selected. This is to be used by
  324. experimental.
  325. <tag>Description<item>
  326. Description is used to describe the release. For instance experimental would
  327. contain a warning that the packages have problems.
  328. </taglist>
  329. <p>
  330. The location of the Release file in the archive is very important, it must
  331. be located in the same location as the packages file so that it can be
  332. located in all situations. The following is an example for the current stable
  333. release, 1.3.1r6
  334. <example>
  335. Archive: stable
  336. Component: main
  337. Version: 1.3.1r6
  338. Origin: Debian
  339. Label: Debian
  340. Architecture: i386
  341. </example>
  342. This is an example of experimental,
  343. <example>
  344. Archive: experimental
  345. Version: 0
  346. Origin: Debian
  347. Label: Debian
  348. Architecture: mixed
  349. NotAutomatic: Yes
  350. </example>
  351. And unstable,
  352. <example>
  353. Archive: unstable
  354. Component: main
  355. Version: 2.1
  356. Origin: Debian
  357. Label: Debian
  358. Architecture: i386
  359. </example>
  360. </sect>
  361. <!-- }}} -->
  362. </book>