]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/deb/deblistparser.cc
Allow an uninstalled package to be marked for removal
[apt.git] / apt-pkg / deb / deblistparser.cc
index 267636776ac609cc56793daad7a57b2227639572..64a2bad919341d19925c6b05e421673f0f133104 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: deblistparser.cc,v 1.25 2001/05/27 05:36:04 jgg Exp $
+// $Id: deblistparser.cc,v 1.28 2001/10/02 03:03:47 tausq Exp $
 /* ######################################################################
    
    Package Cache Generator - Generator for the cache structure.
@@ -152,7 +152,7 @@ unsigned short debListParser::VersionHash()
                             "Conflicts",
                             "Replaces",0};
    unsigned long Result = INIT_FCS;
-   char S[300];
+   char S[1024];
    for (const char **I = Sections; *I != 0; I++)
    {
       const char *Start;
@@ -173,7 +173,7 @@ unsigned short debListParser::VersionHash()
         if (*Start == '>' && Start[1] != '>' && Start[1] != '=')
            *I++ = '=';
       }
-      
+
       Result = AddCRC16(Result,S,I - S);
    }
    
@@ -391,7 +391,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 +402,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,8 +411,14 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop,
         
            if (End == Stop) 
               return 0;
-           
-           if (stringcmp(arch.c_str(),arch.c_str()+arch.length(),I,End) == 0)
+
+           if (*I == '!')
+            {
+              NegArch = true;
+              I++;
+            }
+
+           if (stringcmp(arch,I,End) == 0)
               Found = true;
            
            if (*End++ == ']') {
@@ -422,8 +429,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 */
       }
       
@@ -538,7 +548,7 @@ bool debListParser::Step()
       if (Section.Find("Architecture",Start,Stop) == false)
         return true;
 
-      if (stringcmp(Arch.c_str(),Arch.c_str()+Arch.length(),Start,Stop) == 0)
+      if (stringcmp(Arch,Start,Stop) == 0)
         return true;
 
       if (stringcmp(Start,Stop,"all") == 0)