diff options
author | David Kalnischkies <david@kalnischkies.de> | 2015-07-20 10:33:07 +0200 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2015-08-10 17:27:59 +0200 |
commit | 1d3eea5caf65aacd7f112d14030a0499f32b9c75 (patch) | |
tree | 6ee66f35ffbc4121ed6c2232161e54222a4783be | |
parent | c9443c01208377f0cba9706412ea3a98ad97b56d (diff) |
eliminate dead file-provides code in cache generation
The code was never active in production, it just sits there collecting
dust and given that it is never tested probably doesn't even work
anymore the way it was supposed to be (whatever that was exactly in the
first place). So just remove it before I have to "fix" it again next
time.
Git-Dch: Ignore
-rw-r--r-- | apt-pkg/indexfile.h | 1 | ||||
-rw-r--r-- | apt-pkg/pkgcachegen.cc | 91 | ||||
-rw-r--r-- | apt-pkg/pkgcachegen.h | 15 |
3 files changed, 4 insertions, 103 deletions
diff --git a/apt-pkg/indexfile.h b/apt-pkg/indexfile.h index 77e80ed41..844f0cd3b 100644 --- a/apt-pkg/indexfile.h +++ b/apt-pkg/indexfile.h @@ -135,7 +135,6 @@ class pkgIndexFile virtual bool HasPackages() const = 0; virtual unsigned long Size() const = 0; virtual bool Merge(pkgCacheGenerator &/*Gen*/, OpProgress* const /*Prog*/) { return true; }; - virtual bool MergeFileProvides(pkgCacheGenerator &/*Gen*/,OpProgress* /*Prog*/) {return true;}; virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const; static bool TranslationsAvailable(); diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index cf845b0fb..654f82baa 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -56,7 +56,7 @@ using std::string; /* We set the dirty flag and make sure that is written to the disk */ pkgCacheGenerator::pkgCacheGenerator(DynamicMMap *pMap,OpProgress *Prog) : Map(*pMap), Cache(pMap,false), Progress(Prog), - CurrentRlsFile(NULL), CurrentFile(NULL), FoundFileDeps(0), d(NULL) + CurrentRlsFile(NULL), CurrentFile(NULL), d(NULL) { if (_error->PendingError() == true) return; @@ -267,10 +267,7 @@ bool pkgCacheGenerator::MergeList(ListParser &List, } if (OutVer != 0) - { - FoundFileDeps |= List.HasFileDeps(); return true; - } } if (Cache.HeaderP->PackageCount >= std::numeric_limits<map_id_t>::max()) @@ -286,7 +283,6 @@ bool pkgCacheGenerator::MergeList(ListParser &List, return _error->Error(_("Wow, you exceeded the number of dependencies " "this APT is capable of.")); - FoundFileDeps |= List.HasFileDeps(); return true; } // CacheGenerator::MergeListGroup /*{{{*/ @@ -547,57 +543,6 @@ bool pkgCacheGenerator::AddNewDescription(ListParser &List, pkgCache::VerIterato } /*}}}*/ /*}}}*/ -// CacheGenerator::MergeFileProvides - Merge file provides /*{{{*/ -// --------------------------------------------------------------------- -/* If we found any file depends while parsing the main list we need to - resolve them. Since it is undesired to load the entire list of files - into the cache as virtual packages we do a two stage effort. MergeList - identifies the file depends and this creates Provdies for them by - re-parsing all the indexs. */ -bool pkgCacheGenerator::MergeFileProvides(ListParser &List) -{ - List.Owner = this; - - unsigned int Counter = 0; - while (List.Step() == true) - { - string PackageName = List.Package(); - if (PackageName.empty() == true) - return false; - string Version = List.Version(); - if (Version.empty() == true) - continue; - - pkgCache::PkgIterator Pkg = Cache.FindPkg(PackageName); - Dynamic<pkgCache::PkgIterator> DynPkg(Pkg); - if (Pkg.end() == true) - return _error->Error(_("Error occurred while processing %s (%s%d)"), - PackageName.c_str(), "FindPkg", 1); - Counter++; - if (Counter % 100 == 0 && Progress != 0) - Progress->Progress(List.Offset()); - - unsigned short Hash = List.VersionHash(); - pkgCache::VerIterator Ver = Pkg.VersionList(); - Dynamic<pkgCache::VerIterator> DynVer(Ver); - for (; Ver.end() == false; ++Ver) - { - if (List.SameVersion(Hash, Ver) == true && Version == Ver.VerStr()) - { - if (List.CollectFileProvides(Cache,Ver) == false) - return _error->Error(_("Error occurred while processing %s (%s%d)"), - PackageName.c_str(), "CollectFileProvides", 1); - break; - } - } - - if (Ver.end() == true) - _error->Warning(_("Package %s %s was not found while processing file dependencies"),PackageName.c_str(),Version.c_str()); - } - - return true; -} - /*}}}*/ // CacheGenerator::NewGroup - Add a new group /*{{{*/ // --------------------------------------------------------------------- /* This creates a new group structure and adds it to the hash table */ @@ -1063,10 +1008,6 @@ bool pkgCacheListParser::NewDepends(pkgCache::VerIterator &Ver, if (unlikely(Owner->NewGroup(Grp, PackageName) == false)) return false; - // Is it a file dependency? - if (unlikely(PackageName[0] == '/')) - FoundFileDeps = true; - map_stringitem_t idxVersion = 0; if (Version.empty() == false) { @@ -1489,13 +1430,9 @@ static bool BuildCache(pkgCacheGenerator &Gen, FileIterator const Start, FileIterator const End) { std::vector<pkgIndexFile *> Files; - bool const HasFileDeps = Gen.HasFileDeps(); bool mergeFailure = false; auto const indexFileMerge = [&](pkgIndexFile * const I) { - if (HasFileDeps) - Files.push_back(I); - if (I->HasPackages() == false || mergeFailure) return; @@ -1547,24 +1484,6 @@ static bool BuildCache(pkgCacheGenerator &Gen, if (mergeFailure) return false; } - - if (HasFileDeps == true) - { - if (Progress != NULL) - Progress->Done(); - TotalSize = ComputeSize(List, Start, End); - CurrentSize = 0; - for (std::vector<pkgIndexFile *>::const_iterator I = Files.begin(); I != Files.end(); ++I) - { - map_filesize_t Size = (*I)->Size(); - if (Progress != NULL) - Progress->OverallProgress(CurrentSize,TotalSize,Size,_("Collecting File Provides")); - CurrentSize += Size; - if ((*I)->MergeFileProvides(Gen,Progress) == false) - return false; - } - } - return true; } /*}}}*/ @@ -1828,12 +1747,6 @@ static bool IsDuplicateDescription(pkgCache::DescIterator Desc, return false; } /*}}}*/ -// CacheGenerator::FinishCache /*{{{*/ -bool pkgCacheGenerator::FinishCache(OpProgress * /*Progress*/) -{ - return true; -} - /*}}}*/ -pkgCacheListParser::pkgCacheListParser() : Owner(NULL), OldDepLast(NULL), FoundFileDeps(false), d(NULL) {} +pkgCacheListParser::pkgCacheListParser() : Owner(NULL), OldDepLast(NULL), d(NULL) {} pkgCacheListParser::~pkgCacheListParser() {} diff --git a/apt-pkg/pkgcachegen.h b/apt-pkg/pkgcachegen.h index 15e73627d..97b91ba9f 100644 --- a/apt-pkg/pkgcachegen.h +++ b/apt-pkg/pkgcachegen.h @@ -74,9 +74,6 @@ class APT_HIDDEN pkgCacheGenerator /*{{{*/ std::string PkgFileName; pkgCache::PackageFile *CurrentFile; - // Flag file dependencies - bool FoundFileDeps; - bool NewGroup(pkgCache::GrpIterator &Grp,const std::string &Name); bool NewPackage(pkgCache::PkgIterator &Pkg,const std::string &Name, const std::string &Arch); bool NewFileVer(pkgCache::VerIterator &Ver,ListParser &List); @@ -104,15 +101,11 @@ class APT_HIDDEN pkgCacheGenerator /*{{{*/ bool SelectReleaseFile(const std::string &File, const std::string &Site, unsigned long Flags = 0); bool MergeList(ListParser &List,pkgCache::VerIterator *Ver = 0); inline pkgCache &GetCache() {return Cache;}; - inline pkgCache::PkgFileIterator GetCurFile() + inline pkgCache::PkgFileIterator GetCurFile() {return pkgCache::PkgFileIterator(Cache,CurrentFile);}; - inline pkgCache::RlsFileIterator GetCurRlsFile() + inline pkgCache::RlsFileIterator GetCurRlsFile() {return pkgCache::RlsFileIterator(Cache,CurrentRlsFile);}; - bool HasFileDeps() {return FoundFileDeps;}; - bool MergeFileProvides(ListParser &List); - bool FinishCache(OpProgress *Progress) APT_DEPRECATED APT_CONST; - APT_PUBLIC static bool MakeStatusCache(pkgSourceList &List,OpProgress *Progress, MMap **OutMap = 0,bool AllowMem = false); APT_PUBLIC static bool MakeOnlyStatusCache(OpProgress *Progress,DynamicMMap **OutMap); @@ -148,9 +141,6 @@ class APT_HIDDEN pkgCacheListParser pkgCache::VerIterator OldDepVer; map_pointer_t *OldDepLast; - // Flag file dependencies - bool FoundFileDeps; - void * const d; protected: @@ -194,7 +184,6 @@ class APT_HIDDEN pkgCacheListParser virtual bool Step() = 0; - inline bool HasFileDeps() {return FoundFileDeps;}; virtual bool CollectFileProvides(pkgCache &/*Cache*/, pkgCache::VerIterator &/*Ver*/) {return true;}; |