]> git.saurik.com Git - apt.git/commitdiff
Checkpoint
authorArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 16:50:37 +0000 (16:50 +0000)
committerArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 16:50:37 +0000 (16:50 +0000)
Author: jgg
Date: 1998-07-04 05:57:34 GMT
Checkpoint

12 files changed:
apt-pkg/cacheiterators.h
apt-pkg/contrib/fileutl.cc
apt-pkg/contrib/mmap.cc
apt-pkg/contrib/mmap.h
apt-pkg/deb/deblistparser.cc [new file with mode: 0644]
apt-pkg/deb/deblistparser.h [new file with mode: 0644]
apt-pkg/pkgcache.cc
apt-pkg/pkgcache.h
apt-pkg/pkgcachegen.cc
apt-pkg/pkgcachegen.h
apt-pkg/tagfile.cc
apt-pkg/version.cc

index 539444c3377e5daeb1cce5753a162e49bc17a1d6..17d2be80acf1879bac28e4f5e8d9458a9400c49d 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: cacheiterators.h,v 1.1 1998/07/02 02:58:12 jgg Exp $
+// $Id: cacheiterators.h,v 1.2 1998/07/04 05:57:34 jgg Exp $
 /* ######################################################################
    
    Cache Iterators - Iterators for navigating the cache structure
 /* ######################################################################
    
    Cache Iterators - Iterators for navigating the cache structure
@@ -65,6 +65,7 @@ class pkgCache::PkgIterator
    inline VerIterator CurrentVer() const;
    inline DepIterator RevDependsList() const;
    inline PrvIterator ProvidesList() const;
    inline VerIterator CurrentVer() const;
    inline DepIterator RevDependsList() const;
    inline PrvIterator ProvidesList() const;
+   inline unsigned long Index() const {return Pkg - Owner->PkgP;};
    OkState State() const;
    
    // Constructors
    OkState State() const;
    
    // Constructors
@@ -116,8 +117,9 @@ class pkgCache::VerIterator
    inline PkgIterator ParentPkg() const {return PkgIterator(Owner,Owner.PkgP + Ver->ParentPkg);};
    inline DepIterator DependsList() const;
    inline PrvIterator ProvidesList() const;
    inline PkgIterator ParentPkg() const {return PkgIterator(Owner,Owner.PkgP + Ver->ParentPkg);};
    inline DepIterator DependsList() const;
    inline PrvIterator ProvidesList() const;
+   inline unsigned long Index() const {return Ver - Owner.VerP;};
 
 
-   inline VerIterator(pkgCache &Owner,Version *Trg) : Ver(Trg), Owner(Owner) 
+   inline VerIterator(pkgCache &Owner,Version *Trg = 0) : Ver(Trg), Owner(Owner) 
    { 
       if (Ver == 0)
         Ver = Owner.VerP;
    { 
       if (Ver == 0)
         Ver = Owner.VerP;
@@ -161,6 +163,7 @@ class pkgCache::DepIterator
    inline PkgIterator ParentPkg() {return PkgIterator(*Owner,Owner->PkgP + Owner->VerP[Dep->ParentVer].ParentPkg);};
    bool IsCritical();
    inline bool Reverse() {return Type == DepRev;};
    inline PkgIterator ParentPkg() {return PkgIterator(*Owner,Owner->PkgP + Owner->VerP[Dep->ParentVer].ParentPkg);};
    bool IsCritical();
    inline bool Reverse() {return Type == DepRev;};
+   inline unsigned long Index() const {return Dep - Owner->DepP;};
       
    inline DepIterator(pkgCache &Owner,Dependency *Trg,Version * = 0) :
           Dep(Trg), Type(DepVer), Owner(&Owner) 
       
    inline DepIterator(pkgCache &Owner,Dependency *Trg,Version * = 0) :
           Dep(Trg), Type(DepVer), Owner(&Owner) 
@@ -210,6 +213,7 @@ class pkgCache::PrvIterator
    inline PkgIterator ParentPkg() {return PkgIterator(*Owner,Owner->PkgP + Prv->ParentPkg);};
    inline VerIterator OwnerVer() {return VerIterator(*Owner,Owner->VerP + Prv->Version);};
    inline PkgIterator OwnerPkg() {return PkgIterator(*Owner,Owner->PkgP + Owner->VerP[Prv->Version].ParentPkg);};
    inline PkgIterator ParentPkg() {return PkgIterator(*Owner,Owner->PkgP + Prv->ParentPkg);};
    inline VerIterator OwnerVer() {return VerIterator(*Owner,Owner->VerP + Prv->Version);};
    inline PkgIterator OwnerPkg() {return PkgIterator(*Owner,Owner->PkgP + Owner->VerP[Prv->Version].ParentPkg);};
+   inline unsigned long Index() const {return Prv - Owner->ProvideP;};
 
    inline PrvIterator(pkgCache &Owner,Provides *Trg,Version *) :
           Prv(Trg), Type(PrvVer), Owner(&Owner) 
 
    inline PrvIterator(pkgCache &Owner,Provides *Trg,Version *) :
           Prv(Trg), Type(PrvVer), Owner(&Owner) 
@@ -252,6 +256,7 @@ class pkgCache::PkgFileIterator
    inline const char *FileName() const {return File->FileName == 0?0:Owner->StrP + File->FileName;};
    inline const char *Version() const {return File->Version == 0?0:Owner->StrP + File->Version;};
    inline const char *Distribution() const {return File->Distribution == 0?0:Owner->StrP + File->Distribution;};
    inline const char *FileName() const {return File->FileName == 0?0:Owner->StrP + File->FileName;};
    inline const char *Version() const {return File->Version == 0?0:Owner->StrP + File->Version;};
    inline const char *Distribution() const {return File->Distribution == 0?0:Owner->StrP + File->Distribution;};
+   inline unsigned long Index() const {return File - Owner->PkgFileP;};
 
    bool IsOk();
    
 
    bool IsOk();
    
index 6048ff0bb28e03553e74aaf100b322f33a9c9563..6c6441ef67efafff38ac73a310e985d032e0384c 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: fileutl.cc,v 1.1 1998/07/02 02:58:13 jgg Exp $
+// $Id: fileutl.cc,v 1.2 1998/07/04 05:57:41 jgg Exp $
 /* ######################################################################
    
    File Utilities
 /* ######################################################################
    
    File Utilities
@@ -14,7 +14,7 @@
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
    ##################################################################### */
                                                                        /*}}}*/
 // Include Files                                                       /*{{{*/
