]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/deb/debmetaindex.cc
Release 1.11~exp11
[apt.git] / apt-pkg / deb / debmetaindex.cc
index b2e9eeb0096b4600c5d5cce2dd8a2368ece3b91c..69e41a6f46ea0572c8c2765c786323414a229ed3 100644 (file)
@@ -154,7 +154,7 @@ static void GetIndexTargetsFor(char const * const Type, std::string const &URI,
                  Options.insert(std::make_pair("ARCHITECTURE", *A));
               Options.insert(std::make_pair("BASE_URI", baseURI));
               Options.insert(std::make_pair("REPO_URI", URI));
-              Options.insert(std::make_pair("TARGET_OF", "deb-src"));
+              Options.insert(std::make_pair("TARGET_OF", Type));
               Options.insert(std::make_pair("CREATED_BY", *T));
 
               std::string MetaKey = tplMetaKey;
@@ -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))
            );