diff options
author | Timo Teräs <timo.teras@iki.fi> | 2012-02-24 16:27:51 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2012-02-24 16:27:51 +0200 |
commit | 97d44b5a002b61c7b95303bb8616f1caa6556bca (patch) | |
tree | 8adf9b1e3aa2df4628c2c7fc563f83b48a93feb5 /src | |
parent | 1c1914344edfabfe24315638566944caff8536b5 (diff) | |
download | apk-tools-97d44b5a002b61c7b95303bb8616f1caa6556bca.tar.gz apk-tools-97d44b5a002b61c7b95303bb8616f1caa6556bca.tar.bz2 apk-tools-97d44b5a002b61c7b95303bb8616f1caa6556bca.tar.xz apk-tools-97d44b5a002b61c7b95303bb8616f1caa6556bca.zip |
solver: unallowed pinning is worse than changing installed package
Diffstat (limited to 'src')
-rw-r--r-- | src/solver.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/solver.c b/src/solver.c index f8bd4fd..9875dda 100644 --- a/src/solver.c +++ b/src/solver.c @@ -350,7 +350,7 @@ static int get_topology_score( unsigned int repos; unsigned short preferred_pinning, allowed_pinning; unsigned int preferred_repos, allowed_repos; - int score_locked = TRUE; + int score_locked = TRUE, sticky_installed = FALSE; score = (struct apk_score) { .conflicts = ps->conflicts, @@ -375,6 +375,8 @@ static int get_topology_score( /* not upgrading: it is not preferred to change package */ if (pkg->ipkg == NULL && ns->originally_installed) score.non_preferred_actions++; + else + sticky_installed = TRUE; } else { score_locked = FALSE; } @@ -389,16 +391,11 @@ static int get_topology_score( if (ns->locked || (ns->allowed_pinning | ns->maybe_pinning) == ns->allowed_pinning) { allowed_pinning = ns->allowed_pinning | preferred_pinning | APK_DEFAULT_PINNING_MASK; allowed_repos = get_pinning_mask_repos(ss->db, allowed_pinning); - if (!(repos & allowed_repos)) + if (!(repos & allowed_repos)) { + if (sticky_installed) + score.non_preferred_actions++; score.non_preferred_pinnings += 16; - -#if 0 - if (allowed_pinning & ~APK_DEFAULT_PINNING_MASK) - fprintf(stdout, PKG_VER_FMT": allow: %x, in: %x, reallyin: %x. score="SCORE_FMT"\n", - PKG_VER_PRINTF(pkg), - allowed_repos, repos, pkg->repos, - SCORE_PRINTF(&score)); -#endif + } } else { score_locked = FALSE; } |