-#include <fileutl.h>
+#include <pkglib/fileutl.h>
 #include <pkglib/error.h>
 
 #include <unistd.h>
 #include <pkglib/error.h>
 
 #include <unistd.h>
index 85cac1cca7737bdb2d38eb7f25c0b10d8110a7df..9febc5cdde70019bc11c2b79808d632388610445 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: mmap.cc,v 1.1 1998/07/02 02:58:13 jgg Exp $
+// $Id: mmap.cc,v 1.2 1998/07/04 05:57:42 jgg Exp $
 /* ######################################################################
    
    MMap Class - Provides 'real' mmap or a faked mmap using read().
 /* ######################################################################
    
    MMap Class - Provides 'real' mmap or a faked mmap using read().
@@ -142,11 +142,14 @@ DynamicMMap::~DynamicMMap()
                                                                        /*}}}*/
 // DynamicMMap::RawAllocate - Allocate a raw chunk of unaligned space  /*{{{*/
 // ---------------------------------------------------------------------
                                                                        /*}}}*/
 // DynamicMMap::RawAllocate - Allocate a raw chunk of unaligned space  /*{{{*/
 // ---------------------------------------------------------------------
-/* */
-unsigned long DynamicMMap::RawAllocate(unsigned long Size)
+/* This allocates a block of memory aligned to the given size */
+unsigned long DynamicMMap::RawAllocate(unsigned long Size,unsigned long Aln)
 {
    unsigned long Result = iSize;
 {
    unsigned long Result = iSize;
-   iSize += Size;
+   if (Aln != 0)
+      Result += Aln - (iSize%Aln);
+   
+   iSize = Result + Size;
    
    // Just in case error check
    if (Result > WorkSpace)
    
    // Just in case error check
    if (Result > WorkSpace)
@@ -154,7 +157,6 @@ unsigned long DynamicMMap::RawAllocate(unsigned long Size)
       _error->Error("Dynamic MMap ran out of room");
       return 0;
    }
       _error->Error("Dynamic MMap ran out of room");
       return 0;
    }
-
    return Result;
 }
                                                                        /*}}}*/
    return Result;
 }
                                                                        /*}}}*/
@@ -194,9 +196,9 @@ unsigned long DynamicMMap::Allocate(unsigned long ItemSize)
    if (I->Count == 0)
    {
       I->Count = 20*1024/ItemSize;
    if (I->Count == 0)
    {
       I->Count = 20*1024/ItemSize;
-      I->Start = RawAllocate(I->Count*ItemSize);
+      I->Start = RawAllocate(I->Count*ItemSize,ItemSize);
    }   
    }   
-   
+
    I->Count--;
    unsigned long Result = I->Start;
    I->Start += ItemSize;
    I->Count--;
    unsigned long Result = I->Start;
    I->Start += ItemSize;
