diff options
author | Michael Schroeder <mls@suse.de> | 2010-08-31 19:04:05 +0200 |
---|---|---|
committer | Michael Schroeder <mls@suse.de> | 2010-08-31 19:04:05 +0200 |
commit | 67ba3106e8e5e1adb43fff0027af4e31fed0db90 (patch) | |
tree | 693391fde4eaede055ea2c60432fe045e12e6569 /src | |
parent | 08af426e15d5caa7f3e14e0d89ddf7787cb9a001 (diff) | |
download | libsolv-67ba3106e8e5e1adb43fff0027af4e31fed0db90.tar.gz libsolv-67ba3106e8e5e1adb43fff0027af4e31fed0db90.tar.bz2 libsolv-67ba3106e8e5e1adb43fff0027af4e31fed0db90.zip |
- fix package priority handling of installed packages in dup case [bnc#631306]
Diffstat (limited to 'src')
-rw-r--r-- | src/policy.c | 29 | ||||
-rw-r--r-- | src/rules.c | 3 |
2 files changed, 30 insertions, 2 deletions
diff --git a/src/policy.c b/src/policy.c index 0dc3df8..12542df 100644 --- a/src/policy.c +++ b/src/policy.c @@ -381,7 +381,34 @@ policy_filter_unwanted(Solver *solv, Queue *plist, int mode) { Pool *pool = solv->pool; if (plist->count > 1 && mode != POLICY_MODE_SUGGEST) - prune_to_highest_prio(pool, plist); + { + prune_to_highest_prio(pool, plist); + /* installed packages involed in a dup operation can only be kept + * if they are identical to a non-installed one */ + if (plist->count > 1 && pool->installed && (solv->dupmap_all || solv->dupinvolvedmap.size)) + { + int i, j, k; + for (i = j = 0; i < plist->count; i++) + { + Id p = plist->elements[i]; + Solvable *s = pool->solvables + p; + if (s->repo == pool->installed && (solv->dupmap_all || (solv->dupinvolvedmap.size && MAPTST(&solv->dupinvolvedmap, p)))) + { + for (k = 0; k < plist->count; k++) + { + Solvable *s2 = pool->solvables + plist->elements[k]; + if (s2->repo != pool->installed && solvable_identical(s, s2)) + break; + } + if (k == plist->count) + continue; /* no identical package found, ignore installed package */ + } + plist->elements[j++] = p; + } + if (j) + plist->count = j; + } + } if (plist->count > 1 && mode == POLICY_MODE_CHOOSE) prune_to_recommended(solv, plist); prune_best_arch_name_version(solv, pool, plist); diff --git a/src/rules.c b/src/rules.c index 2ce386a..7e1f4df 100644 --- a/src/rules.c +++ b/src/rules.c @@ -1227,7 +1227,8 @@ void solver_freedupmaps(Solver *solv) { map_free(&solv->dupmap); - map_free(&solv->dupinvolvedmap); + /* wee no longer free solv->dupinvolvedmap as we need it in + * policy's priority pruning code. sigh. */ } void |