diff --git a/0001-Treat-condition-both-as-positive-and-negative-litera.patch b/0001-Treat-condition-both-as-positive-and-negative-litera.patch new file mode 100644 index 0000000..5f226ce --- /dev/null +++ b/0001-Treat-condition-both-as-positive-and-negative-litera.patch @@ -0,0 +1,30 @@ +From 1edb35a3bd9abcede3a200471a4d1868f8054c99 Mon Sep 17 00:00:00 2001 +From: Michael Schroeder +Date: Tue, 18 Apr 2023 11:57:50 +0200 +Subject: [PATCH 1/5] Treat condition both as positive and negative literal in + pool_add_pos_literals_complex_dep + +That's because (A IF B ELSE C) gets rewritten to (A OR ~B) AND (C OR B) and +(A UNLESS B ELSE C) gets rewritten to (A AND ~B) OR (C AND B). In both +cases we have A, B, ~B, C. + +This resolves issue #527 +--- + src/cplxdeps.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/cplxdeps.c b/src/cplxdeps.c +index 6c40752e..26e754d9 100644 +--- a/src/cplxdeps.c ++++ b/src/cplxdeps.c +@@ -405,6 +405,7 @@ pool_add_pos_literals_complex_dep(Pool *pool, Id dep, Queue *q, Map *m, int neg) + Reldep *rd2 = GETRELDEP(pool, rd->evr); + if (rd2->flags == REL_ELSE) + { ++ pool_add_pos_literals_complex_dep(pool, rd2->name, q, m, !neg); + pool_add_pos_literals_complex_dep(pool, rd2->evr, q, m, !neg); + dep = rd2->name; + } +-- +2.40.1 + diff --git a/0002-Add-testcase-for-last-commit.patch b/0002-Add-testcase-for-last-commit.patch new file mode 100644 index 0000000..aebca61 --- /dev/null +++ b/0002-Add-testcase-for-last-commit.patch @@ -0,0 +1,29 @@ +From 47734e26d67ad236a29c160ff224fcb1910e3a6f Mon Sep 17 00:00:00 2001 +From: Michael Schroeder +Date: Tue, 18 Apr 2023 12:36:40 +0200 +Subject: [PATCH 2/5] Add testcase for last commit + +--- + test/testcases/cplxdeps/ifelse_rec.t | 10 ++++++++++ + 1 file changed, 10 insertions(+) + create mode 100644 test/testcases/cplxdeps/ifelse_rec.t + +diff --git a/test/testcases/cplxdeps/ifelse_rec.t b/test/testcases/cplxdeps/ifelse_rec.t +new file mode 100644 +index 00000000..ea467027 +--- /dev/null ++++ b/test/testcases/cplxdeps/ifelse_rec.t +@@ -0,0 +1,10 @@ ++repo appstream 0 testtags ++#>=Pkg: xorg-x11-server-Xorg 1.20.11 18.el9 noarch ++#>=Req: missing-req ++#>=Pkg: pass 1.7.4 6.el9 noarch ++#>=Rec: xclip (xorg-x11-server-Xorg wl-clipboard) ++repo @System 0 empty ++system unset * @System ++job install pkg pass-1.7.4-6.el9.noarch@appstream ++result transaction,problems ++#>install pass-1.7.4-6.el9.noarch@appstream +-- +2.40.1 + diff --git a/0003-Add-feature-complex_deps-to-ifelse_rec.t-testcase.patch b/0003-Add-feature-complex_deps-to-ifelse_rec.t-testcase.patch new file mode 100644 index 0000000..7386a1b --- /dev/null +++ b/0003-Add-feature-complex_deps-to-ifelse_rec.t-testcase.patch @@ -0,0 +1,21 @@ +From fd326d72a1515ab696e2dea535bc49f02752b46e Mon Sep 17 00:00:00 2001 +From: Michael Schroeder +Date: Wed, 19 Apr 2023 09:50:58 +0200 +Subject: [PATCH 3/5] Add 'feature complex_deps' to ifelse_rec.t testcase + +--- + test/testcases/cplxdeps/ifelse_rec.t | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/test/testcases/cplxdeps/ifelse_rec.t b/test/testcases/cplxdeps/ifelse_rec.t +index ea467027..3e052ebe 100644 +--- a/test/testcases/cplxdeps/ifelse_rec.t ++++ b/test/testcases/cplxdeps/ifelse_rec.t +@@ -1,3 +1,4 @@ ++feature complex_deps + repo appstream 0 testtags + #>=Pkg: xorg-x11-server-Xorg 1.20.11 18.el9 noarch + #>=Req: missing-req +-- +2.40.1 + diff --git a/0004-Allow-to-break-arch-lock-step-on-erase-operations.patch b/0004-Allow-to-break-arch-lock-step-on-erase-operations.patch new file mode 100644 index 0000000..16035ea --- /dev/null +++ b/0004-Allow-to-break-arch-lock-step-on-erase-operations.patch @@ -0,0 +1,64 @@ +From 634371f143e5c0d4244dd46084d0aa7ccdb3967c Mon Sep 17 00:00:00 2001 +From: Michael Schroeder +Date: Wed, 19 Apr 2023 13:09:10 +0200 +Subject: [PATCH 4/5] Allow to break arch lock-step on erase operations + +We allow it if SOLVER_SETARCH is (auto-)set in the erase job. +--- + src/rules.c | 26 ++++++++++++++++++++++++++ + 1 file changed, 26 insertions(+) + +diff --git a/src/rules.c b/src/rules.c +index 05891c03..2105c968 100644 +--- a/src/rules.c ++++ b/src/rules.c +@@ -1672,6 +1672,16 @@ solver_addinfarchrules(Solver *solv, Map *addedmap) + if (first) + continue; /* not the first in the group */ + ++ if (!bestscore && allowedarchs.count > 1 && pool->implicitobsoleteusescolors) ++ { ++ for (j = 0; j < allowedarchs.count; j++) ++ { ++ a = pool_arch2score(pool, allowedarchs.elements[j]); ++ if (a && a != 1 && (!bestscore || a < bestscore)) ++ bestscore = a; ++ } ++ } ++ + if (!bestscore) + continue; /* did not find a score for this group */ + +@@ -2578,6 +2588,20 @@ jobtodisablelist(Solver *solv, Id how, Id what, Queue *q) + case SOLVER_ERASE: + if (!installed) + break; ++ set = how & SOLVER_SETMASK; ++ if (!(set & (SOLVER_NOAUTOSET | SOLVER_SETARCH)) && pool->implicitobsoleteusescolors && solv->infarchrules != solv->infarchrules_end) ++ { ++ if (select == SOLVER_SOLVABLE) ++ set |= SOLVER_SETARCH; ++ else if ((select == SOLVER_SOLVABLE_NAME || select == SOLVER_SOLVABLE_PROVIDES) && ISRELDEP(what)) ++ { ++ Reldep *rd = GETRELDEP(pool, what); ++ if (rd->flags <= 7 && ISRELDEP(rd->name)) ++ rd = GETRELDEP(pool, rd->name); ++ if (rd->flags == REL_ARCH) ++ set |= SOLVER_SETARCH; ++ } ++ } + if (select == SOLVER_SOLVABLE_ALL || (select == SOLVER_SOLVABLE_REPO && what == installed->repoid)) + { + FOR_REPO_SOLVABLES(installed, p, s) +@@ -2587,6 +2611,8 @@ jobtodisablelist(Solver *solv, Id how, Id what, Queue *q) + if (pool->solvables[p].repo == installed) + { + 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 */ + #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 + diff --git a/0005-Only-disable-infarch-rules-on-erase-if-the-package-w.patch b/0005-Only-disable-infarch-rules-on-erase-if-the-package-w.patch new file mode 100644 index 0000000..0d5714a --- /dev/null +++ b/0005-Only-disable-infarch-rules-on-erase-if-the-package-w.patch @@ -0,0 +1,60 @@ +From 5dc4f81fda718df26f8f5dda343a71d34cf555b4 Mon Sep 17 00:00:00 2001 +From: Michael Schroeder +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 + diff --git a/libsolv.spec b/libsolv.spec index c62854c..ca95ebf 100644 --- a/libsolv.spec +++ b/libsolv.spec @@ -22,11 +22,11 @@ %define __cmake_switch(b:) %[%{expand:%%{?with_%{-b*}}} ? "ON" : "OFF"] Name: lib%{libname} -Version: 0.7.22 +Version: 0.7.24 Release: %autorelease Summary: Package dependency solver -License: BSD +License: BSD-3-Clause URL: https://github.com/openSUSE/libsolv Source: %{url}/archive/%{version}/%{name}-%{version}.tar.gz @@ -124,6 +124,13 @@ Python bindings for the %{name} library. Python 3 version. %endif +%patchlist +0001-Treat-condition-both-as-positive-and-negative-litera.patch +0002-Add-testcase-for-last-commit.patch +0003-Add-feature-complex_deps-to-ifelse_rec.t-testcase.patch +0004-Allow-to-break-arch-lock-step-on-erase-operations.patch +0005-Only-disable-infarch-rules-on-erase-if-the-package-w.patch + %prep %autosetup -p1