summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2011-11-01 08:29:24 +0200
committerTimo Teräs <timo.teras@iki.fi>2011-11-01 08:29:24 +0200
commitf13ec9cf5efe6de4545b27a56e4806194eae90e2 (patch)
tree7bcda9c714508bd793e9cd0afa7c1d1b7828d901 /src
parente36e99f31d8d1669de1a52d08828bb948d0bdef0 (diff)
downloadapk-tools-f13ec9cf5efe6de4545b27a56e4806194eae90e2.tar.gz
apk-tools-f13ec9cf5efe6de4545b27a56e4806194eae90e2.tar.bz2
apk-tools-f13ec9cf5efe6de4545b27a56e4806194eae90e2.tar.xz
apk-tools-f13ec9cf5efe6de4545b27a56e4806194eae90e2.zip
solver: consider world dependencies to determining exit score
Diffstat (limited to 'src')
-rw-r--r--src/solver.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/solver.c b/src/solver.c
index aa89dd9..ab2ad6f 100644
--- a/src/solver.c
+++ b/src/solver.c
@@ -947,6 +947,7 @@ int apk_solver_solve(struct apk_database *db,
{
struct apk_solver_state *ss;
struct apk_installed_package *ipkg;
+ struct apk_score zero_score;
int i, r;
ss = calloc(1, sizeof(struct apk_solver_state));
@@ -962,6 +963,8 @@ int apk_solver_solve(struct apk_database *db,
sort_name(ss, ipkg->pkg->name);
foreach_dependency(ss, world, apply_constraint);
+ zero_score = ss->score;
+
do {
if (cmpscore(&ss->score, &ss->best_score) < 0) {
r = expand_branch(ss);
@@ -973,8 +976,7 @@ int apk_solver_solve(struct apk_database *db,
if (cmpscore(&ss->score, &ss->best_score) < 0)
record_solution(ss);
- if (ss->score.unsatisfiable == 0 &&
- ss->score.preference == 0) {
+ if (cmpscore(&zero_score, &ss->score) <= 0) {
/* found solution - it is optimal because we permutate
* each preferred local option first, and permutations
* happen in topologally sorted order. */