X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/28166356f30ad13729f7f952e6f1fc6131036591..2ec858bc68bc2d79ec020fe24be2d76b7c5b6792:/apt-pkg/pkgcachegen.cc diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index d44dbf3a9..d0ea2e6e3 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -178,12 +178,7 @@ bool pkgCacheGenerator::MergeList(ListParser &List, if (PackageName.empty() == true) return false; - /* Treat Arch all packages as the same as the native arch. */ - string Arch; - if (List.ArchitectureAll() == true) - Arch = _config->Find("APT::Architecture"); - else - Arch = List.Architecture(); + string const Arch = List.Architecture(); // Get a pointer to the package structure pkgCache::PkgIterator Pkg; @@ -484,7 +479,8 @@ bool pkgCacheGenerator::NewPackage(pkgCache::PkgIterator &Pkg,const string &Name // Set the name, arch and the ID Pkg->Name = Grp->Name; Pkg->Group = Grp.Index(); - map_ptrloc const idxArch = WriteUniqString(Arch.c_str()); + // all is mapped to the native architecture + map_ptrloc const idxArch = (Arch == "all") ? Cache.HeaderP->Architecture : WriteUniqString(Arch.c_str()); if (unlikely(idxArch == 0)) return false; Pkg->Arch = idxArch; @@ -643,7 +639,7 @@ bool pkgCacheGenerator::FinishCache(OpProgress *Progress) - MultiArch: same → Co-Installable if they have the same version - Architecture: all → Need to be Co-Installable for internal reasons - All others conflict with all other group members */ - bool const coInstall = (V->MultiArch == pkgCache::Version::Same); + bool const coInstall = ((V->MultiArch & pkgCache::Version::Same) == pkgCache::Version::Same); for (vector::const_iterator A = archs.begin(); A != archs.end(); ++A) { if (*A == Arch) @@ -787,7 +783,8 @@ bool pkgCacheGenerator::ListParser::NewProvides(pkgCache::VerIterator &Ver, pkgCache &Cache = Owner->Cache; // We do not add self referencing provides - if (Ver.ParentPkg().Name() == PkgName && PkgArch == Ver.Arch()) + if (Ver.ParentPkg().Name() == PkgName && (PkgArch == Ver.ParentPkg().Arch() || + (PkgArch == "all" && strcmp((Cache.StrP + Cache.HeaderP->Architecture), Ver.ParentPkg().Arch()) == 0))) return true; // Get a structure @@ -918,8 +915,11 @@ unsigned long pkgCacheGenerator::WriteUniqString(const char *S, /* This just verifies that each file in the list of index files exists, has matching attributes with the cache and the cache does not have any extra files. */ -static bool CheckValidity(const string &CacheFile, FileIterator Start, - FileIterator End,MMap **OutMap = 0) +static bool CheckValidity(const string &CacheFile, + pkgSourceList &List, + FileIterator Start, + FileIterator End, + MMap **OutMap = 0) { bool const Debug = _config->FindB("Debug::pkgCacheGen", false); // No file, certainly invalid @@ -930,6 +930,13 @@ static bool CheckValidity(const string &CacheFile, FileIterator Start, return false; } + if (List.GetLastModifiedTime() < GetModificationTime(CacheFile)) + { + if (Debug == true) + std::clog << "sources.list is newer than the cache" << std::endl; + return false; + } + // Map it FileFd CacheF(CacheFile,FileFd::ReadOnly); SPtr Map = new MMap(CacheF,0); @@ -1155,7 +1162,7 @@ bool pkgCacheGenerator::MakeStatusCache(pkgSourceList &List,OpProgress *Progress Progress->OverallProgress(0,1,1,_("Reading package lists")); // Cache is OK, Fin. - if (CheckValidity(CacheFile,Files.begin(),Files.end(),OutMap) == true) + if (CheckValidity(CacheFile, List, Files.begin(),Files.end(),OutMap) == true) { if (Progress != NULL) Progress->OverallProgress(1,1,1,_("Reading package lists")); @@ -1192,7 +1199,7 @@ bool pkgCacheGenerator::MakeStatusCache(pkgSourceList &List,OpProgress *Progress // Lets try the source cache. unsigned long CurrentSize = 0; unsigned long TotalSize = 0; - if (CheckValidity(SrcCacheFile,Files.begin(), + if (CheckValidity(SrcCacheFile, List, Files.begin(), Files.begin()+EndOfSource) == true) { if (Debug == true)