]>
Commit | Line | Data |
---|---|---|
1e0f0f28 DK |
1 | # Acquire additional files in 'update' operations |
2 | ||
3 | The download and verification of data from multiple sources in different | |
4 | compression formats, with partial downloads and patches is an involved | |
5 | process which is hard to implement correctly and securely. | |
6 | ||
7 | APT frontends share the code and binaries to make this happen in libapt | |
8 | with the Acquire system, supported by helpers shipped in the apt package | |
9 | itself and additional transports in individual packages like | |
10 | apt-transport-https. | |
11 | ||
12 | For its own operation libapt needs or can make use of Packages, Sources | |
13 | and Translation-* files, which it will acquire by default, but | |
14 | a repository might contain more data files (e.g. Contents) a frontend | |
15 | might want to use and would therefore need to be downloaded as well | |
16 | (e.g. apt-file). | |
17 | ||
18 | This file describes the configuration scheme such a frontend can use to | |
19 | instruct the Acquire system to download those additional files. | |
20 | ||
21 | Note that you can't download files from other sources. It must be files | |
22 | in the same repository and below the Release file. The Release file must | |
23 | also contain hashes for the file itself as well as for the compressed | |
24 | file if wanted, otherwise a download isn't even tried! | |
25 | ||
26 | ||
27 | # The Configuration Stanza | |
28 | ||
29 | The Acquire system uses the same configuration settings to implement the | |
30 | files it downloads by default. These settings are the default, but if | |
31 | they would be written in a configuration file the configuration | |
32 | instructing the Acquire system to download the Packages files would look | |
33 | like this (see also apt.conf(5) manpage for configuration file syntax): | |
34 | ||
35 | APT::Acquire::Targets::deb::Packages { | |
d3a869e3 | 36 | MetaKey "$(COMPONENT)/binary-$(ARCHITECTURE)/Packages"; |
1e0f0f28 DK |
37 | ShortDescription "Packages"; |
38 | Description "$(SITE) $(RELEASE)/$(COMPONENT) $(ARCHITECTURE) Packages"; | |
39 | ||
d3a869e3 | 40 | flatMetaKey "Packages"; |
1e0f0f28 DK |
41 | flatDescription "$(SITE) $(RELEASE) Packages"; |
42 | ||
43 | Optional "false"; | |
44 | }; | |
45 | ||
46 | All files which should be downloaded (nicknamed 'Targets') are mentioned | |
47 | below the APT::Acquire::Targets scope. 'deb' is here the type of the | |
48 | sources.list entry the file should be acquired for. The only other | |
49 | supported value is hence 'deb-src'. Beware: You can't specify multiple | |
8881b11e DK |
50 | types here and you can't download the same (evaluated) MetaKey from |
51 | multiple types! | |
1e0f0f28 DK |
52 | |
53 | After the type you can pick any valid and unique string which preferable | |
54 | refers to the file it downloads (In the example we picked 'Packages'). | |
8881b11e DK |
55 | This string is used as identifier for the target class and accessible as |
56 | 'Created-By' e.g. in the "apt-get files" output as detailed below. | |
1e0f0f28 DK |
57 | |
58 | All targets have three main properties you can define: | |
d3a869e3 | 59 | * MetaKey: The identifier of the file to be downloaded as used in the |
1e0f0f28 DK |
60 | Release file. It is also the relative location of the file from the |
61 | Release file. You can neither download from a different server | |
d3a869e3 DK |
62 | entirely (absolute URI) nor access directories above the Release file |
63 | (e.g. "../../"). | |
1e0f0f28 DK |
64 | * ShortDescription: Very short string intended to be displayed to the |
65 | user e.g. while reporting progress. apt will e.g. use this string in | |
66 | the last line to indicate progress of e.g. the download of a specific | |
67 | item. | |
68 | * Description: A preferable human understandable and readable identifier | |
69 | of which file is acquired exactly. Mainly used for progress reporting | |
70 | and error messages. apt will e.g. use this string in the Get/Hit/Err | |
71 | progress lines. | |
72 | ||
73 | Additional optional properties: | |
d3a869e3 | 74 | * flat{MetaKey,Description}: APT supports two types of repositories: |
1e0f0f28 DK |
75 | dists-style repositories which are the default and by far the most |
76 | common which are named after the fact that the files are in an | |
77 | elaborated directory structure. In contrast a flat-style repositories | |
78 | lumps all files together in one directory. Support for these flat | |
79 | repositories exists mainly for legacy purposes only. It is therefore | |
80 | recommend to not set these values. | |
81 | * Optional: The default value is 'true' and should be kept at this | |
82 | value. If enabled the acquire system will skip the download if the | |
83 | file isn't mentioned in the Release file. Otherwise this is treated as | |
84 | a hard error and the update process fails. | |
85 | ||
86 | ||
87 | Note that the acquire system will automatically choose to download | |
88 | a compressed file if it is available and uncompress it for you, just as | |
89 | it will also use pdiff patching if provided by the repository and | |
90 | enabled by the user. You only have to ensure that the Release file | |
91 | contains the information about the compressed files/pdiffs to make this | |
92 | happen. NO properties have to be set to enable this. | |
93 | ||
94 | # More examples | |
95 | ||
96 | The stanzas for Translation-* files as well as for Sources files would | |
97 | look like this: | |
98 | ||
99 | APT::Acquire::Targets { | |
100 | deb::Translations { | |
d3a869e3 | 101 | MetaKey "$(COMPONENT)/i18n/Translation-$(LANGUAGE)"; |
1e0f0f28 DK |
102 | ShortDescription "Translation-$(LANGUAGE)"; |
103 | Description "$(SITE) $(RELEASE)/$(COMPONENT) Translation-$(LANGUAGE)"; | |
104 | ||
d3a869e3 | 105 | flatMetaKey "$(LANGUAGE)"; |
1e0f0f28 DK |
106 | flatDescription "$(SITE) $(RELEASE) Translation-$(LANGUAGE)"; |
107 | }; | |
108 | ||
109 | deb-src::Sources { | |
d3a869e3 | 110 | MetaKey "$(COMPONENT)/source/Sources"; |
1e0f0f28 DK |
111 | ShortDescription "Sources"; |
112 | Description "$(SITE) $(RELEASE)/$(COMPONENT) Sources"; | |
113 | ||
d3a869e3 | 114 | flatMetaKey "Sources"; |
1e0f0f28 DK |
115 | flatDescription "$(SITE) $(RELEASE) Sources"; |
116 | ||
117 | Optional "false"; | |
118 | }; | |
119 | }; | |
120 | ||
121 | # Substitution variables | |
122 | ||
123 | As seen in the examples, properties can contain placeholders filled in | |
124 | by the acquire system. The following variables are known; note that | |
125 | unknown variables have no default value nor are they touched: They are | |
126 | printed literally. | |
127 | ||
8881b11e DK |
128 | * $(SITE): An identifier of the site we access as seen in sources.list, |
129 | e.g. "http://example.org/debian" or "file:/path/to/a/repository". | |
1e0f0f28 DK |
130 | * $(RELEASE): This is usually an archive- or codename, e.g. "stable" or |
131 | "stretch". Note that flat-style repositories do not have a archive- | |
132 | or codename per-se, so the value might very well be just "/" or so. | |
8881b11e | 133 | Again, as seen in the sources.list. |
1e0f0f28 DK |
134 | * $(COMPONENT): as given in the sources.list, e.g. "main", "non-free" or |
135 | "universe". Note that flat-style repositories again do not really | |
136 | have a meaningful value here. | |
137 | * $(LANGUAGE): Values are all entries (expect "none") of configuration | |
138 | option Acquire::Languages, e.g. "en", "de" or "de_AT". | |
1e0f0f28 DK |
139 | * $(ARCHITECTURE): Values are all entries of configuration option |
140 | APT::Architectures (potentially modified by sources.list options), | |
d3a869e3 DK |
141 | e.g. "amd64", "i386" or "armel" for the 'deb' type. In type 'deb-src' |
142 | this variable has the value "source". | |
8881b11e DK |
143 | |
144 | Note that while more variables might exist in the implementation, these | |
145 | are to be considered undefined and their usage strongly discouraged. If | |
146 | you have a need for another variable contact us instead. | |
147 | ||
148 | # Accessing files | |
149 | ||
150 | Do NOT hardcode specific file locations, names or compression types in | |
151 | your application! You will notice that the configuration options give | |
152 | you no choice over where the downloaded files will be stored. This is by | |
153 | design so multiple applications can download and use the same file | |
154 | rather than each and every one of them potentially downloads and uses | |
155 | its own copy somewhere on disk. | |
156 | ||
157 | "apt-get files" can be used to get the location as well as other | |
158 | information about all files downloaded (aka: you will see Packages, | |
159 | Sources and Translation-* files here as well). Provide a line of the | |
160 | default output format as parameter to filter out all entries which do | |
161 | not have such a line. With --format, you can further more define your | |
162 | own output style. The variables are what you see in the output, just all | |
163 | uppercase and wrapped in $(), as in the configuration file. | |
164 | ||
165 | To get all the filenames of all Translation-en files you can e.g. call: | |
166 | apt-get files --format '$(FILENAME)' "Created-By: Translations" "Language: en" | |
167 | ||
168 | Accessing this information via libapt is done by reading the | |
169 | sources.lists (pkgSourceList), iterating over the metaIndex objects this | |
170 | creates and calling GetIndexTargets() on them. See the sourcecode of | |
171 | "apt-get files" for a complete example. | |
172 | ||
173 | Remarks on the available fields: | |
174 | * MetaKey, ShortDesc, Description, Site, Release: as defined | |
175 | by the configuration and described further above. | |
176 | * Created-By: configuration entity responsible for this target | |
177 | * Target-Of: type of the sources.list entry | |
178 | * URI, Repo-URI: avoid using. Contains potentially username/password. | |
179 | Prefer 'Site', especially for display. | |
180 | * Filename: The mentioned file doesn't need to exist, e.g. because the | |
181 | file wasn't downloaded yet – or it does exist compressed. libapt users | |
182 | are encouraged to use FileFd to open such files as it can handle | |
183 | decompression transparently. | |
184 | * Trusted: As of the last 'apt-get update' call denoting if e.g. apt-get | |
185 | would print the unauthenticated warning while installing packages | |
186 | mentioned in this file (example assumes Packages file) [Not really | |
187 | a property of the target itself, but of the metaIndex]. | |
188 | * Optional: Decodes the option of the same name from the configuration. | |
189 | Note that it is using 'yes' and 'no' instead of 'true' and 'false'. | |
190 | * Language, Architecture, Component: as defined further above, but with | |
191 | the catch that they might be missing if they don't effect the target | |
192 | (aka: They weren't used while evaluating the MetaKey template). | |
193 | ||
194 | Again, additional fields might be visible in certain implementation, but | |
195 | you should avoid using them and instead talk to us about a portable | |
196 | implementation. | |
197 | ||
198 | # Multiple application requiring the same files | |
199 | ||
200 | It is highly encouraged that applications talk to each other and to us | |
201 | about which files they require. It is usually best to have a common | |
202 | package ship the configuration needed to get the files, but specific | |
203 | needs might require specific solutions. Again: talk to us. | |
204 | ||
205 | # Acquiring files not mentioned in the Release file | |
206 | ||
207 | You can't. This is by design as these files couldn't be verified to not | |
208 | be modified in transit, corrupted by the download process or simple if | |
209 | they are present at all on the server, which would require apt to probe | |
210 | for them. APT did this in the past for legacy reasons, we do not intend | |
211 | to go back to these dark times. | |
212 | ||
213 | This is also why you can't request files from a different server. It | |
214 | would have the additional problem that this server might not even be | |
215 | accessible (e.g. proxy settings) or that local sources (file:/, cdrom:/) | |
216 | start requesting online files… | |
217 | ||
218 | In other words: We would be opening Pandora's box. |