summaryrefslogtreecommitdiff
path: root/src/policy.c
diff options
context:
space:
mode:
authorMichael Schroeder <mls@suse.de>2010-08-31 19:04:05 +0200
committerMichael Schroeder <mls@suse.de>2010-08-31 19:04:05 +0200
commit67ba3106e8e5e1adb43fff0027af4e31fed0db90 (patch)
tree693391fde4eaede055ea2c60432fe045e12e6569 /src/policy.c
parent08af426e15d5caa7f3e14e0d89ddf7787cb9a001 (diff)
downloadlibsolv-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/policy.c')
-rw-r--r--src/policy.c29
1 files changed, 28 insertions, 1 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);