use references instead of copies in the Cache generation methods
[ntk/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();
280 struct stat St;
281 if (fstat(Pkg.Fd(),&St) != 0)
282 return _error->Errno("fstat","Failed to stat");
283 File->Size = St.st_size;
284 File->mtime = St.st_mtime;
285
286 if (Gen.MergeList(Parser) == false)
287 return _error->Error("Problem with MergeList %s",PackageFile.c_str());
288
289 // Check the release file
7db98ffc 290 string ReleaseFile = debReleaseIndex(URI,Dist).MetaIndexFile("Release");
b2e465d6
AL
291 if (FileExists(ReleaseFile) == true)
292 {
293 FileFd Rel(ReleaseFile,FileFd::ReadOnly);
294 if (_error->PendingError() == true)
295 return false;
e011829d 296 Parser.LoadReleaseInfo(File,Rel,Section);
b2e465d6
AL
297 }
298
299 return true;
300}
301 /*}}}*/
302// PackagesIndex::FindInCache - Find this index /*{{{*/
303// ---------------------------------------------------------------------
304/* */
305pkgCache::PkgFileIterator debPackagesIndex::FindInCache(pkgCache &Cache) const
306{
307 string FileName = IndexFile("Packages");
308 pkgCache::PkgFileIterator File = Cache.FileBegin();
309 for (; File.end() == false; File++)
310 {
f6442c77 311 if (File.FileName() == NULL || FileName != File.FileName())
b2e465d6
AL
312 continue;
313
314 struct stat St;
315 if (stat(File.FileName(),&St) != 0)
c8e572e3
MV
316 {
317 if (_config->FindB("Debug::pkgCacheGen", false))
318 std::clog << "PackagesIndex::FindInCache - stat failed on " << File.FileName() << std::endl;
b2e465d6 319 return pkgCache::PkgFileIterator(Cache);
c8e572e3 320 }
b2e465d6 321 if ((unsigned)St.st_size != File->Size || St.st_mtime != File->mtime)
c8e572e3
MV
322 {
323 if (_config->FindB("Debug::pkgCacheGen", false))
324 std::clog << "PackagesIndex::FindInCache - size (" << St.st_size << " <> " << File->Size
325 << ") or mtime (" << St.st_mtime << " <> " << File->mtime
326 << ") doesn't match for " << File.FileName() << std::endl;
b2e465d6 327 return pkgCache::PkgFileIterator(Cache);
c8e572e3 328 }
b2e465d6
AL
329 return File;
330 }
331
332 return File;
333}
334 /*}}}*/
335
a52f938b
OS
336// TranslationsIndex::debTranslationsIndex - Contructor /*{{{*/
337// ---------------------------------------------------------------------
338/* */
45df0ad2
DK
339debTranslationsIndex::debTranslationsIndex(string URI,string Dist,string Section,
340 char const * const Translation) :
341 pkgIndexFile(true), URI(URI), Dist(Dist), Section(Section),
342 Language(Translation)
343{}
a52f938b
OS
344 /*}}}*/
345// TranslationIndex::Trans* - Return the URI to the translation files /*{{{*/
346// ---------------------------------------------------------------------
347/* */
348inline string debTranslationsIndex::IndexFile(const char *Type) const
349{
350 return _config->FindDir("Dir::State::lists") + URItoFileName(IndexURI(Type));
351}
352string debTranslationsIndex::IndexURI(const char *Type) const
353{
354 string Res;
355 if (Dist[Dist.size() - 1] == '/')
356 {
357 if (Dist != "/")
422eeaaa 358 Res = URI + Dist;
a52f938b 359 else
422eeaaa 360 Res = URI;
a52f938b
OS
361 }
362 else
422eeaaa 363 Res = URI + "dists/" + Dist + '/' + Section +
a52f938b
OS
364 "/i18n/Translation-";
365
366 Res += Type;
367 return Res;
368}
369 /*}}}*/
370// TranslationsIndex::GetIndexes - Fetch the index files /*{{{*/
371// ---------------------------------------------------------------------
372/* */
373bool debTranslationsIndex::GetIndexes(pkgAcquire *Owner) const
374{
770c32ec 375 if (TranslationsAvailable()) {
45df0ad2
DK
376 string const TranslationFile = string("Translation-").append(Language);
377 new pkgAcqIndexTrans(Owner, IndexURI(Language),
a52f938b
OS
378 Info(TranslationFile.c_str()),
379 TranslationFile);
380 }
381
382 return true;
383}
384 /*}}}*/
385// TranslationsIndex::Describe - Give a descriptive path to the index /*{{{*/
386// ---------------------------------------------------------------------
387/* This should help the user find the index in the sources.list and
388 in the filesystem for problem solving */
389string debTranslationsIndex::Describe(bool Short) const
390{
391 char S[300];
392 if (Short == true)
393 snprintf(S,sizeof(S),"%s",Info(TranslationFile().c_str()).c_str());
394 else
395 snprintf(S,sizeof(S),"%s (%s)",Info(TranslationFile().c_str()).c_str(),
45df0ad2 396 IndexFile(Language).c_str());
a52f938b
OS
397 return S;
398}
399 /*}}}*/
400// TranslationsIndex::Info - One liner describing the index URI /*{{{*/
401// ---------------------------------------------------------------------
402/* */
403string debTranslationsIndex::Info(const char *Type) const
404{
5e02df82 405 string Info = ::URI::NoUserPassword(URI) + ' ';
a52f938b
OS
406 if (Dist[Dist.size() - 1] == '/')
407 {
408 if (Dist != "/")
409 Info += Dist;
410 }
411 else
412 Info += Dist + '/' + Section;
413 Info += " ";
414 Info += Type;
415 return Info;
416}
417 /*}}}*/
45df0ad2 418bool debTranslationsIndex::HasPackages() const /*{{{*/
11680bfd 419{
770c32ec 420 if(!TranslationsAvailable())
11680bfd
MV
421 return false;
422
45df0ad2 423 return FileExists(IndexFile(Language));
11680bfd 424}
45df0ad2 425 /*}}}*/
a52f938b
OS
426// TranslationsIndex::Exists - Check if the index is available /*{{{*/
427// ---------------------------------------------------------------------
428/* */
429bool debTranslationsIndex::Exists() const
430{
45df0ad2 431 return FileExists(IndexFile(Language));
a52f938b
OS
432}
433 /*}}}*/
434// TranslationsIndex::Size - Return the size of the index /*{{{*/
435// ---------------------------------------------------------------------
436/* This is really only used for progress reporting. */
437unsigned long debTranslationsIndex::Size() const
438{
439 struct stat S;
45df0ad2 440 if (stat(IndexFile(Language).c_str(),&S) != 0)
a52f938b
OS
441 return 0;
442 return S.st_size;
443}
444 /*}}}*/
445// TranslationsIndex::Merge - Load the index file into a cache /*{{{*/
446// ---------------------------------------------------------------------
447/* */
2e5f4e45 448bool debTranslationsIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
a52f938b
OS
449{
450 // Check the translation file, if in use
45df0ad2 451 string TranslationFile = IndexFile(Language);
770c32ec 452 if (TranslationsAvailable() && FileExists(TranslationFile))
a52f938b
OS
453 {
454 FileFd Trans(TranslationFile,FileFd::ReadOnly);
455 debListParser TransParser(&Trans);
456 if (_error->PendingError() == true)
457 return false;
458
2e5f4e45
DK
459 if (Prog != NULL)
460 Prog->SubProgress(0, Info(TranslationFile.c_str()));
a52f938b
OS
461 if (Gen.SelectFile(TranslationFile,string(),*this) == false)
462 return _error->Error("Problem with SelectFile %s",TranslationFile.c_str());
463
464 // Store the IMS information
465 pkgCache::PkgFileIterator TransFile = Gen.GetCurFile();
466 struct stat TransSt;
467 if (fstat(Trans.Fd(),&TransSt) != 0)
468 return _error->Errno("fstat","Failed to stat");
469 TransFile->Size = TransSt.st_size;
470 TransFile->mtime = TransSt.st_mtime;
471
472 if (Gen.MergeList(TransParser) == false)
473 return _error->Error("Problem with MergeList %s",TranslationFile.c_str());
474 }
475
476 return true;
477}
478 /*}}}*/
c51c6f08
OS
479// TranslationsIndex::FindInCache - Find this index /*{{{*/
480// ---------------------------------------------------------------------
481/* */
482pkgCache::PkgFileIterator debTranslationsIndex::FindInCache(pkgCache &Cache) const
483{
45df0ad2 484 string FileName = IndexFile(Language);
4d34acf1 485
c51c6f08 486 pkgCache::PkgFileIterator File = Cache.FileBegin();
f416d22e
MV
487 for (; File.end() == false; File++)
488 {
489 if (FileName != File.FileName())
490 continue;
4d34acf1 491
f416d22e
MV
492 struct stat St;
493 if (stat(File.FileName(),&St) != 0)
c8e572e3
MV
494 {
495 if (_config->FindB("Debug::pkgCacheGen", false))
496 std::clog << "TranslationIndex::FindInCache - stat failed on " << File.FileName() << std::endl;
f416d22e 497 return pkgCache::PkgFileIterator(Cache);
c8e572e3 498 }
f416d22e 499 if ((unsigned)St.st_size != File->Size || St.st_mtime != File->mtime)
c8e572e3
MV
500 {
501 if (_config->FindB("Debug::pkgCacheGen", false))
502 std::clog << "TranslationIndex::FindInCache - size (" << St.st_size << " <> " << File->Size
503 << ") or mtime (" << St.st_mtime << " <> " << File->mtime
504 << ") doesn't match for " << File.FileName() << std::endl;
f416d22e 505 return pkgCache::PkgFileIterator(Cache);
c8e572e3 506 }
f416d22e
MV
507 return File;
508 }
c51c6f08
OS
509 return File;
510}
511 /*}}}*/
b2e465d6
AL
512// StatusIndex::debStatusIndex - Constructor /*{{{*/
513// ---------------------------------------------------------------------
514/* */
7db98ffc 515debStatusIndex::debStatusIndex(string File) : pkgIndexFile(true), File(File)
b2e465d6
AL
516{
517}
518 /*}}}*/
519// StatusIndex::Size - Return the size of the index /*{{{*/
520// ---------------------------------------------------------------------
521/* */
522unsigned long debStatusIndex::Size() const
523{
524 struct stat S;
525 if (stat(File.c_str(),&S) != 0)
526 return 0;
527 return S.st_size;
528}
529 /*}}}*/
530// StatusIndex::Merge - Load the index file into a cache /*{{{*/
531// ---------------------------------------------------------------------
532/* */
2e5f4e45 533bool debStatusIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
b2e465d6
AL
534{
535 FileFd Pkg(File,FileFd::ReadOnly);
536 if (_error->PendingError() == true)
537 return false;
538 debListParser Parser(&Pkg);
539 if (_error->PendingError() == true)
540 return false;
2e5f4e45
DK
541
542 if (Prog != NULL)
543 Prog->SubProgress(0,File);
b2e465d6
AL
544 if (Gen.SelectFile(File,string(),*this,pkgCache::Flag::NotSource) == false)
545 return _error->Error("Problem with SelectFile %s",File.c_str());
546
547 // Store the IMS information
548 pkgCache::PkgFileIterator CFile = Gen.GetCurFile();
549 struct stat St;
550 if (fstat(Pkg.Fd(),&St) != 0)
551 return _error->Errno("fstat","Failed to stat");
552 CFile->Size = St.st_size;
553 CFile->mtime = St.st_mtime;
554 CFile->Archive = Gen.WriteUniqString("now");
555
556 if (Gen.MergeList(Parser) == false)
557 return _error->Error("Problem with MergeList %s",File.c_str());
558 return true;
559}
560 /*}}}*/
561// StatusIndex::FindInCache - Find this index /*{{{*/
562// ---------------------------------------------------------------------
563/* */
564pkgCache::PkgFileIterator debStatusIndex::FindInCache(pkgCache &Cache) const
565{
566 pkgCache::PkgFileIterator File = Cache.FileBegin();
567 for (; File.end() == false; File++)
568 {
569 if (this->File != File.FileName())
570 continue;
571
572 struct stat St;
573 if (stat(File.FileName(),&St) != 0)
c8e572e3
MV
574 {
575 if (_config->FindB("Debug::pkgCacheGen", false))
576 std::clog << "StatusIndex::FindInCache - stat failed on " << File.FileName() << std::endl;
b2e465d6 577 return pkgCache::PkgFileIterator(Cache);
c8e572e3 578 }
b2e465d6 579 if ((unsigned)St.st_size != File->Size || St.st_mtime != File->mtime)
c8e572e3
MV
580 {
581 if (_config->FindB("Debug::pkgCacheGen", false))
582 std::clog << "StatusIndex::FindInCache - size (" << St.st_size << " <> " << File->Size
583 << ") or mtime (" << St.st_mtime << " <> " << File->mtime
584 << ") doesn't match for " << File.FileName() << std::endl;
b2e465d6 585 return pkgCache::PkgFileIterator(Cache);
c8e572e3 586 }
b2e465d6
AL
587 return File;
588 }
589 return File;
590}
591 /*}}}*/
592// StatusIndex::Exists - Check if the index is available /*{{{*/
593// ---------------------------------------------------------------------
594/* */
595bool debStatusIndex::Exists() const
596{
597 // Abort if the file does not exist.
598 return true;
599}
600 /*}}}*/
601
b2e465d6
AL
602// Index File types for Debian /*{{{*/
603class debIFTypeSrc : public pkgIndexFile::Type
604{
605 public:
606
607 debIFTypeSrc() {Label = "Debian Source Index";};
608};
609class debIFTypePkg : public pkgIndexFile::Type
610{
611 public:
612
613 virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator File) const
614 {
615 return new debRecordParser(File.FileName(),*File.Cache());
616 };
617 debIFTypePkg() {Label = "Debian Package Index";};
618};
97234432
MV
619class debIFTypeTrans : public debIFTypePkg
620{
621 public:
622 debIFTypeTrans() {Label = "Debian Translation Index";};
623};
b2e465d6
AL
624class debIFTypeStatus : public pkgIndexFile::Type
625{
626 public:
627
628 virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator File) const
629 {
630 return new debRecordParser(File.FileName(),*File.Cache());
631 };
632 debIFTypeStatus() {Label = "Debian dpkg status file";};
633};
634static debIFTypeSrc _apt_Src;
635static debIFTypePkg _apt_Pkg;
97234432 636static debIFTypeTrans _apt_Trans;
b2e465d6
AL
637static debIFTypeStatus _apt_Status;
638
639const pkgIndexFile::Type *debSourcesIndex::GetType() const
640{
641 return &_apt_Src;
642}
643const pkgIndexFile::Type *debPackagesIndex::GetType() const
644{
645 return &_apt_Pkg;
646}
a52f938b
OS
647const pkgIndexFile::Type *debTranslationsIndex::GetType() const
648{
97234432 649 return &_apt_Trans;
a52f938b 650}
b2e465d6
AL
651const pkgIndexFile::Type *debStatusIndex::GetType() const
652{
653 return &_apt_Status;
654}
655
656 /*}}}*/