summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2011-05-17 18:14:25 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2011-05-17 18:14:25 +0200
commit894d672e9b7517573266cda333612e70441cbda8 (patch)
treef4c76670bcd9048188968bb2c5d962e3a6238026 /apt-pkg
parent98278a81bf554246b70b97852c9b8b92eac390ea (diff)
* apt-pkg/pkgcache.h:
- clean up mess with the "all" handling in MultiArch to fix LP: #733741 cleanly for everyone now
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/cacheiterators.h4
-rw-r--r--apt-pkg/deb/deblistparser.cc11
-rw-r--r--apt-pkg/edsp.cc6
-rw-r--r--apt-pkg/packagemanager.cc4
-rw-r--r--apt-pkg/pkgcache.h17
5 files changed, 19 insertions, 23 deletions
diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h
index 0c9813c6d..535253099 100644
--- a/apt-pkg/cacheiterators.h
+++ b/apt-pkg/cacheiterators.h
@@ -206,9 +206,7 @@ class pkgCache::VerIterator : public Iterator<Version, VerIterator> {
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)
+ if (S->MultiArch == pkgCache::Version::All)
return "all";
return S->ParentPkg == 0?0:Owner->StrP + ParentPkg()->Arch;
};
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index 4a9e94c85..a94b79f05 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -128,12 +128,7 @@ bool debListParser::NewVersion(pkgCache::VerIterator &Ver)
}
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;
- }
+ Ver->MultiArch |= pkgCache::Version::All;
// Archive Size
Ver->Size = Section.FindULL("Size");
@@ -687,12 +682,12 @@ bool debListParser::ParseProvides(pkgCache::VerIterator &Ver)
if (MultiArchEnabled == false)
return true;
- else if (Ver->MultiArch == pkgCache::Version::Allowed || Ver->MultiArch == pkgCache::Version::AllAllowed)
+ else if ((Ver->MultiArch & pkgCache::Version::Allowed) == pkgCache::Version::Allowed)
{
string const Package = string(Ver.ParentPkg().Name()).append(":").append("any");
return NewProvidesAllArch(Ver, Package, Ver.VerStr());
}
- else if (Ver->MultiArch == pkgCache::Version::Foreign || Ver->MultiArch == pkgCache::Version::AllForeign)
+ else if ((Ver->MultiArch & pkgCache::Version::Foreign) == pkgCache::Version::Foreign)
return NewProvidesAllArch(Ver, Ver.ParentPkg().Name(), Ver.VerStr());
return true;
diff --git a/apt-pkg/edsp.cc b/apt-pkg/edsp.cc
index 02ef7d04b..4d2230613 100644
--- a/apt-pkg/edsp.cc
+++ b/apt-pkg/edsp.cc
@@ -82,11 +82,11 @@ void EDSP::WriteScenarioVersion(pkgDepCache &Cache, FILE* output, pkgCache::PkgI
if ((Pkg->Flags & pkgCache::Flag::Essential) == pkgCache::Flag::Essential)
fprintf(output, "Essential: yes\n");
fprintf(output, "Section: %s\n", Ver.Section());
- if (Ver->MultiArch == pkgCache::Version::Allowed || Ver->MultiArch == pkgCache::Version::AllAllowed)
+ if ((Ver->MultiArch & pkgCache::Version::Allowed) == pkgCache::Version::Allowed)
fprintf(output, "Multi-Arch: allowed\n");
- else if (Ver->MultiArch == pkgCache::Version::Foreign || Ver->MultiArch == pkgCache::Version::AllForeign)
+ else if ((Ver->MultiArch & pkgCache::Version::Foreign) == pkgCache::Version::Foreign)
fprintf(output, "Multi-Arch: foreign\n");
- else if (Ver->MultiArch == pkgCache::Version::Same)
+ else if ((Ver->MultiArch & pkgCache::Version::Same) == pkgCache::Version::Same)
fprintf(output, "Multi-Arch: same\n");
signed short Pin = std::numeric_limits<signed short>::min();
for (pkgCache::VerFileIterator File = Ver.FileList(); File.end() == false; ++File) {
diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc
index fe9f6eb68..1ae09347a 100644
--- a/apt-pkg/packagemanager.cc
+++ b/apt-pkg/packagemanager.cc
@@ -319,7 +319,7 @@ bool pkgPackageManager::SmartConfigure(PkgIterator Pkg)
List->Flag(Pkg,pkgOrderList::Configured,pkgOrderList::States);
}
- if (Cache[Pkg].InstVerIter(Cache)->MultiArch == pkgCache::Version::Same)
+ if ((Cache[Pkg].InstVerIter(Cache)->MultiArch & pkgCache::Version::Same) == pkgCache::Version::Same)
for (PkgIterator P = Pkg.Group().PackageList();
P.end() == false; P = Pkg.Group().NextPkg(P))
{
@@ -602,7 +602,7 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate)
List->Flag(Pkg,pkgOrderList::UnPacked,pkgOrderList::States);
- if (instVer->MultiArch == pkgCache::Version::Same)
+ if ((instVer->MultiArch & pkgCache::Version::Same) == pkgCache::Version::Same)
for (PkgIterator P = Pkg.Group().PackageList();
P.end() == false; P = Pkg.Group().NextPkg(P))
{
diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h
index 1b1743724..280f37bca 100644
--- a/apt-pkg/pkgcache.h
+++ b/apt-pkg/pkgcache.h
@@ -500,15 +500,18 @@ struct pkgCache::Version
map_ptrloc VerStr; // StringItem
/** \brief section this version is filled in */
map_ptrloc Section; // StringItem
+
+ /** \brief Multi-Arch capabilities of a package version */
+ enum VerMultiArch { None = 0, /*!< is the default and doesn't trigger special behaviour */
+ All = (1<<0), /*!< will cause that Ver.Arch() will report "all" */
+ Foreign = (1<<1), /*!< can satisfy dependencies in another architecture */
+ Same = (1<<2), /*!< can be co-installed with itself from other architectures */
+ Allowed = (1<<3) /*!< other packages are allowed to depend on thispkg:any */ };
/** \brief stores the MultiArch capabilities of this version
- None is the default and doesn't trigger special behaviour,
- Foreign means that this version can fulfill dependencies even
- 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: A bitflag would be better with the next abibreak… */
- enum {None, All, Foreign, Same, Allowed, AllForeign, AllAllowed} MultiArch;
+ Flags used are defined in pkgCache::Version::VerMultiArch
+ */
+ unsigned char MultiArch;
/** \brief references all the PackageFile's that this version came from