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