From 67ba3106e8e5e1adb43fff0027af4e31fed0db90 Mon Sep 17 00:00:00 2001 From: Michael Schroeder Date: Tue, 31 Aug 2010 19:04:05 +0200 Subject: - fix package priority handling of installed packages in dup case [bnc#631306] --- src/policy.c | 29 ++++++++++++++++++++++++++++- src/rules.c | 3 ++- 2 files changed, 30 insertions(+), 2 deletions(-) (limited to 'src') 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 -- cgit v1.2.3