summaryrefslogtreecommitdiff
path: root/src/solver.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2018-11-12 13:20:14 +0200
committerTimo Teräs <timo.teras@iki.fi>2018-11-12 13:20:14 +0200
commita86c8ed0828f670b875b418ef10d83bddeca97f6 (patch)
tree0c11b0c674e21974927cb7999769e89f73cb3659 /src/solver.c
parent8fa193ecda2a71de3ff5f826205351b185d15054 (diff)
downloadapk-tools-a86c8ed0828f670b875b418ef10d83bddeca97f6.tar.gz
apk-tools-a86c8ed0828f670b875b418ef10d83bddeca97f6.tar.bz2
apk-tools-a86c8ed0828f670b875b418ef10d83bddeca97f6.tar.xz
apk-tools-a86c8ed0828f670b875b418ef10d83bddeca97f6.zip
fix package preference based on it's conflicts in --latest mode
remove also redundant pkg_selectable check in repair mode.
Diffstat (limited to 'src/solver.c')
-rw-r--r--src/solver.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/solver.c b/src/solver.c
index 7abc80c..5522707 100644
--- a/src/solver.c
+++ b/src/solver.c
@@ -566,10 +566,6 @@ static int compare_providers(struct apk_solver_state *ss,
r = (int)pkgA->ss.pkg_available - (int)pkgB->ss.pkg_available;
if (r)
return r;
- } else if (solver_flags & APK_SOLVERF_REINSTALL) {
- r = (int)pkgA->ss.pkg_selectable - (int)pkgB->ss.pkg_selectable;
- if (r)
- return r;
}
/* Prefer preferred pinning */
@@ -618,6 +614,11 @@ static int compare_providers(struct apk_solver_state *ss,
if (r)
return r;
+ /* Prefer without errors (mostly if --latest used, and different provider) */
+ r = (int)pkgA->ss.pkg_selectable - (int)pkgB->ss.pkg_selectable;
+ if (r)
+ return r;
+
/* Prefer lowest available repository */
return ffs(pkgB->repos) - ffs(pkgA->repos);
}