From 450556edeeb08c931daa386f351aade6e67f7102 Mon Sep 17 00:00:00 2001 From: Michael Schroeder Date: Thu, 15 Oct 2015 22:43:06 +0200 Subject: [PATCH] Fix last commit We can't add the multiversion orphan to the update rules, as that would mean we no longer enforce an update to one of the repo packages. So we now just detect the multiversion orphan and do not add a dup rule. Note that this is still not correct, as we don't enforce that the orphan is not erased in keep_orphan mode. In that case we really need two independent rules. I'm currently not sure where to put the extra rule... --- src/rules.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/rules.c b/src/rules.c index 381cb22c..1fe21e13 100644 --- a/src/rules.c +++ b/src/rules.c @@ -1302,8 +1302,6 @@ solver_addupdaterule(Solver *solv, Solvable *s, int allow_all) if (j == 0 && p == -SYSTEMSOLVABLE && solv->dupmap_all) { queue_push(&solv->orphaned, s - pool->solvables); /* also treat as orphaned */ - if (solv->keep_orphans && !(solv->droporphanedmap_all || (solv->droporphanedmap.size && MAPTST(&solv->droporphanedmap, s - pool->solvables - solv->installed->start)))) - p = s - pool->solvables; /* keep this orphaned package installed */ j = qs.count; } qs.count = j; @@ -1794,6 +1792,29 @@ solver_freedupmaps(Solver *solv) * policy's priority pruning code. sigh. */ } +static int +is_multiversion_orphan(Solver *solv, Id p) +{ + Pool *pool = solv->pool; + Solvable *s = pool->solvables + p; + Rule *r = solv->rules + solv->updaterules + (p - solv->installed->start); + Id l, pp; + if (!r->p) + return 0; + FOR_RULELITERALS(l, pp, r) + { + Solvable *ps = pool->solvables + l; + /* see multiversion code in solver_addupdaterule */ + if (!MAPTST(&solv->multiversion, l)) + return 0; + if (solv->keepexplicitobsoletes && ps->name != s->name) + return 0; + if (ps->name == s->name && ps->evr == s->evr && ps->arch == s->arch) + return 0; + } + return 1; +} + void solver_addduprules(Solver *solv, Map *addedmap) { @@ -1848,8 +1869,7 @@ solver_addduprules(Solver *solv, Map *addedmap) ip = p; else if (solv->dupmap_all && solv->multiversion.size) { - r = solv->rules + solv->updaterules + (p - solv->installed->start); - if (r->p == p) + if (is_multiversion_orphan(solv, p)) ip = p; } } -- 2.47.3