#include <apt-pkg/metaindex.h>
#include <apt-pkg/indexfile.h>
#include <apt-pkg/tagfile.h>
-
+#include <apt-pkg/pkgcache.h>
+#include <apt-pkg/cacheiterators.h>
+
+#include <ctype.h>
+#include <stddef.h>
+#include <time.h>
+#include <cstring>
+#include <map>
+#include <string>
+#include <vector>
#include <fstream>
#include <algorithm>
{
map<string, string> Options;
- string URI = Tags.FindS("URI");
- if (!FixupURI(URI))
- {
- _error->Error(_("Malformed stanza %u in source list %s (URI parse)"),i,Fd.Name().c_str());
- return false;
- }
+ string Enabled = Tags.FindS("Enabled");
+ if (Enabled.size() > 0 && StringToBool(Enabled) == false)
+ return true;
// Define external/internal options
const char* option_deb822[] = {
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 I = list_dist.begin();
- I != list_dist.end(); I++)
+
+ for (std::vector<std::string>::const_iterator U = list_uris.begin();
+ U != list_uris.end(); ++U)
{
- for (std::vector<std::string>::const_iterator J = list_section.begin();
- J != list_section.end(); J++)
+ 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;
}
/* */
bool pkgSourceList::ReadAppend(string File)
{
- if (_config->FindB("APT::Sources::Use-Deb822", true) == true)
+ if (_config->FindB("APT::Sources::Use-Deb822", false) == true)
{
int lines_parsed =ParseFileDeb822(File);
if (lines_parsed < 0)
{
// Open the stream for reading
ifstream F(File.c_str(),ios::in /*| ios::nocreate*/);
- if (!F != 0)
+ if (F.fail() == true)
return _error->Errno("ifstream::ifstream",_("Opening %s"),File.c_str());
// CNC:2003-12-10 - 300 is too short.
// read step by step
while (Sources.Step(Tags) == true)
{
- if(!Tags.Exists("Type"))
+ if(!Tags.Exists("Types"))
continue;
- string const type = Tags.FindS("Type");
- Type *Parse = Type::GetType(type.c_str());
- if (Parse == 0)
+ string const types = Tags.FindS("Types");
+ std::vector<std::string> list_types = StringSplit(types, " ");
+ for (std::vector<std::string>::const_iterator I = list_types.begin();
+ I != list_types.end(); ++I)
{
- _error->Error(_("Type '%s' is not known on stanza %u in source list %s"),type.c_str(),i,Fd.Name().c_str());
- return -1;
- }
+ Type *Parse = Type::GetType((*I).c_str());
+ if (Parse == 0)
+ {
+ _error->Error(_("Type '%s' is not known on stanza %u in source list %s"), (*I).c_str(),i,Fd.Name().c_str());
+ return -1;
+ }
- if (!Parse->ParseStanza(SrcList, Tags, i, Fd))
- return -1;
+ if (!Parse->ParseStanza(SrcList, Tags, i, Fd))
+ return -1;
- i++;
+ i++;
+ }
}
// we are done, return the number of stanzas read