X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/7f8c0eed6983db7b8959f1498fc8bc80c98d719e..732510fef9af5addc5e3ff1a79ce8c9658711fb6:/apt-pkg/edsp/edsplistparser.cc diff --git a/apt-pkg/edsp/edsplistparser.cc b/apt-pkg/edsp/edsplistparser.cc index a54a46b1e..82799205e 100644 --- a/apt-pkg/edsp/edsplistparser.cc +++ b/apt-pkg/edsp/edsplistparser.cc @@ -11,19 +11,38 @@ // Include Files /*{{{*/ #include +#include #include #include #include #include #include #include +#include -#include /*}}}*/ +class edspListParserPrivate /*{{{*/ +{ +public: + FileFd extendedstates; + FileFd preferences; + + edspListParserPrivate() + { + std::string const states = _config->FindFile("Dir::State::extended_states"); + RemoveFile("edspListParserPrivate", states); + extendedstates.Open(states, FileFd::WriteOnly | FileFd::Create | FileFd::Exclusive, 0600); + std::string const prefs = _config->FindFile("Dir::Etc::preferences"); + RemoveFile("edspListParserPrivate", prefs); + preferences.Open(prefs, FileFd::WriteOnly | FileFd::Create | FileFd::Exclusive, 0600); + } +}; + /*}}}*/ // ListParser::edspListParser - Constructor /*{{{*/ -edspListParser::edspListParser(FileFd *File) : debListParser(File), d(NULL) -{} +edspListParser::edspListParser(FileFd *File) : debListParser(File), d(new edspListParserPrivate()) +{ +} /*}}}*/ // ListParser::NewVersion - Fill in the version structure /*{{{*/ bool edspListParser::NewVersion(pkgCache::VerIterator &Ver) @@ -35,13 +54,9 @@ bool edspListParser::NewVersion(pkgCache::VerIterator &Ver) // ListParser::Description - Return the description string /*{{{*/ // --------------------------------------------------------------------- /* Sorry, no description for the resolvers… */ -std::string edspListParser::Description() -{ - return ""; -} -std::string edspListParser::DescriptionLanguage() +std::vector edspListParser::AvailableDescriptionLanguages() { - return ""; + return {}; } MD5SumValue edspListParser::Description_md5() { @@ -82,6 +97,32 @@ bool edspListParser::ParseStatus(pkgCache::PkgIterator &Pkg, Pkg->CurrentVer = Ver.Index(); } + if (Section.FindB("APT-Automatic", false)) + { + std::string out; + strprintf(out, "Package: %s\nArchitecture: %s\nAuto-Installed: 1\n\n", Pkg.Name(), Pkg.Arch()); + if (d->extendedstates.Write(out.c_str(), out.length()) == false) + return false; + } + + // FIXME: Using an overriding pin is wrong. + if (Section.FindB("APT-Candidate", false)) + { + std::string out; + strprintf(out, "Package: %s\nPin: version %s\nPin-Priority: 9999\n\n", Pkg.FullName().c_str(), Ver.VerStr()); + if (d->preferences.Write(out.c_str(), out.length()) == false) + return false; + } + + signed short const pinvalue = Section.FindI("APT-Pin", 500); + if (pinvalue != 500) + { + std::string out; + strprintf(out, "Package: %s\nPin: version %s\nPin-Priority: %d\n\n", Pkg.FullName().c_str(), Ver.VerStr(), pinvalue); + if (d->preferences.Write(out.c_str(), out.length()) == false) + return false; + } + return true; } /*}}}*/ @@ -92,5 +133,8 @@ APT_CONST bool edspListParser::LoadReleaseInfo(pkgCache::RlsFileIterator & /*Fil return true; } /*}}}*/ - -edspListParser::~edspListParser() {} +edspListParser::~edspListParser() /*{{{*/ +{ + delete d; +} + /*}}}*/