diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2011-05-17 17:26:59 +0200 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2011-05-17 17:26:59 +0200 |
commit | 2b82aa5553eef0cd16b5803047a6b60450bee92f (patch) | |
tree | 1c82ccc9c9ab5d5f0ec892af1193f5d69f8e61ec /apt-pkg/edsp/edsplistparser.cc | |
parent | 470a5c38519989313514ebaec6920aafee53d798 (diff) | |
parent | 27c69dd0b36e3da7b6061e597d755f5a60a0d31b (diff) |
* Implement EDSP in libapt-pkg so that all front-ends which
use the internal resolver can now be used also with external
ones as the usage is hidden in between the old API
* provide two edsp solvers in apt-utils:
- 'dump' to quickly output a complete scenario and
- 'apt' to use the internal as an external resolver
Diffstat (limited to 'apt-pkg/edsp/edsplistparser.cc')
-rw-r--r-- | apt-pkg/edsp/edsplistparser.cc | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/apt-pkg/edsp/edsplistparser.cc b/apt-pkg/edsp/edsplistparser.cc new file mode 100644 index 000000000..3349e8cce --- /dev/null +++ b/apt-pkg/edsp/edsplistparser.cc @@ -0,0 +1,90 @@ +// -*- mode: cpp; mode: fold -*- +// Description /*{{{*/ +/* ###################################################################### + + Package Cache Generator - Generator for the cache structure. + + This builds the cache structure from the abstract package list parser. + + ##################################################################### */ + /*}}}*/ +// Include Files /*{{{*/ +#include <apt-pkg/edsplistparser.h> +#include <apt-pkg/error.h> +#include <apt-pkg/configuration.h> +#include <apt-pkg/strutl.h> +#include <apt-pkg/md5.h> +#include <apt-pkg/macros.h> + /*}}}*/ + +// ListParser::edspListParser - Constructor /*{{{*/ +edspListParser::edspListParser(FileFd *File, string const &Arch) : debListParser(File, Arch) +{} + /*}}}*/ +// ListParser::NewVersion - Fill in the version structure /*{{{*/ +bool edspListParser::NewVersion(pkgCache::VerIterator &Ver) +{ + Ver->ID = Section.FindI("APT-ID", Ver->ID); + return debListParser::NewVersion(Ver); +} + /*}}}*/ +// ListParser::Description - Return the description string /*{{{*/ +// --------------------------------------------------------------------- +/* Sorry, no description for the resolvers… */ +string edspListParser::Description() +{ + return ""; +} +string edspListParser::DescriptionLanguage() +{ + return ""; +} +MD5SumValue edspListParser::Description_md5() +{ + return MD5SumValue(""); +} + /*}}}*/ +// ListParser::VersionHash - Compute a unique hash for this version /*{{{*/ +// --------------------------------------------------------------------- +/* */ +unsigned short edspListParser::VersionHash() +{ + if (Section.Exists("APT-Hash") == true) + return Section.FindI("APT-Hash"); + else if (Section.Exists("APT-ID") == true) + return Section.FindI("APT-ID"); + return 0; +} + /*}}}*/ +// ListParser::ParseStatus - Parse the status field /*{{{*/ +// --------------------------------------------------------------------- +/* The Status: line here is not a normal dpkg one but just one which tells + use if the package is installed or not, where missing means not. */ +bool edspListParser::ParseStatus(pkgCache::PkgIterator &Pkg, + pkgCache::VerIterator &Ver) +{ + unsigned long state = 0; + if (Section.FindFlag("Hold",state,pkgCache::State::Hold) == false) + return false; + if (state != 0) + Pkg->SelectedState = pkgCache::State::Hold; + + state = 0; + if (Section.FindFlag("Installed",state,pkgCache::State::Installed) == false) + return false; + if (state != 0) + { + Pkg->CurrentState = pkgCache::State::Installed; + Pkg->CurrentVer = Ver.Index(); + } + + return true; +} + /*}}}*/ +// ListParser::LoadReleaseInfo - Load the release information /*{{{*/ +bool edspListParser::LoadReleaseInfo(pkgCache::PkgFileIterator &FileI, + FileFd &File, string component) +{ + return true; +} + /*}}}*/ |