]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/algorithms.cc
doesn't execute autoremove marker setting if an external solver is called
[apt.git] / apt-pkg / algorithms.cc
index 2ca3404a08c3b5469978f58485aa83beb8dc1d6d..fea9e92e15d71958f1ad713d5e563a95b6d2ea1c 100644 (file)
@@ -20,7 +20,7 @@
 #include <apt-pkg/version.h>
 #include <apt-pkg/sptr.h>
 #include <apt-pkg/acquire-item.h>
-#include <apt-pkg/edspwriter.h>
+#include <apt-pkg/edsp.h>
 
 #include <apti18n.h>
 #include <sys/types.h>
@@ -740,14 +740,24 @@ bool pkgProblemResolver::DoUpgrade(pkgCache::PkgIterator Pkg)
 bool pkgProblemResolver::Resolve(bool BrokenFix)
 {
    std::string const solver = _config->Find("APT::Solver::Name", "internal");
+
    if (solver != "internal")
    {
-      FILE* output = fopen("/tmp/universe.log", "w");
-      edspWriter::WriteUniverse(Cache, output);
-      fclose(output);
-      output = fopen("/tmp/request.log", "w");
-      edspWriter::WriteRequest(Cache, output);
+      int solver_in, solver_out;
+      if (EDSP::ExecuteSolver(solver.c_str(), &solver_in, &solver_out) == false)
+        return false;
+
+      FILE* output = fdopen(solver_in, "w");
+      if (output == NULL)
+         return _error->Errno("Resolve", "fdopen on solver stdin failed");
+      EDSP::WriteRequest(Cache, output);
+      EDSP::WriteScenario(Cache, output);
       fclose(output);
+
+      if (EDSP::ReadResponse(solver_out, Cache) == false)
+        return _error->Error("Reading solver response failed");
+
+      return true;
    }
    return ResolveInternal(BrokenFix);
 }