summaryrefslogtreecommitdiff
path: root/apt-pkg/deb/debmetaindex.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2015-08-27 10:41:19 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2015-08-27 11:27:45 +0200
commite6a12ff73a2e3246b9e475d9772e88c79a6249f7 (patch)
tree2f7614aa4d9d80ba0de716ee3a7f369ef74c38ec /apt-pkg/deb/debmetaindex.cc
parentb47b1222a3d23d74d59465b98d97f8871c7c8ad2 (diff)
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'.
Diffstat (limited to 'apt-pkg/deb/debmetaindex.cc')
-rw-r--r--apt-pkg/deb/debmetaindex.cc17
1 files changed, 16 insertions, 1 deletions
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<std::string> const alltargets = _config->FindVector(std::string("Acquire::IndexTargets::") + Name, "", true);
+ std::vector<std::string> mytargets = parsePlusMinusOptions("target", Options, alltargets);
+ if (mytargets.empty() == false)
+ for (auto const &target : alltargets)
+ {
+ std::map<std::string, std::string>::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))
);