]> git.saurik.com Git - apt-legacy.git/blame - doc/files.sgml
Drastically improved APT HTTP error messages and actually set the proxy server config...
[apt-legacy.git] / doc / files.sgml
CommitLineData
da6ee469
JF
1<!-- -*- mode: sgml; mode: fold -*- -->
2<!doctype debiandoc PUBLIC "-//DebianDoc//DTD DebianDoc//EN">
3<book>
4<title>APT Files</title>
5
6<author>Jason Gunthorpe <email>jgg@debian.org</email></author>
7<version>$Id: files.sgml,v 1.12 2003/04/26 23:26:13 doogie Exp $</version>
8
9<abstract>
10This document describes the complete implementation and format of the
11installed APT directory structure. It also serves as guide to how APT
12views the Debian archive.
13</abstract>
14
15<copyright>
16Copyright &copy; Jason Gunthorpe, 1998-1999.
17<p>
18"APT" and this document are free software; you can redistribute them and/or
19modify them under the terms of the GNU General Public License as published
20by the Free Software Foundation; either version 2 of the License, or (at your
21option) any later version.
22
23<p>
24For more details, on Debian GNU/Linux systems, see the file
25/usr/share/common-licenses/GPL for the full license.
26</copyright>
27
28<toc sect>
29
30<chapt>Introduction
31<!-- General {{{ -->
32<!-- ===================================================================== -->
33<sect>General
34
35<p>
36This document serves two purposes. The first is to document the installed
37directory structure and the format and purpose of each file. The second
38purpose is to document how APT views the Debian archive and deals with
39multiple package files.
40
41<p>
42The var directory structure is as follows:
43<example>
44 /var/lib/apt/
45 lists/
46 partial/
47 xstatus
48 userstatus
49 cdroms.list
50 /var/cache/apt/
51 pkgcache.bin
52 srcpkgcache.bin
53 archives/
54 partial/
55 /etc/apt/
56 sources.list
57 apt.conf
58 /usr/lib/apt/
59 methods/
60 cdrom
61 ftp
62 http
63 file
64 gzip
65 copy
66</example>
67
68<p>
69As is specified in the FHS 2.1 /var/lib/apt is used for application
70data that is not expected to be user modified. /var/cache/apt is used
71for regeneratable data and is where the package cache and downloaded .debs
72go.
73</sect>
74 <!-- }}} -->
75
76<chapt>Files
77<!-- Distribution Source List {{{ -->
78<!-- ===================================================================== -->
79<sect>Distribution Source list (sources.list)
80
81<p>
82The distribution source list is used to locate archives of the debian
83distribution. It is designed to support any number of active sources and to
84support a mix of source media. The file lists one source per line, with the
85fastest source listed first. The format of each line is:
86
87<p>
88<var>type uri args</var>
89
90<p>
91The first item, <var>type</var>, indicates the format for the remainder
92of the line. It is designed to indicate the structure of the distribution
93the line is talking about. Currently the only defined value is <em>deb</em>
94which indicates a standard debian archive with a dists dir.
95
96<sect1>The deb Type
97 <p>
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 testing while component is one of main,
101 contrib, non-free or non-us. The format for the deb line is as follows:
102
103 <p>
104 deb <var>uri</var> <var>distribution</var> <var>component</var>
105 [<var>component</var> ...]
106
107 <p>
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.
113
114 <p>
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).
120</sect1>
121
122<sect1>URI specification
123<p>
124URIs in the source list support a large number of access schemes.
125
126<taglist>
127<tag>cdrom<item>
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.
138 <example>
139 cdrom:Debian 1.3/debian
140 </example>
141
142<tag>http<item>
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.
146 <example>
147 http://www.debian.org/archive
148 </example>
149
150<tag>ftp<item>
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.
153 <example>
154 ftp://ftp.debian.org/debian
155 </example>
156
157<tag>file<item>
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.
161 <example>
162 file:/var/debian
163 </example>
164
165<tag>smb<item>
166 A possible future expansion may be to have direct support for smb (Samba
167 servers).
168 <example>
169 smb://ftp.kernel.org/pub/mirrors/debian
170 </example>
171</taglist>
172</sect1>
173
174<sect1>Hashing the URI
175<p>
176All permanent information acquired from any of the sources is stored in the
177lists directory. Thus, there must be a way to relate the filename in the
178lists directory to a line in the sourcelist. To simplify things this is
179done by quoting the URI and treating _'s as quoteable characters and
180converting / to _. The URI spec says this is done by converting a
181sensitive character into %xx where xx is the hexadecimal representation
182from the ASCII character set. Examples:
183
184<example>
185http://www.debian.org/archive/dists/stable/binary-i386/Packages
186/var/lib/apt/lists/www.debian.org_archive_dists_stable_binary-i386_Packages
187
188cdrom:Debian 1.3/debian/Packages
189/var/lib/apt/info/Debian%201.3_debian_Packages
190</example>
191
192<p>
193The other alternative that was considered was to use a deep directory
194structure but this poses two problems, it makes it very difficult to prune
195directories back when sources are no longer used and complicates the handling
196of the partial directory. This gives a very simple way to deal with all
197of the situations that can arise. Also note that the same rules described in
198the <em>Archive Directory</> section regarding the partial sub dir apply
199here as well.
200</sect1>
201
202</sect>
203 <!-- }}} -->
204<!-- Extra Status {{{ -->
205<!-- ===================================================================== -->
206<sect>Extra Status File (xstatus)
207
208<p>
209The 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.
211This includes the autoflag, target distribution and version and any other
212unique features that come up over time. It duplicates nothing from the normal
213dpkg status file. Please see other APT documentation for a discussion
214of the exact internal behaviour of these fields. The Package field is
215placed directly before the new fields to indicate which package they
216apply to. The new fields are as follows:
217
218<taglist>
219<tag>X-Auto<item>
220 The Auto flag can be Yes or No and controls whether the package is in
221 auto mode.
222
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 testing.
226
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.
230</taglist>
231</sect>
232 <!-- }}} -->
233<!-- Binary Package Cache {{{ -->
234<!-- ===================================================================== -->
235<sect>Binary Package Cache (pkgcache.bin)
236
237<p>
238Please see cache.sgml for a complete description of what this file is. The
239cache file is updated whenever the contents of the lists directory changes.
240If the cache is erased, corrupted or of a non-matching version it will
241be 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
243source list. This allows regeneration of the cache when the status files
244change to use a prebuilt version for greater speed.
245</sect>
246 <!-- }}} -->
247<!-- Downloads Directory {{{ -->
248<!-- ===================================================================== -->
249<sect>Downloads Directory (archives)
250
251<p>
252The archives directory is where all downloaded .deb archives go. When the
253file transfer is initiated the deb is placed in partial. Once the file
254is fully downloaded and its MD5 hash and size are verified it is moved
255from partial into archives/. Any files found in archives/ can be assumed
256to be verified.
257
258<p>
259No directory structure is transfered from the receiving site and all .deb
260file names conform to debian conventions. No short (msdos) filename should
261be placed in archives. If the need arises .debs should be unpacked, scanned
262and renamed to their correct internal names. This is mostly to prevent
263file name conflicts but other programs may depend on this if convenient.
264A conforming .deb is one of the form, name_version_arch.deb. Our archive
265scripts do not handle epochs, but they are necessary and should be re-inserted.
266If necessary _'s and :'s in the fields should be quoted using the % convention.
267It must be possible to extract all 3 fields by examining the file name.
268Downloaded .debs must be found in one of the package lists with an exact
269name + version match..
270</sect>
271 <!-- }}} -->
272<!-- The Methods Directory {{{ -->
273<!-- ===================================================================== -->
274<sect> The Methods Directory (/usr/lib/apt/methods)
275
276<p>
277The Methods directory is more fully described in the APT Methods interface
278document.
279</sect>
280 <!-- }}} -->
281<!-- The Mirror List {{{ -->
282<!-- ===================================================================== -->
283<sect> The Mirror List
284
285<p>
286The mirror list is stored on the primary debian web server (www.debian.org)
287and contains a machine readable list of all known debian mirrors. It's
288format and style mirror the Package file.
289
290<taglist>
291<tag>Site<item>
292This is the proper host name of the site. It should not be a host within
293debian.org and generally cnames should be avoided here.
294
295<tag>Aliases<item>
296These list any commonly used aliases for the site. This field is used to make
297sure that a site is not added twice.
298
299<tag>Type<item>
300This field can either be <em>Push-Primary</> or <em>leaf</>.
301<em>Push-Primary</> are authorized top level mirrors of the archive, all
302other mirrors are leaf.
303
304<tag>Archive-[access]<item>
305The Archive field gives the path(s) to the debian archive. [access]
306specifies the access method and may be one of ftp, http, rsync, nfs, or
307smb. For many of the types it is possible to prefix the path with :###
308indicating that an alternate port should be used. Generally paths
309start with a / and end with a /, rsync is an exception in that the
310first directory component is not a path but a label.
311
312<tag>WWW-[access]<item>
313The WWW field gives the path(s) to the debian web site.
314
315<tag>CDImage-[access]<item>
316The WWW field gives the path(s) to the debian CD-ROM images
317
318<tag>Incoming-[access]<item>
319The Incoming field gives the path(s) to a mirror of the debian incoming
320directory.
321
322<tag>nonUS-[access]<item>
323The nonUS field gives the path(s) to a mirror of the non-US distribution.
324
325<tag>Maintainer<item>
326This is the email address of the maintainer of the mirror.
327
328<tag>Location<item>
329Location gives the general geographical region the mirror is in.
330
331<tag>Sponsor<item>
332The Sponsor field indicates who owns the mirror and a URL to a web page
333describing the organization.
334
335<tag>Comment<item>
336General free-form text.
337
338</taglist>
339
340<p>
341Some form of network measurement will have to be used to gauge performance
342of each of the mirrors. This will be discussed later, initial versions
343will use the first found URI.
344</sect>
345 <!-- }}} -->
346<!-- The Release File {{{ -->
347<!-- ===================================================================== -->
348<sect> The Release File
349
350<p>
351This file plays and important role in how APT presents the archive to the
352user. Its main purpose is to present a descriptive name for the source
353of each version of each package. It also is used to detect when new versions
354of debian are released. It augments the package file it is associated with
355by providing meta information about the entire archive which the Packages
356file describes.
357
358<p>
359The full name of the distribution for presentation to the user is formed
360as 'label version archive', with a possible extended name being
361'label version archive component'.
362
363<p>
364The file is formed as the package file (RFC-822) with the following tags
365defined:
366
367<taglist>
368<tag>Archive<item>
369This is the common name we give our archives, such as <em>stable</> or
370<em>unstable</>.
371
372<tag>Component<item>
373Refers to the sub-component of the archive, <em>main</>, <em>contrib</>
374etc. Component may be omitted if there are no components for this archive.
375
376<tag>Version<item>
377This is a version string with the same properties as in the Packages file.
378It represents the release level of the archive.
379
380<tag>Origin<item>
381This specifies who is providing this archive. In the case of Debian the
382string will read 'Debian'. Other providers may use their own string
383
384<tag>Label<item>
385This carries the encompassing name of the distribution. For Debian proper
386this field reads 'Debian'. For derived distributions it should contain their
387proper name.
388
389<tag>Architecture<item>
390When the archive has packages for a single architecture then the Architecture
391is listed here. If a mixed set of systems are represented then this should
392contain the keyword <em>mixed</em>.
393
394<tag>NotAutomatic<item>
395A Yes/No flag indicating that the archive is extremely unstable and its
396version's should never be automatically selected. This is to be used by
397experimental.
398
399<tag>Description<item>
400Description is used to describe the release. For instance experimental would
401contain a warning that the packages have problems.
402</taglist>
403
404<p>
405The location of the Release file in the archive is very important, it must
406be located in the same location as the packages file so that it can be
407located in all situations. The following is an example for the current stable
408release, 1.3.1r6
409
410<example>
411Archive: stable
412Component: main
413Version: 1.3.1r6
414Origin: Debian
415Label: Debian
416Architecture: i386
417</example>
418
419This is an example of experimental,
420<example>
421Archive: experimental
422Version: 0
423Origin: Debian
424Label: Debian
425Architecture: mixed
426NotAutomatic: Yes
427</example>
428
429And unstable,
430<example>
431Archive: unstable
432Component: main
433Version: 2.1
434Origin: Debian
435Label: Debian
436Architecture: i386
437</example>
438
439</sect>
440 <!-- }}} -->
441
442</book>