summaryrefslogtreecommitdiff
path: root/apt-pkg/sourcelist.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2015-08-30 22:34:28 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2015-08-30 22:50:55 +0200
commit3090ae6972fd0e15767a96708c248f3ab87502f2 (patch)
tree64784316160820e1673cd2810aad6a2b370fd809 /apt-pkg/sourcelist.cc
parentc4d1ab98921cddc8bd01f1e23ec1f4f9e7d2a90a (diff)
detect and deal with indextarget duplicates
Multiple targets downloading the same file is bad™ as it leads us to all sorts of problems like the acquire system breaking or simply a problem of which settings to use for them. Beside that this is most likely a mistake and silently ignoring it doesn't help the user realizing his mistake… On the other hand, we have 'duplicates' which are 'created' by how we create indextargets, so we have to prevent those from being created to but do not emit a warning for them as this is an implementation detail. And then, there is the absolute and most likely user mistake: Having the same target(s) activated in multiple entries.
Diffstat (limited to 'apt-pkg/sourcelist.cc')
-rw-r--r--apt-pkg/sourcelist.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/apt-pkg/sourcelist.cc b/apt-pkg/sourcelist.cc
index b083da936..31d87a403 100644
--- a/apt-pkg/sourcelist.cc
+++ b/apt-pkg/sourcelist.cc
@@ -119,6 +119,12 @@ bool pkgSourceList::Type::ParseStanza(vector<metaIndex *> &List, /*{{{*/
Options[m->second.first] = option;
}
+ {
+ std::string entry;
+ strprintf(entry, "%s:%i", Fd.Name().c_str(), i);
+ Options["sourceslist-entry"] = entry;
+ }
+
// now create one item per suite/section
string Suite = Tags.FindS("Suites");
Suite = SubstVar(Suite,"$(ARCH)",_config->Find("APT::Architecture"));
@@ -186,6 +192,11 @@ bool pkgSourceList::Type::ParseLine(vector<metaIndex *> &List,
// Parse option field if it exists
// e.g.: [ option1=value1 option2=value2 ]
map<string, string> Options;
+ {
+ std::string entry;
+ strprintf(entry, "%s:%i", File.c_str(), CurLine);
+ Options["sourceslist-entry"] = entry;
+ }
if (Buffer != 0 && Buffer[0] == '[')
{
++Buffer; // ignore the [