summaryrefslogtreecommitdiffstats
path: root/apt-pkg/edsp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 18:07:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 18:07:13 +0000
commit636c7dc17286d93d788c741d15fd756aeda066d5 (patch)
treee7ae158cc54f591041a061b9865bcae51854f15c /apt-pkg/edsp
parentInitial commit. (diff)
downloadapt-636c7dc17286d93d788c741d15fd756aeda066d5.tar.xz
apt-636c7dc17286d93d788c741d15fd756aeda066d5.zip
Adding upstream version 1.8.2.3.upstream/1.8.2.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'apt-pkg/edsp')
-rw-r--r--apt-pkg/edsp/edspindexfile.cc129
-rw-r--r--apt-pkg/edsp/edspindexfile.h62
-rw-r--r--apt-pkg/edsp/edsplistparser.cc178
-rw-r--r--apt-pkg/edsp/edsplistparser.h64
-rw-r--r--apt-pkg/edsp/edspsystem.cc166
-rw-r--r--apt-pkg/edsp/edspsystem.h67
6 files changed, 666 insertions, 0 deletions
diff --git a/apt-pkg/edsp/edspindexfile.cc b/apt-pkg/edsp/edspindexfile.cc
new file mode 100644
index 0000000..1a8af89
--- /dev/null
+++ b/apt-pkg/edsp/edspindexfile.cc
@@ -0,0 +1,129 @@
+// -*- mode: cpp; mode: fold -*-
+// Description /*{{{*/
+/* ######################################################################
+ The scenario file is designed to work as an intermediate file between
+ APT and the resolver. Its on propose very similar to a dpkg status file
+ ##################################################################### */
+ /*}}}*/
+// Include Files /*{{{*/
+#include <config.h>
+
+#include <apt-pkg/edspindexfile.h>
+#include <apt-pkg/edsplistparser.h>
+#include <apt-pkg/error.h>
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/indexfile.h>
+#include <apt-pkg/pkgcache.h>
+#include <apt-pkg/pkgrecords.h>
+
+#include <memory>
+#include <string>
+#include <stddef.h>
+#include <unistd.h>
+ /*}}}*/
+
+// EDSP-like Index /*{{{*/
+edspLikeIndex::edspLikeIndex(std::string const &File) : pkgDebianIndexRealFile(File, true)
+{
+}
+std::string edspLikeIndex::GetArchitecture() const
+{
+ return std::string();
+}
+bool edspLikeIndex::HasPackages() const
+{
+ return true;
+}
+bool edspLikeIndex::Exists() const
+{
+ return true;
+}
+uint8_t edspLikeIndex::GetIndexFlags() const
+{
+ return 0;
+}
+bool edspLikeIndex::OpenListFile(FileFd &Pkg, std::string const &FileName)
+{
+ if (FileName.empty() == false && FileName != "/nonexistent/stdin")
+ return pkgDebianIndexRealFile::OpenListFile(Pkg, FileName);
+ if (Pkg.OpenDescriptor(STDIN_FILENO, FileFd::ReadOnly) == false)
+ return _error->Error("Problem opening %s",FileName.c_str());
+ return true;
+}
+ /*}}}*/
+// EDSP Index /*{{{*/
+edspIndex::edspIndex(std::string const &File) : edspLikeIndex(File)
+{
+}
+std::string edspIndex::GetComponent() const
+{
+ return "edsp";
+}
+pkgCacheListParser * edspIndex::CreateListParser(FileFd &Pkg)
+{
+ if (Pkg.IsOpen() == false)
+ return nullptr;
+ _error->PushToStack();
+ std::unique_ptr<pkgCacheListParser> Parser(new edspListParser(&Pkg));
+ bool const newError = _error->PendingError();
+ _error->MergeWithStack();
+ return newError ? nullptr : Parser.release();
+}
+ /*}}}*/
+// EIPP Index /*{{{*/
+eippIndex::eippIndex(std::string const &File) : edspLikeIndex(File)
+{
+}
+std::string eippIndex::GetComponent() const
+{
+ return "eipp";
+}
+pkgCacheListParser * eippIndex::CreateListParser(FileFd &Pkg)
+{
+ if (Pkg.IsOpen() == false)
+ return nullptr;
+ _error->PushToStack();
+ std::unique_ptr<pkgCacheListParser> Parser(new eippListParser(&Pkg));
+ bool const newError = _error->PendingError();
+ _error->MergeWithStack();
+ return newError ? nullptr : Parser.release();
+}
+ /*}}}*/
+
+// Index File types for APT /*{{{*/
+class APT_HIDDEN edspIFType: public pkgIndexFile::Type
+{
+ public:
+ virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator const &) const APT_OVERRIDE
+ {
+ // we don't have a record parser for this type as the file is not presistent
+ return NULL;
+ };
+ edspIFType() {Label = "EDSP scenario file";};
+};
+APT_HIDDEN edspIFType _apt_Edsp;
+const pkgIndexFile::Type *edspIndex::GetType() const
+{
+ return &_apt_Edsp;
+}
+
+class APT_HIDDEN eippIFType: public pkgIndexFile::Type
+{
+ public:
+ virtual pkgRecords::Parser *CreatePkgParser(pkgCache::PkgFileIterator const &) const APT_OVERRIDE
+ {
+ // we don't have a record parser for this type as the file is not presistent
+ return NULL;
+ };
+ eippIFType() {Label = "EIPP scenario file";};
+};
+APT_HIDDEN eippIFType _apt_Eipp;
+const pkgIndexFile::Type *eippIndex::GetType() const
+{
+ return &_apt_Eipp;
+}
+ /*}}}*/
+
+edspLikeIndex::~edspLikeIndex() {}
+edspIndex::~edspIndex() {}
+eippIndex::~eippIndex() {}
diff --git a/apt-pkg/edsp/edspindexfile.h b/apt-pkg/edsp/edspindexfile.h
new file mode 100644
index 0000000..4ac0f9d
--- /dev/null
+++ b/apt-pkg/edsp/edspindexfile.h
@@ -0,0 +1,62 @@
+// -*- mode: cpp; mode: fold -*-
+// Description /*{{{*/
+/* ######################################################################
+ The scenario file is designed to work as an intermediate file between
+ APT and the resolver. Its on propose very similar to a dpkg status file
+ ##################################################################### */
+ /*}}}*/
+#ifndef PKGLIB_EDSPINDEXFILE_H
+#define PKGLIB_EDSPINDEXFILE_H
+
+#include <apt-pkg/debindexfile.h>
+#include <string>
+
+#ifndef APT_8_CLEANER_HEADERS
+#include <apt-pkg/indexfile.h>
+#endif
+
+class OpProgress;
+class pkgCacheGenerator;
+
+class APT_HIDDEN edspLikeIndex : public pkgDebianIndexRealFile
+{
+protected:
+ virtual bool OpenListFile(FileFd &Pkg, std::string const &File) APT_OVERRIDE;
+ virtual uint8_t GetIndexFlags() const APT_OVERRIDE;
+ virtual std::string GetArchitecture() const APT_OVERRIDE;
+
+public:
+ virtual bool Exists() const APT_OVERRIDE;
+ virtual bool HasPackages() const APT_OVERRIDE;
+
+ edspLikeIndex(std::string const &File);
+ virtual ~edspLikeIndex();
+};
+
+class APT_HIDDEN edspIndex : public edspLikeIndex
+{
+protected:
+ APT_HIDDEN virtual pkgCacheListParser * CreateListParser(FileFd &Pkg) APT_OVERRIDE;
+ virtual std::string GetComponent() const APT_OVERRIDE;
+
+public:
+ virtual const Type *GetType() const APT_OVERRIDE APT_PURE;
+
+ edspIndex(std::string const &File);
+ virtual ~edspIndex();
+};
+
+class APT_HIDDEN eippIndex : public edspLikeIndex
+{
+protected:
+ APT_HIDDEN virtual pkgCacheListParser * CreateListParser(FileFd &Pkg) APT_OVERRIDE;
+ virtual std::string GetComponent() const APT_OVERRIDE;
+
+public:
+ virtual const Type *GetType() const APT_OVERRIDE APT_PURE;
+
+ eippIndex(std::string const &File);
+ virtual ~eippIndex();
+};
+
+#endif
diff --git a/apt-pkg/edsp/edsplistparser.cc b/apt-pkg/edsp/edsplistparser.cc
new file mode 100644
index 0000000..31bded9
--- /dev/null
+++ b/apt-pkg/edsp/edsplistparser.cc
@@ -0,0 +1,178 @@
+// -*- 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 <config.h>
+
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/deblistparser.h>
+#include <apt-pkg/edsplistparser.h>
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/md5.h>
+#include <apt-pkg/pkgcache.h>
+#include <apt-pkg/pkgsystem.h>
+#include <apt-pkg/string_view.h>
+#include <apt-pkg/tagfile.h>
+
+#include <array>
+
+ /*}}}*/
+
+// ListParser::edspListParser - Constructor /*{{{*/
+edspLikeListParser::edspLikeListParser(FileFd * const File) : debListParser(File)
+{
+}
+edspListParser::edspListParser(FileFd * const File) : edspLikeListParser(File)
+{
+ 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::NewVersion - Fill in the version structure /*{{{*/
+bool edspLikeListParser::NewVersion(pkgCache::VerIterator &Ver)
+{
+ _system->SetVersionMapping(Ver->ID, Section.FindI("APT-ID", Ver->ID));
+ return debListParser::NewVersion(Ver);
+}
+ /*}}}*/
+// ListParser::Description - Return the description string /*{{{*/
+// ---------------------------------------------------------------------
+/* Sorry, no description for the resolvers… */
+std::vector<std::string> edspLikeListParser::AvailableDescriptionLanguages()
+{
+ return {};
+}
+APT::StringView edspLikeListParser::Description_md5()
+{
+ return APT::StringView();
+}
+ /*}}}*/
+// ListParser::VersionHash - Compute a unique hash for this version /*{{{*/
+unsigned short edspLikeListParser::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();
+ }
+
+ 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 (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 (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 (preferences.Write(out.c_str(), out.length()) == false)
+ return false;
+ }
+
+ return true;
+}
+ /*}}}*/
+
+// ListParser::eippListParser - Constructor /*{{{*/
+eippListParser::eippListParser(FileFd *File) : edspLikeListParser(File)
+{
+}
+ /*}}}*/
+// 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 eippListParser::ParseStatus(pkgCache::PkgIterator &Pkg,
+ pkgCache::VerIterator &Ver)
+{
+ // Process the flag field
+ static std::array<WordList, 8> const statusvalues = {{
+ {"not-installed",pkgCache::State::NotInstalled},
+ {"config-files",pkgCache::State::ConfigFiles},
+ {"half-installed",pkgCache::State::HalfInstalled},
+ {"unpacked",pkgCache::State::UnPacked},
+ {"half-configured",pkgCache::State::HalfConfigured},
+ {"triggers-awaited",pkgCache::State::TriggersAwaited},
+ {"triggers-pending",pkgCache::State::TriggersPending},
+ {"installed",pkgCache::State::Installed},
+ }};
+ auto const status = Section.Find("Status");
+ if (status.empty() == false)
+ {
+ for (auto && sv: statusvalues)
+ {
+ if (status != sv.Str)
+ continue;
+ Pkg->CurrentState = sv.Val;
+ switch (Pkg->CurrentState)
+ {
+ case pkgCache::State::NotInstalled:
+ case pkgCache::State::ConfigFiles:
+ break;
+ case pkgCache::State::HalfInstalled:
+ case pkgCache::State::UnPacked:
+ case pkgCache::State::HalfConfigured:
+ case pkgCache::State::TriggersAwaited:
+ case pkgCache::State::TriggersPending:
+ case pkgCache::State::Installed:
+ Pkg->CurrentVer = Ver.Index();
+ break;
+ }
+ break;
+ }
+ }
+
+ return true;
+}
+ /*}}}*/
+
+edspLikeListParser::~edspLikeListParser() {}
+edspListParser::~edspListParser() {}
+eippListParser::~eippListParser() {}
diff --git a/apt-pkg/edsp/edsplistparser.h b/apt-pkg/edsp/edsplistparser.h
new file mode 100644
index 0000000..59c759f
--- /dev/null
+++ b/apt-pkg/edsp/edsplistparser.h
@@ -0,0 +1,64 @@
+// -*- mode: cpp; mode: fold -*-
+// Description /*{{{*/
+/* ######################################################################
+
+ EDSP Package List Parser - This implements the abstract parser
+ interface for the APT specific intermediate format which is passed
+ to external resolvers
+
+ ##################################################################### */
+ /*}}}*/
+#ifndef PKGLIB_EDSPLISTPARSER_H
+#define PKGLIB_EDSPLISTPARSER_H
+
+#include <apt-pkg/deblistparser.h>
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/md5.h>
+#include <apt-pkg/pkgcache.h>
+
+#include <string>
+
+#ifndef APT_8_CLEANER_HEADERS
+#include <apt-pkg/indexfile.h>
+#include <apt-pkg/pkgcachegen.h>
+#include <apt-pkg/tagfile.h>
+#endif
+
+namespace APT {
+ class StringView;
+}
+class APT_HIDDEN edspLikeListParser : public debListParser
+{
+ public:
+ virtual bool NewVersion(pkgCache::VerIterator &Ver) APT_OVERRIDE;
+ virtual std::vector<std::string> AvailableDescriptionLanguages() APT_OVERRIDE;
+ virtual APT::StringView Description_md5() APT_OVERRIDE;
+ virtual unsigned short VersionHash() APT_OVERRIDE;
+
+ edspLikeListParser(FileFd *File);
+ virtual ~edspLikeListParser();
+};
+
+class APT_HIDDEN edspListParser : public edspLikeListParser
+{
+ FileFd extendedstates;
+ FileFd preferences;
+
+protected:
+ virtual bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver) APT_OVERRIDE;
+
+public:
+ edspListParser(FileFd *File);
+ virtual ~edspListParser();
+};
+
+class APT_HIDDEN eippListParser : public edspLikeListParser
+{
+protected:
+ virtual bool ParseStatus(pkgCache::PkgIterator &Pkg,pkgCache::VerIterator &Ver) APT_OVERRIDE;
+
+public:
+ eippListParser(FileFd *File);
+ virtual ~eippListParser();
+};
+#endif
diff --git a/apt-pkg/edsp/edspsystem.cc b/apt-pkg/edsp/edspsystem.cc
new file mode 100644
index 0000000..47f5e06
--- /dev/null
+++ b/apt-pkg/edsp/edspsystem.cc
@@ -0,0 +1,166 @@
+// -*- mode: cpp; mode: fold -*-
+// Description /*{{{*/
+/* ######################################################################
+
+ This system provides the abstraction to use the scenario file as the
+ only source of package information to be able to feed the created file
+ back to APT for its own consumption (eat your own dogfood).
+
+ ##################################################################### */
+ /*}}}*/
+// Include Files /*{{{*/
+#include <config.h>
+
+#include <apt-pkg/configuration.h>
+#include <apt-pkg/debversion.h>
+#include <apt-pkg/edspindexfile.h>
+#include <apt-pkg/edspsystem.h>
+#include <apt-pkg/fileutl.h>
+#include <apt-pkg/pkgcache.h>
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <string>
+#include <vector>
+
+ /*}}}*/
+
+// System::System - Constructor /*{{{*/
+edspLikeSystem::edspLikeSystem(char const * const Label) : pkgSystem(Label, &debVS)
+{
+}
+edspSystem::edspSystem() : edspLikeSystem("Debian APT solver interface")
+{
+}
+eippSystem::eippSystem() : edspLikeSystem("Debian APT planner interface")
+{
+}
+ /*}}}*/
+// System::Lock - Get the lock /*{{{*/
+bool edspLikeSystem::Lock()
+{
+ return true;
+}
+ /*}}}*/
+// System::UnLock - Drop a lock /*{{{*/
+bool edspLikeSystem::UnLock(bool /*NoErrors*/)
+{
+ return true;
+}
+ /*}}}*/
+// System::CreatePM - Create the underlying package manager /*{{{*/
+// ---------------------------------------------------------------------
+/* we can't use edsp input as input for real installations - just a
+ simulation can work, but everything else will fail bigtime */
+pkgPackageManager *edspLikeSystem::CreatePM(pkgDepCache * /*Cache*/) const
+{
+ return nullptr;
+}
+ /*}}}*/
+// System::Initialize - Setup the configuration space.. /*{{{*/
+bool edspLikeSystem::Initialize(Configuration &Cnf)
+{
+ Cnf.Set("Dir::Log", "/dev/null");
+ // state is included completely in the input files
+ Cnf.Set("Dir::Etc::preferences", "/dev/null");
+ Cnf.Set("Dir::Etc::preferencesparts", "/dev/null");
+ Cnf.Set("Dir::State::status","/dev/null");
+ Cnf.Set("Dir::State::extended_states","/dev/null");
+ Cnf.Set("Dir::State::lists","/dev/null");
+ // do not store an mmap cache
+ Cnf.Set("Dir::Cache::pkgcache", "");
+ Cnf.Set("Dir::Cache::srcpkgcache", "");
+ // the protocols only propose actions, not do them
+ Cnf.Set("Debug::NoLocking", "true");
+ Cnf.Set("APT::Get::Simulate", "true");
+
+ StatusFile.reset(nullptr);
+ return true;
+}
+bool edspSystem::Initialize(Configuration &Cnf)
+{
+ if (edspLikeSystem::Initialize(Cnf) == false)
+ return false;
+ std::string const tmp = GetTempDir();
+ char tmpname[300];
+ snprintf(tmpname, sizeof(tmpname), "%s/apt-edsp-solver-XXXXXX", tmp.c_str());
+ if (nullptr == mkdtemp(tmpname))
+ return false;
+ tempDir = tmpname;
+ tempStatesFile = flCombine(tempDir, "extended_states");
+ Cnf.Set("Dir::State::extended_states", tempStatesFile);
+ tempPrefsFile = flCombine(tempDir, "apt_preferences");
+ Cnf.Set("Dir::Etc::preferences", tempPrefsFile);
+ return true;
+}
+ /*}}}*/
+// System::ArchiveSupported - Is a file format supported /*{{{*/
+bool edspLikeSystem::ArchiveSupported(const char * /*Type*/)
+{
+ return false;
+}
+ /*}}}*/
+// System::Score - Never use the EDSP system automatically /*{{{*/
+signed edspLikeSystem::Score(Configuration const &)
+{
+ return -1000;
+}
+ /*}}}*/
+// System::FindIndex - Get an index file for status files /*{{{*/
+bool edspLikeSystem::FindIndex(pkgCache::PkgFileIterator File,
+ pkgIndexFile *&Found) const
+{
+ if (StatusFile == 0)
+ return false;
+ if (StatusFile->FindInCache(*File.Cache()) == File)
+ {
+ Found = StatusFile.get();
+ return true;
+ }
+
+ return false;
+}
+ /*}}}*/
+bool edspSystem::AddStatusFiles(std::vector<pkgIndexFile *> &List) /*{{{*/
+{
+ if (StatusFile == nullptr)
+ {
+ if (_config->Find("edsp::scenario", "") == "/nonexistent/stdin")
+ StatusFile.reset(new edspIndex("/nonexistent/stdin"));
+ else
+ StatusFile.reset(new edspIndex(_config->FindFile("edsp::scenario")));
+ }
+ List.push_back(StatusFile.get());
+ return true;
+}
+ /*}}}*/
+bool eippSystem::AddStatusFiles(std::vector<pkgIndexFile *> &List) /*{{{*/
+{
+ if (StatusFile == nullptr)
+ {
+ if (_config->Find("eipp::scenario", "") == "/nonexistent/stdin")
+ StatusFile.reset(new eippIndex("/nonexistent/stdin"));
+ else
+ StatusFile.reset(new eippIndex(_config->FindFile("eipp::scenario")));
+ }
+ List.push_back(StatusFile.get());
+ return true;
+}
+ /*}}}*/
+
+edspLikeSystem::~edspLikeSystem() {}
+edspSystem::~edspSystem()
+{
+ if (tempDir.empty())
+ return;
+
+ RemoveFile("~edspSystem", tempStatesFile);
+ RemoveFile("~edspSystem", tempPrefsFile);
+ rmdir(tempDir.c_str());
+}
+eippSystem::~eippSystem() {}
+
+APT_HIDDEN edspSystem edspSys;
+APT_HIDDEN eippSystem eippSys;
diff --git a/apt-pkg/edsp/edspsystem.h b/apt-pkg/edsp/edspsystem.h
new file mode 100644
index 0000000..0855bb5
--- /dev/null
+++ b/apt-pkg/edsp/edspsystem.h
@@ -0,0 +1,67 @@
+// -*- mode: cpp; mode: fold -*-
+// Description /*{{{*/
+/* ######################################################################
+
+ System - Debian version of the System Class
+
+ ##################################################################### */
+ /*}}}*/
+#ifndef PKGLIB_EDSPSYSTEM_H
+#define PKGLIB_EDSPSYSTEM_H
+
+#include <apt-pkg/pkgcache.h>
+#include <apt-pkg/pkgsystem.h>
+
+#include <memory>
+#include <vector>
+
+#include <apt-pkg/macros.h>
+
+class Configuration;
+class pkgDepCache;
+class pkgIndexFile;
+class pkgPackageManager;
+
+class APT_HIDDEN edspLikeSystem : public pkgSystem
+{
+protected:
+ std::unique_ptr<pkgIndexFile> StatusFile;
+
+public:
+ virtual bool Lock() APT_OVERRIDE APT_PURE;
+ virtual bool UnLock(bool NoErrors = false) APT_OVERRIDE APT_PURE;
+ virtual pkgPackageManager *CreatePM(pkgDepCache *Cache) const APT_OVERRIDE APT_PURE;
+ virtual bool Initialize(Configuration &Cnf) APT_OVERRIDE;
+ virtual bool ArchiveSupported(const char *Type) APT_OVERRIDE APT_PURE;
+ virtual signed Score(Configuration const &Cnf) APT_OVERRIDE;
+ virtual bool FindIndex(pkgCache::PkgFileIterator File,
+ pkgIndexFile *&Found) const APT_OVERRIDE;
+
+ edspLikeSystem(char const * const Label);
+ virtual ~edspLikeSystem();
+};
+
+class APT_HIDDEN edspSystem : public edspLikeSystem
+{
+ std::string tempDir;
+ std::string tempStatesFile;
+ std::string tempPrefsFile;
+
+public:
+ virtual bool Initialize(Configuration &Cnf) APT_OVERRIDE;
+ virtual bool AddStatusFiles(std::vector<pkgIndexFile *> &List) APT_OVERRIDE;
+
+ edspSystem();
+ virtual ~edspSystem();
+};
+
+class APT_HIDDEN eippSystem : public edspLikeSystem
+{
+ public:
+ virtual bool AddStatusFiles(std::vector<pkgIndexFile *> &List) APT_OVERRIDE;
+
+ eippSystem();
+ virtual ~eippSystem();
+};
+
+#endif