From: Michael Schroeder Date: Fri, 28 Sep 2018 12:48:14 +0000 (+0200) Subject: Make sure that targeted updates don't do reinstalls X-Git-Tag: 0.7.0~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0ce04714c477f25fde16c57b5fdc478755794126;p=thirdparty%2Flibsolv.git Make sure that targeted updates don't do reinstalls We already had code in add_update_target() to do this, but it did not cover the multiversion case where more than one package with the same name is installed. --- diff --git a/src/solver.c b/src/solver.c index 6405f4a6..a4e0c4b6 100644 --- a/src/solver.c +++ b/src/solver.c @@ -2957,7 +2957,9 @@ add_update_target(Solver *solv, Id p, Id how) Pool *pool = solv->pool; Solvable *s = pool->solvables + p; Repo *installed = solv->installed; - Id pi, pip; + Id pi, pip, identicalp; + int startcnt, endcnt; + if (!solv->update_targets) { solv->update_targets = solv_calloc(1, sizeof(Queue)); @@ -2968,6 +2970,8 @@ add_update_target(Solver *solv, Id p, Id how) queue_push2(solv->update_targets, p, p); return; } + identicalp = 0; + startcnt = solv->update_targets->count; FOR_PROVIDES(pi, pip, s->name) { Solvable *si = pool->solvables + pi; @@ -2982,9 +2986,9 @@ add_update_target(Solver *solv, Id p, Id how) if (how & SOLVER_CLEANDEPS) add_cleandeps_updatepkg(solv, pi); queue_push2(solv->update_targets, pi, p); - /* check if it's ok to keep the installed package */ + /* remember an installed package that is identical to p */ if (s->evr == si->evr && solvable_identical(s, si)) - queue_push2(solv->update_targets, pi, pi); + identicalp = pi; } if (s->obsoletes) { @@ -3014,6 +3018,12 @@ add_update_target(Solver *solv, Id p, Id how) } } } + /* also allow upgrading to an identical installed package */ + if (identicalp) + { + for (endcnt = solv->update_targets->count; startcnt < endcnt; startcnt += 2) + queue_push2(solv->update_targets, solv->update_targets->elements[startcnt], identicalp); + } } static int