diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2011-03-28 12:29:38 +0200 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2011-03-28 12:29:38 +0200 |
commit | 60dcec6d513859698177c10dabfc9db184363064 (patch) | |
tree | 5ad8b1d97ddff82d96134dcaaa1e098371309f9b /apt-pkg | |
parent | ede85dc09f55a50d61b96186e1f98a4f13eb57ff (diff) |
* apt-pkg/deb/deblistparser.cc:
- create foo:any provides for all architectures for an allowed package
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/deb/deblistparser.cc | 25 | ||||
-rw-r--r-- | apt-pkg/deb/deblistparser.h | 1 | ||||
-rw-r--r-- | apt-pkg/pkgcache.cc | 10 |
3 files changed, 19 insertions, 17 deletions
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index b79cef41c..4be626741 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -632,7 +632,7 @@ bool debListParser::ParseDepends(pkgCache::VerIterator &Ver, while (1) { - Start = ParseDepends(Start,Stop,Package,Version,Op); + Start = ParseDepends(Start,Stop,Package,Version,Op,false,!MultiArchEnabled); if (Start == 0) return _error->Error("Problem parsing dependency %s",Tag); @@ -685,27 +685,28 @@ bool debListParser::ParseProvides(pkgCache::VerIterator &Ver) } } - if (Ver->MultiArch == pkgCache::Version::Allowed || Ver->MultiArch == pkgCache::Version::AllAllowed) + if (MultiArchEnabled == false) + return true; + else 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()); + return NewProvidesAllArch(Ver, Package, Ver.VerStr()); } + else if (Ver->MultiArch == pkgCache::Version::Foreign || Ver->MultiArch == pkgCache::Version::AllForeign) + return NewProvidesAllArch(Ver, Ver.ParentPkg().Name(), Ver.VerStr()); - if (Ver->MultiArch != pkgCache::Version::Foreign && Ver->MultiArch != pkgCache::Version::AllForeign) - return true; - - if (MultiArchEnabled == false) - return true; - - string const Package = Ver.ParentPkg().Name(); - string const Version = Ver.VerStr(); + return true; +} + /*}}}*/ +// ListParser::NewProvides - add provides for all architectures /*{{{*/ +bool debListParser::NewProvidesAllArch(pkgCache::VerIterator &Ver, string const &Package, + string const &Version) { for (std::vector<string>::const_iterator a = Architectures.begin(); a != Architectures.end(); ++a) { if (NewProvides(Ver, Package, *a, Version) == false) return false; } - return true; } /*}}}*/ diff --git a/apt-pkg/deb/deblistparser.h b/apt-pkg/deb/deblistparser.h index 06ea73291..d62ce641c 100644 --- a/apt-pkg/deb/deblistparser.h +++ b/apt-pkg/deb/deblistparser.h @@ -40,6 +40,7 @@ class debListParser : public pkgCacheGenerator::ListParser bool ParseDepends(pkgCache::VerIterator &Ver,const char *Tag, unsigned int Type); bool ParseProvides(pkgCache::VerIterator &Ver); + bool NewProvidesAllArch(pkgCache::VerIterator &Ver, string const &Package, string const &Version); static bool GrabWord(string Word,WordList *List,unsigned char &Out); public: diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index dbcbd9c26..c6326abf1 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -317,6 +317,11 @@ pkgCache::PkgIterator pkgCache::GrpIterator::FindPkg(string Arch) const { if (unlikely(IsGood() == false || S->FirstPackage == 0)) return PkgIterator(*Owner, 0); + /* If we accept any package we simply return the "first" + package in this group (the last one added). */ + if (Arch == "any") + return PkgIterator(*Owner, Owner->PkgP + S->FirstPackage); + static string const myArch = _config->Find("APT::Architecture"); /* Most of the time the package for our native architecture is the one we add at first to the cache, but this would be the @@ -328,11 +333,6 @@ pkgCache::PkgIterator pkgCache::GrpIterator::FindPkg(string Arch) const { return PkgIterator(*Owner, Pkg); } - /* If we accept any package we simply return the "first" - package in this group (the last one added). */ - if (Arch == "any") - return PkgIterator(*Owner, Owner->PkgP + S->FirstPackage); - /* Iterate over the list to find the matching arch unfortunately this list includes "package noise" (= different packages with same calculated hash), |