]> git.saurik.com Git - apt.git/blame - apt-pkg/deb/debindexfile.cc
* apt-pkg/contrib/error.{cc,h}:
[apt.git] / apt-pkg / deb / debindexfile.cc
CommitLineData
b2e465d6
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
7db98ffc 3// $Id: debindexfile.cc,v 1.5.2.3 2004/01/04 19:11:00 mdz Exp $
b2e465d6
AL
4/* ######################################################################
5
6 Debian Specific sources.list types and the three sorts of Debian
7 index files.
8
9 ##################################################################### */
10 /*}}}*/
11// Include Files /*{{{*/
b2e465d6
AL
12#include <apt-pkg/debindexfile.h>
13#include <apt-pkg/debsrcrecords.h>
14#include <apt-pkg/deblistparser.h>
15#include <apt-pkg/debrecords.h>
16#include <apt-pkg/sourcelist.h>
17#include <apt-pkg/configuration.h>
18#include <apt-pkg/progress.h>
19#include <apt-pkg/error.h>
20#include <apt-pkg/strutl.h>
21#include <apt-pkg/acquire-item.h>
7db98ffc 22#include <apt-pkg/debmetaindex.h>
e011829d 23
b2e465d6
AL
24#include <sys/stat.h>
25 /*}}}*/
26
27// SourcesIndex::debSourcesIndex - Constructor /*{{{*/
28// ---------------------------------------------------------------------
29/* */
7db98ffc
MZ
30debSourcesIndex::debSourcesIndex(string URI,string Dist,string Section,bool Trusted) :
31 pkgIndexFile(Trusted), URI(URI), Dist(Dist), Section(Section)
b2e465d6
AL
32{
33}
34 /*}}}*/
35// SourcesIndex::SourceInfo - Short 1 liner describing a source /*{{{*/
36// ---------------------------------------------------------------------
37/* The result looks like:
5e02df82 38 http://foo/debian/ stable/main src 1.1.1 (dsc) */
b2e465d6
AL
39string debSourcesIndex::SourceInfo(pkgSrcRecords::Parser const &Record,
40 pkgSrcRecords::File const &File) const
41{
42 string Res;
5e02df82 43 Res = ::URI::NoUserPassword(URI) + ' ';
b2e465d6
AL
44 if (Dist[Dist.size() - 1] == '/')
45 {
46 if (Dist != "/")
47 Res += Dist;
48 }
49 else
50 Res += Dist + '/' + Section;
51
52 Res += " ";
53 Res += Record.Package();
54 Res += " ";
55 Res += Record.Version();
56 if (File.Type.empty() == false)
57 Res += " (" + File.Type + ")";
58 return Res;
59}
60 /*}}}*/
61// SourcesIndex::CreateSrcParser - Get a parser for the source files /*{{{*/
62// ---------------------------------------------------------------------
63/* */
64pkgSrcRecords::Parser *debSourcesIndex::CreateSrcParser() const
65{
0e72dd52 66 string SourcesURI = URItoFileName(IndexURI("Sources"));
b2e465d6
AL
67 return new debSrcRecordParser(_config->FindDir("Dir::State::lists") +
68 SourcesURI,this);
69}
70 /*}}}*/
71// SourcesIndex::Describe - Give a descriptive path to the index /*{{{*/
72// ---------------------------------------------------------------------
73/* */
af87ab54 74string debSourcesIndex::Describe(bool Short) const
b2e465d6
AL
75{
76 char S[300];
af87ab54 77 if (Short == true)
cc742108 78 snprintf(S,sizeof(S),"%s",Info("Sources").c_str());
af87ab54 79 else
cc742108 80 snprintf(S,sizeof(S),"%s (%s)",Info("Sources").c_str(),
af87ab54
AL
81 IndexFile("Sources").c_str());
82
b2e465d6
AL
83 return S;
84}
85 /*}}}*/
86// SourcesIndex::Info - One liner describing the index URI /*{{{*/
87// ---------------------------------------------------------------------
88/* */
89string debSourcesIndex::Info(const char *Type) const
90{
5e02df82 91 string Info = ::URI::NoUserPassword(URI) + ' ';
b2e465d6
AL
92 if (Dist[Dist.size() - 1] == '/')
93 {
94 if (Dist != "/")
95 Info += Dist;
96 }
97 else
98 Info += Dist + '/' + Section;
99 Info += " ";
100 Info += Type;
101 return Info;
102}
103 /*}}}*/
104// SourcesIndex::Index* - Return the URI to the index files /*{{{*/
105// ---------------------------------------------------------------------
106/* */
107inline string debSourcesIndex::IndexFile(const char *Type) const
108{
109 return URItoFileName(IndexURI(Type));
110}
111string debSourcesIndex::IndexURI(const char *Type) const
112{
113 string Res;
114 if (Dist[Dist.size() - 1] == '/')
115 {
116 if (Dist != "/")
117 Res = URI + Dist;
118 else
119 Res = URI;
120 }
121 else
122 Res = URI + "dists/" + Dist + '/' + Section +
123 "/source/";
124
125 Res += Type;
126 return Res;
127}
128 /*}}}*/
b2e465d6
AL
129// SourcesIndex::Exists - Check if the index is available /*{{{*/
130// ---------------------------------------------------------------------
131/* */
132bool debSourcesIndex::Exists() const
133{
134 return FileExists(IndexFile("Sources"));
135}
136 /*}}}*/
137// SourcesIndex::Size - Return the size of the index /*{{{*/
138// ---------------------------------------------------------------------
139/* */
140unsigned long debSourcesIndex::Size() const
141{
142 struct stat S;
143 if (stat(IndexFile("Sources").c_str(),&S) != 0)
144 return 0;
145 return S.st_size;
146}
147 /*}}}*/
148
149// PackagesIndex::debPackagesIndex - Contructor /*{{{*/
150// ---------------------------------------------------------------------
151/* */
5dd4c8b8
DK
152debPackagesIndex::debPackagesIndex(string const &URI, string const &Dist, string const &Section,
153 bool const &Trusted, string const &Arch) :
154 pkgIndexFile(Trusted), URI(URI), Dist(Dist), Section(Section), Architecture(Arch)
b2e465d6 155{
5dd4c8b8
DK
156 if (Architecture == "native")
157 Architecture = _config->Find("APT::Architecture");
b2e465d6
AL
158}
159 /*}}}*/
160// PackagesIndex::ArchiveInfo - Short version of the archive url /*{{{*/
161// ---------------------------------------------------------------------
162/* This is a shorter version that is designed to be < 60 chars or so */
163string debPackagesIndex::ArchiveInfo(pkgCache::VerIterator Ver) const
164{
5e02df82 165 string Res = ::URI::NoUserPassword(URI) + ' ';
b2e465d6
AL
166 if (Dist[Dist.size() - 1] == '/')
167 {
168 if (Dist != "/")
169 Res += Dist;
170 }
171 else
172 Res += Dist + '/' + Section;
173
174 Res += " ";
175 Res += Ver.ParentPkg().Name();
176 Res += " ";
5dd4c8b8
DK
177 Res += Ver.Arch();
178 Res += " ";
b2e465d6
AL
179 Res += Ver.VerStr();
180 return Res;
181}
182 /*}}}*/
183// PackagesIndex::Describe - Give a descriptive path to the index /*{{{*/
184// ---------------------------------------------------------------------
185/* This should help the user find the index in the sources.list and
186 in the filesystem for problem solving */
af87ab54 187string debPackagesIndex::Describe(bool Short) const
b2e465d6
AL
188{
189 char S[300];
af87ab54
AL
190 if (Short == true)
191 snprintf(S,sizeof(S),"%s",Info("Packages").c_str());
192 else
193 snprintf(S,sizeof(S),"%s (%s)",Info("Packages").c_str(),
194 IndexFile("Packages").c_str());
b2e465d6
AL
195 return S;
196}
197 /*}}}*/
198// PackagesIndex::Info - One liner describing the index URI /*{{{*/
199// ---------------------------------------------------------------------
200/* */
201string debPackagesIndex::Info(const char *Type) const
202{
5e02df82 203 string Info = ::URI::NoUserPassword(URI) + ' ';
b2e465d6
AL
204 if (Dist[Dist.size() - 1] == '/')
205 {
206 if (Dist != "/")
207 Info += Dist;
208 }
209 else
210 Info += Dist + '/' + Section;
211 Info += " ";
5dd4c8b8
DK
212 Info += Architecture;
213 Info += " ";
b2e465d6
AL
214 Info += Type;
215 return Info;
216}
217 /*}}}*/
218// PackagesIndex::Index* - Return the URI to the index files /*{{{*/
219// ---------------------------------------------------------------------
220/* */
221inline string debPackagesIndex::IndexFile(const char *Type) const
222{
223 return _config->FindDir("Dir::State::lists") + URItoFileName(IndexURI(Type));
224}
225string debPackagesIndex::IndexURI(const char *Type) const
226{
227 string Res;
228 if (Dist[Dist.size() - 1] == '/')
229 {
230 if (Dist != "/")
231 Res = URI + Dist;
232 else
233 Res = URI;
234 }
235 else
236 Res = URI + "dists/" + Dist + '/' + Section +
5dd4c8b8 237 "/binary-" + Architecture + '/';
b2e465d6
AL
238
239 Res += Type;
240 return Res;
241}
242 /*}}}*/
b2e465d6
AL
243// PackagesIndex::Exists - Check if the index is available /*{{{*/
244// ---------------------------------------------------------------------
245/* */
246bool debPackagesIndex::Exists() const
247{
248 return FileExists(IndexFile("Packages"));
249}
250 /*}}}*/
251// PackagesIndex::Size - Return the size of the index /*{{{*/
252// ---------------------------------------------------------------------
253/* This is really only used for progress reporting. */
254unsigned long debPackagesIndex::Size() const
255{
256 struct stat S;
257 if (stat(IndexFile("Packages").c_str(),&S) != 0)
258 return 0;
259 return S.st_size;
260}
261 /*}}}*/
262// PackagesIndex::Merge - Load the index file into a cache /*{{{*/
263// ---------------------------------------------------------------------
264/* */
2e5f4e45 265bool debPackagesIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
b2e465d6
AL
266{
267 string PackageFile = IndexFile("Packages");
268 FileFd Pkg(PackageFile,FileFd::ReadOnly);
5dd4c8b8 269 debListParser Parser(&Pkg, Architecture);
b2e465d6
AL
270 if (_error->PendingError() == true)
271 return _error->Error("Problem opening %s",PackageFile.c_str());
2e5f4e45
DK
272 if (Prog != NULL)
273 Prog->SubProgress(0,Info("Packages"));
b2e465d6
AL
274 ::URI Tmp(URI);
275 if (Gen.SelectFile(PackageFile,Tmp.Host,*this) == false)
276 return _error->Error("Problem with SelectFile %s",PackageFile.c_str());
277
278 // Store the IMS information
279 pkgCache::PkgFileIterator File = Gen.GetCurFile();
a9fe5928 280 pkgCacheGenerator::Dynamic<pkgCache::PkgFileIterator> DynFile(File);
b2e465d6
AL
281 struct stat St;
282 if (fstat(Pkg.Fd(),&St) != 0)
283 return _error->Errno("fstat","Failed to stat");
284 File->Size = St.st_size;
285 File->mtime = St.st_mtime;
286
287 if (Gen.MergeList(Parser) == false)
288 return _error->Error("Problem with MergeList %s",PackageFile.c_str());
289
290 // Check the release file
7db98ffc 291 string ReleaseFile = debReleaseIndex(URI,Dist).MetaIndexFile("Release");
b2e465d6
AL
292 if (FileExists(ReleaseFile) == true)
293 {
294 FileFd Rel(ReleaseFile,FileFd::ReadOnly);
295 if (_error->PendingError() == true)
296 return false;
e011829d 297 Parser.LoadReleaseInfo(File,Rel,Section);
b2e465d6
AL
298 }
299
300 return true;
301}
302 /*}}}*/
303// PackagesIndex::FindInCache - Find this index /*{{{*/
304// ---------------------------------------------------------------------
305/* */
306pkgCache::PkgFileIterator debPackagesIndex::FindInCache(pkgCache &Cache) const
307{
308 string FileName = IndexFile("Packages");
309 pkgCache::PkgFileIterator File = Cache.FileBegin();
310 for (; File.end() == false; File++)
311 {
f6442c77 312 if (File.FileName() == NULL || FileName != File.FileName())
b2e465d6
AL
313 continue;
314
315 struct stat St;
316 if (stat(File.FileName(),&St) != 0)
c8e572e3
MV
317 {
318 if (_config->FindB("Debug::pkgCacheGen", false))
319 std::clog << "PackagesIndex::FindInCache - stat failed on " << File.FileName() << std::endl;
b2e465d6 320 return pkgCache::PkgFileIterator(Cache);
c8e572e3 321 }
b2e465d6 322 if ((unsigned)St.st_size != File->Size || St.st_mtime != File->mtime)
c8e572e3
MV
323 {
324 if (_config->FindB("Debug::pkgCacheGen", false))
325 std::clog << "PackagesIndex::FindInCache - size (" << St.st_size << " <> " << File->Size
326 << ") or mtime (" << St.st_mtime << " <> " << File->mtime
327 << ") doesn't match for " << File.FileName() << std::endl;
b2e465d6 328 return pkgCache::PkgFileIterator(Cache);
c8e572e3 329 }
b2e465d6
AL
330 return File;
331 }
332
333 return File;
334}
335 /*}}}*/
336
a52f938b
OS
337// TranslationsIndex::debTranslationsIndex - Contructor /*{{{*/
338// ---------------------------------------------------------------------
339/* */
45df0ad2
DK
340debTranslationsIndex::debTranslationsIndex(string URI,string Dist,string Section,
341 char const * const Translation) :
342 pkgIndexFile(true), URI(URI), Dist(Dist), Section(Section),
343 Language(Translation)
344{}
a52f938b
OS
345 /*}}}*/
346// TranslationIndex::Trans* - Return the URI to the translation files /*{{{*/
347// ---------------------------------------------------------------------
348/* */
349inline string debTranslationsIndex::IndexFile(const char *Type) const
350{
351 return _config->FindDir("Dir::State::lists") + URItoFileName(IndexURI(Type));
352}
353string debTranslationsIndex::IndexURI(const char *Type) const
354{
355 string Res;
356 if (Dist[Dist.size() - 1] == '/')
357 {
358 if (Dist != "/")
422eeaaa 359 Res = URI + Dist;
a52f938b 360 else
422eeaaa 361 Res = URI;
a52f938b
OS
362 }
363 else
422eeaaa 364 Res = URI + "dists/" + Dist + '/' + Section +
a52f938b
OS
365 "/i18n/Translation-";
366
367 Res += Type;
368 return Res;
369}
370 /*}}}*/
371// TranslationsIndex::GetIndexes - Fetch the index files /*{{{*/
372// ---------------------------------------------------------------------
373/* */
374bool debTranslationsIndex::GetIndexes(pkgAcquire *Owner) const
375{
770c32ec 376 if (TranslationsAvailable()) {
45df0ad2
DK
377 string const TranslationFile = string("Translation-").append(Language);
378 new pkgAcqIndexTrans(Owner, IndexURI(Language),
a52f938b
OS
379 Info(TranslationFile.c_str()),
380 TranslationFile);
381 }
382
383 return true;
384}
385 /*}}}*/
386// TranslationsIndex::Describe - Give a descriptive path to the index /*{{{*/
387// ---------------------------------------------------------------------
388/* This should help the user find the index in the sources.list and
389 in the filesystem for problem solving */
390string debTranslationsIndex::Describe(bool Short) const
391{
392 char S[300];
393 if (Short == true)
394 snprintf(S,sizeof(S),"%s",Info(TranslationFile().c_str()).c_str());
395 else
396 snprintf(S,sizeof(S),"%s (%s)",Info(TranslationFile().c_str()).c_str(),
45df0ad2 397 IndexFile(Language).c_str());
a52f938b
OS
398 return S;
399}
400 /*}}}*/
401// TranslationsIndex::Info - One liner describing the index URI /*{{{*/
402// ---------------------------------------------------------------------
403/* */
404string debTranslationsIndex::Info(const char *Type) const
405{
5e02df82 406 string Info = ::URI::NoUserPassword(URI) + ' ';
a52f938b
OS
407 if (Dist[Dist.size() - 1] == '/')
408 {
409 if (Dist != "/")
410 Info += Dist;
411 }
412 else
413 Info += Dist + '/' + Section;
414 Info += " ";
415 Info += Type;
416 return Info;
417}
418 /*}}}*/
45df0ad2 419bool debTranslationsIndex::HasPackages() const /*{{{*/
11680bfd 420{
770c32ec 421 if(!TranslationsAvailable())
11680bfd
MV
422 return false;
423
45df0ad2 424 return FileExists(IndexFile(Language));
11680bfd 425}
45df0ad2 426 /*}}}*/
a52f938b
OS
427// TranslationsIndex::Exists - Check if the index is available /*{{{*/
428// ---------------------------------------------------------------------
429/* */
430bool debTranslationsIndex::Exists() const
431{
45df0ad2 432 return FileExists(IndexFile(Language));
a52f938b
OS
433}
434 /*}}}*/
435// TranslationsIndex::Size - Return the size of the index /*{{{*/
436// ---------------------------------------------------------------------
437/* This is really only used for progress reporting. */
438unsigned long debTranslationsIndex::Size() const
439{
440 struct stat S;
45df0ad2 441 if (stat(IndexFile(Language).c_str(),&S) != 0)
a52f938b
OS
442 return 0;
443 return S.st_size;
444}
445 /*}}}*/
446// TranslationsIndex::Merge - Load the index file into a cache /*{{{*/
447// ---------------------------------------------------------------------
448/* */
2e5f4e45 449bool debTranslationsIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
a52f938b
OS
450{
451 // Check the translation file, if in use
45df0ad2 452 string TranslationFile = IndexFile(Language);
770c32ec 453 if (TranslationsAvailable() && FileExists(TranslationFile))
a52f938b
OS
454 {
455 FileFd Trans(TranslationFile,FileFd::ReadOnly);
456 debListParser TransParser(&Trans);
457 if (_error->PendingError() == true)
458 return false;
459
2e5f4e45
DK
460 if (Prog != NULL)
461 Prog->SubProgress(0, Info(TranslationFile.c_str()));
a52f938b
OS
462 if (Gen.SelectFile(TranslationFile,string(),*this) == false)
463 return _error->Error("Problem with SelectFile %s",TranslationFile.c_str());
464
465 // Store the IMS information
466 pkgCache::PkgFileIterator TransFile = Gen.GetCurFile();
467 struct stat TransSt;
468 if (fstat(Trans.Fd(),&TransSt) != 0)
469 return _error->Errno("fstat","Failed to stat");
470 TransFile->Size = TransSt.st_size;
471 TransFile->mtime = TransSt.st_mtime;
472
473 if (Gen.MergeList(TransParser) == false)
474 return _error->Error("Problem with MergeList %s",TranslationFile.c_str());
475 }
476
477 return true;
478}
479 /*}}}*/
c51c6f08
OS
480// TranslationsIndex::FindInCache - Find this index /*{{{*/
481// ---------------------------------------------------------------------
482/* */
483pkgCache::PkgFileIterator debTranslationsIndex::FindInCache(pkgCache &Cache) const
484{
45df0ad2 485 string FileName = IndexFile(Language);
4d34acf1 486
c51c6f08 487 pkgCache::PkgFileIterator File = Cache.FileBegin();
f416d22e
MV
488 for (; File.end() == false; File++)
489 {
490 if (FileName != File.FileName())
491 continue;
4d34acf1 492
f416d22e
MV
493 struct stat St;
494 if (stat(File.FileName(),&St) != 0)
c8e572e3
MV
495 {
496 if (_config->FindB("Debug::pkgCacheGen", false))
497 std::clog << "TranslationIndex::FindInCache - stat failed on " << File.FileName() << std::endl;
f416d22e 498 return pkgCache::PkgFileIterator(Cache);
c8e572e3 499 }
f416d22e 500 if ((unsigned)St.st_size != File->Size || St.st_mtime != File->mtime)
c8e572e3
MV
501 {
502 if (_config->FindB("Debug::pkgCacheGen", false))
503 std::clog << "TranslationIndex::FindInCache - size (" << St.st_size << " <> " << File->Size
504 << ") or mtime (" << St.st_mtime << " <> " << File->mtime
505 << ") doesn't match for " << File.FileName() << std::endl;
f416d22e 506 return pkgCache::PkgFileIterator(Cache);
c8e572e3 507 }
f416d22e
MV
508 return File;
509 }
c51c6f08
OS
510 return File;
511}
512 /*}}}*/
b2e465d6
AL
513// StatusIndex::debStatusIndex - Constructor /*{{{*/
514// ---------------------------------------------------------------------
515/* */
7db98ffc 516debStatusIndex::debStatusIndex(string File) : pkgIndexFile(true), File(File)
b2e465d6
AL
517{
518}
519 /*}}}*/
520// StatusIndex::Size - Return the size of the index /*{{{*/
521// ---------------------------------------------------------------------
522/* */
523unsigned long debStatusIndex::Size() const
524{
525 struct stat S;
526 if (stat(File.c_str(),&S) != 0)
527 return 0;
528 return S.st_size;
529}
530 /*}}}*/
531// StatusIndex::Merge - Load the index file into a cache /*{{{*/
532// ---------------------------------------------------------------------
533/* */
2e5f4e45 534bool debStatusIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
b2e465d6
AL
535{
536 FileFd Pkg(File,FileFd::ReadOnly);
537 if (_error->PendingError() == true)
538 return false;
539 debListParser Parser(&Pkg);
540 if (_error->PendingError() == true)
541 return false;
2e5f4e45
DK
542
543 if (Prog != NULL)
544 Prog->SubProgress(0,File);
b2e465d6
AL
545 if (Gen.SelectFile(File,string(),*this,pkgCache::Flag::NotSource) == false)
546 return _error->Error("Problem with SelectFile %s",File.c_str());
547
548 // Store the IMS information
549 pkgCache::PkgFileIterator CFile = Gen.GetCurFile();
550 struct stat St;
551 if (fstat(Pkg.Fd(),&St) != 0)
552 return _error->Errno("fstat","Failed to stat");
553 CFile->Size = St.st_size;
554 CFile->mtime = St.st_mtime;
555 CFile->Archive = Gen.WriteUniqString("now");
556
557 if (Gen.MergeList(Parser) == false)
558 return _error->Error("Problem with MergeList %s",File.c_str());
559 return true;
560}
561 /*}}}*/
562// StatusIndex::FindInCache - Find this index /*{{{*/
563// ---------------------------------------------------------------------
564/* */
565pkgCache::PkgFileIterator debStatusIndex::FindInCache(pkgCache &Cache) const
566{
567 pkgCache::PkgFileIterator File = Cache.FileBegin();
568 for (; File.end() == false; File++)
569 {
570 if (this->File != File.FileName())
571 continue;
572
573 struct stat St;
574 if (stat(File.FileName(),&St) != 0)
c8e572e3
MV
575 {
576 if (_config->FindB("Debug::pkgCacheGen", false))
577 std::clog << "StatusIndex::FindInCache - stat failed on " << File.FileName() << std::endl;
b2e465d6 578 return pkgCache::PkgFileIterator(Cache);
c8e572e3 579 }
b2e465d6 580 if ((unsigned)St.st_size != File->Size || St.st_mtime != File->mtime)
c8e572e3
MV
581 {
582 if (_config->FindB("Debug::pkgCacheGen", false))
583 std::clog << "StatusIndex::FindInCache - size (" << St.st_size << " <> " << File->Size
584 << ") or mtime (" << St.st_mtime << " <> " << File->mtime
585 << ") doesn't match for " << File.FileName() << std::endl;
b2e465d6 586 return pkgCache::PkgFileIterator(Cache);
c8e572e3 587 }
b2e465d6
AL
588 return File;
589 }
590 return File;
591}
592 /*}}}*/
593// StatusIndex::Exists - Check if the index is available /*{{{*/
594// ---------------------------------------------------------------------
595/* */
596bool debStatusIndex::Exists() const
597{
598 // Abort if the file does not exist.
599 return true;
600}
601 /*}}}*/
602
b2e465d6
AL
603// Index File types for Debian /*{{{*/
604class debIFTypeSrc : public pkgIndexFile::Type
605{
606 public:
607
608 debIFTypeSrc() {Label = "Debian Source Index";};
609};
610class debIFTypePkg : public pkgIndexFile::Type
611{
612 public:
613
614 virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator File) const
615 {
616 return new debRecordParser(File.FileName(),*File.Cache());
617 };
618 debIFTypePkg() {Label = "Debian Package Index";};
619};
97234432
MV
620class debIFTypeTrans : public debIFTypePkg
621{
622 public:
623 debIFTypeTrans() {Label = "Debian Translation Index";};
624};
b2e465d6
AL
625class debIFTypeStatus : public pkgIndexFile::Type
626{
627 public:
628
629 virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator File) const
630 {
631 return new debRecordParser(File.FileName(),*File.Cache());
632 };
633 debIFTypeStatus() {Label = "Debian dpkg status file";};
634};
635static debIFTypeSrc _apt_Src;
636static debIFTypePkg _apt_Pkg;
97234432 637static debIFTypeTrans _apt_Trans;
b2e465d6
AL
638static debIFTypeStatus _apt_Status;
639
640const pkgIndexFile::Type *debSourcesIndex::GetType() const
641{
642 return &_apt_Src;
643}
644const pkgIndexFile::Type *debPackagesIndex::GetType() const
645{
646 return &_apt_Pkg;
647}
a52f938b
OS
648const pkgIndexFile::Type *debTranslationsIndex::GetType() const
649{
97234432 650 return &_apt_Trans;
a52f938b 651}
b2e465d6
AL
652const pkgIndexFile::Type *debStatusIndex::GetType() const
653{
654 return &_apt_Status;
655}
656
657 /*}}}*/