X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/418a471f144bc4e6d90d4b943169ac5c5336a0a8..b55b78b5d185e54b4830c867cbf82aac05dbedea:/apt-pkg/deb/deblistparser.cc?ds=sidebyside diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 269b474b7..cf81690e2 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: deblistparser.cc,v 1.27 2001/07/26 06:15:59 jgg Exp $ +// $Id: deblistparser.cc,v 1.29 2003/09/22 04:16:26 mdz Exp $ /* ###################################################################### Package Cache Generator - Generator for the cache structure. @@ -268,11 +268,7 @@ bool debListParser::ParseStatus(pkgCache::PkgIterator Pkg, return true; } - /*}}}*/ -// ListParser::ParseDepends - Parse a dependency element /*{{{*/ -// --------------------------------------------------------------------- -/* This parses the dependency elements out of a standard string in place, - bit by bit. */ + const char *debListParser::ConvertRelation(const char *I,unsigned int &Op) { // Determine the operator @@ -331,6 +327,11 @@ const char *debListParser::ConvertRelation(const char *I,unsigned int &Op) return I; } + /*}}}*/ +// ListParser::ParseDepends - Parse a dependency element /*{{{*/ +// --------------------------------------------------------------------- +/* This parses the dependency elements out of a standard string in place, + bit by bit. */ const char *debListParser::ParseDepends(const char *Start,const char *Stop, string &Package,string &Ver, unsigned int &Op, bool ParseArchFlags) @@ -391,7 +392,7 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop, if (ParseArchFlags == true) { string arch = _config->Find("APT::Architecture"); - + // Parse an architecture if (I != Stop && *I == '[') { @@ -402,6 +403,7 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop, const char *End = I; bool Found = false; + bool NegArch = false; while (I != Stop) { // look for whitespace or ending ']' @@ -410,7 +412,13 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop, if (End == Stop) return 0; - + + if (*I == '!') + { + NegArch = true; + I++; + } + if (stringcmp(arch,I,End) == 0) Found = true; @@ -422,8 +430,11 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop, I = End; for (;I != Stop && isspace(*I) != 0; I++); } + + if (NegArch) + Found = !Found; - if (Found == false) + if (Found == false) Package = ""; /* not for this arch */ }