From: Michael Schroeder Date: Mon, 1 Jun 2015 11:43:41 +0000 (+0200) Subject: Fix distupgrade with allowuninstall X-Git-Tag: 0.6.11~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=65a81492f9a86c224614fe2f412eca76c7415d86;p=thirdparty%2Flibsolv.git Fix distupgrade with allowuninstall It used to dump core in rare circumstances, it also did not always produce the correct result. --- diff --git a/src/rules.c b/src/rules.c index 0888fb0d..67de769a 100644 --- a/src/rules.c +++ b/src/rules.c @@ -1721,6 +1721,15 @@ solver_createdupmaps(Solver *solv) solver_addtodupmaps(solv, p, how, targeted); } } + else if (select == SOLVER_SOLVABLE_ALL) + { + FOR_POOL_SOLVABLES(p) + { + MAPSET(&solv->dupinvolvedmap, p); + if (installed && pool->solvables[p].repo != installed) + MAPSET(&solv->dupmap, p); + } + } else { targeted = how & SOLVER_TARGETED ? 1 : 0; diff --git a/src/solver.c b/src/solver.c index 8dcdde56..f5517311 100644 --- a/src/solver.c +++ b/src/solver.c @@ -182,17 +182,10 @@ autouninstall(Solver *solv, Id *problem) { if (v < 0) extraflags &= solv->job.elements[-v - 1]; - if (v >= solv->featurerules && v < solv->featurerules_end) - if (v > lastfeature) - lastfeature = v; if (v >= solv->updaterules && v < solv->updaterules_end) { - /* check if identical to feature rule */ - Id p = solv->rules[v].p; - Rule *r; - if (p <= 0) - continue; - r = solv->rules + solv->featurerules + (p - solv->installed->start); + /* check if identical to feature rule, we don't like that */ + Rule *r = solv->rules + solv->featurerules + (v - solv->updaterules); if (!r->p) { /* update rule == feature rule */ @@ -3550,7 +3543,7 @@ solver_solve(Solver *solv, Queue *job) if (how & SOLVER_FORCEBEST) solv->bestupdatemap_all = 1; } - if (!solv->dupmap_all) + if (!solv->dupmap_all || solv->allowuninstall) hasdupjob = 1; break; default: diff --git a/test/testcases/distupgrade/dup_allowuninstall b/test/testcases/distupgrade/dup_allowuninstall new file mode 100644 index 00000000..86a8af99 --- /dev/null +++ b/test/testcases/distupgrade/dup_allowuninstall @@ -0,0 +1,13 @@ +repo system 0 testtags +#>=Pkg: a 1 1 i686 +#>=Pkg: b 2 1 i686 +repo available 0 testtags +#>=Pkg: a 2 1 i586 +#>=Con: b = 1-1 +#>=Pkg: b 1 1 i586 +system i686 * system +solverflags !dupallowarchchange allowuninstall +job distupgrade all packages +result transaction,problems +#>erase b-2-1.i686@system +#>upgrade a-1-1.i686@system a-2-1.i586@available diff --git a/test/testcases/distupgrade/dup_noarchchange b/test/testcases/distupgrade/dup_noarchchange new file mode 100644 index 00000000..f500d9bf --- /dev/null +++ b/test/testcases/distupgrade/dup_noarchchange @@ -0,0 +1,15 @@ +repo system 0 testtags +#>=Pkg: a 1 1 i686 +#>=Pkg: b 1 1 i686 +repo available 0 testtags +#>=Pkg: a 2 1 i586 +#>=Pkg: b 2 1 i586 +#>=Pkg: b 2 1 i686 +system i686 * system +solverflags !dupallowarchchange +job distupgrade all packages +result transaction,problems +#>problem c43b1300 info problem with installed package a-1-1.i686 +#>problem c43b1300 solution c43b1300 replace a-1-1.i686@system a-2-1.i586@available +#>upgrade a-1-1.i686@system a-2-1.i586@available +#>upgrade b-1-1.i686@system b-2-1.i686@available