]> git.saurik.com Git - apt.git/blob - apt-pkg/edsp/edsplistparser.cc
merged from lp:~donkult/apt/sid/
[apt.git] / apt-pkg / edsp / edsplistparser.cc
1 // -*- mode: cpp; mode: fold -*-
2 // Description /*{{{*/
3 /* ######################################################################
4
5 Package Cache Generator - Generator for the cache structure.
6
7 This builds the cache structure from the abstract package list parser.
8
9 ##################################################################### */
10 /*}}}*/
11 // Include Files /*{{{*/
12 #include <config.h>
13
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>
20 /*}}}*/
21
22 // ListParser::edspListParser - Constructor /*{{{*/
23 edspListParser::edspListParser(FileFd *File, std::string const &Arch) : debListParser(File, Arch)
24 {}
25 /*}}}*/
26 // ListParser::NewVersion - Fill in the version structure /*{{{*/
27 bool edspListParser::NewVersion(pkgCache::VerIterator &Ver)
28 {
29 Ver->ID = Section.FindI("APT-ID", Ver->ID);
30 return debListParser::NewVersion(Ver);
31 }
32 /*}}}*/
33 // ListParser::Description - Return the description string /*{{{*/
34 // ---------------------------------------------------------------------
35 /* Sorry, no description for the resolvers… */
36 std::string edspListParser::Description()
37 {
38 return "";
39 }
40 std::string edspListParser::DescriptionLanguage()
41 {
42 return "";
43 }
44 MD5SumValue edspListParser::Description_md5()
45 {
46 return MD5SumValue("");
47 }
48 /*}}}*/
49 // ListParser::VersionHash - Compute a unique hash for this version /*{{{*/
50 // ---------------------------------------------------------------------
51 /* */
52 unsigned short edspListParser::VersionHash()
53 {
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");
58 return 0;
59 }
60 /*}}}*/
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)
67 {
68 unsigned long state = 0;
69 if (Section.FindFlag("Hold",state,pkgCache::State::Hold) == false)
70 return false;
71 if (state != 0)
72 Pkg->SelectedState = pkgCache::State::Hold;
73
74 state = 0;
75 if (Section.FindFlag("Installed",state,pkgCache::State::Installed) == false)
76 return false;
77 if (state != 0)
78 {
79 Pkg->CurrentState = pkgCache::State::Installed;
80 Pkg->CurrentVer = Ver.Index();
81 }
82
83 return true;
84 }
85 /*}}}*/
86 // ListParser::LoadReleaseInfo - Load the release information /*{{{*/
87 bool edspListParser::LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,
88 FileFd &File, std::string component)
89 {
90 return true;
91 }
92 /*}}}*/