]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/edsp/edsplistparser.cc
Release 1.4~beta1
[apt.git] / apt-pkg / edsp / edsplistparser.cc
index 39a6e8a6e6650843f8e63e14c850d31274c8bb55..4119639a6e4cb4673a97fa577e94a874e031da13 100644 (file)
@@ -20,6 +20,9 @@
 #include <apt-pkg/tagfile.h>
 #include <apt-pkg/fileutl.h>
 #include <apt-pkg/pkgsystem.h>
+#include <apt-pkg/string_view.h>
+
+#include <array>
 
                                                                        /*}}}*/
 
@@ -51,9 +54,9 @@ std::vector<std::string> edspLikeListParser::AvailableDescriptionLanguages()
 {
    return {};
 }
-MD5SumValue edspLikeListParser::Description_md5()
+APT::StringView edspLikeListParser::Description_md5()
 {
-   return MD5SumValue("");
+   return APT::StringView();
 }
                                                                        /*}}}*/
 // ListParser::VersionHash - Compute a unique hash for this version    /*{{{*/
@@ -125,5 +128,59 @@ bool edspListParser::ParseStatus(pkgCache::PkgIterator &Pkg,
 }
                                                                        /*}}}*/
 
+// 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() {}