Blob Blame History Raw
From 954862319e32e97b20afd0f598cd461ece320e4f Mon Sep 17 00:00:00 2001
From: Michael Schroeder <mls@suse.de>
Date: Tue, 8 Oct 2019 13:40:45 +0200
Subject: [PATCH] Fix handling of disabled installed packages in distupgrade

Such packages must not be touched, i.e. they must stay installed.
---
 src/pool.c  |  1 -
 src/rules.c | 10 ++++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/pool.c b/src/pool.c
index d2053b9..76636a7 100644
--- a/src/pool.c
+++ b/src/pool.c
@@ -455,7 +455,6 @@ pool_createwhatprovides(Pool *pool)
   Offset *whatprovides;
   Id *whatprovidesdata, *dp, *whatprovidesauxdata;
   Offset *whatprovidesaux;
-  Repo *installed = pool->installed;
   unsigned int now;
 
   now = solv_timems(0);
diff --git a/src/rules.c b/src/rules.c
index 4075b9d..57895c0 100644
--- a/src/rules.c
+++ b/src/rules.c
@@ -1373,6 +1373,14 @@ solver_addupdaterule(Solver *solv, Solvable *s)
   int dupinvolved = 0;
 
   p = s - pool->solvables;
+
+  if (pool->considered && pool_disabled_solvable(pool, s))
+    {
+      /* disabled installed solvables must stay installed */
+      solver_addrule(solv, p, 0, 0);
+      return;
+    }
+
   /* Orphan detection. We cheat by looking at the feature rule, which
    * we already calculated */
   r = solv->rules + solv->featurerules + (p - solv->installed->start);
@@ -2003,6 +2011,8 @@ solver_addduprules(Solver *solv, Map *addedmap)
 	    continue;
 	  if (installed && ps->repo == installed)
 	    {
+	      if (pool->considered && pool_disabled_solvable(pool, ps))
+		continue;		/* always keep disabled installed packages */
 	      if (!MAPTST(&solv->dupmap, p))
 		{
 		  Id ip, ipp;
--
libgit2 0.28.2