]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/deb/deblistparser.cc
* Patch from Koblinger Egmont <egmont@uhulinux.hu> to f...
[apt.git] / apt-pkg / deb / deblistparser.cc
index 2b3dfaf6e66bce7e56de4deb929f3ffffe86ebe6..64a2bad919341d19925c6b05e421673f0f133104 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: deblistparser.cc,v 1.24 2001/02/20 07:03:17 jgg Exp $
+// $Id: deblistparser.cc,v 1.28 2001/10/02 03:03:47 tausq Exp $
 /* ######################################################################
    
    Package Cache Generator - Generator for the cache structure.
@@ -16,6 +16,8 @@
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/crc-16.h>
 
+#include <ctype.h>
+
 #include <system.h>
                                                                        /*}}}*/
 
@@ -150,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;
@@ -171,7 +173,7 @@ unsigned short debListParser::VersionHash()
         if (*Start == '>' && Start[1] != '>' && Start[1] != '=')
            *I++ = '=';
       }
-      
+
       Result = AddCRC16(Result,S,I - S);
    }
    
@@ -389,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 == '[')
       {
@@ -400,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 ']'
@@ -408,8 +411,14 @@ const char *debListParser::ParseDepends(const char *Start,const char *Stop,
         
            if (End == Stop) 
               return 0;
-           
-           if (stringcmp(I,End,arch.begin(),arch.end()) == 0)
+
+           if (*I == '!')
+            {
+              NegArch = true;
+              I++;
+            }
+
+           if (stringcmp(arch,I,End) == 0)
               Found = true;
            
            if (*End++ == ']') {
@@ -420,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 */
       }
       
@@ -536,7 +548,7 @@ bool debListParser::Step()
       if (Section.Find("Architecture",Start,Stop) == false)
         return true;
 
-      if (stringcmp(Start,Stop,Arch.begin(),Arch.end()) == 0)
+      if (stringcmp(Arch,Start,Stop) == 0)
         return true;
 
       if (stringcmp(Start,Stop,"all") == 0)