Merge remote-tracking branch 'mvo/feature/README' into debian/sid
[ntk/apt.git] / doc / files.dbk
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!-- -*- DocBook -*- -->
3 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
4 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
5 <!ENTITY % aptverbatiment SYSTEM "apt-verbatim.ent"> %aptverbatiment;
6 ]>
7
8 <book lang="en">
9
10 <title>APT Files</title>
11
12 <bookinfo>
13
14 <authorgroup>
15 <author>
16 <personname>Jason Gunthorpe</personname><email>jgg@debian.org</email>
17 </author>
18 </authorgroup>
19
20 <releaseinfo>Version &apt-product-version;</releaseinfo>
21
22 <abstract>
23 <para>
24 This document describes the complete implementation and format of the installed
25 APT directory structure. It also serves as guide to how APT views the Debian
26 archive.
27 </para>
28 </abstract>
29
30 <copyright><year>1998-1999</year><holder>Jason Gunthorpe</holder></copyright>
31
32 <legalnotice>
33 <title>License Notice</title>
34 <para>
35 "APT" and this document are free software; you can redistribute them and/or
36 modify them under the terms of the GNU General Public License as published by
37 the Free Software Foundation; either version 2 of the License, or (at your
38 option) any later version.
39 </para>
40 <para>
41 For more details, on Debian systems, see the file
42 /usr/share/common-licenses/GPL for the full license.
43 </para>
44 </legalnotice>
45
46 </bookinfo>
47
48 <chapter id="ch1"><title>Introduction</title>
49
50 <section id="s1.1"><title>General</title>
51 <para>
52 This document serves two purposes. The first is to document the installed
53 directory structure and the format and purpose of each file. The second
54 purpose is to document how APT views the Debian archive and deals with multiple
55 package files.
56 </para>
57 <para>
58 The var directory structure is as follows:
59 </para>
60 <screen>
61 /var/lib/apt/
62 lists/
63 partial/
64 periodic/
65 extended_states
66 cdroms.list
67 /var/cache/apt/
68 archives/
69 partial/
70 pkgcache.bin
71 srcpkgcache.bin
72 /etc/apt/
73 sources.list.d/
74 apt.conf.d/
75 preferences.d/
76 trusted.gpg.d/
77 sources.list
78 apt.conf
79 apt_preferences
80 trusted.gpg
81 /usr/lib/apt/
82 methods/
83 bzip2
84 cdrom
85 copy
86 file
87 ftp
88 gpgv
89 gzip
90 http
91 https
92 lzma
93 rred
94 rsh
95 ssh
96 </screen>
97 <para>
98 As is specified in the FHS 2.1 /var/lib/apt is used for application data that
99 is not expected to be user modified. /var/cache/apt is used for regeneratable
100 data and is where the package cache and downloaded .debs go. /etc/apt is the
101 place where configuration should happen and /usr/lib/apt is the place where the
102 apt and other packages can place binaries which can be used by the acquire
103 system of APT.
104 </para>
105 </section>
106
107 </chapter>
108
109 <chapter id="ch2"><title>Files</title>
110
111 <section id="s2.1"><title>Files and fragment directories in /etc/apt</title>
112 <para>
113 All files in /etc/apt are used to modify specific aspects of APT. To enable
114 other packages to ship needed configuration herself all these files have a
115 fragment directory packages can place their files in instead of mangling with
116 the main files. The main files are therefore considered to be only used by the
117 user and not by a package. The documentation omits this directories most of
118 the time to be easier readable, so every time the documentation includes a
119 reference to a main file it really means the file or the fragment directories.
120 </para>
121 </section>
122
123 <section id="s2.2"><title>Distribution Source list (sources.list)</title>
124 <para>
125 The distribution source list is used to locate archives of the debian
126 distribution. It is designed to support any number of active sources and to
127 support a mix of source media. The file lists one source per line, with the
128 fastest source listed first. The format of each line is:
129 </para>
130 <para>
131 <replaceable>type uri args</replaceable>
132 </para>
133 <para>
134 The first item, <replaceable>type</replaceable>, indicates the format for the
135 remainder of the line. It is designed to indicate the structure of the
136 distribution the line is talking about. Currently the only defined values are
137 <emphasis>deb</emphasis> and <emphasis>deb-src</emphasis> which indicate a
138 standard debian (source) archive with a dists directory. More about these
139 types and the URI specification can be found in the sources.list manpage.
140 </para>
141
142 <section id="s2.2.1"><title>Hashing the URI</title>
143 <para>
144 All permanent information acquired from any of the sources is stored in the
145 lists directory. Thus, there must be a way to relate the filename in the lists
146 directory to a line in the sourcelist. To simplify things this is done by
147 quoting the URI and treating _'s as quoteable characters and converting /
148 to _. The URI spec says this is done by converting a sensitive character
149 into %xx where xx is the hexadecimal representation from the ASCII character
150 set. Examples:
151 </para>
152 <screen>
153 http://www.debian.org/archive/dists/stable/binary-i386/Packages
154 /var/lib/apt/lists/www.debian.org_archive_dists_stable_binary-i386_Packages
155
156 cdrom:Debian 1.3/debian/Packages
157 /var/lib/apt/info/Debian%201.3_debian_Packages
158 </screen>
159 <para>
160 The other alternative that was considered was to use a deep directory structure
161 but this poses two problems, it makes it very difficult to prune directories
162 back when sources are no longer used and complicates the handling of the
163 partial directory. This gives a very simple way to deal with all of the
164 situations that can arise. Also note that the same rules described in the
165 <emphasis>Archive Directory</emphasis> section regarding the partial sub dir
166 apply here as well.
167 </para>
168 </section>
169
170 </section>
171
172 <section id="s2.3"><title>Extended States File (extended_states)</title>
173 <para>
174 The extended_states file serves the same purpose as the normal dpkg status
175 file (/var/lib/dpkg/status) except that it stores information unique to
176 apt. This includes currently only the autoflag but is open to store more
177 unique data that come up over time. It duplicates nothing from the normal
178 dpkg status file. Please see other APT documentation for a discussion of
179 the exact internal behavior of these fields. The Package and the Architecture
180 field are placed directly before the new fields to indicate which package
181 they apply to. The new fields are as follows:
182 </para>
183 <variablelist>
184 <varlistentry>
185 <term>Auto-Installed</term>
186 <listitem>
187 <para>
188 The Auto flag can be 1 (Yes) or 0 (No) and controls whether the package was
189 automatical installed to satisfy a dependency or if the user requested the
190 installation
191 </para>
192 </listitem>
193 </varlistentry>
194 </variablelist>
195 </section>
196
197 <section id="s2.4"><title>Binary Package Cache (srcpkgcache.bin and pkgcache.bin)</title>
198 <para>
199 Please see cache.sgml for a complete description of what this file
200 is. The cache file is updated whenever the contents of the lists
201 directory changes. If the cache is erased, corrupted or of a non-matching
202 version it will be automatically rebuilt by all of the tools that need
203 it. <emphasis>srcpkgcache.bin</emphasis> contains a cache of all of the
204 package files in the source list. This allows regeneration of the cache
205 when the status files change to use a prebuilt version for greater speed.
206 </para>
207 </section>
208
209 <section id="s2.5"><title>Downloads Directory (archives)</title>
210 <para>
211 The archives directory is where all downloaded .deb archives go. When the file
212 transfer is initiated the deb is placed in partial. Once the file is fully
213 downloaded and its MD5 hash and size are verified it is moved from partial
214 into archives/. Any files found in archives/ can be assumed to be verified.
215 </para>
216 <para>
217 No directory structure is transferred from the receiving site and all .deb file
218 names conform to debian conventions. No short (msdos) filename should be
219 placed in archives. If the need arises .debs should be unpacked, scanned and
220 renamed to their correct internal names. This is mostly to prevent file name
221 conflicts but other programs may depend on this if convenient. A conforming
222 .deb is one of the form, name_version_arch.deb. Our archive scripts do not
223 handle epochs, but they are necessary and should be re-inserted. If necessary
224 _'s and :'s in the fields should be quoted using the % convention. It must be
225 possible to extract all 3 fields by examining the file name. Downloaded .debs
226 must be found in one of the package lists with an exact name + version match..
227 </para>
228 </section>
229
230 <section id="s2.6"><title>The Methods Directory (/usr/lib/apt/methods)</title>
231 <para>
232 The Methods directory is more fully described in the APT Methods interface
233 document.
234 </para>
235 </section>
236
237 <section id="s2.7"><title>The Configuration File (/etc/apt/apt.conf)</title>
238 <para>
239 The configuration file (and the associated fragments directory
240 /etc/apt/apt.conf.d/) is described in the apt.conf manpage.
241 </para>
242 </section>
243
244 <section id="s2.8"><title>The trusted.gpg File (/etc/apt/trusted.gpg)</title>
245 <para>
246 The trusted.gpg file (and the files in the associated fragments directory
247 /etc/apt/trusted.gpg.d/) is a binary file including the keyring used by apt to
248 validate that the information (e.g. the Release file) it downloads are really
249 from the distributor it clams to be and is unmodified and is therefore the last
250 step in the chain of trust between the archive and the end user. This security
251 system is described in the apt-secure manpage.
252 </para>
253 </section>
254
255 <section id="s2.9"><title>The Release File</title>
256 <para>
257 This file plays an important role in how APT presents the archive to the
258 user. Its main purpose is to present a descriptive name for the source of
259 each version of each package. It also is used to detect when new versions
260 of debian are released. It augments the package file it is associated with
261 by providing meta information about the entire archive which the Packages
262 file describes.
263 </para>
264 <para>
265 The full name of the distribution for presentation to the user is formed as
266 'label version archive', with a possible extended name being 'label version
267 archive component'.
268 </para>
269 <para>
270 The file is formed as the package file (RFC-822) with the following tags
271 defined:
272 </para>
273 <variablelist>
274 <varlistentry>
275 <term>Archive</term>
276 <listitem>
277 <para>
278 This is the common name we give our archives, such as
279 <emphasis>stable</emphasis> or <emphasis>unstable</emphasis>.
280 </para>
281 </listitem>
282 </varlistentry>
283 <varlistentry>
284 <term>Component</term>
285 <listitem>
286 <para>
287 Refers to the sub-component of the archive, <emphasis>main</emphasis>,
288 <emphasis>contrib</emphasis> etc. Component may be omitted if there are no
289 components for this archive.
290 </para>
291 </listitem>
292 </varlistentry>
293 <varlistentry>
294 <term>Version</term>
295 <listitem>
296 <para>
297 This is a version string with the same properties as in the Packages file. It
298 represents the release level of the archive.
299 </para>
300 </listitem>
301 </varlistentry>
302 <varlistentry>
303 <term>Origin</term>
304 <listitem>
305 <para>
306 This specifies who is providing this archive. In the case of Debian the string
307 will read 'Debian'. Other providers may use their own string
308 </para>
309 </listitem>
310 </varlistentry>
311 <varlistentry>
312 <term>Label</term>
313 <listitem>
314 <para>
315 This carries the encompassing name of the distribution. For Debian proper this
316 field reads 'Debian'. For derived distributions it should contain their proper
317 name.
318 </para>
319 </listitem>
320 </varlistentry>
321 <varlistentry>
322 <term>Architecture</term>
323 <listitem>
324 <para>
325 When the archive has packages for a single architecture then the Architecture
326 is listed here. If a mixed set of systems are represented then this should
327 contain the keyword <emphasis>mixed</emphasis>.
328 </para>
329 </listitem>
330 </varlistentry>
331 <varlistentry>
332 <term>NotAutomatic</term>
333 <listitem>
334 <para>
335 A Yes/No flag indicating that the archive is extremely unstable and its
336 version's should never be automatically selected. This is to be used by
337 experimental.
338 </para>
339 </listitem>
340 </varlistentry>
341 <varlistentry>
342 <term>Description</term>
343 <listitem>
344 <para>
345 Description is used to describe the release. For instance experimental would
346 contain a warning that the packages have problems.
347 </para>
348 </listitem>
349 </varlistentry>
350 </variablelist>
351 <para>
352 The location of the Release file in the archive is very important, it must be
353 located in the same location as the packages file so that it can be located in
354 all situations. The following is an example for the current stable release,
355 1.3.1r6
356 </para>
357 <screen>
358 Archive: stable
359 Component: main
360 Version: 1.3.1r6
361 Origin: Debian
362 Label: Debian
363 Architecture: i386
364 </screen>
365 <para>
366 This is an example of experimental,
367 </para>
368 <screen>
369 Archive: experimental
370 Version: 0
371 Origin: Debian
372 Label: Debian
373 Architecture: mixed
374 NotAutomatic: Yes
375 </screen>
376 <para>
377 And unstable,
378 </para>
379 <screen>
380 Archive: unstable
381 Component: main
382 Version: 2.1
383 Origin: Debian
384 Label: Debian
385 Architecture: i386
386 </screen>
387 </section>
388
389 </chapter>
390
391
392 </book>