+bool pkgSourceList::Type::ParseStanza(vector<metaIndex *> &List,
+ pkgTagSection &Tags,
+ int i,
+ FileFd &Fd)
+{
+ map<string, string> Options;
+
+ string Enabled = Tags.FindS("Enabled");
+ if (Enabled.size() > 0 && StringToBool(Enabled) == false)
+ return true;
+
+ // Define external/internal options
+ const char* option_deb822[] = {
+ "Architectures", "Architectures-Add", "Architectures-Remove", "Trusted",
+ };
+ const char* option_internal[] = {
+ "arch", "arch+", "arch-", "trusted",
+ };
+ for (unsigned int j=0; j < sizeof(option_deb822)/sizeof(char*); j++)
+ if (Tags.Exists(option_deb822[j]))
+ {
+ // for deb822 the " " is the delimiter, but the backend expects ","
+ std::string option = Tags.FindS(option_deb822[j]);
+ std::replace(option.begin(), option.end(), ' ', ',');
+ Options[option_internal[j]] = option;
+ }
+
+ // now create one item per suite/section
+ string Suite = Tags.FindS("Suites");
+ Suite = SubstVar(Suite,"$(ARCH)",_config->Find("APT::Architecture"));
+ string const Section = Tags.FindS("Sections");
+ string URIS = Tags.FindS("URIs");
+
+ std::vector<std::string> list_uris = StringSplit(URIS, " ");
+ std::vector<std::string> list_dist = StringSplit(Suite, " ");
+ std::vector<std::string> list_section = StringSplit(Section, " ");
+
+ for (std::vector<std::string>::const_iterator U = list_uris.begin();
+ U != list_uris.end(); ++U)
+ {
+ std::string URI = (*U);
+ if (!FixupURI(URI))
+ {
+ _error->Error(_("Malformed stanza %u in source list %s (URI parse)"),i,Fd.Name().c_str());
+ return false;
+ }
+
+ for (std::vector<std::string>::const_iterator I = list_dist.begin();
+ I != list_dist.end(); ++I)
+ {
+ for (std::vector<std::string>::const_iterator J = list_section.begin();
+ J != list_section.end(); ++J)
+ {
+ if (CreateItem(List, URI, (*I), (*J), Options) == false)
+ {
+ return false;
+ }
+ }
+ }
+ }
+ return true;
+}
+