* doc/external-dependency-solver-protocol.txt:
[ntk/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 <apt-pkg/edsplistparser.h>
13 #include <apt-pkg/error.h>
14 #include <apt-pkg/configuration.h>
15 #include <apt-pkg/strutl.h>
16 #include <apt-pkg/md5.h>
17 #include <apt-pkg/macros.h>
18 /*}}}*/
19
20 // ListParser::edspListParser - Constructor /*{{{*/
21 edspListParser::edspListParser(FileFd *File, string const &Arch) : debListParser(File, Arch)
22 {}
23 /*}}}*/
24 // ListParser::NewVersion - Fill in the version structure /*{{{*/
25 bool edspListParser::NewVersion(pkgCache::VerIterator &Ver)
26 {
27 Ver->ID = Section.FindI("APT-ID", Ver->ID);
28 return debListParser::NewVersion(Ver);
29 }
30 /*}}}*/
31 // ListParser::Description - Return the description string /*{{{*/
32 // ---------------------------------------------------------------------
33 /* Sorry, no description for the resolvers… */
34 string edspListParser::Description()
35 {
36 return "";
37 }
38 string edspListParser::DescriptionLanguage()
39 {
40 return "";
41 }
42 MD5SumValue edspListParser::Description_md5()
43 {
44 return MD5SumValue("");
45 }
46 /*}}}*/
47 // ListParser::VersionHash - Compute a unique hash for this version /*{{{*/
48 // ---------------------------------------------------------------------
49 /* */
50 unsigned short edspListParser::VersionHash()
51 {
52 if (Section.Exists("APT-Hash") == true)
53 return Section.FindI("APT-Hash");
54 else if (Section.Exists("APT-ID") == true)
55 return Section.FindI("APT-ID");
56 return 0;
57 }
58 /*}}}*/
59 // ListParser::ParseStatus - Parse the status field /*{{{*/
60 // ---------------------------------------------------------------------
61 /* The Status: line here is not a normal dpkg one but just one which tells
62 use if the package is installed or not, where missing means not. */
63 bool edspListParser::ParseStatus(pkgCache::PkgIterator &Pkg,
64 pkgCache::VerIterator &Ver)
65 {
66 unsigned long state = 0;
67 if (Section.FindFlag("Hold",state,pkgCache::State::Hold) == false)
68 return false;
69 if (state != 0)
70 Pkg->SelectedState = pkgCache::State::Hold;
71
72 state = 0;
73 if (Section.FindFlag("Installed",state,pkgCache::State::Installed) == false)
74 return false;
75 if (state != 0)
76 {
77 Pkg->CurrentState = pkgCache::State::Installed;
78 Pkg->CurrentVer = Ver.Index();
79 }
80
81 return true;
82 }
83 /*}}}*/
84 // ListParser::LoadReleaseInfo - Load the release information /*{{{*/
85 bool edspListParser::LoadReleaseInfo(pkgCache::PkgFileIterator &FileI,
86 FileFd &File, string component)
87 {
88 return true;
89 }
90 /*}}}*/