]> git.saurik.com Git - apt.git/commitdiff
be able to write solutions, too
authorDavid Kalnischkies <kalnischkies@gmail.com>
Wed, 30 Mar 2011 20:15:40 +0000 (22:15 +0200)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Wed, 30 Mar 2011 20:15:40 +0000 (22:15 +0200)
apt-pkg/algorithms.cc
apt-pkg/edsp/edspwriter.cc
apt-pkg/edsp/edspwriter.h

index 2ca3404a08c3b5469978f58485aa83beb8dc1d6d..35752a5c43f584ebf57b20bdc7b64cbb02870bf9 100644 (file)
@@ -748,6 +748,12 @@ bool pkgProblemResolver::Resolve(bool BrokenFix)
       output = fopen("/tmp/request.log", "w");
       edspWriter::WriteRequest(Cache, output);
       fclose(output);
+      if (ResolveInternal(BrokenFix) == false)
+        return false;
+      output = fopen("/tmp/solution.log", "w");
+      edspWriter::WriteSolution(Cache, output);
+      fclose(output);
+      return true;
    }
    return ResolveInternal(BrokenFix);
 }
index 38d0d82c5e0c6777b982590f69bf7c8539672140..ea46065c298dc4ec8f73ad404350a0391925b777 100644 (file)
@@ -125,6 +125,26 @@ bool edspWriter::WriteRequest(pkgDepCache &Cache, FILE* output)
    if (upgrade.empty() == false)
       fprintf(output, "Upgrade: %s\n", upgrade.c_str()+2);
 
+   return true;
+}
+                                                                       /*}}}*/
+// edspWriter::WriteSolution - to the given file descriptor            /*{{{*/
+bool edspWriter::WriteSolution(pkgDepCache &Cache, FILE* output)
+{
+   bool const Debug = _config->FindB("Debug::EDSPWriter::WriteSolution", false);
+   for (pkgCache::PkgIterator Pkg = Cache.PkgBegin(); Pkg.end() == false; ++Pkg)
+   {
+      if (Cache[Pkg].Delete() == true)
+        fprintf(output, "Remove: %d\n", Cache.GetCandidateVer(Pkg)->ID);
+      else if (Cache[Pkg].NewInstall() == true || Cache[Pkg].Upgrade() == true)
+        fprintf(output, "Install: %d\n", Cache.GetCandidateVer(Pkg)->ID);
+      else
+        continue;
+      if (Debug == true)
+        fprintf(output, "Package: %s\nVersion: %s\n", Pkg.FullName().c_str(), Cache.GetCandidateVer(Pkg).VerStr());
+      fprintf(output, "\n");
+   }
+
    return true;
 }
                                                                        /*}}}*/
index 52923ff7345dacdccea1810bf194795c9d868dff..c42dfd398d80655534d699e6bd3688868fe48563 100644 (file)
@@ -14,6 +14,7 @@ class edspWriter                                                              /*{{{*/
 public:
        bool static WriteUniverse(pkgDepCache &Cache, FILE* output);
        bool static WriteRequest(pkgDepCache &Cache, FILE* output);
+       bool static WriteSolution(pkgDepCache &Cache, FILE* output);
 };
                                                                        /*}}}*/
 #endif