+ 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"));
+ string const Component = Tags.FindS("Components");
+ string const URIS = Tags.FindS("URIs");
+
+ std::vector<std::string> const list_uris = VectorizeString(URIS, ' ');
+ std::vector<std::string> const list_suite = VectorizeString(Suite, ' ');
+ std::vector<std::string> const list_comp = VectorizeString(Component, ' ');
+
+ if (list_uris.empty())
+ // TRANSLATOR: %u is a line number, the first %s is a filename of a file with the extension "second %s" and the third %s is a unique identifier for bugreports
+ return _error->Error(_("Malformed entry %u in %s file %s (%s)"), i, "sources", Fd.Name().c_str(), "URI");
+
+ for (std::vector<std::string>::const_iterator U = list_uris.begin();
+ U != list_uris.end(); ++U)
+ {
+ std::string URI = *U;
+ if (U->empty() || FixupURI(URI) == false)
+ return _error->Error(_("Malformed entry %u in %s file %s (%s)"), i, "sources", Fd.Name().c_str(), "URI parse");
+
+ if (list_suite.empty())
+ return _error->Error(_("Malformed entry %u in %s file %s (%s)"), i, "sources", Fd.Name().c_str(), "Suite");
+
+ for (std::vector<std::string>::const_iterator S = list_suite.begin();
+ S != list_suite.end(); ++S)
+ {
+ if (S->empty() == false && (*S)[S->size() - 1] == '/')
+ {
+ if (list_comp.empty() == false)
+ return _error->Error(_("Malformed entry %u in %s file %s (%s)"), i, "sources", Fd.Name().c_str(), "absolute Suite Component");
+ if (CreateItem(List, URI, *S, "", Options) == false)
+ return false;
+ }
+ else
+ {
+ if (list_comp.empty())
+ return _error->Error(_("Malformed entry %u in %s file %s (%s)"), i, "sources", Fd.Name().c_str(), "Component");
+
+ for (std::vector<std::string>::const_iterator C = list_comp.begin();
+ C != list_comp.end(); ++C)
+ {
+ if (CreateItem(List, URI, *S, *C, Options) == false)
+ {
+ return false;
+ }
+ }
+ }
+ }