summaryrefslogtreecommitdiff
path: root/apt-pkg/algorithms.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <kalnischkies@gmail.com>2011-05-03 10:50:25 +0200
committerDavid Kalnischkies <kalnischkies@gmail.com>2011-05-03 10:50:25 +0200
commit741b7da9de1d2ab470728f1e7f38b25e0d6a556c (patch)
tree9f666192b31c43e9cd29df0bb326a4a7930faf16 /apt-pkg/algorithms.cc
parent80699703b6015a8fe7707302f365020f9782cf2c (diff)
implement external solver calling for upgrade and dist-upgrade, too
Diffstat (limited to 'apt-pkg/algorithms.cc')
-rw-r--r--apt-pkg/algorithms.cc40
1 files changed, 22 insertions, 18 deletions
diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc
index fea9e92e1..5d9fefaa6 100644
--- a/apt-pkg/algorithms.cc
+++ b/apt-pkg/algorithms.cc
@@ -332,6 +332,10 @@ bool pkgFixBroken(pkgDepCache &Cache)
*/
bool pkgDistUpgrade(pkgDepCache &Cache)
{
+ std::string const solver = _config->Find("APT::Solver::Name", "internal");
+ if (solver != "internal")
+ return EDSP::ResolveExternal(solver.c_str(), Cache, false, true, false);
+
pkgDepCache::ActionGroup group(Cache);
/* Upgrade all installed packages first without autoinst to help the resolver
@@ -384,6 +388,10 @@ bool pkgDistUpgrade(pkgDepCache &Cache)
to install packages not marked for install */
bool pkgAllUpgrade(pkgDepCache &Cache)
{
+ std::string const solver = _config->Find("APT::Solver::Name", "internal");
+ if (solver != "internal")
+ return EDSP::ResolveExternal(solver.c_str(), Cache, true, false, false);
+
pkgDepCache::ActionGroup group(Cache);
pkgProblemResolver Fix(&Cache);
@@ -740,25 +748,8 @@ bool pkgProblemResolver::DoUpgrade(pkgCache::PkgIterator Pkg)
bool pkgProblemResolver::Resolve(bool BrokenFix)
{
std::string const solver = _config->Find("APT::Solver::Name", "internal");
-
if (solver != "internal")
- {
- 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 EDSP::ResolveExternal(solver.c_str(), Cache, false, false, false);
return ResolveInternal(BrokenFix);
}
/*}}}*/
@@ -1231,6 +1222,19 @@ bool pkgProblemResolver::ResolveInternal(bool const BrokenFix)
system was non-broken previously. */
bool pkgProblemResolver::ResolveByKeep()
{
+ std::string const solver = _config->Find("APT::Solver::Name", "internal");
+ if (solver != "internal")
+ return EDSP::ResolveExternal(solver.c_str(), Cache, true, false, false);
+ return ResolveByKeepInternal();
+}
+ /*}}}*/
+// ProblemResolver::ResolveByKeepInternal - Resolve problems using keep /*{{{*/
+// ---------------------------------------------------------------------
+/* This is the work horse of the soft upgrade routine. It is very gental
+ in that it does not install or remove any packages. It is assumed that the
+ system was non-broken previously. */
+bool pkgProblemResolver::ResolveByKeepInternal()
+{
pkgDepCache::ActionGroup group(Cache);
unsigned long Size = Cache.Head().PackageCount;