diff options
author | William Pitcock <nenolod@dereferenced.org> | 2017-11-02 17:15:00 +0000 |
---|---|---|
committer | William Pitcock <nenolod@dereferenced.org> | 2017-11-02 17:15:00 +0000 |
commit | 20ae27c1daec1e6efd19d74a2116c6a1f65e02ec (patch) | |
tree | 38455eaea530cfd7fab4e9e4fa4aa1bfeb4104ce /src/solver.c | |
parent | 6aabb96c204c5290dd69cba6f8f163b314de702d (diff) | |
download | apk-tools-20ae27c1daec1e6efd19d74a2116c6a1f65e02ec.tar.gz apk-tools-20ae27c1daec1e6efd19d74a2116c6a1f65e02ec.tar.bz2 apk-tools-20ae27c1daec1e6efd19d74a2116c6a1f65e02ec.tar.xz apk-tools-20ae27c1daec1e6efd19d74a2116c6a1f65e02ec.zip |
solver: prefer highest requirer count above installed status
This ensures a swap is emitted when replacing a virtual with
apk add.
Diffstat (limited to 'src/solver.c')
-rw-r--r-- | src/solver.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/solver.c b/src/solver.c index 5d73af6..5698215 100644 --- a/src/solver.c +++ b/src/solver.c @@ -567,6 +567,11 @@ static int compare_providers(struct apk_solver_state *ss, if (r) return r; + /* Prefer highest requirer count. */ + r = count_requirers(pkgA) - count_requirers(pkgB); + if (r) + return r; + /* Prefer installed */ if (!(solver_flags & APK_SOLVERF_UPGRADE)) { r = (pkgA->ipkg != NULL) - (pkgB->ipkg != NULL); @@ -598,11 +603,6 @@ static int compare_providers(struct apk_solver_state *ss, if (r) return r; - /* Prefer highest requirer count. */ - r = count_requirers(pkgA) - count_requirers(pkgB); - if (r) - return r; - /* Prefer highest declared provider priority. */ r = pkgA->provider_priority - pkgB->provider_priority; if (r) |