1 <!-- -*- mode: sgml; mode: fold -*- -->
2 <!doctype debiandoc PUBLIC "-//DebianDoc//DTD DebianDoc//EN">
4 <title>APT Files</title>
6 <author>Jason Gunthorpe <email>jgg@debian.org</email></author>
7 <version>$Id: files.sgml,v 1.10 2002/09/15 23:14:34 jgg Exp $</version>
10 This document describes the complete implementation and format of the
11 installed APT directory structure. It also serves as guide to how APT
12 views the Debian archive.
16 Copyright © Jason Gunthorpe, 1998-1999.
18 "APT" and this document are free software; you can redistribute them and/or
19 modify them under the terms of the GNU General Public License as published
20 by the Free Software Foundation; either version 2 of the License, or (at your
21 option) any later version.
24 For more details, on Debian GNU/Linux systems, see the file
25 /usr/doc/copyright/GPL for the full license.
32 <!-- ===================================================================== -->
36 This document serves two purposes. The first is to document the installed
37 directory structure and the format and purpose of each file. The second
38 purpose is to document how APT views the Debian archive and deals with
39 multiple package files.
42 The var directory structure is as follows:
69 As is specified in the FHS 2.1 /var/lib/apt is used for application
70 data that is not expected to be user modified. /var/cache/apt is used
71 for regeneratable data and is where the package cache and downloaded .debs
77 <!-- Distribution Source List {{{ -->
78 <!-- ===================================================================== -->
79 <sect>Distribution Source list (sources.list)
82 The distribution source list is used to locate archives of the debian
83 distribution. It is designed to support any number of active sources and to
84 support a mix of source media. The file lists one source per line, with the
85 fastest source listed first. The format of each line is:
88 <var>type uri args</var>
91 The first item, <var>type</var>, indicates the format for the remainder
92 of the line. It is designed to indicate the structure of the distribution
93 the line is talking about. Currently the only defined value is <em>deb</em>
94 which indicates a standard debian archive with a dists dir.
98 The <em>deb</em> type is to be a typical two level debian distributions,
99 dist/<var>distribution</var>/<var>component</var>. Typically distribution
100 is one of stable, unstable or frozen while component is one of main,
101 contrib, non-free or non-us. The format for the deb line is as follows:
104 deb <var>uri</var> <var>distribution</var> <var>component</var>
105 [<var>component</var> ...]
108 <var>uri</var> for the <em>deb</em> type must specify the base of the
109 debian distribution. APT will automatically generate the proper longer
110 URIs to get the information it needs. <var>distribution</var> can specify
111 an exact path, in this case the components must be omitted and
112 <var>distribution</var> must end in a slash.
115 Since only one distribution can be specified per deb line it may be
116 necessary to list a number of deb lines for the same URI. APT will
117 sort the URI list after it has generated a complete set to allow
118 connection reuse. It is important to order things in the sourcelist
119 from most preferred to least preferred (fastest to slowest).
122 <sect1>URI specification
124 URIs in the source list support a large number of access schemes.
128 The cdrom scheme is special in that If Modified Since queries are never
129 performed and that APT knows how to match a cdrom to the name it
130 was given when first inserted. APT also knows all of the possible
131 mount points the cdrom drives and that the user should be prompted
132 to insert a CD if it cannot be found. The path is relative to an
133 arbitrary mount point (of APT's choosing) and must not start with a
134 slash. The first pathname component is the given name and is purely
135 descriptive and of the users choice. However, if a file in the root of
136 the cdrom is called '.disk/info' its contents will be used instead of
137 prompting. The name serves as a tag for the cdrom and should be unique.
139 cdrom:Debian 1.3/debian
143 This scheme specifies a HTTP server for the debian archive. HTTP is preferred
144 over FTP because If Modified Since queries against the Package file are
145 possible as well as deep pipelining and resume capabilities.
147 http://www.debian.org/archive
151 This scheme specifies a FTP connection to the server. FTP is limited because
152 there is no support for IMS and is hard to proxy over firewalls.
154 ftp://ftp.debian.org/debian
158 The file scheme allows an arbitrary directory in the file system to be
159 considered as a debian archive. This is useful for NFS mounts and
160 local mirrors/archives.
166 A possible future expansion may be to have direct support for smb (Samba
169 smb://ftp.kernel.org/pub/mirrors/debian
174 <sect1>Hashing the URI
176 All permanent information acquired from any of the sources is stored in the
177 lists directory. Thus, there must be a way to relate the filename in the
178 lists directory to a line in the sourcelist. To simplify things this is
179 done by quoting the URI and treating _'s as quoteable characters and
180 converting / to _. The URI spec says this is done by converting a
181 sensitive character into %xx where xx is the hexadecimal representation
182 from the ASCII character set. Examples:
185 http://www.debian.org/archive/dists/stable/binary-i386/Packages
186 /var/lib/apt/lists/www.debian.org_archive_dists_stable_binary-i386_Packages
188 cdrom:Debian 1.3/debian/Packages
189 /var/lib/apt/info/Debian%201.3_debian_Packages
193 The other alternative that was considered was to use a deep directory
194 structure but this poses two problems, it makes it very difficult to prune
195 directories back when sources are no longer used and complicates the handling
196 of the partial directory. This gives a very simple way to deal with all
197 of the situations that can arise. Also note that the same rules described in
198 the <em>Archive Directory</> section regarding the partial sub dir apply
204 <!-- Extra Status {{{ -->
205 <!-- ===================================================================== -->
206 <sect>Extra Status File (xstatus)
209 The extra status file serves the same purpose as the normal dpkg status file
210 (/var/lib/dpkg/status) except that it stores information unique to apt.
211 This includes the autoflag, target distribution and version and any other
212 unique features that come up over time. It duplicates nothing from the normal
213 dpkg status file. Please see other APT documentation for a discussion
214 of the exact internal behaviour of these fields. The Package field is
215 placed directly before the new fields to indicate which package they
216 apply to. The new fields are as follows:
220 The Auto flag can be Yes or No and controls whether the package is in
223 <tag>X-TargetDist<item>
224 The TargetDist item indicates which distribution versions are offered for
225 installation from. It should be stable, unstable or frozen.
227 <tag>X-TargetVersion<item>
228 The target version item is set if the user selects a specific version, it
229 overrides the TargetDist selection if both are present.
233 <!-- Binary Package Cache {{{ -->
234 <!-- ===================================================================== -->
235 <sect>Binary Package Cache (pkgcache.bin)
238 Please see cache.sgml for a complete description of what this file is. The
239 cache file is updated whenever the contents of the lists directory changes.
240 If the cache is erased, corrupted or of a non-matching version it will
241 be automatically rebuilt by all of the tools that need it.
242 <em>srcpkgcache.bin</> contains a cache of all of the package files in the
243 source list. This allows regeneration of the cache when the status files
244 change to use a prebuilt version for greater speed.
247 <!-- Downloads Directory {{{ -->
248 <!-- ===================================================================== -->
249 <sect>Downloads Directory (archives)
252 The archives directory is where all downloaded .deb archives go. When the
253 file transfer is initiated the deb is placed in partial. Once the file
254 is fully downloaded and its MD5 hash and size are verified it is moved
255 from partial into archives/. Any files found in archives/ can be assumed
259 No directory structure is transfered from the receiving site and all .deb
260 file names conform to debian conventions. No short (msdos) filename should
261 be placed in archives. If the need arises .debs should be unpacked, scanned
262 and renamed to their correct internal names. This is mostly to prevent
263 file name conflicts but other programs may depend on this if convenient.
264 A conforming .deb is one of the form, name_version_arch.deb. Our archive
265 scripts do not handle epochs, but they are necessary and should be re-inserted.
266 If necessary _'s and :'s in the fields should be quoted using the % convention.
267 It must be possible to extract all 3 fields by examining the file name.
268 Downloaded .debs must be found in one of the package lists with an exact
269 name + version match..
272 <!-- The Methods Directory {{{ -->
273 <!-- ===================================================================== -->
274 <sect> The Methods Directory (/usr/lib/apt/methods)
277 The Methods directory is more fully described in the APT Methods interface
281 <!-- The Mirror List {{{ -->
282 <!-- ===================================================================== -->
283 <sect> The Mirror List
286 The mirror list is stored on the primary debian web server (www.debian.org)
287 and contains a machine readable list of all known debian mirrors. It's
288 format and style mirror the Package file.
292 This is the proper host name of the site. It should not be a host within
293 debian.org and generally cnames should be avoided here.
296 These list any commonly used aliases for the site. This field is used to make
297 sure that a site is not added twice.
300 This field can either be <em>Push-Primary</> or <em>leaf</>.
301 <em>Push-Primary</> are authorized top level mirrors of the archive, all
302 other mirrors are leaf.
304 <tag>Archive-[access]<item>
305 The Archive field gives the path(s) to the debian archive. [access]
306 specifies the access method and may be one of ftp, http, rsync, nfs, or
307 smb. For many of the types it is possible to prefix the path with :###
308 indicating that an alternate port should be used. Generally paths
309 start with a / and end with a /, rsync is an exception in that the
310 first directory component is not a path but a label.
312 <tag>WWW-[access]<item>
313 The WWW field gives the path(s) to the debian web site.
315 <tag>CDImage-[access]<item>
316 The WWW field gives the path(s) to the debian CD-ROM images
318 <tag>Incoming-[access]<item>
319 The Incoming field gives the path(s) to a mirror of the debian incoming
322 <tag>nonUS-[access]<item>
323 The nonUS field gives the path(s) to a mirror of the non-US distribution.
325 <tag>Maintainer<item>
326 This is the email address of the maintainer of the mirror.
329 Location gives the general geographical region the mirror is in.
332 The Sponsor field indicates who owns the mirror and a URL to a web page
333 describing the organization.
336 General free-form text.
341 Some form of network measurement will have to be used to gauge performance
342 of each of the mirrors. This will be discussed later, initial versions
343 will use the first found URI.
346 <!-- The Release File {{{ -->
347 <!-- ===================================================================== -->
348 <sect> The Release File
351 This file plays and important role in how APT presents the archive to the
352 user. Its main purpose is to present a descriptive name for the source
353 of each version of each package. It also is used to detect when new versions
354 of debian are released. It augments the package file it is associated with
355 by providing meta information about the entire archive which the Packages
359 The full name of the distribution for presentation to the user is formed
360 as 'label version archive', with a possible extended name being
361 'label version archive component'.
364 The file is formed as the package file (RFC-822) with the following tags
369 This is the common name we give our archives, such as <em>stable</> or
373 Refers to the sub-component of the archive, <em>main</>, <em>contrib</>
374 etc. Component may be omitted if there are no components for this archive.
377 This is a version string with the same properties as in the Packages file.
378 It represents the release level of the archive.
381 This specifies who is providing this archive. In the case of Debian the
382 string will read 'Debian'. Other providers may use their own string
385 This carries the encompassing name of the distribution. For Debian proper
386 this field reads 'Debian'. For derived distributions it should contain their
389 <tag>Architecture<item>
390 When the archive has packages for a single architecture then the Architecture
391 is listed here. If a mixed set of systems are represented then this should
392 contain the keyword <em>mixed</em>.
394 <tag>NotAutomatic<item>
395 A Yes/No flag indicating that the archive is extremely unstable and its
396 version's should never be automatically selected. This is to be used by
399 <tag>Description<item>
400 Description is used to describe the release. For instance experimental would
401 contain a warning that the packages have problems.
405 The location of the Release file in the archive is very important, it must
406 be located in the same location as the packages file so that it can be
407 located in all situations. The following is an example for the current stable
419 This is an example of experimental,
421 Archive: experimental