]>
git.saurik.com Git - apt.git/blob - apt-pkg/edsp/edsplistparser.cc
   1 // -*- mode: cpp; mode: fold -*- 
   3 /* ###################################################################### 
   5    Package Cache Generator - Generator for the cache structure. 
   7    This builds the cache structure from the abstract package list parser. 
   9    ##################################################################### */ 
  11 // Include Files                                                        /*{{{*/ 
  14 #include <apt-pkg/edsplistparser.h> 
  15 #include <apt-pkg/error.h> 
  16 #include <apt-pkg/configuration.h> 
  17 #include <apt-pkg/strutl.h> 
  18 #include <apt-pkg/md5.h> 
  19 #include <apt-pkg/macros.h> 
  22 // ListParser::edspListParser - Constructor                             /*{{{*/ 
  23 edspListParser::edspListParser(FileFd 
*File
, std::string 
const &Arch
) : debListParser(File
, Arch
) 
  26 // ListParser::NewVersion - Fill in the version structure               /*{{{*/ 
  27 bool edspListParser::NewVersion(pkgCache::VerIterator 
&Ver
) 
  29    Ver
->ID 
= Section
.FindI("APT-ID", Ver
->ID
); 
  30    return debListParser::NewVersion(Ver
); 
  33 // ListParser::Description - Return the description string              /*{{{*/ 
  34 // --------------------------------------------------------------------- 
  35 /* Sorry, no description for the resolvers… */ 
  36 std::string 
edspListParser::Description() 
  40 std::string 
edspListParser::DescriptionLanguage() 
  44 MD5SumValue 
edspListParser::Description_md5() 
  46    return MD5SumValue(""); 
  49 // ListParser::VersionHash - Compute a unique hash for this version     /*{{{*/ 
  50 // --------------------------------------------------------------------- 
  52 unsigned short edspListParser::VersionHash() 
  54    if (Section
.Exists("APT-Hash") == true) 
  55       return Section
.FindI("APT-Hash"); 
  56    else if (Section
.Exists("APT-ID") == true) 
  57       return Section
.FindI("APT-ID"); 
  61 // ListParser::ParseStatus - Parse the status field                     /*{{{*/ 
  62 // --------------------------------------------------------------------- 
  63 /* The Status: line here is not a normal dpkg one but just one which tells 
  64    use if the package is installed or not, where missing means not. */ 
  65 bool edspListParser::ParseStatus(pkgCache::PkgIterator 
&Pkg
, 
  66                                 pkgCache::VerIterator 
&Ver
) 
  68    unsigned long state 
= 0; 
  69    if (Section
.FindFlag("Hold",state
,pkgCache::State::Hold
) == false) 
  72       Pkg
->SelectedState 
= pkgCache::State::Hold
; 
  75    if (Section
.FindFlag("Installed",state
,pkgCache::State::Installed
) == false) 
  79       Pkg
->CurrentState 
= pkgCache::State::Installed
; 
  80       Pkg
->CurrentVer 
= Ver
.Index(); 
  86 // ListParser::LoadReleaseInfo - Load the release information           /*{{{*/ 
  87 bool edspListParser::LoadReleaseInfo(pkgCache::PkgFileIterator 
&FileI
, 
  88                                     FileFd 
&File
, std::string component
)