]>
Commit | Line | Data |
---|---|---|
ea542140 | 1 | #include <config.h> |
7db98ffc | 2 | |
7db98ffc MZ |
3 | #include <apt-pkg/debmetaindex.h> |
4 | #include <apt-pkg/debindexfile.h> | |
5 | #include <apt-pkg/strutl.h> | |
472ff00e | 6 | #include <apt-pkg/fileutl.h> |
7db98ffc MZ |
7 | #include <apt-pkg/acquire-item.h> |
8 | #include <apt-pkg/configuration.h> | |
45df0ad2 | 9 | #include <apt-pkg/aptconfiguration.h> |
472ff00e DK |
10 | #include <apt-pkg/indexrecords.h> |
11 | #include <apt-pkg/sourcelist.h> | |
453b82a3 DK |
12 | #include <apt-pkg/hashes.h> |
13 | #include <apt-pkg/macros.h> | |
14 | #include <apt-pkg/metaindex.h> | |
7db98ffc | 15 | |
453b82a3 DK |
16 | #include <string.h> |
17 | #include <map> | |
18 | #include <string> | |
19 | #include <utility> | |
20 | #include <vector> | |
5dd4c8b8 | 21 | #include <set> |
7cb28948 | 22 | #include <algorithm> |
5dd4c8b8 | 23 | |
7db98ffc MZ |
24 | using namespace std; |
25 | ||
5dd4c8b8 | 26 | string debReleaseIndex::Info(const char *Type, string const &Section, string const &Arch) const |
7db98ffc MZ |
27 | { |
28 | string Info = ::URI::SiteOnly(URI) + ' '; | |
29 | if (Dist[Dist.size() - 1] == '/') | |
30 | { | |
31 | if (Dist != "/") | |
32 | Info += Dist; | |
33 | } | |
34 | else | |
5dd4c8b8 DK |
35 | { |
36 | Info += Dist + '/' + Section; | |
ff1ad6fd | 37 | if (Arch.empty() != true) |
5dd4c8b8 DK |
38 | Info += " " + Arch; |
39 | } | |
7db98ffc MZ |
40 | Info += " "; |
41 | Info += Type; | |
42 | return Info; | |
43 | } | |
44 | ||
45 | string debReleaseIndex::MetaIndexInfo(const char *Type) const | |
46 | { | |
47 | string Info = ::URI::SiteOnly(URI) + ' '; | |
48 | if (Dist[Dist.size() - 1] == '/') | |
49 | { | |
50 | if (Dist != "/") | |
51 | Info += Dist; | |
52 | } | |
53 | else | |
54 | Info += Dist; | |
55 | Info += " "; | |
56 | Info += Type; | |
57 | return Info; | |
58 | } | |
59 | ||
60 | string debReleaseIndex::MetaIndexFile(const char *Type) const | |
61 | { | |
62 | return _config->FindDir("Dir::State::lists") + | |
63 | URItoFileName(MetaIndexURI(Type)); | |
64 | } | |
65 | ||
66 | string debReleaseIndex::MetaIndexURI(const char *Type) const | |
67 | { | |
68 | string Res; | |
69 | ||
70 | if (Dist == "/") | |
71 | Res = URI; | |
72 | else if (Dist[Dist.size()-1] == '/') | |
73 | Res = URI + Dist; | |
74 | else | |
75 | Res = URI + "dists/" + Dist + "/"; | |
76 | ||
77 | Res += Type; | |
78 | return Res; | |
79 | } | |
80 | ||
7014e148 MV |
81 | std::string debReleaseIndex::LocalFileName() const |
82 | { | |
83 | // see if we have a InRelease file | |
84 | std::string PathInRelease = MetaIndexFile("InRelease"); | |
85 | if (FileExists(PathInRelease)) | |
86 | return PathInRelease; | |
87 | ||
88 | // and if not return the normal one | |
89 | if (FileExists(PathInRelease)) | |
90 | return MetaIndexFile("Release"); | |
91 | ||
92 | return ""; | |
93 | } | |
7014e148 | 94 | |
5dd4c8b8 | 95 | string debReleaseIndex::IndexURISuffix(const char *Type, string const &Section, string const &Arch) const |
7db98ffc MZ |
96 | { |
97 | string Res =""; | |
98 | if (Dist[Dist.size() - 1] != '/') | |
5dd4c8b8 DK |
99 | { |
100 | if (Arch == "native") | |
101 | Res += Section + "/binary-" + _config->Find("APT::Architecture") + '/'; | |
102 | else | |
103 | Res += Section + "/binary-" + Arch + '/'; | |
104 | } | |
7db98ffc MZ |
105 | return Res + Type; |
106 | } | |
107 | ||
108 | ||
5dd4c8b8 | 109 | string debReleaseIndex::IndexURI(const char *Type, string const &Section, string const &Arch) const |
7db98ffc MZ |
110 | { |
111 | if (Dist[Dist.size() - 1] == '/') | |
112 | { | |
113 | string Res; | |
114 | if (Dist != "/") | |
115 | Res = URI + Dist; | |
116 | else | |
117 | Res = URI; | |
118 | return Res + Type; | |
119 | } | |
120 | else | |
5dd4c8b8 | 121 | return URI + "dists/" + Dist + '/' + IndexURISuffix(Type, Section, Arch); |
7db98ffc MZ |
122 | } |
123 | ||
5dd4c8b8 | 124 | string debReleaseIndex::SourceIndexURISuffix(const char *Type, const string &Section) const |
7db98ffc MZ |
125 | { |
126 | string Res =""; | |
127 | if (Dist[Dist.size() - 1] != '/') | |
128 | Res += Section + "/source/"; | |
129 | return Res + Type; | |
130 | } | |
131 | ||
5dd4c8b8 | 132 | string debReleaseIndex::SourceIndexURI(const char *Type, const string &Section) const |
7db98ffc MZ |
133 | { |
134 | string Res; | |
135 | if (Dist[Dist.size() - 1] == '/') | |
136 | { | |
137 | if (Dist != "/") | |
138 | Res = URI + Dist; | |
139 | else | |
140 | Res = URI; | |
141 | return Res + Type; | |
142 | } | |
143 | else | |
144 | return URI + "dists/" + Dist + "/" + SourceIndexURISuffix(Type, Section); | |
145 | } | |
146 | ||
ab53c018 DK |
147 | string debReleaseIndex::TranslationIndexURISuffix(const char *Type, const string &Section) const |
148 | { | |
149 | string Res =""; | |
150 | if (Dist[Dist.size() - 1] != '/') | |
8e3900d0 | 151 | Res += Section + "/i18n/Translation-"; |
ab53c018 DK |
152 | return Res + Type; |
153 | } | |
154 | ||
155 | string debReleaseIndex::TranslationIndexURI(const char *Type, const string &Section) const | |
156 | { | |
157 | string Res; | |
158 | if (Dist[Dist.size() - 1] == '/') | |
159 | { | |
160 | if (Dist != "/") | |
161 | Res = URI + Dist; | |
162 | else | |
163 | Res = URI; | |
164 | return Res + Type; | |
165 | } | |
166 | else | |
167 | return URI + "dists/" + Dist + "/" + TranslationIndexURISuffix(Type, Section); | |
168 | } | |
169 | ||
4b42f43b DK |
170 | debReleaseIndex::debReleaseIndex(string const &URI, string const &Dist) : |
171 | metaIndex(URI, Dist, "deb"), Trusted(CHECK_TRUST) | |
172 | {} | |
173 | ||
174 | debReleaseIndex::debReleaseIndex(string const &URI, string const &Dist, bool const Trusted) : | |
175 | metaIndex(URI, Dist, "deb") { | |
176 | SetTrusted(Trusted); | |
7db98ffc MZ |
177 | } |
178 | ||
5dd4c8b8 DK |
179 | debReleaseIndex::~debReleaseIndex() { |
180 | for (map<string, vector<debSectionEntry const*> >::const_iterator A = ArchEntries.begin(); | |
181 | A != ArchEntries.end(); ++A) | |
182 | for (vector<const debSectionEntry *>::const_iterator S = A->second.begin(); | |
183 | S != A->second.end(); ++S) | |
184 | delete *S; | |
7a9f09bd MV |
185 | } |
186 | ||
80624be7 MV |
187 | vector <IndexTarget *>* debReleaseIndex::ComputeIndexTargets() const { |
188 | vector <IndexTarget *>* IndexTargets = new vector <IndexTarget *>; | |
5dd4c8b8 DK |
189 | |
190 | map<string, vector<debSectionEntry const*> >::const_iterator const src = ArchEntries.find("source"); | |
191 | if (src != ArchEntries.end()) { | |
192 | vector<debSectionEntry const*> const SectionEntries = src->second; | |
193 | for (vector<debSectionEntry const*>::const_iterator I = SectionEntries.begin(); | |
194 | I != SectionEntries.end(); ++I) { | |
195 | IndexTarget * Target = new IndexTarget(); | |
196 | Target->ShortDesc = "Sources"; | |
197 | Target->MetaKey = SourceIndexURISuffix(Target->ShortDesc.c_str(), (*I)->Section); | |
198 | Target->URI = SourceIndexURI(Target->ShortDesc.c_str(), (*I)->Section); | |
199 | Target->Description = Info (Target->ShortDesc.c_str(), (*I)->Section); | |
200 | IndexTargets->push_back (Target); | |
201 | } | |
202 | } | |
203 | ||
204 | // Only source release | |
205 | if (IndexTargets->empty() == false && ArchEntries.size() == 1) | |
206 | return IndexTargets; | |
207 | ||
ab53c018 | 208 | std::set<std::string> sections; |
5dd4c8b8 DK |
209 | for (map<string, vector<debSectionEntry const*> >::const_iterator a = ArchEntries.begin(); |
210 | a != ArchEntries.end(); ++a) { | |
211 | if (a->first == "source") | |
212 | continue; | |
213 | for (vector <const debSectionEntry *>::const_iterator I = a->second.begin(); | |
214 | I != a->second.end(); ++I) { | |
215 | IndexTarget * Target = new IndexTarget(); | |
216 | Target->ShortDesc = "Packages"; | |
217 | Target->MetaKey = IndexURISuffix(Target->ShortDesc.c_str(), (*I)->Section, a->first); | |
218 | Target->URI = IndexURI(Target->ShortDesc.c_str(), (*I)->Section, a->first); | |
219 | Target->Description = Info (Target->ShortDesc.c_str(), (*I)->Section, a->first); | |
220 | IndexTargets->push_back (Target); | |
ab53c018 DK |
221 | sections.insert((*I)->Section); |
222 | } | |
223 | } | |
224 | ||
7cb28948 DK |
225 | std::vector<std::string> lang = APT::Configuration::getLanguages(true); |
226 | std::vector<std::string>::iterator lend = std::remove(lang.begin(), lang.end(), "none"); | |
227 | if (lend != lang.end()) | |
228 | lang.erase(lend); | |
229 | ||
05bb1e5d DK |
230 | if (lang.empty() == true) |
231 | return IndexTargets; | |
232 | ||
8e3900d0 DK |
233 | // get the Translation-* files, later we will skip download of non-existent if we have an index |
234 | for (std::set<std::string>::const_iterator s = sections.begin(); | |
235 | s != sections.end(); ++s) { | |
236 | for (std::vector<std::string>::const_iterator l = lang.begin(); | |
237 | l != lang.end(); ++l) { | |
238 | IndexTarget * Target = new OptionalIndexTarget(); | |
239 | Target->ShortDesc = "Translation-" + *l; | |
240 | Target->MetaKey = TranslationIndexURISuffix(l->c_str(), *s); | |
241 | Target->URI = TranslationIndexURI(l->c_str(), *s); | |
ab53c018 | 242 | Target->Description = Info (Target->ShortDesc.c_str(), *s); |
8e3900d0 | 243 | IndexTargets->push_back(Target); |
5dd4c8b8 DK |
244 | } |
245 | } | |
246 | ||
247 | return IndexTargets; | |
7db98ffc MZ |
248 | } |
249 | /*}}}*/ | |
5dd4c8b8 | 250 | bool debReleaseIndex::GetIndexes(pkgAcquire *Owner, bool const &GetAll) const |
7db98ffc | 251 | { |
2d3fe9cf DK |
252 | bool const tryInRelease = _config->FindB("Acquire::TryInRelease", true); |
253 | ||
07cb47e7 DK |
254 | indexRecords * const iR = new indexRecords(Dist); |
255 | if (Trusted == ALWAYS_TRUSTED) | |
256 | iR->SetTrusted(true); | |
257 | else if (Trusted == NEVER_TRUSTED) | |
258 | iR->SetTrusted(false); | |
259 | ||
7db98ffc MZ |
260 | // special case for --print-uris |
261 | if (GetAll) { | |
80624be7 MV |
262 | vector <IndexTarget *> *targets = ComputeIndexTargets(); |
263 | for (vector <IndexTarget*>::const_iterator Target = targets->begin(); Target != targets->end(); ++Target) { | |
7db98ffc | 264 | new pkgAcqIndex(Owner, (*Target)->URI, (*Target)->Description, |
b3501edb | 265 | (*Target)->ShortDesc, HashStringList()); |
7db98ffc | 266 | } |
6612c86e | 267 | delete targets; |
55971004 MV |
268 | |
269 | // this is normally created in pkgAcqMetaSig, but if we run | |
270 | // in --print-uris mode, we add it here | |
2d3fe9cf | 271 | if (tryInRelease == false) |
715c65de | 272 | new pkgAcqMetaIndex(Owner, NULL, |
e05672e8 MV |
273 | MetaIndexURI("Release"), |
274 | MetaIndexInfo("Release"), "Release", | |
275 | MetaIndexURI("Release.gpg"), MetaIndexInfo("Release.gpg"), "Release.gpg", | |
276 | ComputeIndexTargets(), | |
07cb47e7 | 277 | iR); |
7db98ffc | 278 | } |
2d3fe9cf | 279 | if (tryInRelease == true) |
2737f28a MV |
280 | new pkgAcqMetaClearSig(Owner, |
281 | MetaIndexURI("InRelease"), MetaIndexInfo("InRelease"), "InRelease", | |
2d3fe9cf DK |
282 | MetaIndexURI("Release"), MetaIndexInfo("Release"), "Release", |
283 | MetaIndexURI("Release.gpg"), MetaIndexInfo("Release.gpg"), "Release.gpg", | |
284 | ComputeIndexTargets(), | |
07cb47e7 | 285 | iR); |
2d3fe9cf | 286 | else |
715c65de | 287 | new pkgAcqMetaIndex(Owner, NULL, |
2737f28a MV |
288 | MetaIndexURI("Release"), MetaIndexInfo("Release"), "Release", |
289 | MetaIndexURI("Release.gpg"), MetaIndexInfo("Release.gpg"), "Release.gpg", | |
290 | ComputeIndexTargets(), | |
07cb47e7 | 291 | iR); |
fe0f7911 | 292 | |
55971004 | 293 | return true; |
7db98ffc MZ |
294 | } |
295 | ||
4b42f43b DK |
296 | void debReleaseIndex::SetTrusted(bool const Trusted) |
297 | { | |
298 | if (Trusted == true) | |
299 | this->Trusted = ALWAYS_TRUSTED; | |
300 | else | |
301 | this->Trusted = NEVER_TRUSTED; | |
302 | } | |
303 | ||
7db98ffc MZ |
304 | bool debReleaseIndex::IsTrusted() const |
305 | { | |
4b42f43b DK |
306 | if (Trusted == ALWAYS_TRUSTED) |
307 | return true; | |
308 | else if (Trusted == NEVER_TRUSTED) | |
309 | return false; | |
310 | ||
311 | ||
4e0ad446 | 312 | if(_config->FindB("APT::Authentication::TrustCDROM", false)) |
e8cdc56a MV |
313 | if(URI.substr(0,strlen("cdrom:")) == "cdrom:") |
314 | return true; | |
fe0f7911 DK |
315 | |
316 | string VerifiedSigFile = _config->FindDir("Dir::State::lists") + | |
317 | URItoFileName(MetaIndexURI("Release")) + ".gpg"; | |
318 | ||
7db98ffc MZ |
319 | if (FileExists(VerifiedSigFile)) |
320 | return true; | |
fe0f7911 DK |
321 | |
322 | VerifiedSigFile = _config->FindDir("Dir::State::lists") + | |
323 | URItoFileName(MetaIndexURI("InRelease")); | |
324 | ||
325 | return FileExists(VerifiedSigFile); | |
7db98ffc MZ |
326 | } |
327 | ||
5dd4c8b8 DK |
328 | vector <pkgIndexFile *> *debReleaseIndex::GetIndexFiles() { |
329 | if (Indexes != NULL) | |
330 | return Indexes; | |
331 | ||
332 | Indexes = new vector <pkgIndexFile*>; | |
333 | map<string, vector<debSectionEntry const*> >::const_iterator const src = ArchEntries.find("source"); | |
334 | if (src != ArchEntries.end()) { | |
335 | vector<debSectionEntry const*> const SectionEntries = src->second; | |
336 | for (vector<debSectionEntry const*>::const_iterator I = SectionEntries.begin(); | |
f7f0d6c7 | 337 | I != SectionEntries.end(); ++I) |
5dd4c8b8 DK |
338 | Indexes->push_back(new debSourcesIndex (URI, Dist, (*I)->Section, IsTrusted())); |
339 | } | |
340 | ||
341 | // Only source release | |
342 | if (Indexes->empty() == false && ArchEntries.size() == 1) | |
343 | return Indexes; | |
344 | ||
345 | std::vector<std::string> const lang = APT::Configuration::getLanguages(true); | |
346 | map<string, set<string> > sections; | |
347 | for (map<string, vector<debSectionEntry const*> >::const_iterator a = ArchEntries.begin(); | |
348 | a != ArchEntries.end(); ++a) { | |
349 | if (a->first == "source") | |
350 | continue; | |
351 | for (vector<debSectionEntry const*>::const_iterator I = a->second.begin(); | |
f7f0d6c7 | 352 | I != a->second.end(); ++I) { |
5dd4c8b8 DK |
353 | Indexes->push_back(new debPackagesIndex (URI, Dist, (*I)->Section, IsTrusted(), a->first)); |
354 | sections[(*I)->Section].insert(lang.begin(), lang.end()); | |
355 | } | |
356 | } | |
357 | ||
358 | for (map<string, set<string> >::const_iterator s = sections.begin(); | |
359 | s != sections.end(); ++s) | |
360 | for (set<string>::const_iterator l = s->second.begin(); | |
f7f0d6c7 | 361 | l != s->second.end(); ++l) { |
1a31359b | 362 | if (*l == "none") continue; |
5dd4c8b8 | 363 | Indexes->push_back(new debTranslationsIndex(URI,Dist,s->first,(*l).c_str())); |
1a31359b | 364 | } |
5dd4c8b8 DK |
365 | |
366 | return Indexes; | |
367 | } | |
a7a5b0d9 | 368 | |
5dd4c8b8 DK |
369 | void debReleaseIndex::PushSectionEntry(vector<string> const &Archs, const debSectionEntry *Entry) { |
370 | for (vector<string>::const_iterator a = Archs.begin(); | |
371 | a != Archs.end(); ++a) | |
372 | ArchEntries[*a].push_back(new debSectionEntry(Entry->Section, Entry->IsSrc)); | |
373 | delete Entry; | |
7db98ffc MZ |
374 | } |
375 | ||
5dd4c8b8 DK |
376 | void debReleaseIndex::PushSectionEntry(string const &Arch, const debSectionEntry *Entry) { |
377 | ArchEntries[Arch].push_back(Entry); | |
7db98ffc MZ |
378 | } |
379 | ||
5dd4c8b8 DK |
380 | void debReleaseIndex::PushSectionEntry(const debSectionEntry *Entry) { |
381 | if (Entry->IsSrc == true) | |
382 | PushSectionEntry("source", Entry); | |
383 | else { | |
384 | for (map<string, vector<const debSectionEntry *> >::iterator a = ArchEntries.begin(); | |
385 | a != ArchEntries.end(); ++a) { | |
386 | a->second.push_back(Entry); | |
387 | } | |
388 | } | |
7db98ffc MZ |
389 | } |
390 | ||
5dd4c8b8 DK |
391 | debReleaseIndex::debSectionEntry::debSectionEntry (string const &Section, |
392 | bool const &IsSrc): Section(Section), IsSrc(IsSrc) | |
393 | {} | |
394 | ||
dce45dbe | 395 | class APT_HIDDEN debSLTypeDebian : public pkgSourceList::Type |
7db98ffc MZ |
396 | { |
397 | protected: | |
398 | ||
5dd4c8b8 DK |
399 | bool CreateItemInternal(vector<metaIndex *> &List, string const &URI, |
400 | string const &Dist, string const &Section, | |
401 | bool const &IsSrc, map<string, string> const &Options) const | |
7db98ffc | 402 | { |
3d1be93d DK |
403 | // parse arch=, arch+= and arch-= settings |
404 | map<string, string>::const_iterator arch = Options.find("arch"); | |
405 | vector<string> Archs = | |
3f42500d | 406 | (arch != Options.end()) ? VectorizeString(arch->second, ',') : |
5dd4c8b8 | 407 | APT::Configuration::getArchitectures(); |
3d1be93d DK |
408 | if ((arch = Options.find("arch+")) != Options.end()) |
409 | { | |
410 | std::vector<std::string> const plusArch = VectorizeString(arch->second, ','); | |
411 | for (std::vector<std::string>::const_iterator plus = plusArch.begin(); plus != plusArch.end(); ++plus) | |
412 | if (std::find(Archs.begin(), Archs.end(), *plus) == Archs.end()) | |
413 | Archs.push_back(*plus); | |
414 | } | |
415 | if ((arch = Options.find("arch-")) != Options.end()) | |
416 | { | |
417 | std::vector<std::string> const minusArch = VectorizeString(arch->second, ','); | |
418 | for (std::vector<std::string>::const_iterator minus = minusArch.begin(); minus != minusArch.end(); ++minus) | |
419 | { | |
420 | std::vector<std::string>::iterator kill = std::find(Archs.begin(), Archs.end(), *minus); | |
421 | if (kill != Archs.end()) | |
422 | Archs.erase(kill); | |
423 | } | |
424 | } | |
425 | ||
4b42f43b | 426 | map<string, string>::const_iterator const trusted = Options.find("trusted"); |
5dd4c8b8 DK |
427 | |
428 | for (vector<metaIndex *>::const_iterator I = List.begin(); | |
f7f0d6c7 | 429 | I != List.end(); ++I) |
7db98ffc | 430 | { |
5dd4c8b8 DK |
431 | // We only worry about debian entries here |
432 | if (strcmp((*I)->GetType(), "deb") != 0) | |
433 | continue; | |
434 | ||
435 | debReleaseIndex *Deb = (debReleaseIndex *) (*I); | |
4b42f43b DK |
436 | if (trusted != Options.end()) |
437 | Deb->SetTrusted(StringToBool(trusted->second, false)); | |
438 | ||
5dd4c8b8 DK |
439 | /* This check insures that there will be only one Release file |
440 | queued for all the Packages files and Sources files it | |
441 | corresponds to. */ | |
442 | if (Deb->GetURI() == URI && Deb->GetDist() == Dist) | |
7db98ffc | 443 | { |
5dd4c8b8 DK |
444 | if (IsSrc == true) |
445 | Deb->PushSectionEntry("source", new debReleaseIndex::debSectionEntry(Section, IsSrc)); | |
446 | else | |
dd13742e DK |
447 | { |
448 | if (Dist[Dist.size() - 1] == '/') | |
449 | Deb->PushSectionEntry("any", new debReleaseIndex::debSectionEntry(Section, IsSrc)); | |
450 | else | |
451 | Deb->PushSectionEntry(Archs, new debReleaseIndex::debSectionEntry(Section, IsSrc)); | |
452 | } | |
5dd4c8b8 | 453 | return true; |
7db98ffc MZ |
454 | } |
455 | } | |
4b42f43b | 456 | |
7db98ffc | 457 | // No currently created Release file indexes this entry, so we create a new one. |
4b42f43b DK |
458 | debReleaseIndex *Deb; |
459 | if (trusted != Options.end()) | |
460 | Deb = new debReleaseIndex(URI, Dist, StringToBool(trusted->second, false)); | |
461 | else | |
462 | Deb = new debReleaseIndex(URI, Dist); | |
463 | ||
5dd4c8b8 DK |
464 | if (IsSrc == true) |
465 | Deb->PushSectionEntry ("source", new debReleaseIndex::debSectionEntry(Section, IsSrc)); | |
466 | else | |
dd13742e DK |
467 | { |
468 | if (Dist[Dist.size() - 1] == '/') | |
469 | Deb->PushSectionEntry ("any", new debReleaseIndex::debSectionEntry(Section, IsSrc)); | |
470 | else | |
471 | Deb->PushSectionEntry (Archs, new debReleaseIndex::debSectionEntry(Section, IsSrc)); | |
472 | } | |
7db98ffc MZ |
473 | List.push_back(Deb); |
474 | return true; | |
475 | } | |
476 | }; | |
477 | ||
0d29b9d4 MV |
478 | debDebFileMetaIndex::debDebFileMetaIndex(std::string const &DebFile) |
479 | : metaIndex(DebFile, "local-uri", "deb-dist"), DebFile(DebFile) | |
480 | { | |
481 | DebIndex = new debDebPkgFileIndex(DebFile); | |
482 | Indexes = new vector<pkgIndexFile *>(); | |
483 | Indexes->push_back(DebIndex); | |
484 | } | |
485 | ||
486 | ||
dce45dbe | 487 | class APT_HIDDEN debSLTypeDeb : public debSLTypeDebian |
7db98ffc MZ |
488 | { |
489 | public: | |
490 | ||
5dd4c8b8 DK |
491 | bool CreateItem(vector<metaIndex *> &List, string const &URI, |
492 | string const &Dist, string const &Section, | |
493 | std::map<string, string> const &Options) const | |
7db98ffc | 494 | { |
5dd4c8b8 | 495 | return CreateItemInternal(List, URI, Dist, Section, false, Options); |
7db98ffc MZ |
496 | } |
497 | ||
498 | debSLTypeDeb() | |
499 | { | |
500 | Name = "deb"; | |
501 | Label = "Standard Debian binary tree"; | |
502 | } | |
503 | }; | |
504 | ||
dce45dbe | 505 | class APT_HIDDEN debSLTypeDebSrc : public debSLTypeDebian |
7db98ffc MZ |
506 | { |
507 | public: | |
508 | ||
5dd4c8b8 DK |
509 | bool CreateItem(vector<metaIndex *> &List, string const &URI, |
510 | string const &Dist, string const &Section, | |
511 | std::map<string, string> const &Options) const | |
7db98ffc | 512 | { |
5dd4c8b8 | 513 | return CreateItemInternal(List, URI, Dist, Section, true, Options); |
7db98ffc MZ |
514 | } |
515 | ||
516 | debSLTypeDebSrc() | |
517 | { | |
518 | Name = "deb-src"; | |
519 | Label = "Standard Debian source tree"; | |
520 | } | |
521 | }; | |
522 | ||
dce45dbe | 523 | class APT_HIDDEN debSLTypeDebFile : public pkgSourceList::Type |
eafc5435 MV |
524 | { |
525 | public: | |
526 | ||
527 | bool CreateItem(vector<metaIndex *> &List, string const &URI, | |
070536e6 MV |
528 | string const &/*Dist*/, string const &/*Section*/, |
529 | std::map<string, string> const &/*Options*/) const | |
eafc5435 MV |
530 | { |
531 | metaIndex *mi = new debDebFileMetaIndex(URI); | |
532 | List.push_back(mi); | |
533 | return true; | |
534 | } | |
535 | ||
536 | debSLTypeDebFile() | |
537 | { | |
538 | Name = "deb-file"; | |
539 | Label = "Debian Deb File"; | |
540 | } | |
541 | }; | |
dce45dbe DK |
542 | |
543 | APT_HIDDEN debSLTypeDeb _apt_DebType; | |
544 | APT_HIDDEN debSLTypeDebSrc _apt_DebSrcType; | |
545 | APT_HIDDEN debSLTypeDebFile _apt_DebFileType; |