index 09630417774f49bf38e1d2a4edf306c2d685f003..c7ddf685da36bb53361512ce3b82ad45ce5c5fd0 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: mmap.h,v 1.1 1998/07/02 02:58:13 jgg Exp $
+// $Id: mmap.h,v 1.2 1998/07/04 05:57:43 jgg Exp $
 /* ######################################################################
    
    MMap Class - Provides 'real' mmap or a faked mmap using read().
 /* ######################################################################
    
    MMap Class - Provides 'real' mmap or a faked mmap using read().
@@ -79,7 +79,7 @@ class DynamicMMap : public MMap
    public:
 
    // Allocation
    public:
 
    // Allocation
-   unsigned long RawAllocate(unsigned long Size);
+   unsigned long RawAllocate(unsigned long Size,unsigned long Aln = 0);
    unsigned long Allocate(unsigned long ItemSize);
    unsigned long WriteString(const char *String,unsigned long Len = 0);
    inline unsigned long WriteString(string S) {return WriteString(S.begin(),S.size());};
    unsigned long Allocate(unsigned long ItemSize);
    unsigned long WriteString(const char *String,unsigned long Len = 0);
    inline unsigned long WriteString(string S) {return WriteString(S.begin(),S.size());};
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
new file mode 100644 (file)
index 0000000..28298aa
--- /dev/null
@@ -0,0 +1,255 @@
+// -*- mode: cpp; mode: fold -*-
+// Description                                                         /*{{{*/
+// $Id: deblistparser.cc,v 1.1 1998/07/04 05:58:08 jgg Exp $
+/* ######################################################################
+   
+   Package Cache Generator - Generator for the cache structure.
+   
+   This builds the cache structure from the abstract package list parser. 
+   
+   ##################################################################### */
+                                                                       /*}}}*/
+// Include Files                                                       /*{{{*/
+#include <pkglib/deblistparser.h>
+#include <pkglib/error.h>
+#include <system.h>
+                                                                       /*}}}*/
+
+// ListParser::debListParser - Constructor                             /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+debListParser::debListParser(File &File) : Tags(File)
+{
+   Step();
+}
+                                                                       /*}}}*/
+// ListParser::FindTag - Find the tag and return a string              /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+string debListParser::FindTag(const char *Tag)
+{
+   const char *Start;
+   const char *Stop;
+   if (Section.Find(Tag,Start,Stop) == false)
+      return string();
+   return string(Start,Stop - Start);
+}
+                                                                       /*}}}*/
+// ListParser::UniqFindTagWrite - Find the tag and write a unq string  /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+unsigned long debListParser::UniqFindTagWrite(const char *Tag)
+{
+   const char *Start;
+   const char *Stop;
+   if (Section.Find(Tag,Start,Stop) == false)
+      return 0;
+   return WriteUniqString(Start,Stop - Start);
+}
+                                                                       /*}}}*/
+// ListParser::HandleFlag - Sets a flag variable based on a tag                /*{{{*/
+// ---------------------------------------------------------------------
+/* This checks the tag for true/false yes/no etc */
+bool debListParser::HandleFlag(const char *Tag,unsigned long &Flags,
+                              unsigned long Flag)
+{
+   const char *Start;
+   const char *Stop;
+   if (Section.Find(Tag,Start,Stop) == false)
+      return true;
+   
+   int Set = 2;
+   if (strncasecmp(Start,"yes",Stop - Start) == 0)
+      Set = 1;
+   if (strncasecmp(Start,"true",Stop - Start) == 0)
+      Set = 1;
+   if (strncasecmp(Start,"no",Stop - Start) == 0)
+      Set = 0;
+   if (strncasecmp(Start,"false",Stop - Start) == 0)
+      Set = 0;
+   if (Set == 2)
+   {
+      _error->Warning("Unknown flag value");
+      return true;
+   }
+   
+   if (Set == 0)
+      Flags &= ~Flag;
+   if (Set == 1)
+      Flags |= Flag;
+   return true;
+}
+                                                                       /*}}}*/
+// ListParser::Package - Return the package name                       /*{{{*/
+// ---------------------------------------------------------------------
+/* This is to return the name of the package this section describes */
+string debListParser::Package()
+{
+   string Result = FindTag("Package");
+   if (Result.empty() == true)
+      _error->Error("Encoutered a section with no Package: header");
+   return Result;
+}
+                                                                       /*}}}*/
+// ListParser::Version - Return the version string                     /*{{{*/
+// ---------------------------------------------------------------------
+/* This is to return the string describing the version in debian form,
+   epoch:upstream-release. If this returns the blank string then the 
+   entry is assumed to only describe package properties */
+string debListParser::Version()
+{
+   return FindTag("Version");
+}
+                                                                       /*}}}*/
+// ListParser::NewPackage - Fill in the package structure              /*{{{*/
+// ---------------------------------------------------------------------
+/* This is called when a new package structure is created. It must fill
+   in the static package information. */
+bool debListParser::NewPackage(pkgCache::PkgIterator Pkg)
+{
+   // Debian doesnt have anything, everything is condionally megered
+   return true;
+}
+                                                                       /*}}}*/
+// ListParser::NewVersion - Fill in the version structure              /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+bool debListParser::NewVersion(pkgCache::VerIterator Ver)
+{   
+   return true;
+}
+                                                                       /*}}}*/
+// ListParser::UsePackage - Update a package structure                 /*{{{*/
+// ---------------------------------------------------------------------
+/* This is called to update the package with any new information 
+   that might be found in the section */
+bool debListParser::UsePackage(pkgCache::PkgIterator Pkg,
+                              pkgCache::VerIterator Ver)
+{
+   if (Pkg->Section == 0)
+      if ((Pkg->Section = UniqFindTagWrite("Section")) == 0)
+        return false;
+   if (HandleFlag("Essential",Pkg->Flags,pkgCache::Essential) == false)
+      return false;
+   if (HandleFlag("Immediate-Configure",Pkg->Flags,pkgCache::ImmediateConf) == false)
+      return false;
+   if (ParseStatus(Pkg,Ver) == false)
+      return false;
+   return true;
+}
+                                                                       /*}}}*/
+// ListParser::ParseStatus - Parse the status feild                    /*{{{*/
+// ---------------------------------------------------------------------
+/* Status lines are of the form,
+     Status: want flag status
+   want = unknown, install, hold, deinstall, purge
+   flag = ok, reinstreq, hold, hold-reinstreq
+   status = not-installed, unpacked, half-configured, uninstalled,
+            half-installed, config-files, post-inst-failed, 
+            removal-failed, installed
+   
+   Some of the above are obsolete (I think?) flag = hold-* and 
+   status = post-inst-failed, removal-failed at least.
+ */
+bool debListParser::ParseStatus(pkgCache::PkgIterator Pkg,
+                               pkgCache::VerIterator Ver)
+{
+   const char *Start;
+   const char *Stop;
+   if (Section.Find("Status",Start,Stop) == false)
+      return true;
+   
+   // Isolate the first word
+   const char *I = Start;
+   for(; I < Stop && *I != ' '; I++);
+   if (I >= Stop || *I != ' ')
+      return _error->Error("Malformed Status line");
+
+   // Process the want field
+   WordList WantList[] = {{"unknown",pkgCache::Unknown},
+                          {"install",pkgCache::Install},
+                          {"hold",pkgCache::Hold},
+                          {"deinstall",pkgCache::DeInstall},
+                          {"purge",pkgCache::Purge}};
+   if (GrabWord(string(Start,I-Start),WantList,
+               _count(WantList),Pkg->SelectedState) == false)
+      return _error->Error("Malformed 1st word in the Status line");
+
+   // Isloate the next word
+   I++;
+   Start = I;
+   for(; I < Stop && *I != ' '; I++);
+   if (I >= Stop || *I != ' ')
+      return _error->Error("Malformed status line, no 2nd word");
+
+   // Process the flag field
+   WordList FlagList[] = {{"ok",pkgCache::Ok},
+                          {"reinstreq",pkgCache::ReInstReq},
+                          {"hold",pkgCache::HoldInst},
+                          {"hold-reinstreq",pkgCache::HoldReInstReq}};
+   if (GrabWord(string(Start,I-Start),FlagList,
+               _count(FlagList),Pkg->InstState) == false)
+      return _error->Error("Malformed 2nd word in the Status line");
+
+   // Isloate the last word
+   I++;
+   Start = I;
+   for(; I < Stop && *I != ' '; I++);
+   if (I != Stop)
+      return _error->Error("Malformed Status line, no 3rd word");
+
+   // Process the flag field
+   WordList StatusList[] = {{"not-installed",pkgCache::NotInstalled},
+                            {"unpacked",pkgCache::UnPacked},
+                            {"half-configured",pkgCache::HalfConfigured},
+                            {"installed",pkgCache::Installed},
+                            {"uninstalled",pkgCache::UnInstalled},
+                            {"half-installed",pkgCache::HalfInstalled},
+                            {"config-files",pkgCache::ConfigFiles},
+                            {"post-inst-failed",pkgCache::HalfConfigured},
+                            {"removal-failed",pkgCache::HalfInstalled}};
+   if (GrabWord(string(Start,I-Start),StatusList,
+               _count(StatusList),Pkg->CurrentState) == false)
+      return _error->Error("Malformed 3rd word in the Status line");
+
+   /* A Status line marks the package as indicating the current
+      version as well. Only if it is actually installed.. Otherwise
+      the interesting dpkg handling of the status file creates bogus 
+      entries. */
+   if (!(Pkg->CurrentState == pkgCache::NotInstalled ||
+        Pkg->CurrentState == pkgCache::ConfigFiles))
+   {
+      if (Ver.end() == true)
+        _error->Warning("Encountered status field in a non-version description");
+      else
+        Pkg->CurrentVer = Ver.Index();
+   }
+   
+   return true;
+}
+                                                                       /*}}}*/
+// ListParser::GrabWord - Matches a word and returns                   /*{{{*/
+// ---------------------------------------------------------------------
+/* Looks for a word in a list of words - for ParseStatus */
+bool debListParser::GrabWord(string Word,WordList *List,int Count,
+                            unsigned char &Out)
+{
+   for (int C = 0; C != Count; C++)
+   {
+      if (strcasecmp(Word.c_str(),List[C].Str) == 0)
+      {
+        Out = List[C].Val;
+        return true;
+      }
+   }
+   return false;
+}
+                                                                       /*}}}*/
+// ListParser::Step - Move to the next section in the file             /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+bool debListParser::Step()
+{
+   return Tags.Step(Section);
+}
+                                                                       /*}}}*/
diff --git a/apt-pkg/deb/deblistparser.h b/apt-pkg/deb/deblistparser.h
new file mode 100644 (file)
index 0000000..30eb869
--- /dev/null
@@ -0,0 +1,51 @@
+// -*- mode: cpp; mode: fold -*-
+// Description                                                         /*{{{*/
+// $Id: deblistparser.h,v 1.1 1998/07/04 05:58:08 jgg Exp $
+/* ######################################################################
+   
+   Debian Package List Parser - This implements the abstract parser 
+   interface for Debian package files
+   
+   ##################################################################### */
+                                                                       /*}}}*/
+// Header section: pkglib
+#ifndef PKGLIB_DEBLISTPARSER_H
+#define PKGLIB_DEBLISTPARSER_H
+
+#include <pkglib/pkgcachegen.h>
+#include <pkglib/tagfile.h>
+
+class debListParser : public pkgCacheGenerator::ListParser
+{
+   pkgTagFile Tags;
+   pkgTagSection Section;
+   
+   // Parser Helper
+   struct WordList
+   {
+      char *Str;
+      unsigned char Val;
+   };
+   
+   string FindTag(const char *Tag);
+   unsigned long UniqFindTagWrite(const char *Tag);
+   bool HandleFlag(const char *Tag,unsigned long &Flags,unsigned long Flag);
+   bool ParseStatus(pkgCache::PkgIterator Pkg,pkgCache::VerIterator Ver);
+   bool GrabWord(string Word,WordList *List,int Count,unsigned char &Out);
+   
+   public:
+   
+   // These all operate against the current section
+   virtual string Package();
+   virtual string Version();
+   virtual bool NewVersion(pkgCache::VerIterator Ver);
+   virtual bool NewPackage(pkgCache::PkgIterator Pkg);
+   virtual bool UsePackage(pkgCache::PkgIterator Pkg,
+                          pkgCache::VerIterator Ver);
+
+   virtual bool Step();
+   
+   debListParser(File &File);
+};
+
+#endif
index b75fe6d94f866d2307a2af9ade41ba6511eef294..fa0c363f7cc236a7d0b8ac199944bbcc7ab353cc 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: pkgcache.cc,v 1.1 1998/07/02 02:58:12 jgg Exp $
+// $Id: pkgcache.cc,v 1.2 1998/07/04 05:57:35 jgg Exp $
 /* ######################################################################
    
    Package Cache - Accessor code for the cache
 /* ######################################################################
    
    Package Cache - Accessor code for the cache
@@ -159,7 +159,12 @@ pkgCache::PkgIterator pkgCache::FindPkg(string Name)
 }
                                                                        /*}}}*/
 
 }
                                                                        /*}}}*/
 
