]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/deb/deblistparser.cc
Fixed string case compare problem
[apt.git] / apt-pkg / deb / deblistparser.cc
index 182d46829e1f6c297a4411f8e53fed18586a524e..9da03a7f60793234d8d521a38d64962304b2be79 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: deblistparser.cc,v 1.20 1999/06/04 05:54:20 jgg Exp $
+// $Id: deblistparser.cc,v 1.23 1999/09/30 06:30:34 jgg Exp $
 /* ######################################################################
    
    Package Cache Generator - Generator for the cache structure.
@@ -24,6 +24,7 @@
 /* */
 debListParser::debListParser(FileFd &File) : Tags(File)
 {
+   Arch = _config->Find("APT::architecture");
 }
                                                                        /*}}}*/
 // ListParser::UniqFindTagWrite - Find the tag and write a unq string  /*{{{*/
@@ -87,7 +88,7 @@ bool debListParser::NewVersion(pkgCache::VerIterator Ver)
                             {"extra",pkgCache::State::Extra}};
       if (GrabWord(string(Start,Stop-Start),PrioList,
                   _count(PrioList),Ver->Priority) == false)
-        return _error->Error("Malformed Priority line");
+        Ver->Priority = pkgCache::State::Extra;
    }
 
    if (ParseDepends(Ver,"Depends",pkgCache::Dep::Depends) == false)
@@ -153,11 +154,18 @@ unsigned short debListParser::VersionHash()
         continue;
       
       /* Strip out any spaces from the text, this undoes dpkgs reformatting
-         of certain fields */
+         of certain fields. dpkg also has the rather interesting notion of
+         reformatting depends operators < -> <= */
       char *I = S;
       for (; Start != End; Start++)
+      {
         if (isspace(*Start) == 0)
-           *I++ = *Start;
+           *I++ = tolower(*Start);
+        if (*Start == '<' && Start[1] != '<' && Start[1] != '=')
+           *I++ = '=';
+        if (*Start == '>' && Start[1] != '>' && Start[1] != '=')
+           *I++ = '=';
+      }
       
       Result = AddCRC16(Result,S,I - S);
    }
@@ -171,7 +179,7 @@ unsigned short debListParser::VersionHash()
      Status: want flag status
    want = unknown, install, hold, deinstall, purge
    flag = ok, reinstreq, hold, hold-reinstreq
-   status = not-installed, unpacked, half-configured, uninstalled,
+   status = not-installed, unpacked, half-configured,
             half-installed, config-files, post-inst-failed, 
             removal-failed, installed
    
@@ -230,7 +238,6 @@ bool debListParser::ParseStatus(pkgCache::PkgIterator Pkg,
                             {"unpacked",pkgCache::State::UnPacked},
                             {"half-configured",pkgCache::State::HalfConfigured},
                             {"installed",pkgCache::State::Installed},
-                            {"uninstalled",pkgCache::State::UnInstalled},
                             {"half-installed",pkgCache::State::HalfInstalled},
                             {"config-files",pkgCache::State::ConfigFiles},
                             {"post-inst-failed",pkgCache::State::HalfConfigured},
@@ -466,11 +473,11 @@ bool debListParser::GrabWord(string Word,WordList *List,int Count,
 bool debListParser::Step()
 {
    iOffset = Tags.Offset();
-   string Arch = _config->Find("APT::architecture");
    while (Tags.Step(Section) == true)
-   {
-      /* See if this is the correct Architecture, if it isnt then we
-         drop the whole section */
+   {      
+      /* See if this is the correct Architecture, if it isn't then we
+         drop the whole section. A missing arch tag only happens (in theory)
+         inside the Status file, so that is a positive return */
       const char *Start;
       const char *Stop;
       if (Section.Find("Architecture",Start,Stop) == false)