files.sgml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443
  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. xstatus
  40. userstatus
  41. cdroms.list
  42. /var/cache/apt/
  43. pkgcache.bin
  44. srcpkgcache.bin
  45. archives/
  46. partial/
  47. /etc/apt/
  48. sources.list
  49. apt.conf
  50. /usr/lib/apt/
  51. methods/
  52. cdrom
  53. ftp
  54. http
  55. file
  56. gzip
  57. copy
  58. </example>
  59. <p>
  60. As is specified in the FHS 2.1 /var/lib/apt is used for application
  61. data that is not expected to be user modified. /var/cache/apt is used
  62. for regeneratable data and is where the package cache and downloaded .debs
  63. go.
  64. </sect>
  65. <!-- }}} -->
  66. <chapt>Files
  67. <!-- Distribution Source List {{{ -->
  68. <!-- ===================================================================== -->
  69. <sect>Distribution Source list (sources.list)
  70. <p>
  71. The distribution source list is used to locate archives of the debian
  72. distribution. It is designed to support any number of active sources and to
  73. support a mix of source media. The file lists one source per line, with the
  74. fastest source listed first. The format of each line is:
  75. <p>
  76. <var>type uri args</var>
  77. <p>
  78. The first item, <var>type</var>, indicates the format for the remainder
  79. of the line. It is designed to indicate the structure of the distribution
  80. the line is talking about. Currently the only defined value is <em>deb</em>
  81. which indicates a standard debian archive with a dists dir.
  82. <sect1>The deb Type
  83. <p>
  84. The <em>deb</em> type is to be a typical two level debian distributions,
  85. dist/<var>distribution</var>/<var>component</var>. Typically distribution
  86. is one of stable, unstable or testing while component is one of main,
  87. contrib, non-free or non-us. The format for the deb line is as follows:
  88. <p>
  89. deb <var>uri</var> <var>distribution</var> <var>component</var>
  90. [<var>component</var> ...]
  91. <p>
  92. <var>uri</var> for the <em>deb</em> type must specify the base of the
  93. debian distribution. APT will automatically generate the proper longer
  94. URIs to get the information it needs. <var>distribution</var> can specify
  95. an exact path, in this case the components must be omitted and
  96. <var>distribution</var> must end in a slash.
  97. <p>
  98. Since only one distribution can be specified per deb line it may be
  99. necessary to list a number of deb lines for the same URI. APT will
  100. sort the URI list after it has generated a complete set to allow
  101. connection reuse. It is important to order things in the sourcelist
  102. from most preferred to least preferred (fastest to slowest).
  103. </sect1>
  104. <sect1>URI specification
  105. <p>
  106. URIs in the source list support a large number of access schemes.
  107. <taglist>
  108. <tag>cdrom<item>
  109. The cdrom scheme is special in that If Modified Since queries are never
  110. performed and that APT knows how to match a cdrom to the name it
  111. was given when first inserted. APT also knows all of the possible
  112. mount points the cdrom drives and that the user should be prompted
  113. to insert a CD if it cannot be found. The path is relative to an
  114. arbitrary mount point (of APT's choosing) and must not start with a
  115. slash. The first pathname component is the given name and is purely
  116. descriptive and of the users choice. However, if a file in the root of
  117. the cdrom is called '.disk/info' its contents will be used instead of
  118. prompting. The name serves as a tag for the cdrom and should be unique.
  119. <example>
  120. cdrom:Debian 1.3/debian
  121. </example>
  122. <tag>http<item>
  123. This scheme specifies a HTTP server for the debian archive. HTTP is preferred
  124. over FTP because If Modified Since queries against the Package file are
  125. possible as well as deep pipelining and resume capabilities.
  126. <example>
  127. http://www.debian.org/archive
  128. </example>
  129. <tag>ftp<item>
  130. This scheme specifies a FTP connection to the server. FTP is limited because
  131. there is no support for IMS and is hard to proxy over firewalls.
  132. <example>
  133. ftp://ftp.debian.org/debian
  134. </example>
  135. <tag>file<item>
  136. The file scheme allows an arbitrary directory in the file system to be
  137. considered as a debian archive. This is useful for NFS mounts and
  138. local mirrors/archives.
  139. <example>
  140. file:/var/debian
  141. </example>
  142. <tag>smb<item>
  143. A possible future expansion may be to have direct support for smb (Samba
  144. servers).
  145. <example>
  146. smb://ftp.kernel.org/pub/mirrors/debian
  147. </example>
  148. </taglist>
  149. </sect1>
  150. <sect1>Hashing the URI
  151. <p>
  152. All permanent information acquired from any of the sources is stored in the
  153. lists directory. Thus, there must be a way to relate the filename in the
  154. lists directory to a line in the sourcelist. To simplify things this is
  155. done by quoting the URI and treating _'s as quoteable characters and
  156. converting / to _. The URI spec says this is done by converting a
  157. sensitive character into %xx where xx is the hexadecimal representation
  158. from the ASCII character set. Examples:
  159. <example>
  160. http://www.debian.org/archive/dists/stable/binary-i386/Packages
  161. /var/lib/apt/lists/www.debian.org_archive_dists_stable_binary-i386_Packages
  162. cdrom:Debian 1.3/debian/Packages
  163. /var/lib/apt/info/Debian%201.3_debian_Packages
  164. </example>
  165. <p>
  166. The other alternative that was considered was to use a deep directory
  167. structure but this poses two problems, it makes it very difficult to prune
  168. directories back when sources are no longer used and complicates the handling
  169. of the partial directory. This gives a very simple way to deal with all
  170. of the situations that can arise. Also note that the same rules described in
  171. the <em>Archive Directory</> section regarding the partial sub dir apply
  172. here as well.
  173. </sect1>
  174. </sect>
  175. <!-- }}} -->
  176. <!-- Extra Status {{{ -->
  177. <!-- ===================================================================== -->
  178. <sect>Extra Status File (xstatus)
  179. <p>
  180. The extra status file serves the same purpose as the normal dpkg status file
  181. (/var/lib/dpkg/status) except that it stores information unique to apt.
  182. This includes the autoflag, target distribution and version and any other
  183. unique features that come up over time. It duplicates nothing from the normal
  184. dpkg status file. Please see other APT documentation for a discussion
  185. of the exact internal behaviour of these fields. The Package field is
  186. placed directly before the new fields to indicate which package they
  187. apply to. The new fields are as follows:
  188. <taglist>
  189. <tag>X-Auto<item>
  190. The Auto flag can be Yes or No and controls whether the package is in
  191. auto mode.
  192. <tag>X-TargetDist<item>
  193. The TargetDist item indicates which distribution versions are offered for
  194. installation from. It should be stable, unstable or testing.
  195. <tag>X-TargetVersion<item>
  196. The target version item is set if the user selects a specific version, it
  197. overrides the TargetDist selection if both are present.
  198. </taglist>
  199. </sect>
  200. <!-- }}} -->
  201. <!-- Binary Package Cache {{{ -->
  202. <!-- ===================================================================== -->
  203. <sect>Binary Package Cache (pkgcache.bin)
  204. <p>
  205. Please see cache.sgml for a complete description of what this file is. The
  206. cache file is updated whenever the contents of the lists directory changes.
  207. If the cache is erased, corrupted or of a non-matching version it will
  208. be automatically rebuilt by all of the tools that need it.
  209. <em>srcpkgcache.bin</> contains a cache of all of the package files in the
  210. source list. This allows regeneration of the cache when the status files
  211. change to use a prebuilt version for greater speed.
  212. </sect>
  213. <!-- }}} -->
  214. <!-- Downloads Directory {{{ -->
  215. <!-- ===================================================================== -->
  216. <sect>Downloads Directory (archives)
  217. <p>
  218. The archives directory is where all downloaded .deb archives go. When the
  219. file transfer is initiated the deb is placed in partial. Once the file
  220. is fully downloaded and its MD5 hash and size are verified it is moved
  221. from partial into archives/. Any files found in archives/ can be assumed
  222. to be verified.
  223. <p>
  224. No directory structure is transfered from the receiving site and all .deb
  225. file names conform to debian conventions. No short (msdos) filename should
  226. be placed in archives. If the need arises .debs should be unpacked, scanned
  227. and renamed to their correct internal names. This is mostly to prevent
  228. file name conflicts but other programs may depend on this if convenient.
  229. A conforming .deb is one of the form, name_version_arch.deb. Our archive
  230. scripts do not handle epochs, but they are necessary and should be re-inserted.
  231. If necessary _'s and :'s in the fields should be quoted using the % convention.
  232. It must be possible to extract all 3 fields by examining the file name.
  233. Downloaded .debs must be found in one of the package lists with an exact
  234. name + version match..
  235. </sect>
  236. <!-- }}} -->
  237. <!-- The Methods Directory {{{ -->
  238. <!-- ===================================================================== -->
  239. <sect> The Methods Directory (/usr/lib/apt/methods)
  240. <p>
  241. The Methods directory is more fully described in the APT Methods interface
  242. document.
  243. </sect>
  244. <!-- }}} -->
  245. <!-- The Mirror List {{{ -->
  246. <!-- ===================================================================== -->
  247. <sect> The Mirror List
  248. <p>
  249. The mirror list is stored on the primary debian web server (www.debian.org)
  250. and contains a machine readable list of all known debian mirrors. It's
  251. format and style mirror the Package file.
  252. <taglist>
  253. <tag>Site<item>
  254. This is the proper host name of the site. It should not be a host within
  255. debian.org and generally cnames should be avoided here.
  256. <tag>Aliases<item>
  257. These list any commonly used aliases for the site. This field is used to make
  258. sure that a site is not added twice.
  259. <tag>Type<item>
  260. This field can either be <em>Push-Primary</> or <em>leaf</>.
  261. <em>Push-Primary</> are authorized top level mirrors of the archive, all
  262. other mirrors are leaf.
  263. <tag>Archive-[access]<item>
  264. The Archive field gives the path(s) to the debian archive. [access]
  265. specifies the access method and may be one of ftp, http, rsync, nfs, or
  266. smb. For many of the types it is possible to prefix the path with :###
  267. indicating that an alternate port should be used. Generally paths
  268. start with a / and end with a /, rsync is an exception in that the
  269. first directory component is not a path but a label.
  270. <tag>WWW-[access]<item>
  271. The WWW field gives the path(s) to the debian web site.
  272. <tag>CDImage-[access]<item>
  273. The WWW field gives the path(s) to the debian CD-ROM images
  274. <tag>Incoming-[access]<item>
  275. The Incoming field gives the path(s) to a mirror of the debian incoming
  276. directory.
  277. <tag>nonUS-[access]<item>
  278. The nonUS field gives the path(s) to a mirror of the non-US distribution.
  279. <tag>Maintainer<item>
  280. This is the email address of the maintainer of the mirror.
  281. <tag>Location<item>
  282. Location gives the general geographical region the mirror is in.
  283. <tag>Sponsor<item>
  284. The Sponsor field indicates who owns the mirror and a URL to a web page
  285. describing the organization.
  286. <tag>Comment<item>
  287. General free-form text.
  288. </taglist>
  289. <p>
  290. Some form of network measurement will have to be used to gauge performance
  291. of each of the mirrors. This will be discussed later, initial versions
  292. will use the first found URI.
  293. </sect>
  294. <!-- }}} -->
  295. <!-- The Release File {{{ -->
  296. <!-- ===================================================================== -->
  297. <sect> The Release File
  298. <p>
  299. This file plays and important role in how APT presents the archive to the
  300. user. Its main purpose is to present a descriptive name for the source
  301. of each version of each package. It also is used to detect when new versions
  302. of debian are released. It augments the package file it is associated with
  303. by providing meta information about the entire archive which the Packages
  304. file describes.
  305. <p>
  306. The full name of the distribution for presentation to the user is formed
  307. as 'label version archive', with a possible extended name being
  308. 'label version archive component'.
  309. <p>
  310. The file is formed as the package file (RFC-822) with the following tags
  311. defined:
  312. <taglist>
  313. <tag>Archive<item>
  314. This is the common name we give our archives, such as <em>stable</> or
  315. <em>unstable</>.
  316. <tag>Component<item>
  317. Refers to the sub-component of the archive, <em>main</>, <em>contrib</>
  318. etc. Component may be omitted if there are no components for this archive.
  319. <tag>Version<item>
  320. This is a version string with the same properties as in the Packages file.
  321. It represents the release level of the archive.
  322. <tag>Origin<item>
  323. This specifies who is providing this archive. In the case of Debian the
  324. string will read 'Debian'. Other providers may use their own string
  325. <tag>Label<item>
  326. This carries the encompassing name of the distribution. For Debian proper
  327. this field reads 'Debian'. For derived distributions it should contain their
  328. proper name.
  329. <tag>Architecture<item>
  330. When the archive has packages for a single architecture then the Architecture
  331. is listed here. If a mixed set of systems are represented then this should
  332. contain the keyword <em>mixed</em>.
  333. <tag>NotAutomatic<item>
  334. A Yes/No flag indicating that the archive is extremely unstable and its
  335. version's should never be automatically selected. This is to be used by
  336. experimental.
  337. <tag>Description<item>
  338. Description is used to describe the release. For instance experimental would
  339. contain a warning that the packages have problems.
  340. </taglist>
  341. <p>
  342. The location of the Release file in the archive is very important, it must
  343. be located in the same location as the packages file so that it can be
  344. located in all situations. The following is an example for the current stable
  345. release, 1.3.1r6
  346. <example>
  347. Archive: stable
  348. Component: main
  349. Version: 1.3.1r6
  350. Origin: Debian
  351. Label: Debian
  352. Architecture: i386
  353. </example>
  354. This is an example of experimental,
  355. <example>
  356. Archive: experimental
  357. Version: 0
  358. Origin: Debian
  359. Label: Debian
  360. Architecture: mixed
  361. NotAutomatic: Yes
  362. </example>
  363. And unstable,
  364. <example>
  365. Archive: unstable
  366. Component: main
  367. Version: 2.1
  368. Origin: Debian
  369. Label: Debian
  370. Architecture: i386
  371. </example>
  372. </sect>
  373. <!-- }}} -->
  374. </book>