From e6a12ff73a2e3246b9e475d9772e88c79a6249f7 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 27 Aug 2015 10:41:19 +0200 Subject: allow explicit dis/enable of IndexTargets in sources options While Target{,-Add,-Remove} is available for configuring IndexTargets already, allow Targets to be mentioned explicitely as yes/no options as well, so that the Target 'Contents' can be disabled via 'Contents: no' as well as 'Target-Remove: Contents'. --- apt-pkg/deb/debmetaindex.cc | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/debmetaindex.cc b/apt-pkg/deb/debmetaindex.cc index 8e0512759..69e41a6f4 100644 --- a/apt-pkg/deb/debmetaindex.cc +++ b/apt-pkg/deb/debmetaindex.cc @@ -715,10 +715,25 @@ class APT_HIDDEN debSLTypeDebian : public pkgSourceList::Type /*{{{*/ List.push_back(Deb); } + std::vector const alltargets = _config->FindVector(std::string("Acquire::IndexTargets::") + Name, "", true); + std::vector mytargets = parsePlusMinusOptions("target", Options, alltargets); + if (mytargets.empty() == false) + for (auto const &target : alltargets) + { + std::map::const_iterator const opt = Options.find(target); + if (opt == Options.end()) + continue; + auto const tarItr = std::find(mytargets.begin(), mytargets.end(), target); + bool const optValue = StringToBool(opt->second); + if (optValue == true && tarItr == mytargets.end()) + mytargets.push_back(target); + else if (optValue == false && tarItr != mytargets.end()) + mytargets.erase(std::remove(mytargets.begin(), mytargets.end(), target), mytargets.end()); + } Deb->AddComponent( IsSrc, Section, - parsePlusMinusOptions("target", Options, _config->FindVector(std::string("Acquire::IndexTargets::") + Name, "", true)), + mytargets, parsePlusMinusOptions("arch", Options, APT::Configuration::getArchitectures()), parsePlusMinusOptions("lang", Options, APT::Configuration::getLanguages(true)) ); -- cgit v1.2.3