Blob Blame History Raw
From 36a4434559e3885f75f3e1e878f11f3b18fce920 Mon Sep 17 00:00:00 2001
From: Michael Schroeder <mls@suse.de>
Date: Mon, 12 Oct 2015 14:03:25 +0200
Subject: [PATCH 2/4] Prefer to autouninstall orphans

---
 src/solver.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/solver.c b/src/solver.c
index f371546..87b6c45 100644
--- a/src/solver.c
+++ b/src/solver.c
@@ -217,13 +217,24 @@ autouninstall(Solver *solv, Id *problem)
 	  Rule *r;
 	  if (m && !MAPTST(m, v - solv->updaterules))
 	    continue;
-	  /* check if identical to feature rule, we don't like that */
+	  /* 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)
 	    {
 	      /* update rule == feature rule */
 	      if (v > lastfeature)
 		lastfeature = v;
+	      /* prefer orphaned packages in dup mode */
+	      if (solv->dupmap_all && solv->keep_orphans)
+		{
+		  r = solv->rules + v;
+		  if (!r->d && r->p == (solv->installed->start + (v - solv->updaterules)))
+		    {
+		      lastfeature = v;
+		      lastupdate = 0;
+		      break;
+		    }
+		}
 	      continue;
 	    }
 	  if (v > lastupdate)
-- 
2.6.1