Skip to content

Commit 0ce0471

Browse files
committed
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.
1 parent 35612b6 commit 0ce0471

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

src/solver.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2957,7 +2957,9 @@ add_update_target(Solver *solv, Id p, Id how)
29572957
Pool *pool = solv->pool;
29582958
Solvable *s = pool->solvables + p;
29592959
Repo *installed = solv->installed;
2960-
Id pi, pip;
2960+
Id pi, pip, identicalp;
2961+
int startcnt, endcnt;
2962+
29612963
if (!solv->update_targets)
29622964
{
29632965
solv->update_targets = solv_calloc(1, sizeof(Queue));
@@ -2968,6 +2970,8 @@ add_update_target(Solver *solv, Id p, Id how)
29682970
queue_push2(solv->update_targets, p, p);
29692971
return;
29702972
}
2973+
identicalp = 0;
2974+
startcnt = solv->update_targets->count;
29712975
FOR_PROVIDES(pi, pip, s->name)
29722976
{
29732977
Solvable *si = pool->solvables + pi;
@@ -2982,9 +2986,9 @@ add_update_target(Solver *solv, Id p, Id how)
29822986
if (how & SOLVER_CLEANDEPS)
29832987
add_cleandeps_updatepkg(solv, pi);
29842988
queue_push2(solv->update_targets, pi, p);
2985-
/* check if it's ok to keep the installed package */
2989+
/* remember an installed package that is identical to p */
29862990
if (s->evr == si->evr && solvable_identical(s, si))
2987-
queue_push2(solv->update_targets, pi, pi);
2991+
identicalp = pi;
29882992
}
29892993
if (s->obsoletes)
29902994
{
@@ -3014,6 +3018,12 @@ add_update_target(Solver *solv, Id p, Id how)
30143018
}
30153019
}
30163020
}
3021+
/* also allow upgrading to an identical installed package */
3022+
if (identicalp)
3023+
{
3024+
for (endcnt = solv->update_targets->count; startcnt < endcnt; startcnt += 2)
3025+
queue_push2(solv->update_targets, solv->update_targets->elements[startcnt], identicalp);
3026+
}
30173027
}
30183028

30193029
static int

0 commit comments

Comments
 (0)