+ // try reading as deb822
+ // FIXME: proper error handling so that we do not error for good old-style
+ // sources
+ FileFd Fd(File, FileFd::ReadOnly);
+ pkgTagFile Sources(&Fd);
+ if (_error->PendingError() == false)
+ {
+ pkgTagSection Tags;
+ map<string, string> Options;
+ int i=0;
+ while (Sources.Step(Tags) == true)
+ {
+ if(!Tags.Exists("Type"))
+ continue;
+ string const type = Tags.FindS("Type");
+ Type *Parse = Type::GetType(type.c_str());
+ if (Parse == 0)
+ return _error->Error(_("Type '%s' is not known on stanza %u in source list %s"),type.c_str(),i,File.c_str());
+
+ string URI = Tags.FindS("URL");
+ if (!Parse->FixupURI(URI))
+ return _error->Error(_("Malformed stanza %lu in source list %s (URI parse)"),i,File.c_str());
+ string const Dist = Tags.FindS("Dist");
+ string const Section = Tags.FindS("Section");
+ // check if there are any options we support
+ const char* option_str[] = {
+ "arch", "arch+", "arch-", "trusted" };
+ for (unsigned int j=0; j < sizeof(option_str)/sizeof(char*); j++)
+ if (Tags.Exists(option_str[j]))
+ Options[option_str[j]] = Tags.FindS(option_str[j]);
+ Parse->CreateItem(SrcList, URI, Dist, Section, Options);
+ i++;
+ }
+ // we are done
+ if(i>0)
+ return true;
+ }
+