Browse Source

Fix more instances of missing remapping handling

After fixing Bug#796999, we noticed that there were
some more instances of iterators which had no associated
Dynamic object, causing them to not be updated when
the cache was remapped.

This happened in two places: In NewPackage() and in
NewProvidesAllArch().

Gbp-Dch: ignore
debian/1.8.y
Julian Andres Klode 7 years ago
parent
commit
a6deb7a0ea
  1. 29
      apt-pkg/pkgcachegen.cc

29
apt-pkg/pkgcachegen.cc

@ -572,21 +572,31 @@ bool pkgCacheGenerator::NewPackage(pkgCache::PkgIterator &Pkg,const string &Name
if (APT::Configuration::checkArchitecture(Pkg.Arch()) == true)
{
pkgCache::PkgIterator const M = Grp.FindPreferredPkg(false); // native or any foreign pkg will do
if (M.end() == false)
for (pkgCache::PrvIterator Prv = M.ProvidesList(); Prv.end() == false; ++Prv)
if (M.end() == false) {
pkgCache::PrvIterator Prv;
Dynamic<pkgCache::PrvIterator> DynPrv(Prv);
for (Prv = M.ProvidesList(); Prv.end() == false; ++Prv)
{
if ((Prv->Flags & pkgCache::Flag::ArchSpecific) != 0)
continue;
pkgCache::VerIterator Ver = Prv.OwnerVer();
Dynamic<pkgCache::VerIterator> DynVer(Ver);
if ((Ver->MultiArch & pkgCache::Version::Allowed) == pkgCache::Version::Allowed ||
((Ver->MultiArch & pkgCache::Version::Foreign) == pkgCache::Version::Foreign &&
(Prv->Flags & pkgCache::Flag::MultiArchImplicit) == 0))
if (NewProvides(Ver, Pkg, Prv->ProvideVersion, Prv->Flags) == false)
return false;
}
}
pkgCache::PkgIterator P;
pkgCache::VerIterator Ver;
Dynamic<pkgCache::PkgIterator> DynP(P);
Dynamic<pkgCache::VerIterator> DynVer(Ver);
for (pkgCache::PkgIterator P = Grp.PackageList(); P.end() == false; P = Grp.NextPkg(P))
for (pkgCache::VerIterator Ver = P.VersionList(); Ver.end() == false; ++Ver)
for (P = Grp.PackageList(); P.end() == false; P = Grp.NextPkg(P))
for (Ver = P.VersionList(); Ver.end() == false; ++Ver)
if ((Ver->MultiArch & pkgCache::Version::Foreign) == pkgCache::Version::Foreign)
if (NewProvides(Ver, Pkg, Ver->VerStr, pkgCache::Flag::MultiArchImplicit) == false)
return false;
@ -1075,7 +1085,9 @@ bool pkgCacheGenerator::NewProvides(pkgCache::VerIterator &Ver,
bool pkgCacheListParser::NewProvidesAllArch(pkgCache::VerIterator &Ver, string const &Package,
string const &Version, uint8_t const Flags) {
pkgCache &Cache = Owner->Cache;
pkgCache::GrpIterator const Grp = Cache.FindGrp(Package);
pkgCache::GrpIterator Grp = Cache.FindGrp(Package);
Dynamic<pkgCache::GrpIterator> DynGrp(Grp);
if (Grp.end() == true)
return NewProvides(Ver, Package, Cache.NativeArch(), Version, Flags);
else
@ -1089,8 +1101,11 @@ bool pkgCacheListParser::NewProvidesAllArch(pkgCache::VerIterator &Ver, string c
bool const isImplicit = (Flags & pkgCache::Flag::MultiArchImplicit) == pkgCache::Flag::MultiArchImplicit;
bool const isArchSpecific = (Flags & pkgCache::Flag::ArchSpecific) == pkgCache::Flag::ArchSpecific;
pkgCache::PkgIterator const OwnerPkg = Ver.ParentPkg();
for (pkgCache::PkgIterator Pkg = Grp.PackageList(); Pkg.end() == false; Pkg = Grp.NextPkg(Pkg))
pkgCache::PkgIterator OwnerPkg = Ver.ParentPkg();
Dynamic<pkgCache::PkgIterator> DynOwnerPkg(OwnerPkg);
pkgCache::PkgIterator Pkg;
Dynamic<pkgCache::PkgIterator> DynPkg(Pkg);
for (Pkg = Grp.PackageList(); Pkg.end() == false; Pkg = Grp.NextPkg(Pkg))
{
if (isImplicit && OwnerPkg == Pkg)
continue;

Loading…
Cancel
Save