summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/sourcelist.cc58
-rw-r--r--apt-pkg/tagfile.cc84
2 files changed, 80 insertions, 62 deletions
diff --git a/apt-pkg/sourcelist.cc b/apt-pkg/sourcelist.cc
index 8462027c5..1f5179885 100644
--- a/apt-pkg/sourcelist.cc
+++ b/apt-pkg/sourcelist.cc
@@ -79,12 +79,9 @@ bool pkgSourceList::Type::ParseStanza(vector<metaIndex *> &List,
{
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[] = {
@@ -106,20 +103,34 @@ bool pkgSourceList::Type::ParseStanza(vector<metaIndex *> &List,
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;
}
@@ -292,7 +303,7 @@ bool pkgSourceList::Read(string File)
/* */
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)
@@ -382,21 +393,26 @@ int pkgSourceList::ParseFileDeb822(string File)
// 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
diff --git a/apt-pkg/tagfile.cc b/apt-pkg/tagfile.cc
index bef3c76ba..b92b2c15a 100644
--- a/apt-pkg/tagfile.cc
+++ b/apt-pkg/tagfile.cc
@@ -567,52 +567,54 @@ bool TFRewrite(FILE *Output,pkgTagSection const &Tags,const char *Order[],
}
// Write all all of the tags, in order.
- for (unsigned int I = 0; Order[I] != 0; I++)
+ if (Order != NULL)
{
- bool Rewritten = false;
-
- // See if this is a field that needs to be rewritten
- for (unsigned int J = 0; Rewrite != 0 && Rewrite[J].Tag != 0; J++)
+ for (unsigned int I = 0; Order[I] != 0; I++)
{
- if (strcasecmp(Rewrite[J].Tag,Order[I]) == 0)
- {
- Visited[J] |= 2;
- if (Rewrite[J].Rewrite != 0 && Rewrite[J].Rewrite[0] != 0)
- {
- if (isspace(Rewrite[J].Rewrite[0]))
- fprintf(Output,"%s:%s\n",Rewrite[J].NewTag,Rewrite[J].Rewrite);
- else
- fprintf(Output,"%s: %s\n",Rewrite[J].NewTag,Rewrite[J].Rewrite);
- }
-
- Rewritten = true;
- break;
- }
- }
+ bool Rewritten = false;
+
+ // See if this is a field that needs to be rewritten
+ for (unsigned int J = 0; Rewrite != 0 && Rewrite[J].Tag != 0; J++)
+ {
+ if (strcasecmp(Rewrite[J].Tag,Order[I]) == 0)
+ {
+ Visited[J] |= 2;
+ if (Rewrite[J].Rewrite != 0 && Rewrite[J].Rewrite[0] != 0)
+ {
+ if (isspace(Rewrite[J].Rewrite[0]))
+ fprintf(Output,"%s:%s\n",Rewrite[J].NewTag,Rewrite[J].Rewrite);
+ else
+ fprintf(Output,"%s: %s\n",Rewrite[J].NewTag,Rewrite[J].Rewrite);
+ }
+ Rewritten = true;
+ break;
+ }
+ }
- // See if it is in the fragment
- unsigned Pos;
- if (Tags.Find(Order[I],Pos) == false)
- continue;
- Visited[Pos] |= 1;
-
- if (Rewritten == true)
- continue;
+ // See if it is in the fragment
+ unsigned Pos;
+ if (Tags.Find(Order[I],Pos) == false)
+ continue;
+ Visited[Pos] |= 1;
+
+ if (Rewritten == true)
+ continue;
- /* Write out this element, taking a moment to rewrite the tag
- in case of changes of case. */
- const char *Start;
- const char *Stop;
- Tags.Get(Start,Stop,Pos);
+ /* Write out this element, taking a moment to rewrite the tag
+ in case of changes of case. */
+ const char *Start;
+ const char *Stop;
+ Tags.Get(Start,Stop,Pos);
- if (fputs(Order[I],Output) < 0)
- return _error->Errno("fputs","IO Error to output");
- Start += strlen(Order[I]);
- if (fwrite(Start,Stop - Start,1,Output) != 1)
- return _error->Errno("fwrite","IO Error to output");
- if (Stop[-1] != '\n')
- fprintf(Output,"\n");
- }
+ if (fputs(Order[I],Output) < 0)
+ return _error->Errno("fputs","IO Error to output");
+ Start += strlen(Order[I]);
+ if (fwrite(Start,Stop - Start,1,Output) != 1)
+ return _error->Errno("fwrite","IO Error to output");
+ if (Stop[-1] != '\n')
+ fprintf(Output,"\n");
+ }
+ }
// Now write all the old tags that were missed.
for (unsigned int I = 0; I != Tags.Count(); I++)