]> git.saurik.com Git - apt.git/blame - doc/acquire-additional-files.txt
add hidden config to set packages as Essential/Important
[apt.git] / doc / acquire-additional-files.txt
CommitLineData
1e0f0f28
DK
1# Acquire additional files in 'update' operations
2
3The download and verification of data from multiple sources in different
4compression formats, with partial downloads and patches is an involved
5process which is hard to implement correctly and securely.
6
add81166 7APT front-ends share the code and binaries to make this happen in libapt
1e0f0f28
DK
8with the Acquire system, supported by helpers shipped in the apt package
9itself and additional transports in individual packages like
10apt-transport-https.
11
12For its own operation libapt needs or can make use of Packages, Sources
13and Translation-* files, which it will acquire by default, but
add81166 14a repository might contain more data files (e.g. Contents) a front-end
9adb9778
DK
15(e.g. apt-file) might want to use and would therefore need to be
16downloaded as well.
1e0f0f28 17
add81166 18This file describes the configuration scheme such a front-end can use to
1e0f0f28
DK
19instruct the Acquire system to download those additional files.
20
1e0f0f28
DK
21# The Configuration Stanza
22
23The Acquire system uses the same configuration settings to implement the
24files it downloads by default. These settings are the default, but if
25they would be written in a configuration file the configuration
26instructing the Acquire system to download the Packages files would look
27like this (see also apt.conf(5) manpage for configuration file syntax):
28
c2a4a8dd 29 Acquire::IndexTargets::deb::Packages {
d3a869e3 30 MetaKey "$(COMPONENT)/binary-$(ARCHITECTURE)/Packages";
1e0f0f28 31 ShortDescription "Packages";
79b60dcd 32 Description "$(RELEASE)/$(COMPONENT) $(ARCHITECTURE) Packages";
1e0f0f28 33
d3a869e3 34 flatMetaKey "Packages";
79b60dcd 35 flatDescription "$(RELEASE) Packages";
1e0f0f28 36
9adb9778 37 Optional "no";
1e0f0f28
DK
38 };
39
40All files which should be downloaded (nicknamed 'Targets') are mentioned
c2a4a8dd 41below the Acquire::IndexTargets scope. 'deb' is here the type of the
1e0f0f28
DK
42sources.list entry the file should be acquired for. The only other
43supported value is hence 'deb-src'. Beware: You can't specify multiple
8881b11e
DK
44types here and you can't download the same (evaluated) MetaKey from
45multiple types!
1e0f0f28
DK
46
47After the type you can pick any valid and unique string which preferable
48refers to the file it downloads (In the example we picked 'Packages').
39c724b4
DK
49This string is used as identifier (if not explicitly set otherwise) for
50the target class and accessible as 'Identifier' and 'Created-By' e.g.
51in the "apt-get indextargets" output as detailed below. The identifier
52is also used to allow user to enable/disable targets per sources.list
53entry.
1e0f0f28
DK
54
55All targets have three main properties you can define:
d3a869e3 56* MetaKey: The identifier of the file to be downloaded as used in the
1e0f0f28
DK
57 Release file. It is also the relative location of the file from the
58 Release file. You can neither download from a different server
d3a869e3
DK
59 entirely (absolute URI) nor access directories above the Release file
60 (e.g. "../../").
1e0f0f28
DK
61* ShortDescription: Very short string intended to be displayed to the
62 user e.g. while reporting progress. apt will e.g. use this string in
63 the last line to indicate progress of e.g. the download of a specific
64 item.
65* Description: A preferable human understandable and readable identifier
66 of which file is acquired exactly. Mainly used for progress reporting
67 and error messages. apt will e.g. use this string in the Get/Hit/Err
68 progress lines.
79b60dcd
DK
69 An identifier of the site accessed as seen in the sources.list (e.g.
70 "http://example.org/debian" or "file:/path/to/a/repository") is
71 automatically prefixed for this property.
72
1e0f0f28
DK
73
74Additional optional properties:
39c724b4
DK
75* Identifier: The default value is the unique string identifying this
76 file (in the example above it was 'Packages') also accessible as
77 Created-By. The difference is that using this property multiple files
78 can be subsumed under one identifier e.g. if you configure multiple
79 possible locations for the files (with Fallback-Of), but the front-end
80 doesn't need to handle files from the different locations differently.
9adb9778
DK
81* DefaultEnabled: The default value is 'yes' which means that apt will
82 try to acquire this target from all sources. If set to 'no' the user
83 has to explicitly enable this target in the sources.list file with the
84 Targets option(s) – or override this value in a config file.
85* Optional: The default value is 'yes' and should be kept at this value.
86 If enabled the acquire system will skip the download if the file isn't
87 mentioned in the Release file. Otherwise this is treated as a hard
88 error and the update process fails. Note that failures while
3fd89e62
DK
89 downloading (e.g. 404 or hash verification errors) are failures,
90 regardless of this setting.
d7a51997
DK
91* KeepCompressed: The default is the value of Acquire::GzipIndexes,
92 which defaults to false. If true, the acquire system will keep the
add81166 93 file compressed on disk rather than extract it. If your front-end can't
d7a51997
DK
94 deal with compressed files transparently you have to explicitly set
95 this option to false to avoid problems with users setting the option
96 globally. On the other hand, if you set it to true or don't set it you
add81166 97 have to ensure your front-end can deal with all compressed fileformats
341e0147
JAK
98 supported by apt (libapt users can e.g. use FileFd, others can use
99 the cat-file command of /usr/lib/apt/apt-helper).
7f2d1eef
DK
100* Fallback-Of: Is by default not set. If it is set and specifies another
101 target name (see Created-By) which was found in the Release file the
102 download of this target will be skipped. This can be used to implement
103 fallback(chain)s to allow transitions like the rename of target files.
104 The behavior if cycles are formed with Fallback-Of is undefined!
9adb9778
DK
105* flat{MetaKey,Description}: APT supports two types of repositories:
106 dists-style repositories which are the default and by far the most
107 common which are named after the fact that the files are in an
108 elaborated directory structure. In contrast a flat-style repository
109 lumps all files together in one directory. Support for these flat
110 repositories exists mainly for legacy purposes only. It is therefore
111 recommend to not set these values.
1e0f0f28
DK
112
113
3fd89e62
DK
114The acquire system will automatically choose to download a compressed
115file if it is available and uncompress it for you, just as it will also
d7a51997 116use PDiff patching if provided by the repository and enabled by the
3fd89e62 117user. You only have to ensure that the Release file contains the
d7a51997 118information about the compressed files/PDiffs to make this happen.
1a3a14ac
DK
119*NO* properties have to be set to enable this!
120
121
add81166 122More properties exist, but these should *NOT* be set by front-ends
9adb9778
DK
123requesting files. They exist for internal and end-user usage only.
124Some of these are – which are documented here only to ensure that they
add81166 125aren't accidentally used by front-ends:
d7a51997 126* PDiffs: controls if apt will try to use PDiffs for this target.
1a3a14ac
DK
127 Defaults to the value of Acquire::PDiffs which is true by default.
128 Can be overridden per-source by the sources.list option of the same
129 name. See the documentation for both of these for details.
24e8f24e
DK
130* By-Hash: controls if apt will try to use an URI constructed from
131 a hashsum of the file to download. See the documentation for config
132 option Acquire::By-Hash and sources.list option By-Hash for details.
d7a51997
DK
133* CompressionTypes: The default value is a space separated list of
134 compression types supported by apt (see Acquire::CompressionTypes).
135 You can set this option to prevent apt from downloading a compression
add81166 136 type a front-end can't open transparently. This should always be
d7a51997 137 a temporary workaround through and a bug should be reported against
add81166 138 the front-end in question.
0179cfa8
DK
139* KeepCompressedAs: The default value is a space separated list of
140 compression types supported by apt (see previous option) which is
141 sorted by the cost-value of the compression in ascending order,
142 except that cost=0 "compressions" (like uncompressed) are listed last.
d7a51997 143
1e0f0f28
DK
144
145# More examples
146
147The stanzas for Translation-* files as well as for Sources files would
148look like this:
149
c2a4a8dd 150Acquire::IndexTargets {
1e0f0f28 151 deb::Translations {
d3a869e3 152 MetaKey "$(COMPONENT)/i18n/Translation-$(LANGUAGE)";
1e0f0f28 153 ShortDescription "Translation-$(LANGUAGE)";
79b60dcd 154 Description "$(RELEASE)/$(COMPONENT) Translation-$(LANGUAGE)";
1e0f0f28 155
d3a869e3 156 flatMetaKey "$(LANGUAGE)";
79b60dcd 157 flatDescription "$(RELEASE) Translation-$(LANGUAGE)";
1e0f0f28
DK
158 };
159
160 deb-src::Sources {
d3a869e3 161 MetaKey "$(COMPONENT)/source/Sources";
1e0f0f28 162 ShortDescription "Sources";
79b60dcd 163 Description "$(RELEASE)/$(COMPONENT) Sources";
1e0f0f28 164
d3a869e3 165 flatMetaKey "Sources";
79b60dcd 166 flatDescription "$(RELEASE) Sources";
1e0f0f28 167
9adb9778 168 Optional "no";
1e0f0f28
DK
169 };
170};
171
172# Substitution variables
173
174As seen in the examples, properties can contain placeholders filled in
175by the acquire system. The following variables are known; note that
176unknown variables have no default value nor are they touched: They are
3fd89e62 177printed as-is.
1e0f0f28 178
1e0f0f28 179* $(RELEASE): This is usually an archive- or codename, e.g. "stable" or
9adb9778 180 "stretch". Note that flat-style repositories do not have an archive-
1e0f0f28
DK
181 or codename per-se, so the value might very well be just "/" or so.
182* $(COMPONENT): as given in the sources.list, e.g. "main", "non-free" or
183 "universe". Note that flat-style repositories again do not really
184 have a meaningful value here.
185* $(LANGUAGE): Values are all entries (expect "none") of configuration
186 option Acquire::Languages, e.g. "en", "de" or "de_AT".
1e0f0f28
DK
187* $(ARCHITECTURE): Values are all entries of configuration option
188 APT::Architectures (potentially modified by sources.list options),
d3a869e3
DK
189 e.g. "amd64", "i386" or "armel" for the 'deb' type. In type 'deb-src'
190 this variable has the value "source".
c4d1ab98
DK
191* $(NATIVE_ARCHITECTURE): The architecture apt treats as the native
192 architecture for this system configured as APT::Architecture
193 defaulting to the architecture apt itself was built for.
8881b11e
DK
194
195Note that while more variables might exist in the implementation, these
196are to be considered undefined and their usage strongly discouraged. If
3fd89e62 197you have a need for other variables contact us.
8881b11e
DK
198
199# Accessing files
200
201Do NOT hardcode specific file locations, names or compression types in
202your application! You will notice that the configuration options give
203you no choice over where the downloaded files will be stored. This is by
204design so multiple applications can download and use the same file
205rather than each and every one of them potentially downloads and uses
206its own copy somewhere on disk.
207
c2a4a8dd 208"apt-get indextargets" can be used to get the location as well as other
8881b11e
DK
209information about all files downloaded (aka: you will see Packages,
210Sources and Translation-* files here as well). Provide a line of the
211default output format as parameter to filter out all entries which do
212not have such a line. With --format, you can further more define your
213own output style. The variables are what you see in the output, just all
214uppercase and wrapped in $(), as in the configuration file.
215
216To get all the filenames of all Translation-en files you can e.g. call:
39c724b4 217 apt-get indextargets --format '$(FILENAME)' "Identifier: Translations" "Language: en"
c2a4a8dd 218
7f2d1eef 219The line-based filtering and the formatting is rather crude and feature-
9adb9778
DK
220less by design: The default format is Debians standard format deb822 (in
221particular: Field names are case-insensitive and the order of fields in
222the stanza is undefined), so instead of apt reimplementing powerful
7f2d1eef 223filters and formatting for this command, it is recommend to use piping
9adb9778
DK
224and dedicated tools like 'grep-dctrl' if you need more than the basics
225provided.
8881b11e
DK
226
227Accessing this information via libapt is done by reading the
228sources.lists (pkgSourceList), iterating over the metaIndex objects this
d7a51997 229creates and calling GetIndexTargets() on them. See the source code of
c2a4a8dd 230"apt-get indextargets" for a complete example.
8881b11e 231
3fd89e62
DK
232Note that by default targets are not listed if they weren't downloaded.
233If you want to see all targets, you can use the --no-release-info, which
234also removes the Codename, Suite, Version, Origin, Label and Trusted
235fields from the output as these also display data which needs to be
236downloaded first and could hence be inaccurate [on the pro-side: This
237mode is faster as it doesn't require a valid binary cache to operate].
238The most notable difference perhaps is in the Filename field through: By
239default it indicates an existing file, potentially compressed (Hint:
240libapt users can use FileFd to open compressed files transparently). In
241the --no-release-info mode the indicated file doesn't need to exist and
242it will always refer to an uncompressed file, even if the index would be
243(or is) stored compressed.
244
245Remarks on fields only available in (default) --release-info mode:
246* Trusted: Denotes with a 'yes' or 'no' if the data in this file is
d7a51997 247 authenticated by a trust chain rooted in a trusted gpg key. You should
3fd89e62
DK
248 be careful with untrusted data and warn the user if you use it.
249* Codename, Suite, Version, Origin and Label are fields from the Release
250 file, are only present if they are present in the Release file and
251 contain the same data.
252
253Remarks on other available fields:
8881b11e
DK
254* MetaKey, ShortDesc, Description, Site, Release: as defined
255 by the configuration and described further above.
39c724b4
DK
256* Identifier: Defaults to the value of Created-By, but can be set
257 explicitly in the configuration (see above). Prefer this field over
258 Created-By to subsume multiple file(location)s (see Fallback-Of).
8881b11e
DK
259* Created-By: configuration entity responsible for this target
260* Target-Of: type of the sources.list entry
261* URI, Repo-URI: avoid using. Contains potentially username/password.
262 Prefer 'Site', especially for display.
9adb9778
DK
263* Optional, DefaultEnabled, KeepCompressed: Decode the options of the
264 same name from the configuration.
8881b11e
DK
265* Language, Architecture, Component: as defined further above, but with
266 the catch that they might be missing if they don't effect the target
267 (aka: They weren't used while evaluating the MetaKey template).
268
3fd89e62
DK
269Again, additional fields might be visible in certain implementations,
270but you should avoid using them and instead talk to us about a portable
8881b11e
DK
271implementation.
272
9adb9778 273# Multiple applications requiring the same files
8881b11e
DK
274
275It is highly encouraged that applications talk to each other and to us
276about which files they require. It is usually best to have a common
277package ship the configuration needed to get the files, but specific
278needs might require specific solutions. Again: talk to us.
279
add81166 280Bad things will happen if multiple front-ends request the same file(s)
9adb9778
DK
281via different targets, which is another reason why coordination is very
282important!
283
8881b11e
DK
284# Acquiring files not mentioned in the Release file
285
286You can't. This is by design as these files couldn't be verified to not
287be modified in transit, corrupted by the download process or simple if
288they are present at all on the server, which would require apt to probe
289for them. APT did this in the past for legacy reasons, we do not intend
290to go back to these dark times.
291
292This is also why you can't request files from a different server. It
293would have the additional problem that this server might not even be
294accessible (e.g. proxy settings) or that local sources (file:/, cdrom:/)
295start requesting online files…
296
297In other words: We would be opening Pandora's box.
9adb9778
DK
298
299# Acquiring files to a specific location on disk
300
add81166 301You can't by design to avoid multiple front-ends requesting the same file
9adb9778
DK
302to be downloaded to multiple different places on (different) disks
303(among other reasons). See the next point for a solution if you really
304have to force a specific location by creating symlinks.
305
306# Post processing the acquired files
307
308You can't modify the files apt has downloaded as apt keeps state with
309e.g. the modification times of the files and advanced features like
310PDiffs break.
311
312You can however install an APT::Update::Post-Invoke{-Success,} hook
313script and use them to copy (modified) files to a different location.
314Use 'apt-get indextargets' (or similar) to get the filenames – do not
315look into /var/lib/apt/lists directly!
316
317Please avoid time consuming calculations in the scripts and instead just
318trigger a background task as there is little to no feedback for the user
319while hook scripts run.