]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/deb/deblistparser.cc
implement PDiff patching for compressed files
[apt.git] / apt-pkg / deb / deblistparser.cc
index cb2b1566845ab2fbb0d5b2297158d598e3351bbc..d88e25e6fbd10d469528d0012e446f977e9d77a6 100644 (file)
 #include <apt-pkg/cachefilter.h>
 #include <apt-pkg/aptconfiguration.h>
 #include <apt-pkg/strutl.h>
 #include <apt-pkg/cachefilter.h>
 #include <apt-pkg/aptconfiguration.h>
 #include <apt-pkg/strutl.h>
-#include <apt-pkg/fileutl.h>
 #include <apt-pkg/crc-16.h>
 #include <apt-pkg/md5.h>
 #include <apt-pkg/crc-16.h>
 #include <apt-pkg/md5.h>
-#include <apt-pkg/mmap.h>
 #include <apt-pkg/pkgcache.h>
 #include <apt-pkg/cacheiterators.h>
 #include <apt-pkg/tagfile.h>
 #include <apt-pkg/pkgcache.h>
 #include <apt-pkg/cacheiterators.h>
 #include <apt-pkg/tagfile.h>
@@ -50,13 +48,9 @@ static debListParser::WordList PrioList[] = {
 /* Provide an architecture and only this one and "all" will be accepted
    in Step(), if no Architecture is given we will accept every arch
    we would accept in general with checkArchitecture() */
 /* Provide an architecture and only this one and "all" will be accepted
    in Step(), if no Architecture is given we will accept every arch
    we would accept in general with checkArchitecture() */
-debListParser::debListParser(FileFd *File, string const &Arch) :
-   pkgCacheListParser(), d(NULL), Tags(File), Arch(Arch)
+debListParser::debListParser(FileFd *File) :
+   pkgCacheListParser(), d(NULL), Tags(File)
 {
 {
-   if (Arch == "native")
-      this->Arch = _config->Find("APT::Architecture");
-   Architectures = APT::Configuration::getArchitectures();
-   MultiArchEnabled = Architectures.size() > 1;
 }
                                                                        /*}}}*/
 // ListParser::Package - Return the package name                       /*{{{*/
 }
                                                                        /*}}}*/
 // ListParser::Package - Return the package name                       /*{{{*/
@@ -73,7 +67,8 @@ string debListParser::Package() {
 // ---------------------------------------------------------------------
 /* This will return the Architecture of the package this section describes */
 string debListParser::Architecture() {
 // ---------------------------------------------------------------------
 /* This will return the Architecture of the package this section describes */
 string debListParser::Architecture() {
-   return Section.FindS("Architecture");
+   std::string const Arch = Section.FindS("Architecture");
+   return Arch.empty() ? "none" : Arch;
 }
                                                                        /*}}}*/
 // ListParser::ArchitectureAll                                         /*{{{*/
 }
                                                                        /*}}}*/
 // ListParser::ArchitectureAll                                         /*{{{*/
@@ -98,14 +93,14 @@ unsigned char debListParser::ParseMultiArch(bool const showErrors)  /*{{{*/
    unsigned char MA;
    string const MultiArch = Section.FindS("Multi-Arch");
    if (MultiArch.empty() == true || MultiArch == "no")
    unsigned char MA;
    string const MultiArch = Section.FindS("Multi-Arch");
    if (MultiArch.empty() == true || MultiArch == "no")
-      MA = pkgCache::Version::None;
+      MA = pkgCache::Version::No;
    else if (MultiArch == "same") {
       if (ArchitectureAll() == true)
       {
         if (showErrors == true)
            _error->Warning("Architecture: all package '%s' can't be Multi-Arch: same",
                  Section.FindS("Package").c_str());
    else if (MultiArch == "same") {
       if (ArchitectureAll() == true)
       {
         if (showErrors == true)
            _error->Warning("Architecture: all package '%s' can't be Multi-Arch: same",
                  Section.FindS("Package").c_str());
-        MA = pkgCache::Version::None;
+        MA = pkgCache::Version::No;
       }
       else
         MA = pkgCache::Version::Same;
       }
       else
         MA = pkgCache::Version::Same;
@@ -119,7 +114,7 @@ unsigned char debListParser::ParseMultiArch(bool const showErrors)  /*{{{*/
       if (showErrors == true)
         _error->Warning("Unknown Multi-Arch type '%s' for package '%s'",
               MultiArch.c_str(), Section.FindS("Package").c_str());
       if (showErrors == true)
         _error->Warning("Unknown Multi-Arch type '%s' for package '%s'",
               MultiArch.c_str(), Section.FindS("Package").c_str());
-      MA = pkgCache::Version::None;
+      MA = pkgCache::Version::No;
    }
 
    if (ArchitectureAll() == true)
    }
 
    if (ArchitectureAll() == true)
@@ -367,7 +362,7 @@ unsigned short debListParser::VersionHash()
    return Result;
 }
                                                                        /*}}}*/
    return Result;
 }
                                                                        /*}}}*/
