files.sgml 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  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.2 1998/07/12 02:11:09 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>mirror<item>
  142. The mirror scheme is special in that it does not specify the location of a
  143. debian archive but specifies the location of a list of mirrors to use
  144. to access the archive. Some technique will be used to determine the
  145. best choice for a mirror. The mirror file is specified in the Mirror File
  146. section. If/when URIs take off they should obsolete this field.
  147. <example>
  148. mirror:http://www.debian.org/archivemirrors
  149. </example>
  150. <tag>smb<item>
  151. A possible future expansion may be to have direct support for smb (Samba
  152. servers).
  153. <example>
  154. smb://ftp.kernel.org/pub/mirrors/debian
  155. </example>
  156. </taglist>
  157. </sect1>
  158. <sect1>Hashing the URI
  159. <p>
  160. All permanent information aquired from any of the sources is stored in the
  161. lists directory. Thus, there must be a way to relate the filename in the
  162. lists directory to a line in the sourcelist. To simplify things this is
  163. done by quoting the URI and treating _'s as quoteable characters and
  164. converting / to _. The URI spec says this is done by converting a
  165. sensitive character into %xx where xx is the hexadecimal representation
  166. from the ascii character set. Examples:
  167. <example>
  168. http://www.debian.org/archive/dists/stable/binary-i386/Packages
  169. /var/state/apt/lists/www.debian.org_archive_dists_stable_binary-i386_Packages
  170. cdrom:Debian 1.3/debian/Packages
  171. /var/state/apt/info/Debian%201.3_debian_Packages
  172. </example>
  173. <p>
  174. The other alternative that was considered was to use a deep directory
  175. structure but this poses two problems, it makes it very difficult to prune
  176. directories back when sources are no longer used and complicates the handling
  177. of the partial directory. This gives a very simple way to deal with all
  178. of the situations that can arise. The equals sign was choosen on the
  179. suggestion of Manoj because it is very infrequently used in filenames.
  180. Also note that the same rules described in the <em>Archive Directory</>
  181. section regarding the partial sub dir apply here as well.
  182. </sect1>
  183. </sect>
  184. <!-- }}} -->
  185. <!-- Extra Status {{{ -->
  186. <!-- ===================================================================== -->
  187. <sect>Extra Status File (xstatus)
  188. <p>
  189. The extra status file serves the same purpose as the normal dpkg status file
  190. (/var/lib/dpkg/status) except that it stores information unique to diety.
  191. This includes the autoflag, target distribution and version and any other
  192. uniqe features that come up over time. It duplicates nothing from the normal
  193. dpkg status file. Please see other APT documentation for a discussion
  194. of the exact internal behavior of these fields. The Package field is
  195. placed directly before the new fields to indicate which package they
  196. apply to. The new fields are as follows:
  197. <taglist>
  198. <tag>X-Auto<item>
  199. The Auto flag can be Yes or No and controls whether the package is in
  200. auto mode.
  201. <tag>X-TargetDist<item>
  202. The TargetDist item indicates which distribution versions are offered for
  203. installation from. It should be stable, unstable or frozen.
  204. <tag>X-TargetVersion<item>
  205. The target version item is set if the user selects a specific version, it
  206. overrides the TargetDist selection if both are present.
  207. </taglist>
  208. </sect>
  209. <!-- }}} -->
  210. <!-- Binary Package Cache {{{ -->
  211. <!-- ===================================================================== -->
  212. <sect>Binary Package Cache (pkgcache.bin)
  213. <p>
  214. Please see cache.sgml for a complete description of what this file is. The
  215. cache file is updated whenever the contents of the lists directory changes.
  216. If the cache is erased, corrupted or of a non-matching version it will
  217. be automatically rebuilt by all of the tools that need it.
  218. <em>srcpkgcache.bin</> contains a cache of all of the package files in the
  219. source list. This allows regeneration of the cache when the status files
  220. change to use a prebuilt version for greater speed.
  221. </sect>
  222. <!-- }}} -->
  223. <!-- Downloads Directory {{{ -->
  224. <!-- ===================================================================== -->
  225. <sect>Downloads Directory (archives)
  226. <p>
  227. The archives directory is where all downloaded .deb archives go. When the
  228. file transfer is initiated the deb is placed in partial. Once the file
  229. is fully downloaded and its MD5 hash and size are verifitied it is moved
  230. from partial into archives/. Any files found in archives/ can be assumed
  231. to be verified.
  232. <p>
  233. No dirctory structure is transfered from the receiving site and all .deb
  234. file names conform to debian conventions. No short (msdos) filename should
  235. be placed in archives. If the need arises .debs should be unpacked, scanned
  236. and renamed to their correct internal names. This is mostly to prevent
  237. file name conflicts but other programs may depend on this if convenient.
  238. Downloaded .debs must be found in one of the package lists with an exact
  239. name + version match..
  240. </sect>
  241. <!-- }}} -->
  242. <!-- The Methods Directory {{{ -->
  243. <!-- ===================================================================== -->
  244. <sect> The Methods Directory (/usr/lib/apt/methods)
  245. <p>
  246. Like dselect, APT will support plugable acquisition methods to complement
  247. its internaly supported methods. The files in
  248. this directory are execultables named after the URI type. APT will
  249. sort the required URIs and spawn these programs giving a full sorted, quoted
  250. list of URIs.
  251. <p>
  252. The interface is simple, the program will be given a list
  253. of URIs on the command line. The URIs will be a pairs of strings, the first
  254. being the actual URI and the second being the filename to write the data to.
  255. The current directory will be set properly by APT and it is
  256. expected the method will put files relative to the current directory.
  257. The output of these programs is strictly speficied. The programs must accept
  258. nothing from stdin (stdin will be an invalid fd) and they must output
  259. status information to stdout according to the format below.
  260. Stderr will be redirected to the logging facility.
  261. <p>
  262. Each line sent to stdout must be a line that has a single letter and a
  263. space. Strings after the first letter do not need quoting, they are taken
  264. as is till the end of the line. The tag letters, listed in expected order,
  265. is as follows:
  266. <taglist>
  267. <tag>F - Change URI<item>
  268. This specifies a change in URI. All information after this will be applied
  269. to the new URI. When the URI is changed it is assumed that the old URI has
  270. completed unless an error is set. The format is <var>F URI</>
  271. <tag>S - Object Size<item>
  272. This specifies the expected size of the object. APT will use this to
  273. compute percent done figures. If it is not sent then a kilobyte meter
  274. will be used instead of a percent display. The foramat is <var>S INTEGER</>
  275. <tag>E - Error Information<item>
  276. Exactly one line of error information can be set for each URI. The
  277. information will be summarized for the user. If an E tag is send before
  278. any F tags then the error is assumed to be a fatal method error and all URI
  279. fetches for that method are aborted with that error string. The format
  280. is <var>E String</>
  281. <tag>I - Informative progress information<item>
  282. The I tag allows the method to specify the status of the connection.
  283. Typically the GUI will show the last recieved I line. The format is
  284. <var>I String</> As a general rule an I tag should be ommitted before a
  285. lengthy operation only. Things that always take a short period are not
  286. suited for I tags. I tags should change wnenever the methods state changes.
  287. Some standard forms, in order of occurance, are <var>Connecting to SITE</>,
  288. <var>Connecting to SITE (1.1.1.1)</>, <var>Waiting for file</>,
  289. <var>Authenticating</>, <var>Downloading</>, <var>Resuming (size)</>,
  290. <var>Computing MD5</> <var>I</> lines should never print out information that
  291. APT is already aware of, such as file names.
  292. <tag>R - Set final path<item>
  293. The R tag allows the method to tell APT that the file is present in the
  294. local file system. APT might copy it into a the download directory. The format
  295. is <var>R String</>
  296. <tag>M - MD5Sum of the file<item>
  297. The method is expected to compute the md5 hash on the fly as the download
  298. progresses. The final md5 of the file is to be output when the file is
  299. completed. If the md5 is not output it will not be checked! Some methods
  300. such as the file method will not check md5's because they are most
  301. commonly used on mirrors or local CD-ROM's, a paranoid option may be
  302. provided in future to force checking. The format is <var>M MD5-String</>
  303. <tag>L - Log output<item>
  304. This tag indicates a string that should be dumped to some log file. The
  305. string is for debugging and is not ment to be seen by the user. The format
  306. is <var>L String</> Log things should only be used in a completed method
  307. if they have special relavence to what is happening.
  308. </taglist>
  309. <p>
  310. APT monitors the progress of the transfer by watching the file size. This
  311. means the method must not create any temp files and must use a fairly small
  312. buffer. The method is also responsible for If-Modified-Since (IMS) queries
  313. for the object. It should check ../outputname to get the time stamp but not
  314. size. The size may be different because the file was uncompressed after
  315. it was transfed. A method must <em>never</> change the file in .., it may
  316. only change the output file in the current directory.
  317. <p>
  318. The APT 'http' program is the reference implementation of this specification,
  319. it implements all of the features a method is expected to do.
  320. </sect>
  321. <!-- }}} -->
  322. <!-- The Mirror List {{{ -->
  323. <!-- ===================================================================== -->
  324. <sect> The Mirror List
  325. <p>
  326. The mirror list is stored on the primary debian web server (www.debian.org)
  327. and contains a machine readable list of all known debian mirrors. The mirror
  328. URI type will cause this list to be downloaded and considered. It has the
  329. same form as the source list. When the source list specifies mirror
  330. as the target the mirror list is scanned to find the nescessary parts for
  331. the requested distributions and components. This means the user could
  332. have a line like:
  333. <var>deb mirror:http://www.debian.org/mirrorlist stable main non-us</var>
  334. which would likely cause APT to choose two separate sites to download from,
  335. one for main and another for non-us.
  336. <p>
  337. Some form of network measurement will have to be used to gauge performance
  338. of each of the mirrors. This will be discussed later, initial versions
  339. will use the first found URI.
  340. </sect>
  341. <!-- }}} -->
  342. <!-- The Release File {{{ -->
  343. <!-- ===================================================================== -->
  344. <sect> The Release File
  345. <p>
  346. This file plays and important role in how APT presents the archive to the
  347. user. Its main purpose is to present a descriptive name for the source
  348. of each version of each package. It also is used to detect when new versions
  349. of debian are released. It augments the package file it is associated with
  350. by providing meta information about the entire archive which the Packages
  351. file describes.
  352. <p>
  353. The full name of the distribution for presentation to the user is formed
  354. as 'label version archive', with a possible extended name being
  355. 'label version archive component'.
  356. <p>
  357. The file is formed as the package file (RFC-822) with the following tags
  358. defined:
  359. <taglist>
  360. <tag>Archive<item>
  361. This is the common name we give our archives, such as <em>stable</> or
  362. <em>unstable</>.
  363. <tag>Component<item>
  364. Referes to the sub-component of the archive, <em>main</>, <em>contrib</>
  365. etc.
  366. <tag>Version<item>
  367. This is a version string with the same properties as in the Packages file.
  368. It represents the release level of the archive.
  369. <tag>Origin<item>
  370. This specifies who is providing this archive. In the case of Debian the
  371. string will read 'Debian'. Other providers may use their own string
  372. <tag>Label<item>
  373. This carries the encompassing name of the distribution. For Debian proper
  374. this field reads 'Debian'. For derived distributions it should contain their
  375. proper name.
  376. <tag>Architecture<item>
  377. When the archive has packages for a single architecture then the Architecture
  378. is listed here. If a mixed set of systems are represented then this should
  379. contain the keyword <em>mixed</em>.
  380. <tag>NotAutomatic<item>
  381. A Yes/No flag indicating that the archive is extremely unstable and its
  382. version's should never be automatically selected. This is to be used by
  383. experimental.
  384. <tag>Description<item>
  385. Description is used to describe the release. For instance experimental would
  386. contain a warning that the packages have problems.
  387. </taglist>
  388. <p>
  389. The location of the Release file in the archive is very important, it must
  390. be located in the same location as the packages file so that it can be
  391. located in all situations. The following is an example for the current stable
  392. release, 1.3.1r6
  393. <example>
  394. Archive: stable
  395. Compontent: main
  396. Version: 1.3.1r6
  397. Origin: Debian
  398. Label: Debian
  399. Architecture: i386
  400. </example>
  401. This is an example of experimental,
  402. <example>
  403. Archive: experimental
  404. Version: 0
  405. Origin: Debian
  406. Label: Debian
  407. Architecture: mixed
  408. NotAutomatic: Yes
  409. </example>
  410. And unstable,
  411. <example>
  412. Archive: unstable
  413. Compontent: main
  414. Version: 2.1
  415. Origin: Debian
  416. Label: Debian
  417. Architecture: i386
  418. </example>
  419. </sect>
  420. <!-- }}} -->
  421. </book>