diff options
Diffstat (limited to 'apt-pkg/deb')
| -rw-r--r-- | apt-pkg/deb/deblistparser.cc | 17 | ||||
| -rw-r--r-- | apt-pkg/deb/debmetaindex.cc | 20 |
2 files changed, 28 insertions, 9 deletions
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 966246ca7..2f0ebaa7b 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -823,6 +823,7 @@ bool debListParser::ParseDepends(pkgCache::VerIterator &Ver, return true; string const pkgArch = Ver.Arch(); + bool const barbarianArch = not APT::Configuration::checkArchitecture(pkgArch); while (1) { @@ -843,7 +844,14 @@ bool debListParser::ParseDepends(pkgCache::VerIterator &Ver, } else if (Package.substr(found) == ":any") { - if (NewDepends(Ver,Package,"any",Version,Op,Type) == false) + if (barbarianArch) + { + if (not NewDepends(Ver, Package, "any", Version, Op | pkgCache::Dep::Or, Type)) + return false; + if (not NewDepends(Ver, Package.substr(0, found), pkgArch, Version, Op, Type)) + return false; + } + else if (not NewDepends(Ver, Package, "any", Version, Op, Type)) return false; } else @@ -888,6 +896,7 @@ bool debListParser::ParseProvides(pkgCache::VerIterator &Ver) } string const Arch = Ver.Arch(); + bool const barbarianArch = not APT::Configuration::checkArchitecture(Arch); const char *Start; const char *Stop; if (Section.Find(pkgTagSection::Key::Provides,Start,Stop) == true) @@ -914,7 +923,7 @@ bool debListParser::ParseProvides(pkgCache::VerIterator &Ver) if (NewProvides(Ver, Package, "any", Version, pkgCache::Flag::ArchSpecific) == false) return false; } else if ((Ver->MultiArch & pkgCache::Version::Foreign) == pkgCache::Version::Foreign) { - if (APT::Configuration::checkArchitecture(Arch)) + if (not barbarianArch) { if (NewProvidesAllArch(Ver, Package, Version, 0) == false) return false; @@ -922,7 +931,7 @@ bool debListParser::ParseProvides(pkgCache::VerIterator &Ver) else if (NewProvides(Ver, Package, Arch, Version, 0) == false) return false; } else { - if ((Ver->MultiArch & pkgCache::Version::Allowed) == pkgCache::Version::Allowed) + if ((Ver->MultiArch & pkgCache::Version::Allowed) == pkgCache::Version::Allowed && not barbarianArch) { if (NewProvides(Ver, Package.to_string().append(":any"), "any", Version, pkgCache::Flag::MultiArchImplicit) == false) return false; @@ -945,7 +954,7 @@ bool debListParser::ParseProvides(pkgCache::VerIterator &Ver) } while (Start != Stop); } - if (APT::Configuration::checkArchitecture(Arch)) + if (not barbarianArch) { if ((Ver->MultiArch & pkgCache::Version::Allowed) == pkgCache::Version::Allowed) { diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc index f24a5e79e..d78cea758 100644 --- a/apt-pkg/deb/debmetaindex.cc +++ b/apt-pkg/deb/debmetaindex.cc @@ -18,6 +18,7 @@ #include <algorithm> #include <map> +#include <optional> #include <sstream> #include <string> #include <utility> @@ -966,13 +967,13 @@ pkgCache::RlsFileIterator debReleaseIndex::FindInCache(pkgCache &Cache, bool con class APT_HIDDEN debSLTypeDebian : public pkgSourceList::Type /*{{{*/ { - static std::vector<std::string> getDefaultSetOf(std::string const &Name, - std::map<std::string, std::string> const &Options, std::vector<std::string> const &defaultValues) + static std::optional<std::vector<std::string>> getDefaultSetOf(std::string const &Name, + std::map<std::string, std::string> const &Options) { auto const val = Options.find(Name); if (val != Options.end()) return VectorizeString(val->second, ','); - return defaultValues; + return {}; } static std::vector<std::string> applyPlusMinusOptions(std::string const &Name, std::map<std::string, std::string> const &Options, std::vector<std::string> &&Values) @@ -997,12 +998,21 @@ class APT_HIDDEN debSLTypeDebian : public pkgSourceList::Type /*{{{*/ static std::vector<std::string> parsePlusMinusOptions(std::string const &Name, std::map<std::string, std::string> const &Options, std::vector<std::string> const &defaultValues) { - return applyPlusMinusOptions(Name, Options, getDefaultSetOf(Name, Options, defaultValues)); + return applyPlusMinusOptions(Name, Options, getDefaultSetOf(Name, Options).value_or(defaultValues)); } static std::vector<std::string> parsePlusMinusArchOptions(std::string const &Name, std::map<std::string, std::string> const &Options) { - auto Values = getDefaultSetOf(Name, Options, APT::Configuration::getArchitectures()); + std::vector<std::string> Values; + if (auto opt = getDefaultSetOf(Name, Options); opt.has_value()) + Values = opt.value(); + else + { + Values = APT::Configuration::getArchitectures(); + auto veryforeign = _config->FindVector("APT::BarbarianArchitectures"); + Values.reserve(Values.size() + veryforeign.size()); + std::move(veryforeign.begin(), veryforeign.end(), std::back_inserter(Values)); + } // all is a very special architecture users shouldn't be concerned with explicitly // but if the user does, do not override the choice auto const val = Options.find(Name + "-"); |