-// ListParser::ParseStatus - Parse the status field                    /*{{{*/
+// StatusListParser::ParseStatus - Parse the status field              /*{{{*/
 // ---------------------------------------------------------------------
 /* Status lines are of the form,
      Status: want flag status
 // ---------------------------------------------------------------------
 /* Status lines are of the form,
      Status: want flag status
@@ -378,6 +373,11 @@ unsigned short debListParser::VersionHash()
  */
 bool debListParser::ParseStatus(pkgCache::PkgIterator &Pkg,
                                pkgCache::VerIterator &Ver)
  */
 bool debListParser::ParseStatus(pkgCache::PkgIterator &Pkg,
                                pkgCache::VerIterator &Ver)
+{
+   return true;
+}
+bool debStatusListParser::ParseStatus(pkgCache::PkgIterator &Pkg,
+                               pkgCache::VerIterator &Ver)
 {
    const char *Start;
    const char *Stop;
 {
    const char *Start;
    const char *Stop;
@@ -887,34 +887,7 @@ bool debListParser::GrabWord(string Word,WordList *List,unsigned char &Out)
 bool debListParser::Step()
 {
    iOffset = Tags.Offset();
 bool debListParser::Step()
 {
    iOffset = Tags.Offset();
-   while (Tags.Step(Section) == true)
-   {      
-      /* 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 */
-      string const Architecture = Section.FindS("Architecture");
-
-      if (Arch.empty() == true || Arch == "any" || MultiArchEnabled == false)
-      {
-        if (APT::Configuration::checkArchitecture(Architecture) == true)
-           return true;
-        /* parse version stanzas without an architecture only in the status file
-           (and as misfortune bycatch flat-archives) */
-        if ((Arch.empty() == true || Arch == "any") && Architecture.empty() == true)
-           return true;
-      }
-      else
-      {
-        if (Architecture == Arch)
-           return true;
-
-        if (Architecture == "all" && Arch == _config->Find("APT::Architecture"))
-           return true;
-      }
-
-      iOffset = Tags.Offset();
-   }   
-   return false;
+   return Tags.Step(Section);
 }
                                                                        /*}}}*/
 // ListParser::GetPrio - Convert the priority from a string            /*{{{*/
 }
                                                                        /*}}}*/
 // ListParser::GetPrio - Convert the priority from a string            /*{{{*/
@@ -950,7 +923,7 @@ bool debListParser::SameVersion(unsigned short const Hash,          /*{{{*/
                                                                        /*}}}*/
 
 debDebFileParser::debDebFileParser(FileFd *File, std::string const &DebFile)
                                                                        /*}}}*/
 
 debDebFileParser::debDebFileParser(FileFd *File, std::string const &DebFile)
-   : debListParser(File, ""), DebFile(DebFile)
+   : debListParser(File), DebFile(DebFile)
 {
 }
 
 {
 }