From ca238ede0446483c107ace331324cbee0f096361 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 25 Mar 2011 22:12:29 +0100 Subject: * apt-pkg/cacheiterator.h: - return "all" instead of native architecture without breaking the abi (too much) by extending enum instead of using bitflags (LP: #733741) With the next abi break that enum should be a char bitflag instead --- apt-pkg/cacheiterators.h | 4 ++++ apt-pkg/deb/deblistparser.cc | 14 +++++++++++--- apt-pkg/pkgcache.h | 4 ++-- apt-pkg/pkgcachegen.cc | 2 +- 4 files changed, 18 insertions(+), 6 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h index 31b3aced3..8f9f811da 100644 --- a/apt-pkg/cacheiterators.h +++ b/apt-pkg/cacheiterators.h @@ -206,6 +206,10 @@ class pkgCache::VerIterator : public Iterator { inline const char *VerStr() const {return S->VerStr == 0?0:Owner->StrP + S->VerStr;}; inline const char *Section() const {return S->Section == 0?0:Owner->StrP + S->Section;}; inline const char *Arch() const { + if (S->MultiArch == pkgCache::Version::All || + S->MultiArch == pkgCache::Version::AllForeign || + S->MultiArch == pkgCache::Version::AllAllowed) + return "all"; return S->ParentPkg == 0?0:Owner->StrP + ParentPkg()->Arch; }; __deprecated inline const char *Arch(bool const pseudo) const { diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index edc001abb..b79cef41c 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -106,7 +106,7 @@ bool debListParser::NewVersion(pkgCache::VerIterator &Ver) Ver->MultiArch = pkgCache::Version::None; else if (MultiArch == "same") { // Parse multi-arch - if (Section.FindS("Architecture") == "all") + if (ArchitectureAll() == true) { /* Arch all packages can't be Multi-Arch: same */ _error->Warning("Architecture: all package '%s' can't be Multi-Arch: same", @@ -127,6 +127,14 @@ bool debListParser::NewVersion(pkgCache::VerIterator &Ver) Ver->MultiArch = pkgCache::Version::None; } + if (ArchitectureAll() == true) + switch (Ver->MultiArch) + { + case pkgCache::Version::Foreign: Ver->MultiArch = pkgCache::Version::AllForeign; break; + case pkgCache::Version::Allowed: Ver->MultiArch = pkgCache::Version::AllAllowed; break; + default: Ver->MultiArch = pkgCache::Version::All; + } + // Archive Size Ver->Size = Section.FindULL("Size"); // Unpacked Size (in K) @@ -677,13 +685,13 @@ bool debListParser::ParseProvides(pkgCache::VerIterator &Ver) } } - if (Ver->MultiArch == pkgCache::Version::Allowed) + if (Ver->MultiArch == pkgCache::Version::Allowed || Ver->MultiArch == pkgCache::Version::AllAllowed) { string const Package = string(Ver.ParentPkg().Name()).append(":").append("any"); NewProvides(Ver, Package, "any", Ver.VerStr()); } - if (Ver->MultiArch != pkgCache::Version::Foreign) + if (Ver->MultiArch != pkgCache::Version::Foreign && Ver->MultiArch != pkgCache::Version::AllForeign) return true; if (MultiArchEnabled == false) diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h index 89a296ce9..d654a2976 100644 --- a/apt-pkg/pkgcache.h +++ b/apt-pkg/pkgcache.h @@ -506,8 +506,8 @@ struct pkgCache::Version if it is built for another architecture as the requester. Same indicates that builds for different architectures can be co-installed on the system */ - // FIXME: remove All on abi break - enum {None, All, Foreign, Same, Allowed} MultiArch; + /* FIXME: A bitflag would be better with the next abibreak… */ + enum {None, All, Foreign, Same, Allowed, AllForeign, AllAllowed} MultiArch; /** \brief references all the PackageFile's that this version came from diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc index ae031fee4..b0ee04554 100644 --- a/apt-pkg/pkgcachegen.cc +++ b/apt-pkg/pkgcachegen.cc @@ -638,7 +638,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) -- cgit v1.2.3