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