1 // -*- mode: cpp; mode: fold -*-
3 // $Id: debindexfile.cc,v 1.5.2.3 2004/01/04 19:11:00 mdz Exp $
4 /* ######################################################################
6 Debian Specific sources.list types and the three sorts of Debian
9 ##################################################################### */
11 // Include Files /*{{{*/
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/configuration.h>
19 #include <apt-pkg/progress.h>
20 #include <apt-pkg/error.h>
21 #include <apt-pkg/strutl.h>
22 #include <apt-pkg/acquire-item.h>
23 #include <apt-pkg/debmetaindex.h>
24 #include <apt-pkg/gpgv.h>
25 #include <apt-pkg/fileutl.h>
26 #include <apt-pkg/indexfile.h>
27 #include <apt-pkg/mmap.h>
28 #include <apt-pkg/pkgcache.h>
29 #include <apt-pkg/cacheiterators.h>
30 #include <apt-pkg/pkgcachegen.h>
31 #include <apt-pkg/pkgrecords.h>
32 #include <apt-pkg/srcrecords.h>
33 #include <apt-pkg/sptr.h>
43 // SourcesIndex::debSourcesIndex - Constructor /*{{{*/
44 // ---------------------------------------------------------------------
46 debSourcesIndex::debSourcesIndex(string URI
,string Dist
,string Section
,bool Trusted
) :
47 pkgIndexFile(Trusted
), URI(URI
), Dist(Dist
), Section(Section
)
51 // SourcesIndex::SourceInfo - Short 1 liner describing a source /*{{{*/
52 // ---------------------------------------------------------------------
53 /* The result looks like:
54 http://foo/debian/ stable/main src 1.1.1 (dsc) */
55 string
debSourcesIndex::SourceInfo(pkgSrcRecords::Parser
const &Record
,
56 pkgSrcRecords::File
const &File
) const
59 Res
= ::URI::NoUserPassword(URI
) + ' ';
60 if (Dist
[Dist
.size() - 1] == '/')
66 Res
+= Dist
+ '/' + Section
;
69 Res
+= Record
.Package();
71 Res
+= Record
.Version();
72 if (File
.Type
.empty() == false)
73 Res
+= " (" + File
.Type
+ ")";
77 // SourcesIndex::CreateSrcParser - Get a parser for the source files /*{{{*/
78 // ---------------------------------------------------------------------
80 pkgSrcRecords::Parser
*debSourcesIndex::CreateSrcParser() const
82 string SourcesURI
= _config
->FindDir("Dir::State::lists") +
83 URItoFileName(IndexURI("Sources"));
84 string SourcesURIgzip
= SourcesURI
+ ".gz";
86 if (!FileExists(SourcesURI
) && !FileExists(SourcesURIgzip
))
88 else if (!FileExists(SourcesURI
) && FileExists(SourcesURIgzip
))
89 SourcesURI
= SourcesURIgzip
;
91 return new debSrcRecordParser(SourcesURI
,this);
94 // SourcesIndex::Describe - Give a descriptive path to the index /*{{{*/
95 // ---------------------------------------------------------------------
97 string
debSourcesIndex::Describe(bool Short
) const
101 snprintf(S
,sizeof(S
),"%s",Info("Sources").c_str());
103 snprintf(S
,sizeof(S
),"%s (%s)",Info("Sources").c_str(),
104 IndexFile("Sources").c_str());
109 // SourcesIndex::Info - One liner describing the index URI /*{{{*/
110 // ---------------------------------------------------------------------
112 string
debSourcesIndex::Info(const char *Type
) const
114 string Info
= ::URI::NoUserPassword(URI
) + ' ';
115 if (Dist
[Dist
.size() - 1] == '/')
121 Info
+= Dist
+ '/' + Section
;
127 // SourcesIndex::Index* - Return the URI to the index files /*{{{*/
128 // ---------------------------------------------------------------------
130 inline string
debSourcesIndex::IndexFile(const char *Type
) const
132 string s
= URItoFileName(IndexURI(Type
));
133 string sgzip
= s
+ ".gz";
134 if (!FileExists(s
) && FileExists(sgzip
))
140 string
debSourcesIndex::IndexURI(const char *Type
) const
143 if (Dist
[Dist
.size() - 1] == '/')
151 Res
= URI
+ "dists/" + Dist
+ '/' + Section
+
158 // SourcesIndex::Exists - Check if the index is available /*{{{*/
159 // ---------------------------------------------------------------------
161 bool debSourcesIndex::Exists() const
163 return FileExists(IndexFile("Sources"));
166 // SourcesIndex::Size - Return the size of the index /*{{{*/
167 // ---------------------------------------------------------------------
169 unsigned long debSourcesIndex::Size() const
171 unsigned long size
= 0;
173 /* we need to ignore errors here; if the lists are absent, just return 0 */
174 _error
->PushToStack();
176 FileFd
f(IndexFile("Sources"), FileFd::ReadOnly
, FileFd::Extension
);
180 if (_error
->PendingError() == true)
182 _error
->RevertToStack();
188 // PackagesIndex::debPackagesIndex - Contructor /*{{{*/
189 // ---------------------------------------------------------------------
191 debPackagesIndex::debPackagesIndex(string
const &URI
, string
const &Dist
, string
const &Section
,
192 bool const &Trusted
, string
const &Arch
) :
193 pkgIndexFile(Trusted
), URI(URI
), Dist(Dist
), Section(Section
), Architecture(Arch
)
195 if (Architecture
== "native")
196 Architecture
= _config
->Find("APT::Architecture");
199 // PackagesIndex::ArchiveInfo - Short version of the archive url /*{{{*/
200 // ---------------------------------------------------------------------
201 /* This is a shorter version that is designed to be < 60 chars or so */
202 string
debPackagesIndex::ArchiveInfo(pkgCache::VerIterator Ver
) const
204 string Res
= ::URI::NoUserPassword(URI
) + ' ';
205 if (Dist
[Dist
.size() - 1] == '/')
211 Res
+= Dist
+ '/' + Section
;
214 Res
+= Ver
.ParentPkg().Name();
216 if (Dist
[Dist
.size() - 1] != '/')
217 Res
.append(Ver
.Arch()).append(" ");
222 // PackagesIndex::Describe - Give a descriptive path to the index /*{{{*/
223 // ---------------------------------------------------------------------
224 /* This should help the user find the index in the sources.list and
225 in the filesystem for problem solving */
226 string
debPackagesIndex::Describe(bool Short
) const
230 snprintf(S
,sizeof(S
),"%s",Info("Packages").c_str());
232 snprintf(S
,sizeof(S
),"%s (%s)",Info("Packages").c_str(),
233 IndexFile("Packages").c_str());
237 // PackagesIndex::Info - One liner describing the index URI /*{{{*/
238 // ---------------------------------------------------------------------
240 string
debPackagesIndex::Info(const char *Type
) const
242 string Info
= ::URI::NoUserPassword(URI
) + ' ';
243 if (Dist
[Dist
.size() - 1] == '/')
249 Info
+= Dist
+ '/' + Section
;
251 if (Dist
[Dist
.size() - 1] != '/')
252 Info
+= Architecture
+ " ";
257 // PackagesIndex::Index* - Return the URI to the index files /*{{{*/
258 // ---------------------------------------------------------------------
260 inline string
debPackagesIndex::IndexFile(const char *Type
) const
262 string s
=_config
->FindDir("Dir::State::lists") + URItoFileName(IndexURI(Type
));
263 string sgzip
= s
+ ".gz";
264 if (!FileExists(s
) && FileExists(sgzip
))
269 string
debPackagesIndex::IndexURI(const char *Type
) const
272 if (Dist
[Dist
.size() - 1] == '/')
280 Res
= URI
+ "dists/" + Dist
+ '/' + Section
+
281 "/binary-" + Architecture
+ '/';
287 // PackagesIndex::Exists - Check if the index is available /*{{{*/
288 // ---------------------------------------------------------------------
290 bool debPackagesIndex::Exists() const
292 return FileExists(IndexFile("Packages"));
295 // PackagesIndex::Size - Return the size of the index /*{{{*/
296 // ---------------------------------------------------------------------
297 /* This is really only used for progress reporting. */
298 unsigned long debPackagesIndex::Size() const
300 unsigned long size
= 0;
302 /* we need to ignore errors here; if the lists are absent, just return 0 */
303 _error
->PushToStack();
305 FileFd
f(IndexFile("Packages"), FileFd::ReadOnly
, FileFd::Extension
);
309 if (_error
->PendingError() == true)
311 _error
->RevertToStack();
316 // PackagesIndex::Merge - Load the index file into a cache /*{{{*/
317 // ---------------------------------------------------------------------
319 bool debPackagesIndex::Merge(pkgCacheGenerator
&Gen
,OpProgress
*Prog
) const
321 string PackageFile
= IndexFile("Packages");
322 FileFd
Pkg(PackageFile
,FileFd::ReadOnly
, FileFd::Extension
);
323 debListParser
Parser(&Pkg
, Architecture
);
325 if (_error
->PendingError() == true)
326 return _error
->Error("Problem opening %s",PackageFile
.c_str());
328 Prog
->SubProgress(0,Info("Packages"));
330 if (Gen
.SelectFile(PackageFile
,Tmp
.Host
,*this) == false)
331 return _error
->Error("Problem with SelectFile %s",PackageFile
.c_str());
333 // Store the IMS information
334 pkgCache::PkgFileIterator File
= Gen
.GetCurFile();
335 pkgCacheGenerator::Dynamic
<pkgCache::PkgFileIterator
> DynFile(File
);
336 File
->Size
= Pkg
.FileSize();
337 File
->mtime
= Pkg
.ModificationTime();
339 if (Gen
.MergeList(Parser
) == false)
340 return _error
->Error("Problem with MergeList %s",PackageFile
.c_str());
342 // Check the release file
343 string ReleaseFile
= debReleaseIndex(URI
,Dist
).MetaIndexFile("InRelease");
344 bool releaseExists
= false;
345 if (FileExists(ReleaseFile
) == true)
346 releaseExists
= true;
348 ReleaseFile
= debReleaseIndex(URI
,Dist
).MetaIndexFile("Release");
350 if (releaseExists
== true || FileExists(ReleaseFile
) == true)
353 // Beware: The 'Release' file might be clearsigned in case the
354 // signature for an 'InRelease' file couldn't be checked
355 if (OpenMaybeClearSignedFile(ReleaseFile
, Rel
) == false)
358 if (_error
->PendingError() == true)
360 Parser
.LoadReleaseInfo(File
,Rel
,Section
);
366 // PackagesIndex::FindInCache - Find this index /*{{{*/
367 // ---------------------------------------------------------------------
369 pkgCache::PkgFileIterator
debPackagesIndex::FindInCache(pkgCache
&Cache
) const
371 string FileName
= IndexFile("Packages");
372 pkgCache::PkgFileIterator File
= Cache
.FileBegin();
373 for (; File
.end() == false; ++File
)
375 if (File
.FileName() == NULL
|| FileName
!= File
.FileName())
379 if (stat(File
.FileName(),&St
) != 0)
381 if (_config
->FindB("Debug::pkgCacheGen", false))
382 std::clog
<< "PackagesIndex::FindInCache - stat failed on " << File
.FileName() << std::endl
;
383 return pkgCache::PkgFileIterator(Cache
);
385 if ((unsigned)St
.st_size
!= File
->Size
|| St
.st_mtime
!= File
->mtime
)
387 if (_config
->FindB("Debug::pkgCacheGen", false))
388 std::clog
<< "PackagesIndex::FindInCache - size (" << St
.st_size
<< " <> " << File
->Size
389 << ") or mtime (" << St
.st_mtime
<< " <> " << File
->mtime
390 << ") doesn't match for " << File
.FileName() << std::endl
;
391 return pkgCache::PkgFileIterator(Cache
);
400 // TranslationsIndex::debTranslationsIndex - Contructor /*{{{*/
401 // ---------------------------------------------------------------------
403 debTranslationsIndex::debTranslationsIndex(string URI
,string Dist
,string Section
,
404 char const * const Translation
) :
405 pkgIndexFile(true), URI(URI
), Dist(Dist
), Section(Section
),
406 Language(Translation
)
409 // TranslationIndex::Trans* - Return the URI to the translation files /*{{{*/
410 // ---------------------------------------------------------------------
412 inline string
debTranslationsIndex::IndexFile(const char *Type
) const
414 string s
=_config
->FindDir("Dir::State::lists") + URItoFileName(IndexURI(Type
));
415 string sgzip
= s
+ ".gz";
416 if (!FileExists(s
) && FileExists(sgzip
))
421 string
debTranslationsIndex::IndexURI(const char *Type
) const
424 if (Dist
[Dist
.size() - 1] == '/')
432 Res
= URI
+ "dists/" + Dist
+ '/' + Section
+
433 "/i18n/Translation-";
439 // TranslationsIndex::GetIndexes - Fetch the index files /*{{{*/
440 // ---------------------------------------------------------------------
442 bool debTranslationsIndex::GetIndexes(pkgAcquire
*Owner
) const
444 string
const TranslationFile
= string("Translation-").append(Language
);
445 new pkgAcqIndexTrans(Owner
, IndexURI(Language
),
446 Info(TranslationFile
.c_str()),
452 // TranslationsIndex::Describe - Give a descriptive path to the index /*{{{*/
453 // ---------------------------------------------------------------------
454 /* This should help the user find the index in the sources.list and
455 in the filesystem for problem solving */
456 string
debTranslationsIndex::Describe(bool Short
) const
460 snprintf(S
,sizeof(S
),"%s",Info(TranslationFile().c_str()).c_str());
462 snprintf(S
,sizeof(S
),"%s (%s)",Info(TranslationFile().c_str()).c_str(),
463 IndexFile(Language
).c_str());
467 // TranslationsIndex::Info - One liner describing the index URI /*{{{*/
468 // ---------------------------------------------------------------------
470 string
debTranslationsIndex::Info(const char *Type
) const
472 string Info
= ::URI::NoUserPassword(URI
) + ' ';
473 if (Dist
[Dist
.size() - 1] == '/')
479 Info
+= Dist
+ '/' + Section
;
485 bool debTranslationsIndex::HasPackages() const /*{{{*/
487 return FileExists(IndexFile(Language
));
490 // TranslationsIndex::Exists - Check if the index is available /*{{{*/
491 // ---------------------------------------------------------------------
493 bool debTranslationsIndex::Exists() const
495 return FileExists(IndexFile(Language
));
498 // TranslationsIndex::Size - Return the size of the index /*{{{*/
499 // ---------------------------------------------------------------------
500 /* This is really only used for progress reporting. */
501 unsigned long debTranslationsIndex::Size() const
503 unsigned long size
= 0;
505 /* we need to ignore errors here; if the lists are absent, just return 0 */
506 _error
->PushToStack();
508 FileFd
f(IndexFile(Language
), FileFd::ReadOnly
, FileFd::Extension
);
512 if (_error
->PendingError() == true)
514 _error
->RevertToStack();
519 // TranslationsIndex::Merge - Load the index file into a cache /*{{{*/
520 // ---------------------------------------------------------------------
522 bool debTranslationsIndex::Merge(pkgCacheGenerator
&Gen
,OpProgress
*Prog
) const
524 // Check the translation file, if in use
525 string TranslationFile
= IndexFile(Language
);
526 if (FileExists(TranslationFile
))
528 FileFd
Trans(TranslationFile
,FileFd::ReadOnly
, FileFd::Extension
);
529 debListParser
TransParser(&Trans
);
530 if (_error
->PendingError() == true)
534 Prog
->SubProgress(0, Info(TranslationFile
.c_str()));
535 if (Gen
.SelectFile(TranslationFile
,string(),*this) == false)
536 return _error
->Error("Problem with SelectFile %s",TranslationFile
.c_str());
538 // Store the IMS information
539 pkgCache::PkgFileIterator TransFile
= Gen
.GetCurFile();
540 TransFile
->Size
= Trans
.FileSize();
541 TransFile
->mtime
= Trans
.ModificationTime();
543 if (Gen
.MergeList(TransParser
) == false)
544 return _error
->Error("Problem with MergeList %s",TranslationFile
.c_str());
550 // TranslationsIndex::FindInCache - Find this index /*{{{*/
551 // ---------------------------------------------------------------------
553 pkgCache::PkgFileIterator
debTranslationsIndex::FindInCache(pkgCache
&Cache
) const
555 string FileName
= IndexFile(Language
);
557 pkgCache::PkgFileIterator File
= Cache
.FileBegin();
558 for (; File
.end() == false; ++File
)
560 if (FileName
!= File
.FileName())
564 if (stat(File
.FileName(),&St
) != 0)
566 if (_config
->FindB("Debug::pkgCacheGen", false))
567 std::clog
<< "TranslationIndex::FindInCache - stat failed on " << File
.FileName() << std::endl
;
568 return pkgCache::PkgFileIterator(Cache
);
570 if ((unsigned)St
.st_size
!= File
->Size
|| St
.st_mtime
!= File
->mtime
)
572 if (_config
->FindB("Debug::pkgCacheGen", false))
573 std::clog
<< "TranslationIndex::FindInCache - size (" << St
.st_size
<< " <> " << File
->Size
574 << ") or mtime (" << St
.st_mtime
<< " <> " << File
->mtime
575 << ") doesn't match for " << File
.FileName() << std::endl
;
576 return pkgCache::PkgFileIterator(Cache
);
583 // StatusIndex::debStatusIndex - Constructor /*{{{*/
584 // ---------------------------------------------------------------------
586 debStatusIndex::debStatusIndex(string File
) : pkgIndexFile(true), File(File
)
590 // StatusIndex::Size - Return the size of the index /*{{{*/
591 // ---------------------------------------------------------------------
593 unsigned long debStatusIndex::Size() const
596 if (stat(File
.c_str(),&S
) != 0)
601 // StatusIndex::Merge - Load the index file into a cache /*{{{*/
602 // ---------------------------------------------------------------------
604 bool debStatusIndex::Merge(pkgCacheGenerator
&Gen
,OpProgress
*Prog
) const
606 FileFd
Pkg(File
,FileFd::ReadOnly
, FileFd::Extension
);
607 if (_error
->PendingError() == true)
609 debListParser
Parser(&Pkg
);
610 if (_error
->PendingError() == true)
614 Prog
->SubProgress(0,File
);
615 if (Gen
.SelectFile(File
,string(),*this,pkgCache::Flag::NotSource
) == false)
616 return _error
->Error("Problem with SelectFile %s",File
.c_str());
618 // Store the IMS information
619 pkgCache::PkgFileIterator CFile
= Gen
.GetCurFile();
620 CFile
->Size
= Pkg
.FileSize();
621 CFile
->mtime
= Pkg
.ModificationTime();
622 map_ptrloc
const storage
= Gen
.WriteUniqString("now");
623 CFile
->Archive
= storage
;
625 if (Gen
.MergeList(Parser
) == false)
626 return _error
->Error("Problem with MergeList %s",File
.c_str());
630 // StatusIndex::FindInCache - Find this index /*{{{*/
631 // ---------------------------------------------------------------------
633 pkgCache::PkgFileIterator
debStatusIndex::FindInCache(pkgCache
&Cache
) const
635 pkgCache::PkgFileIterator File
= Cache
.FileBegin();
636 for (; File
.end() == false; ++File
)
638 if (this->File
!= File
.FileName())
642 if (stat(File
.FileName(),&St
) != 0)
644 if (_config
->FindB("Debug::pkgCacheGen", false))
645 std::clog
<< "StatusIndex::FindInCache - stat failed on " << File
.FileName() << std::endl
;
646 return pkgCache::PkgFileIterator(Cache
);
648 if ((unsigned)St
.st_size
!= File
->Size
|| St
.st_mtime
!= File
->mtime
)
650 if (_config
->FindB("Debug::pkgCacheGen", false))
651 std::clog
<< "StatusIndex::FindInCache - size (" << St
.st_size
<< " <> " << File
->Size
652 << ") or mtime (" << St
.st_mtime
<< " <> " << File
->mtime
653 << ") doesn't match for " << File
.FileName() << std::endl
;
654 return pkgCache::PkgFileIterator(Cache
);
661 // StatusIndex::Exists - Check if the index is available /*{{{*/
662 // ---------------------------------------------------------------------
664 APT_CONST
bool debStatusIndex::Exists() const
666 // Abort if the file does not exist.
671 // debDebPkgFile - Single .deb file /*{{{*/
672 // ---------------------------------------------------------------------
673 debDebPkgFileIndex::debDebPkgFileIndex(std::string DebFile
)
674 : pkgIndexFile(true), DebFile(DebFile
)
676 DebFileFullPath
= flAbsPath(DebFile
);
679 std::string
debDebPkgFileIndex::ArchiveURI(std::string
/*File*/) const
681 return "file:" + DebFileFullPath
;
684 bool debDebPkgFileIndex::Exists() const
686 return FileExists(DebFile
);
688 bool debDebPkgFileIndex::Merge(pkgCacheGenerator
& Gen
, OpProgress
* Prog
) const
691 Prog
->SubProgress(0, "Reading deb file");
693 // get the control data out of the deb file vid dpkg -I
694 // ... can I haz libdpkg?
695 std::string dpkg
= _config
->Find("Dir::Bin::dpkg","dpkg");
696 const char *Args
[5] = {dpkg
.c_str(),
703 if(Popen(Args
, PipeFd
, Child
, FileFd::ReadOnly
) == false)
704 return _error
->Error("Popen failed");
705 // FIXME: static buffer
707 unsigned long long n
= 0;
708 if(PipeFd
.Read(buf
, sizeof(buf
)-1, &n
) == false)
709 return _error
->Errno("read", "Failed to read dpkg pipe");
710 ExecWait(Child
, "Popen");
712 // now write the control data to a tempfile
713 SPtr
<FileFd
> DebControl
= GetTempFile("deb-file-" + DebFile
);
714 if(DebControl
== NULL
)
716 DebControl
->Write(buf
, n
);
717 // append size of the file
718 FileFd
Fd(DebFile
, FileFd::ReadOnly
);
720 strprintf(Size
, "Size: %llu\n", Fd
.Size());
721 DebControl
->Write(Size
.c_str(), Size
.size());
722 // and rewind for the listparser
725 // and give it to the list parser
726 debDebFileParser
Parser(DebControl
, DebFile
);
727 if(Gen
.SelectFile(DebFile
, "local", *this) == false)
728 return _error
->Error("Problem with SelectFile %s", DebFile
.c_str());
730 pkgCache::PkgFileIterator File
= Gen
.GetCurFile();
731 File
->Size
= DebControl
->Size();
732 File
->mtime
= DebControl
->ModificationTime();
734 if (Gen
.MergeList(Parser
) == false)
735 return _error
->Error("Problem with MergeLister for %s", DebFile
.c_str());
739 pkgCache::PkgFileIterator
debDebPkgFileIndex::FindInCache(pkgCache
&Cache
) const
741 // FIXME: we could simply always return pkgCache::PkgFileIterator(Cache);
742 // to indicate its never in the cache which will force a Merge()
743 pkgCache::PkgFileIterator File
= Cache
.FileBegin();
744 for (; File
.end() == false; ++File
)
746 if (File
.FileName() == NULL
|| DebFile
!= File
.FileName())
754 unsigned long debDebPkgFileIndex::Size() const
757 if(stat(DebFile
.c_str(), &buf
) != 0)
763 // debDscFileIndex stuff
764 debDscFileIndex::debDscFileIndex(std::string
&DscFile
)
765 : pkgIndexFile(true), DscFile(DscFile
)
769 bool debDscFileIndex::Exists() const
771 return FileExists(DscFile
);
774 unsigned long debDscFileIndex::Size() const
777 if(stat(DscFile
.c_str(), &buf
) == 0)
782 // DscFileIndex::CreateSrcParser - Get a parser for the .dsc file /*{{{*/
783 // ---------------------------------------------------------------------
785 pkgSrcRecords::Parser
*debDscFileIndex::CreateSrcParser() const
787 if (!FileExists(DscFile
))
790 return new debDscRecordParser(DscFile
,this);
797 // ---------------------------------------------------------------------
798 // Index File types for Debian /*{{{*/
799 class debIFTypeSrc
: public pkgIndexFile::Type
803 debIFTypeSrc() {Label
= "Debian Source Index";};
805 class debIFTypePkg
: public pkgIndexFile::Type
809 virtual pkgRecords::Parser
*CreatePkgParser(pkgCache::PkgFileIterator File
) const
811 return new debRecordParser(File
.FileName(),*File
.Cache());
813 debIFTypePkg() {Label
= "Debian Package Index";};
815 class debIFTypeTrans
: public debIFTypePkg
818 debIFTypeTrans() {Label
= "Debian Translation Index";};
820 class debIFTypeStatus
: public pkgIndexFile::Type
824 virtual pkgRecords::Parser
*CreatePkgParser(pkgCache::PkgFileIterator File
) const
826 return new debRecordParser(File
.FileName(),*File
.Cache());
828 debIFTypeStatus() {Label
= "Debian dpkg status file";};
830 class debIFTypeDebPkgFile
: public pkgIndexFile::Type
833 virtual pkgRecords::Parser
*CreatePkgParser(pkgCache::PkgFileIterator File
) const
835 return new debDebFileRecordParser(File
.FileName(),*File
.Cache());
837 debIFTypeDebPkgFile() {Label
= "deb Package file";};
839 class debIFTypeDscFile
: public pkgIndexFile::Type
842 virtual pkgSrcRecords::Parser
*CreateSrcPkgParser(std::string DscFile
) const
844 return new debDscRecordParser(DscFile
, NULL
);
846 debIFTypeDscFile() {Label
= "dsc File Source Index";};
848 class debIFTypeDebianSourceDir
: public pkgIndexFile::Type
851 virtual pkgSrcRecords::Parser
*CreateSrcPkgParser(std::string SourceDir
) const
853 return new debDscRecordParser(SourceDir
+ string("/debian/control"), NULL
);
855 debIFTypeDebianSourceDir() {Label
= "debian/control File Source Index";};
858 static debIFTypeSrc _apt_Src
;
859 static debIFTypePkg _apt_Pkg
;
860 static debIFTypeTrans _apt_Trans
;
861 static debIFTypeStatus _apt_Status
;
862 static debIFTypeDebPkgFile _apt_DebPkgFile
;
863 // file based pseudo indexes
864 static debIFTypeDscFile _apt_DscFile
;
865 static debIFTypeDebianSourceDir _apt_DebianSourceDir
;
867 const pkgIndexFile::Type
*debSourcesIndex::GetType() const
871 const pkgIndexFile::Type
*debPackagesIndex::GetType() const
875 const pkgIndexFile::Type
*debTranslationsIndex::GetType() const
879 const pkgIndexFile::Type
*debStatusIndex::GetType() const
883 const pkgIndexFile::Type
*debDebPkgFileIndex::GetType() const
885 return &_apt_DebPkgFile
;
887 const pkgIndexFile::Type
*debDscFileIndex::GetType() const
889 return &_apt_DscFile
;
891 const pkgIndexFile::Type
*debDebianSourceDirIndex::GetType() const
893 return &_apt_DebianSourceDir
;