]> git.saurik.com Git - apt.git/blame - doc/files.sgml
merged from lp:~donkult/apt/sid
[apt.git] / doc / files.sgml
CommitLineData
578bfd0a 1<!-- -*- mode: sgml; mode: fold -*- -->
851389e7 2<!doctype debiandoc PUBLIC "-//DebianDoc//DTD DebianDoc//EN">
578bfd0a
AL
3<book>
4<title>APT Files</title>
5
6<author>Jason Gunthorpe <email>jgg@debian.org</email></author>
8835c5d0 7<version>$Id: files.sgml,v 1.12 2003/04/26 23:26:13 doogie 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>
a66a514f 16Copyright &copy; Jason Gunthorpe, 1998-1999.
578bfd0a
AL
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
2926128f 25/usr/share/common-licenses/GPL for the full license.
578bfd0a
AL
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>
b2e465d6 44 /var/lib/apt/
86435b7d 45 lists/
578bfd0a 46 partial/
86435b7d
DK
47 periodic/
48 extended_states
49 cdroms.list
578bfd0a 50 /var/cache/apt/
578bfd0a
AL
51 archives/
52 partial/
86435b7d
DK
53 pkgcache.bin
54 srcpkgcache.bin
578bfd0a 55 /etc/apt/
86435b7d
DK
56 sources.list.d/
57 apt.conf.d/
58 preferences.d/
59 trusted.gpg.d/
60 sources.list
61 apt.conf
62 apt_preferences
63 trusted.gpg
578bfd0a 64 /usr/lib/apt/
86435b7d
DK
65 methods/
66 bzip2
67 cdrom
68 copy
69 file
70 ftp
71 gpgv
72 gzip
73 http
74 https
75 lzma
76 rred
77 rsh
78 ssh
578bfd0a
AL
79</example>
80
81<p>
b2e465d6 82As is specified in the FHS 2.1 /var/lib/apt is used for application
578bfd0a
AL
83data that is not expected to be user modified. /var/cache/apt is used
84for regeneratable data and is where the package cache and downloaded .debs
86435b7d
DK
85go. /etc/apt is the place where configuration should happen and
86/usr/lib/apt is the place where the apt and other packages can place
87binaries which can be used by the acquire system of APT.
578bfd0a
AL
88</sect>
89 <!-- }}} -->
90
91<chapt>Files
92<!-- Distribution Source List {{{ -->
93<!-- ===================================================================== -->
86435b7d
DK
94<sect>Files and fragment directories in /etc/apt
95
96<p>
97All files in /etc/apt are used to modify specific aspects of APT. To enable
98other packages to ship needed configuration herself all these files have
99a fragment directory packages can place their files in instead of mangling
100with the main files. The main files are therefore considered to be only
101used by the user and not by a package. The documentation omits this directories
102most of the time to be easier readable, so every time the documentation includes
103a reference to a main file it really means the file or the fragment directories.
104
105</sect>
106
578bfd0a
AL
107<sect>Distribution Source list (sources.list)
108
109<p>
110The distribution source list is used to locate archives of the debian
111distribution. It is designed to support any number of active sources and to
112support a mix of source media. The file lists one source per line, with the
113fastest source listed first. The format of each line is:
114
115<p>
42c90c42 116<var>type uri args</var>
578bfd0a
AL
117
118<p>
119The first item, <var>type</var>, indicates the format for the remainder
120of the line. It is designed to indicate the structure of the distribution
121the line is talking about. Currently the only defined value is <em>deb</em>
122which indicates a standard debian archive with a dists dir.
123
124<sect1>The deb Type
125 <p>
126 The <em>deb</em> type is to be a typical two level debian distributions,
127 dist/<var>distribution</var>/<var>component</var>. Typically distribution
8835c5d0 128 is one of stable, unstable or testing while component is one of main,
578bfd0a
AL
129 contrib, non-free or non-us. The format for the deb line is as follows:
130
131 <p>
dd0594df 132 deb <var>uri</var> <var>distribution</var> <var>component</var>
578bfd0a
AL
133 [<var>component</var> ...]
134
135 <p>
136 <var>uri</var> for the <em>deb</em> type must specify the base of the
137 debian distribution. APT will automatically generate the proper longer
fb9ebfdb 138 URIs to get the information it needs. <var>distribution</var> can specify
578bfd0a
AL
139 an exact path, in this case the components must be omitted and
140 <var>distribution</var> must end in a slash.
141
142 <p>
143 Since only one distribution can be specified per deb line it may be
144 necessary to list a number of deb lines for the same URI. APT will
145 sort the URI list after it has generated a complete set to allow
146 connection reuse. It is important to order things in the sourcelist
dd0594df 147 from most preferred to least preferred (fastest to slowest).
578bfd0a
AL
148</sect1>
149
150<sect1>URI specification
151<p>
86435b7d
DK
152URIs in the source list support a large number of access schemes which
153are listed in the sources.list manpage and can be further extended by
154transport binaries placed in /usr/lib/apt/methods. The most important
155builtin schemes are:
578bfd0a
AL
156
157<taglist>
158<tag>cdrom<item>
dd0594df 159 The cdrom scheme is special in that If Modified Since queries are never
578bfd0a 160 performed and that APT knows how to match a cdrom to the name it
42c90c42
AL
161 was given when first inserted. APT also knows all of the possible
162 mount points the cdrom drives and that the user should be prompted
578bfd0a 163 to insert a CD if it cannot be found. The path is relative to an
dd0594df 164 arbitrary mount point (of APT's choosing) and must not start with a
578bfd0a
AL
165 slash. The first pathname component is the given name and is purely
166 descriptive and of the users choice. However, if a file in the root of
42c90c42 167 the cdrom is called '.disk/info' its contents will be used instead of
578bfd0a 168 prompting. The name serves as a tag for the cdrom and should be unique.
578bfd0a
AL
169 <example>
170 cdrom:Debian 1.3/debian
171 </example>
172
173<tag>http<item>
dd0594df 174 This scheme specifies a HTTP server for the debian archive. HTTP is preferred
578bfd0a 175 over FTP because If Modified Since queries against the Package file are
42c90c42 176 possible as well as deep pipelining and resume capabilities.
578bfd0a
AL
177 <example>
178 http://www.debian.org/archive
179 </example>
180
181<tag>ftp<item>
182 This scheme specifies a FTP connection to the server. FTP is limited because
183 there is no support for IMS and is hard to proxy over firewalls.
184 <example>
185 ftp://ftp.debian.org/debian
186 </example>
187
188<tag>file<item>
dd0594df 189 The file scheme allows an arbitrary directory in the file system to be
b2e465d6 190 considered as a debian archive. This is useful for NFS mounts and
578bfd0a
AL
191 local mirrors/archives.
192 <example>
193 file:/var/debian
194 </example>
578bfd0a
AL
195</taglist>
196</sect1>
197
198<sect1>Hashing the URI
199<p>
dd0594df 200All permanent information acquired from any of the sources is stored in the
578bfd0a
AL
201lists directory. Thus, there must be a way to relate the filename in the
202lists directory to a line in the sourcelist. To simplify things this is
fb9ebfdb
AL
203done by quoting the URI and treating _'s as quoteable characters and
204converting / to _. The URI spec says this is done by converting a
578bfd0a 205sensitive character into %xx where xx is the hexadecimal representation
dd0594df 206from the ASCII character set. Examples:
578bfd0a
AL
207
208<example>
209http://www.debian.org/archive/dists/stable/binary-i386/Packages
b2e465d6 210/var/lib/apt/lists/www.debian.org_archive_dists_stable_binary-i386_Packages
578bfd0a
AL
211
212cdrom:Debian 1.3/debian/Packages
b2e465d6 213/var/lib/apt/info/Debian%201.3_debian_Packages
578bfd0a
AL
214</example>
215
216<p>
217The other alternative that was considered was to use a deep directory
218structure but this poses two problems, it makes it very difficult to prune
219directories back when sources are no longer used and complicates the handling
220of the partial directory. This gives a very simple way to deal with all
0a8e3465
AL
221of the situations that can arise. Also note that the same rules described in
222the <em>Archive Directory</> section regarding the partial sub dir apply
223here as well.
578bfd0a
AL
224</sect1>
225
226</sect>
227 <!-- }}} -->
86435b7d 228<!-- Extended Status {{{ -->
578bfd0a 229<!-- ===================================================================== -->
86435b7d 230<sect>Extended States File (extended_states)
578bfd0a
AL
231
232<p>
86435b7d 233The extended_states file serves the same purpose as the normal dpkg status file
0a8e3465 234(/var/lib/dpkg/status) except that it stores information unique to apt.
86435b7d
DK
235This includes currently only the autoflag but is open to store more
236unique data that come up over time. It duplicates nothing from the normal
578bfd0a 237dpkg status file. Please see other APT documentation for a discussion
86435b7d
DK
238of the exact internal behaviour of these fields. The Package and the
239Architecture field are placed directly before the new fields to indicate
240which package they apply to. The new fields are as follows:
578bfd0a
AL
241
242<taglist>
86435b7d
DK
243<tag>Auto-Installed<item>
244 The Auto flag can be 1 (Yes) or 0 (No) and controls whether the package
245 was automatical installed to satisfy a dependency or if the user requested
246 the installation
578bfd0a
AL
247</taglist>
248</sect>
249 <!-- }}} -->
250<!-- Binary Package Cache {{{ -->
251<!-- ===================================================================== -->
86435b7d 252<sect>Binary Package Cache (srcpkgcache.bin and pkgcache.bin)
578bfd0a
AL
253
254<p>
255Please see cache.sgml for a complete description of what this file is. The
256cache file is updated whenever the contents of the lists directory changes.
257If the cache is erased, corrupted or of a non-matching version it will
258be automatically rebuilt by all of the tools that need it.
259<em>srcpkgcache.bin</> contains a cache of all of the package files in the
260source list. This allows regeneration of the cache when the status files
261change to use a prebuilt version for greater speed.
262</sect>
263 <!-- }}} -->
264<!-- Downloads Directory {{{ -->
265<!-- ===================================================================== -->
266<sect>Downloads Directory (archives)
267
268<p>
269The archives directory is where all downloaded .deb archives go. When the
270file transfer is initiated the deb is placed in partial. Once the file
dd0594df 271is fully downloaded and its MD5 hash and size are verified it is moved
578bfd0a
AL
272from partial into archives/. Any files found in archives/ can be assumed
273to be verified.
274
275<p>
dd0594df 276No directory structure is transfered from the receiving site and all .deb
578bfd0a
AL
277file names conform to debian conventions. No short (msdos) filename should
278be placed in archives. If the need arises .debs should be unpacked, scanned
279and renamed to their correct internal names. This is mostly to prevent
350ed194
AL
280file name conflicts but other programs may depend on this if convenient.
281A conforming .deb is one of the form, name_version_arch.deb. Our archive
282scripts do not handle epochs, but they are necessary and should be re-inserted.
283If necessary _'s and :'s in the fields should be quoted using the % convention.
284It must be possible to extract all 3 fields by examining the file name.
578bfd0a
AL
285Downloaded .debs must be found in one of the package lists with an exact
286name + version match..
287</sect>
288 <!-- }}} -->
289<!-- The Methods Directory {{{ -->
290<!-- ===================================================================== -->
291<sect> The Methods Directory (/usr/lib/apt/methods)
292
293<p>
0a8e3465
AL
294The Methods directory is more fully described in the APT Methods interface
295document.
578bfd0a
AL
296</sect>
297 <!-- }}} -->
86435b7d 298<!-- The Configuration File {{{ -->
578bfd0a 299<!-- ===================================================================== -->
86435b7d 300<sect> The Configuration File (/etc/apt/apt.conf)
578bfd0a
AL
301
302<p>
86435b7d
DK
303The configuration file (and the associated fragments directory
304/etc/apt/apt.conf.d/) is described in the apt.conf manpage.
305</sect>
306 <!-- }}} -->
307<!-- The trusted.gpg File {{{ -->
308<!-- ===================================================================== -->
309<sect> The trusted.gpg File (/etc/apt/trusted.gpg)
578bfd0a
AL
310
311<p>
86435b7d
DK
312The trusted.gpg file (and the files in the associated fragments directory
313/etc/apt/trusted.gpg.d/) is a binary file including the keyring used
314by apt to validate that the information (e.g. the Release file) it
315downloads are really from the distributor it clams to be and is
316unmodified and is therefore the last step in the chain of trust between
317the archive and the end user. This security system is described in the
318apt-secure manpage.
578bfd0a
AL
319</sect>
320 <!-- }}} -->
321<!-- The Release File {{{ -->
322<!-- ===================================================================== -->
323<sect> The Release File
324
325<p>
86435b7d 326This file plays an important role in how APT presents the archive to the
578bfd0a
AL
327user. Its main purpose is to present a descriptive name for the source
328of each version of each package. It also is used to detect when new versions
329of debian are released. It augments the package file it is associated with
330by providing meta information about the entire archive which the Packages
331file describes.
332
333<p>
334The full name of the distribution for presentation to the user is formed
335as 'label version archive', with a possible extended name being
336'label version archive component'.
337
338<p>
339The file is formed as the package file (RFC-822) with the following tags
340defined:
341
342<taglist>
343<tag>Archive<item>
344This is the common name we give our archives, such as <em>stable</> or
345<em>unstable</>.
346
347<tag>Component<item>
dd0594df 348Refers to the sub-component of the archive, <em>main</>, <em>contrib</>
a4edf53b 349etc. Component may be omitted if there are no components for this archive.
578bfd0a
AL
350
351<tag>Version<item>
352This is a version string with the same properties as in the Packages file.
353It represents the release level of the archive.
354
355<tag>Origin<item>
356This specifies who is providing this archive. In the case of Debian the
357string will read 'Debian'. Other providers may use their own string
358
359<tag>Label<item>
360This carries the encompassing name of the distribution. For Debian proper
361this field reads 'Debian'. For derived distributions it should contain their
362proper name.
363
364<tag>Architecture<item>
365When the archive has packages for a single architecture then the Architecture
366is listed here. If a mixed set of systems are represented then this should
367contain the keyword <em>mixed</em>.
368
369<tag>NotAutomatic<item>
370A Yes/No flag indicating that the archive is extremely unstable and its
371version's should never be automatically selected. This is to be used by
372experimental.
373
374<tag>Description<item>
375Description is used to describe the release. For instance experimental would
376contain a warning that the packages have problems.
377</taglist>
378
379<p>
380The location of the Release file in the archive is very important, it must
381be located in the same location as the packages file so that it can be
382located in all situations. The following is an example for the current stable
383release, 1.3.1r6
384
385<example>
386Archive: stable
dd0594df 387Component: main
578bfd0a
AL
388Version: 1.3.1r6
389Origin: Debian
390Label: Debian
391Architecture: i386
392</example>
393
394This is an example of experimental,
395<example>
396Archive: experimental
397Version: 0
398Origin: Debian
399Label: Debian
400Architecture: mixed
401NotAutomatic: Yes
402</example>
403
404And unstable,
405<example>
406Archive: unstable
dd0594df 407Component: main
578bfd0a
AL
408Version: 2.1
409Origin: Debian
410Label: Debian
411Architecture: i386
412</example>
413
414</sect>
415 <!-- }}} -->
416
417</book>