-// Cache::PkgIterator - operator ++ - Postfix incr                     /*{{{*/
+// Bases for iterator classes                                          /*{{{*/
+void pkgCache::VerIterator::_dummy() {}
+void pkgCache::DepIterator::_dummy() {}
+void pkgCache::PrvIterator::_dummy() {}
+                                                                       /*}}}*/
+// PkgIterator::operator ++ - Postfix incr                             /*{{{*/
 // ---------------------------------------------------------------------
 /* This will advance to the next logical package in the hash table. */
 void pkgCache::PkgIterator::operator ++(int) 
 // ---------------------------------------------------------------------
 /* This will advance to the next logical package in the hash table. */
 void pkgCache::PkgIterator::operator ++(int) 
@@ -176,23 +181,18 @@ void pkgCache::PkgIterator::operator ++(int)
    }
 };
                                                                        /*}}}*/
    }
 };
                                                                        /*}}}*/
-// Bases for iterator classes                                          /*{{{*/
-void pkgCache::VerIterator::_dummy() {}
-void pkgCache::DepIterator::_dummy() {}
-void pkgCache::PrvIterator::_dummy() {}
-                                                                       /*}}}*/
 // PkgIterator::State - Check the State of the package                 /*{{{*/
 // ---------------------------------------------------------------------
 /* By this we mean if it is either cleanly installed or cleanly removed. */
 pkgCache::PkgIterator::OkState pkgCache::PkgIterator::State() const
 {
 // PkgIterator::State - Check the State of the package                 /*{{{*/
 // ---------------------------------------------------------------------
 /* By this we mean if it is either cleanly installed or cleanly removed. */
 pkgCache::PkgIterator::OkState pkgCache::PkgIterator::State() const
 {
-   if (Pkg->CurrentState == pkgSTATE_UnPacked ||
-       Pkg->CurrentState == pkgSTATE_HalfConfigured)
+   if (Pkg->CurrentState == UnPacked ||
+       Pkg->CurrentState == HalfConfigured)
       return NeedsConfigure;
    
       return NeedsConfigure;
    
-   if (Pkg->CurrentState == pkgSTATE_UnInstalled ||
-       Pkg->CurrentState == pkgSTATE_HalfInstalled ||
-       Pkg->InstState != pkgSTATE_Ok)
+   if (Pkg->CurrentState == UnInstalled ||
+       Pkg->CurrentState == HalfInstalled ||
+       Pkg->InstState != Ok)
       return NeedsUnpack;
       
    return NeedsNothing;
       return NeedsUnpack;
       
    return NeedsNothing;
@@ -204,8 +204,8 @@ pkgCache::PkgIterator::OkState pkgCache::PkgIterator::State() const
    conflicts. */
 bool pkgCache::DepIterator::IsCritical()
 {
    conflicts. */
 bool pkgCache::DepIterator::IsCritical()
 {
-   if (Dep->Type == pkgDEP_Conflicts || Dep->Type == pkgDEP_Depends ||
-       Dep->Type == pkgDEP_PreDepends)
+   if (Dep->Type == Conflicts || Dep->Type == Depends ||
+       Dep->Type == PreDepends)
       return true;
    return false;
 }
       return true;
    return false;
 }
@@ -280,7 +280,7 @@ pkgCache::Version **pkgCache::DepIterator::AllTargets()
         if (pkgCheckDep(TargetVer(),I.VerStr(),Dep->CompareOp) == false)
            continue;
 
         if (pkgCheckDep(TargetVer(),I.VerStr(),Dep->CompareOp) == false)
            continue;
 
-        if (Dep->Type == pkgDEP_Conflicts && ParentPkg() == I.ParentPkg())
+        if (Dep->Type == Conflicts && ParentPkg() == I.ParentPkg())
            continue;
         
         Size++;
            continue;
         
         Size++;
@@ -294,7 +294,7 @@ pkgCache::Version **pkgCache::DepIterator::AllTargets()
         if (pkgCheckDep(TargetVer(),I.ProvideVersion(),Dep->CompareOp) == false)
            continue;
         
         if (pkgCheckDep(TargetVer(),I.ProvideVersion(),Dep->CompareOp) == false)
            continue;
         
-        if (Dep->Type == pkgDEP_Conflicts && ParentPkg() == I.OwnerPkg())
+        if (Dep->Type == Conflicts && ParentPkg() == I.OwnerPkg())
            continue;
         
         Size++;
            continue;
         
         Size++;
index 0dc939a51424cdb8944562019fbfb0b085e73cb7..c8fe3a8deedb7ebe29108d608fed1cea36caeb77 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: pkgcache.h,v 1.1 1998/07/02 02:58:12 jgg Exp $
+// $Id: pkgcache.h,v 1.2 1998/07/04 05:57:36 jgg Exp $
 /* ######################################################################
    
    Cache - Structure definitions for the cache file
 /* ######################################################################
    
    Cache - Structure definitions for the cache file
 #include <time.h>
 #include <pkglib/mmap.h>
 
 #include <time.h>
 #include <pkglib/mmap.h>
 
-// Definitions for Depends::Type
-#define pkgDEP_Depends 1
-#define pkgDEP_PreDepends 2
-#define pkgDEP_Suggests 3
-#define pkgDEP_Recommends 4
-#define pkgDEP_Conflicts 5
-#define pkgDEP_Replaces 6
-
-// Definitions for Version::Priority
-#define pkgPRIO_Important 1
-#define pkgPRIO_Required 2
-#define pkgPRIO_Standard 3
-#define pkgPRIO_Optional 4
-#define pkgPRIO_Extra 5
-
-// Definitions for Package::SelectedState
-#define pkgSTATE_Unkown 0
-#define pkgSTATE_Install 1
-#define pkgSTATE_Hold 2
-#define pkgSTATE_DeInstall 3
-#define pkgSTATE_Purge 4
-
-// Definitions for Package::Flags
-#define pkgFLAG_Auto (1 << 0)
-#define pkgFLAG_New (1 << 1)
-#define pkgFLAG_Obsolete (1 << 2)
-#define pkgFLAG_Essential (1 << 3)
-#define pkgFLAG_ImmediateConf (1 << 4)
-
-// Definitions for Package::InstState
-#define pkgSTATE_Ok 0
-#define pkgSTATE_ReInstReq 1
-#define pkgSTATE_Hold 2
-#define pkgSTATE_HoldReInstReq 3
-
-// Definitions for Package::CurrentState
-#define pkgSTATE_NotInstalled 0
-#define pkgSTATE_UnPacked 1
-#define pkgSTATE_HalfConfigured 2
-#define pkgSTATE_UnInstalled 3
-#define pkgSTATE_HalfInstalled 4
-#define pkgSTATE_ConfigFiles 5
-#define pkgSTATE_Installed 6
-
-// Definitions for PackageFile::Flags
-#define pkgFLAG_NotSource (1 << 0)
-
-// Definitions for Dependency::CompareOp
-#define pkgOP_OR 0x10
-#define pkgOP_LESSEQ 0x1
-#define pkgOP_GREATEREQ 0x2
-#define pkgOP_LESS 0x3
-#define pkgOP_GREATER 0x4
-#define pkgOP_EQUALS 0x5
-#define pkgOP_NOTEQUALS 0x6
-
 class pkgCache
 {
    public:
 class pkgCache
 {
    public:
@@ -103,6 +47,21 @@ class pkgCache
    friend DepIterator;
    friend PrvIterator;
    friend PkgFileIterator;
    friend DepIterator;
    friend PrvIterator;
    friend PkgFileIterator;
+
+   // These are all the constants used in the cache structures
+   enum DepType {Depends=1,PreDepends=2,Suggests=3,Recommends=4,
+                 Conflicts=5,Replaces=6};
+   enum VerPriority {Important=1,Required=2,Standard=3,Optional=5,Extra=5};
+   enum PkgSelectedState {Unknown=0,Install=1,Hold=2,DeInstall=3,Purge=4};
+   enum PkgFlags {Auto=(1<<0),New=(1<<1),Obsolete=(1<<2),Essential=(1<<3),
+                  ImmediateConf=(1<<4)};
+   enum PkgInstState {Ok=0,ReInstReq=1,HoldInst=2,HoldReInstReq=3};
+   enum PkgCurrentState {NotInstalled=0,UnPacked=1,HalfConfigured=2,
+                         UnInstalled=3,HalfInstalled=4,ConfigFiles=5,
+                         Installed=6};
+   enum PkgFFlags {NotSource=(1<<0)};
+   enum DepCompareOp {Or=0x10,LessEq=0x1,GreaterEq=0x2,Less=0x3,
+                      Greater=0x4,Equals=0x5,NotEquals=0x6};
    
    protected:
    
    
    protected:
    
@@ -204,7 +163,7 @@ struct pkgCache::Package
    unsigned char CurrentState;      // State
    
    unsigned short ID;
    unsigned char CurrentState;      // State
    
    unsigned short ID;
-   unsigned short Flags;
+   unsigned long Flags;
 };
 
 struct pkgCache::PackageFile
 };
 
 struct pkgCache::PackageFile
@@ -218,7 +177,7 @@ struct pkgCache::PackageFile
    // Linked list
    unsigned long NextFile;        // PackageFile
    unsigned short ID;
    // Linked list
    unsigned long NextFile;        // PackageFile
    unsigned short ID;
-   unsigned short Flags;
+   unsigned long Flags;
    time_t mtime;                  // Modification time for the file
 };
 
    time_t mtime;                  // Modification time for the file
 };
 
index cb0fd3f74a17523c20e672c0d4c8a2472822151f..8a5423e69deed4480fc0449d8ba6218904a3d82d 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: pkgcachegen.cc,v 1.1 1998/07/02 02:58:12 jgg Exp $
+// $Id: pkgcachegen.cc,v 1.2 1998/07/04 05:57:37 jgg Exp $
 /* ######################################################################
    
    Package Cache Generator - Generator for the cache structure.
 /* ######################################################################
    
    Package Cache Generator - Generator for the cache structure.
@@ -58,13 +58,12 @@ pkgCacheGenerator::~pkgCacheGenerator()
 bool pkgCacheGenerator::MergeList(ListParser &List)
 {
    List.Owner = this;
 bool pkgCacheGenerator::MergeList(ListParser &List)
 {
    List.Owner = this;
-   
    do
    {
       // Get a pointer to the package structure
       string Package = List.Package();
       pkgCache::PkgIterator Pkg = Cache.FindPkg(Package);
    do
    {
       // Get a pointer to the package structure
       string Package = List.Package();
       pkgCache::PkgIterator Pkg = Cache.FindPkg(Package);
-      if (Pkg.end() == false)
+      if (Pkg.end() == true)
       {
         if (NewPackage(Pkg,Package) == false)
            return false;
       {
         if (NewPackage(Pkg,Package) == false)
            return false;
@@ -72,17 +71,22 @@ bool pkgCacheGenerator::MergeList(ListParser &List)
         if (List.NewPackage(Pkg) == false)
            return false;
       }
         if (List.NewPackage(Pkg) == false)
            return false;
       }
-      if (List.UsePackage(Pkg) == false)
-        return false;
       
       /* Get a pointer to the version structure. We know the list is sorted
          so we use that fact in the search. Insertion of new versions is
         done with correct sorting */
       string Version = List.Version();
       
       /* Get a pointer to the version structure. We know the list is sorted
          so we use that fact in the search. Insertion of new versions is
         done with correct sorting */
       string Version = List.Version();
+      if (Version.empty() == true)
+      {
+        if (List.UsePackage(Pkg,pkgCache::VerIterator(Cache)) == false)
+           return false;
+        continue;
+      }
+
       pkgCache::VerIterator Ver = Pkg.VersionList();
       unsigned long *Last = &Pkg->VersionList;
       int Res;
       pkgCache::VerIterator Ver = Pkg.VersionList();
       unsigned long *Last = &Pkg->VersionList;
       int Res;
-      for (; Ver.end() == false; Ver++, Last = &Ver->NextVer)
+      for (; Ver.end() == false; Last = &Ver->NextVer, Ver++)
       {
         Res = pkgVersionCompare(Version.begin(),Version.end(),Ver.VerStr(),
                                 Ver.VerStr() + strlen(Ver.VerStr()));
       {
         Res = pkgVersionCompare(Version.begin(),Version.end(),Ver.VerStr(),
                                 Ver.VerStr() + strlen(Ver.VerStr()));
@@ -94,6 +98,9 @@ bool pkgCacheGenerator::MergeList(ListParser &List)
          saw it */
       if (Res == 0)
       {
          saw it */
       if (Res == 0)
       {
+        if (List.UsePackage(Pkg,Ver) == false)
+           return false;
+        
         if (NewFileVer(Ver,List) == false)
            return false;
         
         if (NewFileVer(Ver,List) == false)
            return false;
         
@@ -101,10 +108,14 @@ bool pkgCacheGenerator::MergeList(ListParser &List)
       }      
 
       // Add a new version
       }      
 
       // Add a new version
-      *Last = NewVersion(Ver,*Last);
+      *Last = NewVersion(Ver,Version,*Last);
+      Ver->ParentPkg = Pkg.Index();
       if (List.NewVersion(Ver) == false)
         return false;
       
       if (List.NewVersion(Ver) == false)
         return false;
       
+      if (List.UsePackage(Pkg,Ver) == false)
+        return false;
+      
       if (NewFileVer(Ver,List) == false)
         return false;
    }
       if (NewFileVer(Ver,List) == false)
         return false;
    }
@@ -116,17 +127,17 @@ bool pkgCacheGenerator::MergeList(ListParser &List)
 // CacheGenerator::NewPackage - Add a new package                      /*{{{*/
 // ---------------------------------------------------------------------
 /* This creates a new package structure and adds it to the hash table */
 // CacheGenerator::NewPackage - Add a new package                      /*{{{*/
 // ---------------------------------------------------------------------
 /* This creates a new package structure and adds it to the hash table */
-bool pkgCacheGenerator::NewPackage(pkgCache::PkgIterator Pkg,string Name)
+bool pkgCacheGenerator::NewPackage(pkgCache::PkgIterator &Pkg,string Name)
 {
    // Get a structure
    unsigned long Package = Map.Allocate(sizeof(pkgCache::Package));
    if (Package == 0)
       return false;
    
 {
    // Get a structure
    unsigned long Package = Map.Allocate(sizeof(pkgCache::Package));
    if (Package == 0)
       return false;
    
-   Pkg = pkgCache::PkgIterator(Cache,Cache.PackageP + Package);
+   Pkg = pkgCache::PkgIterator(Cache,Cache.PkgP + Package);
    
    // Insert it into the hash table
    
    // Insert it into the hash table
-   unsigned long Hash = Map.Hash(Name);
+   unsigned long Hash = Cache.Hash(Name);
    Pkg->NextPackage = Cache.HeaderP->HashTable[Hash];
    Cache.HeaderP->HashTable[Hash] = Package;
    
    Pkg->NextPackage = Cache.HeaderP->HashTable[Hash];
    Cache.HeaderP->HashTable[Hash] = Package;
    
@@ -142,17 +153,34 @@ bool pkgCacheGenerator::NewPackage(pkgCache::PkgIterator Pkg,string Name)
 // CacheGenerator::NewFileVer - Create a new File<->Version association        /*{{{*/
 // ---------------------------------------------------------------------
 /* */
 // CacheGenerator::NewFileVer - Create a new File<->Version association        /*{{{*/
 // ---------------------------------------------------------------------
 /* */
-bool pkgCacheGenerator::NewFileVer(pkgCache::VerIterator Ver,
+bool pkgCacheGenerator::NewFileVer(pkgCache::VerIterator &Ver,
                                   ListParser &List)
 {
                                   ListParser &List)
 {
+   return true;
 }
                                                                        /*}}}*/
 // CacheGenerator::NewVersion - Create a new Version                   /*{{{*/
 // ---------------------------------------------------------------------
 }
                                                                        /*}}}*/
 // CacheGenerator::NewVersion - Create a new Version                   /*{{{*/
 // ---------------------------------------------------------------------
-/* */
+/* This puts a version structure in the linked list */
 unsigned long pkgCacheGenerator::NewVersion(pkgCache::VerIterator &Ver,
 unsigned long pkgCacheGenerator::NewVersion(pkgCache::VerIterator &Ver,
+                                           string VerStr,
                                            unsigned long Next)
 {
                                            unsigned long Next)
 {
+   // Get a structure
+   unsigned long Version = Map.Allocate(sizeof(pkgCache::Version));
+   if (Version == 0)
+      return false;
+   
+   // Fill it in
+   Ver = pkgCache::VerIterator(Cache,Cache.VerP + Version);
+   Ver->File = CurrentFile - Cache.PkgFileP;
+   Ver->NextVer = Next;
+   Ver->ID = Cache.HeaderP->VersionCount++;
+   Ver->VerStr = Map.WriteString(VerStr);
+   if (Ver->VerStr == 0)
+      return false;
+   
+   return true;
 }
                                                                        /*}}}*/
 // CacheGenerator::SelectFile - Select the current file being parsed   /*{{{*/
 }
                                                                        /*}}}*/
 // CacheGenerator::SelectFile - Select the current file being parsed   /*{{{*/
@@ -182,3 +210,44 @@ bool pkgCacheGenerator::SelectFile(string File,unsigned long Flags)
       return false;
 }
                                                                        /*}}}*/
       return false;
 }
                                                                        /*}}}*/
+// CacheGenerator::WriteUniqueString - Insert a unique string          /*{{{*/
+// ---------------------------------------------------------------------
+/* This is used to create handles to strings. Given the same text it
+   always returns the same number */
+unsigned long pkgCacheGenerator::WriteUniqString(const char *S,
+                                                unsigned int Size)
+{
+   // Search for an insertion point
+   pkgCache::StringItem *I = Cache.StringItemP + Cache.HeaderP->StringList;
+   int Res = 1;
+   unsigned long *Last = &Cache.HeaderP->StringList;
+   for (; I != Cache.StringItemP; Last = &I->NextItem, 
+        I = Cache.StringItemP + I->NextItem)
+   {
+      Res = strncmp(Cache.StrP + I->String,S,Size);
+      if (Res == 0 && *(Cache.StrP + I->String + Size) != 0)
+        Res = 1;
+      if (Res >= 0)
+        break;
+   }
+   
+   // Match
+   if (Res == 0)
+      return I - Cache.StringItemP;
+   
+   // Get a structure
+   unsigned long Item = Map.Allocate(sizeof(pkgCache::StringItem));
+   if (Item == 0)
+      return false;
+   
+   // Fill in the structure
+   pkgCache::StringItem *ItemP = Cache.StringItemP + Item;
+   ItemP->NextItem = I - Cache.StringItemP;
+   *Last = Item;
+   ItemP->String = Map.WriteString(S,Size);
+   if (ItemP->String == 0)
+      return false;
+   
+   return true;
+}
+                                                                       /*}}}*/
index 1385ab964ab9c5c1066df5c0624f804685fa27fd..6ce1ed8b6ac177e07222c064a861d574937fa3ca 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: pkgcachegen.h,v 1.1 1998/07/02 02:58:13 jgg Exp $
+// $Id: pkgcachegen.h,v 1.2 1998/07/04 05:57:38 jgg Exp $
 /* ######################################################################
    
    Package Cache Generator - Generator for the cache structure.
 /* ######################################################################
    
    Package Cache Generator - Generator for the cache structure.
@@ -29,10 +29,13 @@ class pkgCacheGenerator
    string PkgFileName;
    pkgCache::PackageFile *CurrentFile;
    
    string PkgFileName;
    pkgCache::PackageFile *CurrentFile;
    
-   bool NewPackage(pkgCache::PkgIterator Pkg,string Pkg);
-   bool NewFileVer(pkgCache::VerIterator Ver,ListParser &List);
-   unsigned long NewVersion(pkgCache::VerIterator &Ver,unsigned long Next);
+   bool NewPackage(pkgCache::PkgIterator &Pkg,string Pkg);
+   bool NewFileVer(pkgCache::VerIterator &Ver,ListParser &List);
+   unsigned long NewVersion(pkgCache::VerIterator &Ver,string VerStr,unsigned long Next);
 
 
+   unsigned long WriteUniqString(const char *S,unsigned int Size);
+   inline unsigned long WriteUniqString(string S) {return WriteUniqString(S);};
+   
    public:
    
    // This is the abstract package list parser class.
    public:
    
    // This is the abstract package list parser class.
@@ -43,9 +46,11 @@ class pkgCacheGenerator
       
       protected:
       
       
       protected:
       
+      inline unsigned long WriteUniqString(string S) {return Owner->WriteUniqString(S);};
+      inline unsigned long WriteUniqString(const char *S,unsigned int Size) {return Owner->WriteUniqString(S,Size);};
       inline unsigned long WriteString(string S) {return Owner->Map.WriteString(S);};
       inline unsigned long WriteString(const char *S,unsigned int Size) {return Owner->Map.WriteString(S,Size);};
       inline unsigned long WriteString(string S) {return Owner->Map.WriteString(S);};
       inline unsigned long WriteString(const char *S,unsigned int Size) {return Owner->Map.WriteString(S,Size);};
-
+      
       public:
       
       // These all operate against the current section
       public:
       
       // These all operate against the current section
@@ -53,9 +58,11 @@ class pkgCacheGenerator
       virtual string Version() = 0;
       virtual bool NewVersion(pkgCache::VerIterator Ver) = 0;
       virtual bool NewPackage(pkgCache::PkgIterator Pkg) = 0;
       virtual string Version() = 0;
       virtual bool NewVersion(pkgCache::VerIterator Ver) = 0;
       virtual bool NewPackage(pkgCache::PkgIterator Pkg) = 0;
-      virtual bool UsePackage(pkgCache::PkgIterator Pkg) = 0;
-      
+      virtual bool UsePackage(pkgCache::PkgIterator Pkg,
+                             pkgCache::VerIterator Ver) = 0;
+                                  
       virtual bool Step() = 0;
       virtual bool Step() = 0;
+      virtual ~ListParser() {};
    };
    friend ListParser;
 
    };
    friend ListParser;
 
index 106b0febeb29ddd5a9a7d9b840ccc22e1483b502..62d66590b77c516398a9543706b2f72fba3cf1e0 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: tagfile.cc,v 1.1 1998/07/02 02:58:13 jgg Exp $
+// $Id: tagfile.cc,v 1.2 1998/07/04 05:57:39 jgg Exp $
 /* ######################################################################
 
    Fast scanner for RFC-822 type header information
 /* ######################################################################
 
    Fast scanner for RFC-822 type header information
@@ -147,18 +147,31 @@ bool pkgTagSection::Find(const char *Tag,const char *&Start,
                                                                        /*}}}*/
 
 #include <pkglib/pkgcachegen.h>
                                                                        /*}}}*/
 
 #include <pkglib/pkgcachegen.h>
+#include <pkglib/deblistparser.h>
 
 int main(int argc,char *argv[])
 {
    {
       File F(argv[1],File::ReadOnly);
 
 int main(int argc,char *argv[])
 {
    {
       File F(argv[1],File::ReadOnly);
-      pkgTagFile Test(F);
       File CacheF("./cache",File::WriteEmpty);
       DynamicMMap Map(CacheF,MMap::Public);
       pkgCacheGenerator Gen(Map);
       File CacheF("./cache",File::WriteEmpty);
       DynamicMMap Map(CacheF,MMap::Public);
       pkgCacheGenerator Gen(Map);
-      Gen.SelectFile("tet");
+      Gen.SelectFile(argv[1]);
+      
+      debListParser Parser(F);
+      Gen.MergeList(Parser);
    }
 
    }
 
+   {
+      File CacheF("./cache",File::WriteExists);
+      MMap Map(CacheF,MMap::Public);
+      pkgCache Cache(Map);
+      for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
+      {
+        cout << "Package: " << I.Name() << endl;
+      }      
+   }
+   
 #if 0 
    pkgTagSection I;
    while (Test.Step(I) == true)
 #if 0 
    pkgTagSection I;
    while (Test.Step(I) == true)
index c02ee5f876e4ce1ef97e355e55cab1a7902833c7..174622c91b3181b9a409345079b2033f93720c94 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: version.cc,v 1.1 1998/07/02 02:58:13 jgg Exp $
+// $Id: version.cc,v 1.2 1998/07/04 05:57:40 jgg Exp $
 /* ######################################################################
 
    Version - Version string 
 /* ######################################################################
 
    Version - Version string 
@@ -212,32 +212,32 @@ bool pkgCheckDep(const char *DepVer,const char *PkgVer,int Op)
    int Res = pkgVersionCompare(PkgVer,DepVer);
    switch (Op & 0x0F)
    {
    int Res = pkgVersionCompare(PkgVer,DepVer);
    switch (Op & 0x0F)
    {
-      case pkgOP_LESSEQ:
+      case pkgCache::LessEq:
       if (Res <= 0)
         return true;
       break;
       
       if (Res <= 0)
         return true;
       break;
       
-      case pkgOP_GREATEREQ:
+      case pkgCache::GreaterEq:
       if (Res >= 0)
         return true;
       break;
       
       if (Res >= 0)
         return true;
       break;
       
-      case pkgOP_LESS:
+      case pkgCache::Less:
       if (Res < 0)
         return true;
       break;
       
       if (Res < 0)
         return true;
       break;
       
-      case pkgOP_GREATER:
+      case pkgCache::Greater:
       if (Res > 0)
         return true;
       break;
       
       if (Res > 0)
         return true;
       break;
       
-      case pkgOP_EQUALS:
+      case pkgCache::Equals:
       if (Res == 0)
         return true;
       break;
       
       if (Res == 0)
         return true;
       break;
       
-      case pkgOP_NOTEQUALS:
+      case pkgCache::NotEquals:
       if (Res != 0)
         return true;
       break;
       if (Res != 0)
         return true;
       break;