]> git.saurik.com Git - apt.git/commitdiff
WriteRequest according to current EDSP draft
authorDavid Kalnischkies <kalnischkies@gmail.com>
Thu, 31 Mar 2011 13:32:55 +0000 (15:32 +0200)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Thu, 31 Mar 2011 13:32:55 +0000 (15:32 +0200)
apt-pkg/edsp.cc
apt-pkg/edsp.h

index 1af5aed53cb153b5b9abe1a9841fcab5adb3ce7b..db0e2466cbdcce83219b529852a6683bad6ed9a0 100644 (file)
@@ -102,28 +102,38 @@ bool EDSP::WriteScenario(pkgDepCache &Cache, FILE* output)
 }
                                                                        /*}}}*/
 // EDSP::WriteRequest - to the given file descriptor                   /*{{{*/
-bool EDSP::WriteRequest(pkgDepCache &Cache, FILE* output)
+bool EDSP::WriteRequest(pkgDepCache &Cache, FILE* output, bool const Upgrade,
+                       bool const DistUpgrade, bool const AutoRemove)
 {
-   string del, inst, upgrade;
+   string del, inst;
    for (pkgCache::PkgIterator Pkg = Cache.PkgBegin(); Pkg.end() == false; ++Pkg)
    {
       string* req;
       if (Cache[Pkg].Delete() == true)
         req = &del;
-      else if (Cache[Pkg].NewInstall() == true)
+      else if (Cache[Pkg].NewInstall() == true || Cache[Pkg].Upgrade() == true)
         req = &inst;
-      else if (Cache[Pkg].Upgrade() == true)
-        req = &upgrade;
       else
         continue;
       req->append(", ").append(Pkg.FullName());
    }
+   fprintf(output, "Request: EDSP 0.2\n");
    if (del.empty() == false)
       fprintf(output, "Remove: %s\n", del.c_str()+2);
    if (inst.empty() == false)
       fprintf(output, "Install: %s\n", inst.c_str()+2);
-   if (upgrade.empty() == false)
-      fprintf(output, "Upgrade: %s\n", upgrade.c_str()+2);
+   if (Upgrade == true)
+      fprintf(output, "Upgrade: yes\n");
+   if (DistUpgrade == true)
+      fprintf(output, "Dist-Upgrade: yes\n");
+   if (AutoRemove == true)
+      fprintf(output, "Autoremove: yes\n");
+   if (_config->FindB("APT::Solver::Strict-Pinning", true) == false)
+      fprintf(output, "Strict-Pinning: no\n");
+   string solverpref("APT::Solver::");
+   solverpref.append(_config->Find("APT::Solver::Name", "internal")).append("::Preferences");
+   if (_config->Exists(solverpref) == false)
+      fprintf(output, "Preferences: %s\n", _config->Find(solverpref,"").c_str());
 
    return true;
 }
index ef137b8f608449f80c95c14b42c0a5a7958365c3..04d8c255f2c21ef76f3ca06bd8293e431325660a 100644 (file)
 class EDSP                                                             /*{{{*/
 {
 public:
-       bool static WriteRequest(pkgDepCache &Cache, FILE* output);
+       bool static WriteRequest(pkgDepCache &Cache, FILE* output,
+                                bool const Upgrade = false,
+                                bool const DistUpgrade = false,
+                                bool const AutoRemove = false);
        bool static WriteScenario(pkgDepCache &Cache, FILE* output);
        bool static ReadResponse(FILE* input, pkgDepCache &Cache);