libsolv/0004-Do-not-autouninstall-packages-because-of-forcebest-u.patch

80 lines
2.9 KiB
Diff
Raw Normal View History

From 02b3d1ba7bd73c399be71b0e55e18dce4ddb4a0d Mon Sep 17 00:00:00 2001
From: Michael Schroeder <mls@suse.de>
Date: Fri, 30 Nov 2018 15:05:33 +0100
Subject: [PATCH 4/4] Do not autouninstall packages because of forcebest
updates
(cherry picked from commit d17aa8f15c354c27b7231196bc9468ac7890fb8f)
---
src/problems.c | 17 +++++++++++++++--
test/testcases/allowuninstall/forcebest.t | 19 +++++++++++++++++++
2 files changed, 34 insertions(+), 2 deletions(-)
create mode 100644 test/testcases/allowuninstall/forcebest.t
diff --git a/src/problems.c b/src/problems.c
index 68ff61d7..2b5cefda 100644
--- a/src/problems.c
+++ b/src/problems.c
@@ -247,10 +247,23 @@ solver_autouninstall(Solver *solv, int start)
if (v >= solv->updaterules && v < solv->updaterules_end)
{
Rule *r;
+ Id p = solv->installed->start + (v - solv->updaterules);
if (m && !MAPTST(m, v - solv->updaterules))
continue;
- if (pool->considered && !MAPTST(pool->considered, solv->installed->start + (v - solv->updaterules)))
+ if (pool->considered && !MAPTST(pool->considered, p))
continue; /* do not uninstalled disabled packages */
+ if (solv->bestrules_pkg && solv->bestrules_end > solv->bestrules)
+ {
+ int j;
+ for (j = start + 1; j < solv->problems.count - 1; j++)
+ {
+ Id vv = solv->problems.elements[j];
+ if (vv >= solv->bestrules && vv < solv->bestrules_end && solv->bestrules_pkg[vv - solv->bestrules] == p)
+ break;
+ }
+ if (j < solv->problems.count - 1)
+ continue; /* best rule involved, do not uninstall */
+ }
/* check if identical to feature rule, we don't like that (except for orphans) */
r = solv->rules + solv->featurerules + (v - solv->updaterules);
if (!r->p)
@@ -262,7 +275,7 @@ solver_autouninstall(Solver *solv, int start)
if (solv->keep_orphans)
{
r = solv->rules + v;
- if (!r->d && !r->w2 && r->p == (solv->installed->start + (v - solv->updaterules)))
+ if (!r->d && !r->w2 && r->p == p)
{
lastfeature = v;
lastupdate = 0;
diff --git a/test/testcases/allowuninstall/forcebest.t b/test/testcases/allowuninstall/forcebest.t
new file mode 100644
index 00000000..38ade6f9
--- /dev/null
+++ b/test/testcases/allowuninstall/forcebest.t
@@ -0,0 +1,19 @@
+repo system 0 testtags <inline>
+#>=Pkg: a 1 1 noarch
+#>=Req: b = 1-1
+#>=Pkg: b 1 1 noarch
+repo available 0 testtags <inline>
+#>=Pkg: a 2 1 noarch
+#>=Req: b = 2-1
+#>=Pkg: b 2 1 noarch
+
+system x86_64 rpm system
+disable pkg b-1-1.noarch@system
+disable pkg b-2-1.noarch@available
+job allowuninstall pkg a-1-1.noarch@system
+job allowuninstall pkg b-1-1.noarch@system
+job update name a [forcebest]
+result transaction,problems <inline>
+#>problem e6d3911d info nothing provides b = 2-1 needed by a-2-1.noarch
+#>problem e6d3911d solution 0011b04f allow a-1-1.noarch@system
+#>problem e6d3911d solution 44d189a0 erase a-1-1.noarch@system
--
2.19.2