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