libsolv/0005-Only-disable-infarch-rules-on-erase-if-the-package-w.patch
2023-05-15 12:58:33 +02:00

61 lines
1.9 KiB
Diff

From 5dc4f81fda718df26f8f5dda343a71d34cf555b4 Mon Sep 17 00:00:00 2001
From: Michael Schroeder <mls@suse.de>
Date: Fri, 21 Apr 2023 16:15:10 +0200
Subject: [PATCH 5/5] Only disable infarch rules on erase if the package was in
lock-step
Fiexes issue #528
---
src/rules.c | 28 +++++++++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/src/rules.c b/src/rules.c
index 2105c968..660656f0 100644
--- a/src/rules.c
+++ b/src/rules.c
@@ -2367,6 +2367,31 @@ reenablerepopriorule(Solver *solv, Id name)
#define DISABLE_BLACK 4
#define DISABLE_REPOPRIO 5
+/* check if installed package p is in lock-step with another installed package */
+static int
+installed_is_in_lockstep(Solver *solv, Id p)
+{
+ Pool *pool = solv->pool;
+ Repo *installed = solv->installed;
+ int rid;
+ Id pp, l;
+ Rule *r;
+
+ if (!installed)
+ return 0;
+ for (rid = solv->infarchrules, r = solv->rules + rid; rid < solv->infarchrules_end; rid++, r++)
+ {
+ if (r->p >= 0)
+ continue;
+ if (pool->solvables[-r->p].repo != installed)
+ continue;
+ FOR_RULELITERALS(l, pp, r)
+ if (l == p)
+ return 1;
+ }
+ return 0;
+}
+
static void
jobtodisablelist(Solver *solv, Id how, Id what, Queue *q)
{
@@ -2612,7 +2637,8 @@ jobtodisablelist(Solver *solv, Id how, Id what, Queue *q)
{
queue_push2(q, DISABLE_UPDATE, p);
if ((set & SOLVER_SETARCH) != 0 && pool->implicitobsoleteusescolors && solv->infarchrules != solv->infarchrules_end)
- queue_push2(q, DISABLE_INFARCH, pool->solvables[p].name); /* allow to break the lock-step */
+ if (installed_is_in_lockstep(solv, p))
+ queue_push2(q, DISABLE_INFARCH, pool->solvables[p].name); /* allow to break the lock-step */
#ifdef ENABLE_LINKED_PKGS
if (solv->instbuddy && solv->instbuddy[p - installed->start] > 1)
queue_push2(q, DISABLE_UPDATE, solv->instbuddy[p - installed->start]);
--
2.40.1