files.sgml 15 KB

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