solver: prefer highest requirer count above installed status

This ensures a swap is emitted when replacing a virtual with
apk add.
cute-signatures
William Pitcock 2017-11-02 17:15:00 +00:00
parent 6aabb96c20
commit 20ae27c1da
2 changed files with 8 additions and 7 deletions

View File

@ -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)

View File

@ -1,6 +1,7 @@
C:Q1EyN5AdpAOBJWKMR89pp/C66o+OE=
C:Q1eVpkasfqZAukAXFYbgwt4xAEEEe=
P:mailreadplus
V:1
S:1
I:1
p:mail-reader
k:2