X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/0e72dd523557b84a3b37988d23d99eae1d79a657..899d08fea9e10d617afaa42f51f4abda76fc508f:/apt-pkg/deb/debindexfile.cc diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc index dcc916c1a..ff8bce85d 100644 --- a/apt-pkg/deb/debindexfile.cc +++ b/apt-pkg/deb/debindexfile.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: debindexfile.cc,v 1.3 2001/02/23 06:41:55 jgg Exp $ +// $Id: debindexfile.cc,v 1.5.2.3 2004/01/04 19:11:00 mdz Exp $ /* ###################################################################### Debian Specific sources.list types and the three sorts of Debian @@ -23,15 +23,16 @@ #include #include #include - +#include + #include /*}}}*/ // SourcesIndex::debSourcesIndex - Constructor /*{{{*/ // --------------------------------------------------------------------- /* */ -debSourcesIndex::debSourcesIndex(string URI,string Dist,string Section) : - URI(URI), Dist(Dist), Section(Section) +debSourcesIndex::debSourcesIndex(string URI,string Dist,string Section,bool Trusted) : + pkgIndexFile(Trusted), URI(URI), Dist(Dist), Section(Section) { } /*}}}*/ @@ -74,11 +75,15 @@ pkgSrcRecords::Parser *debSourcesIndex::CreateSrcParser() const // SourcesIndex::Describe - Give a descriptive path to the index /*{{{*/ // --------------------------------------------------------------------- /* */ -string debSourcesIndex::Describe() const +string debSourcesIndex::Describe(bool Short) const { char S[300]; - snprintf(S,sizeof(S),"%s (%s)",Info("Packages").c_str(), - IndexFile("Sources").c_str()); + if (Short == true) + snprintf(S,sizeof(S),"%s",Info("Sources").c_str()); + else + snprintf(S,sizeof(S),"%s (%s)",Info("Sources").c_str(), + IndexFile("Sources").c_str()); + return S; } /*}}}*/ @@ -125,16 +130,6 @@ string debSourcesIndex::IndexURI(const char *Type) const return Res; } /*}}}*/ -// SourcesIndex::GetIndexes - Fetch the index files /*{{{*/ -// --------------------------------------------------------------------- -/* */ -bool debSourcesIndex::GetIndexes(pkgAcquire *Owner) const -{ - new pkgAcqIndex(Owner,IndexURI("Sources"),Info("Sources"),"Sources"); - new pkgAcqIndexRel(Owner,IndexURI("Release"),Info("Release"),"Release"); - return true; -} - /*}}}*/ // SourcesIndex::Exists - Check if the index is available /*{{{*/ // --------------------------------------------------------------------- /* */ @@ -158,8 +153,8 @@ unsigned long debSourcesIndex::Size() const // PackagesIndex::debPackagesIndex - Contructor /*{{{*/ // --------------------------------------------------------------------- /* */ -debPackagesIndex::debPackagesIndex(string URI,string Dist,string Section) : - URI(URI), Dist(Dist), Section(Section) +debPackagesIndex::debPackagesIndex(string URI,string Dist,string Section,bool Trusted) : + pkgIndexFile(Trusted), URI(URI), Dist(Dist), Section(Section) { } /*}}}*/ @@ -188,11 +183,14 @@ string debPackagesIndex::ArchiveInfo(pkgCache::VerIterator Ver) const // --------------------------------------------------------------------- /* This should help the user find the index in the sources.list and in the filesystem for problem solving */ -string debPackagesIndex::Describe() const +string debPackagesIndex::Describe(bool Short) const { char S[300]; - snprintf(S,sizeof(S),"%s (%s)",Info("Packages").c_str(), - IndexFile("Packages").c_str()); + if (Short == true) + snprintf(S,sizeof(S),"%s",Info("Packages").c_str()); + else + snprintf(S,sizeof(S),"%s (%s)",Info("Packages").c_str(), + IndexFile("Packages").c_str()); return S; } /*}}}*/ @@ -239,16 +237,6 @@ string debPackagesIndex::IndexURI(const char *Type) const return Res; } /*}}}*/ -// PackagesIndex::GetIndexes - Fetch the index files /*{{{*/ -// --------------------------------------------------------------------- -/* */ -bool debPackagesIndex::GetIndexes(pkgAcquire *Owner) const -{ - new pkgAcqIndex(Owner,IndexURI("Packages"),Info("Packages"),"Packages"); - new pkgAcqIndexRel(Owner,IndexURI("Release"),Info("Release"),"Release"); - return true; -} - /*}}}*/ // PackagesIndex::Exists - Check if the index is available /*{{{*/ // --------------------------------------------------------------------- /* */ @@ -296,13 +284,13 @@ bool debPackagesIndex::Merge(pkgCacheGenerator &Gen,OpProgress &Prog) const return _error->Error("Problem with MergeList %s",PackageFile.c_str()); // Check the release file - string ReleaseFile = IndexFile("Release"); + string ReleaseFile = debReleaseIndex(URI,Dist).MetaIndexFile("Release"); if (FileExists(ReleaseFile) == true) { FileFd Rel(ReleaseFile,FileFd::ReadOnly); if (_error->PendingError() == true) return false; - Parser.LoadReleaseInfo(File,Rel); + Parser.LoadReleaseInfo(File,Rel,Section); } return true; @@ -335,7 +323,7 @@ pkgCache::PkgFileIterator debPackagesIndex::FindInCache(pkgCache &Cache) const // StatusIndex::debStatusIndex - Constructor /*{{{*/ // --------------------------------------------------------------------- /* */ -debStatusIndex::debStatusIndex(string File) : File(File) +debStatusIndex::debStatusIndex(string File) : pkgIndexFile(true), File(File) { } /*}}}*/ @@ -411,46 +399,6 @@ bool debStatusIndex::Exists() const } /*}}}*/ -// Source List types for Debian /*{{{*/ -class debSLTypeDeb : public pkgSourceList::Type -{ - public: - - bool CreateItem(vector &List,string URI, - string Dist,string Section) const - { - List.push_back(new debPackagesIndex(URI,Dist,Section)); - return true; - }; - - debSLTypeDeb() - { - Name = "deb"; - Label = "Standard Debian binary tree"; - } -}; - -class debSLTypeDebSrc : public pkgSourceList::Type -{ - public: - - bool CreateItem(vector &List,string URI, - string Dist,string Section) const - { - List.push_back(new debSourcesIndex(URI,Dist,Section)); - return true; - }; - - debSLTypeDebSrc() - { - Name = "deb-src"; - Label = "Standard Debian source tree"; - } -}; - -debSLTypeDeb _apt_DebType; -debSLTypeDebSrc _apt_DebSrcType; - /*}}}*/ // Index File types for Debian /*{{{*/ class debIFTypeSrc : public pkgIndexFile::Type {