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