Backport fixes for autouninstall
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
This commit is contained in:
parent
7f087029b7
commit
d6b7b25161
28
0001-Fix-off-by-one-error-in-the-oneof-parsing-code.patch
Normal file
28
0001-Fix-off-by-one-error-in-the-oneof-parsing-code.patch
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
From b3fa58877a2fa34dc594ba8ce4e3d8f16c0ce5b0 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Michael Schroeder <mls@suse.de>
|
||||||
|
Date: Thu, 22 Nov 2018 12:02:00 +0100
|
||||||
|
Subject: [PATCH 1/4] Fix off-by-one error in the "oneof" parsing code
|
||||||
|
|
||||||
|
Fixes issue#289
|
||||||
|
|
||||||
|
(cherry picked from commit 0302dce36cb5066a5c818d616a047dc93cfd025d)
|
||||||
|
---
|
||||||
|
ext/testcase.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/ext/testcase.c b/ext/testcase.c
|
||||||
|
index ffc8b8ae..469218d3 100644
|
||||||
|
--- a/ext/testcase.c
|
||||||
|
+++ b/ext/testcase.c
|
||||||
|
@@ -1071,7 +1071,7 @@ testcase_str2job(Pool *pool, const char *str, Id *whatp)
|
||||||
|
Queue q;
|
||||||
|
job |= SOLVER_SOLVABLE_ONE_OF;
|
||||||
|
queue_init(&q);
|
||||||
|
- if (npieces > 3 && strcmp(pieces[2], "nothing") != 0)
|
||||||
|
+ if (npieces > 2 && strcmp(pieces[2], "nothing") != 0)
|
||||||
|
{
|
||||||
|
for (i = 2; i < npieces; i++)
|
||||||
|
{
|
||||||
|
--
|
||||||
|
2.19.2
|
||||||
|
|
46
0002-Do-not-auto-erase-disabled-packages.patch
Normal file
46
0002-Do-not-auto-erase-disabled-packages.patch
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
From 0cb7e546662ba7bb3d802e3b1ca4defea7f08c70 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Michael Schroeder <mls@suse.de>
|
||||||
|
Date: Fri, 30 Nov 2018 14:28:59 +0100
|
||||||
|
Subject: [PATCH 2/4] Do not auto-erase disabled packages
|
||||||
|
|
||||||
|
(cherry picked from commit 581a11d3eaef9977344ea524e0290d59acdf9114)
|
||||||
|
---
|
||||||
|
src/problems.c | 2 ++
|
||||||
|
test/testcases/allowuninstall/conflict.t | 12 ++++++++++++
|
||||||
|
2 files changed, 14 insertions(+)
|
||||||
|
create mode 100644 test/testcases/allowuninstall/conflict.t
|
||||||
|
|
||||||
|
diff --git a/src/problems.c b/src/problems.c
|
||||||
|
index df751c4f..68ff61d7 100644
|
||||||
|
--- a/src/problems.c
|
||||||
|
+++ b/src/problems.c
|
||||||
|
@@ -249,6 +249,8 @@ solver_autouninstall(Solver *solv, int start)
|
||||||
|
Rule *r;
|
||||||
|
if (m && !MAPTST(m, v - solv->updaterules))
|
||||||
|
continue;
|
||||||
|
+ if (pool->considered && !MAPTST(pool->considered, solv->installed->start + (v - solv->updaterules)))
|
||||||
|
+ continue; /* do not uninstalled disabled packages */
|
||||||
|
/* 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)
|
||||||
|
diff --git a/test/testcases/allowuninstall/conflict.t b/test/testcases/allowuninstall/conflict.t
|
||||||
|
new file mode 100644
|
||||||
|
index 00000000..8dc8024b
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/test/testcases/allowuninstall/conflict.t
|
||||||
|
@@ -0,0 +1,12 @@
|
||||||
|
+repo system 0 testtags <inline>
|
||||||
|
+#>=Pkg: a 1 1 noarch
|
||||||
|
+#>=Con: b
|
||||||
|
+repo available 0 testtags <inline>
|
||||||
|
+#>=Pkg: b 1 1 noarch
|
||||||
|
+
|
||||||
|
+system x86_64 rpm system
|
||||||
|
+solverflags allowuninstall
|
||||||
|
+disable pkg a-1-1.noarch@system
|
||||||
|
+job install name b
|
||||||
|
+result transaction,problems <inline>
|
||||||
|
+
|
||||||
|
--
|
||||||
|
2.19.2
|
||||||
|
|
25
0003-Note-to-self-do-not-commit-unfinished-test-cases.patch
Normal file
25
0003-Note-to-self-do-not-commit-unfinished-test-cases.patch
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
From 81ea154b8af63614ed1eb63bd86de8da9d02a1df Mon Sep 17 00:00:00 2001
|
||||||
|
From: Michael Schroeder <mls@suse.de>
|
||||||
|
Date: Fri, 30 Nov 2018 14:35:16 +0100
|
||||||
|
Subject: [PATCH 3/4] Note to self: do not commit unfinished test cases...
|
||||||
|
|
||||||
|
(cherry picked from commit 1052e5cd4860d4d88227ae8d8363f0de933894df)
|
||||||
|
---
|
||||||
|
test/testcases/allowuninstall/conflict.t | 4 +++-
|
||||||
|
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/test/testcases/allowuninstall/conflict.t b/test/testcases/allowuninstall/conflict.t
|
||||||
|
index 8dc8024b..a66d3227 100644
|
||||||
|
--- a/test/testcases/allowuninstall/conflict.t
|
||||||
|
+++ b/test/testcases/allowuninstall/conflict.t
|
||||||
|
@@ -9,4 +9,6 @@ solverflags allowuninstall
|
||||||
|
disable pkg a-1-1.noarch@system
|
||||||
|
job install name b
|
||||||
|
result transaction,problems <inline>
|
||||||
|
-
|
||||||
|
+#>problem a658cbaf info package a-1-1.noarch conflicts with b provided by b-1-1.noarch
|
||||||
|
+#>problem a658cbaf solution 567aa15d erase a-1-1.noarch@system
|
||||||
|
+#>problem a658cbaf solution e98e1a37 deljob install name b
|
||||||
|
--
|
||||||
|
2.19.2
|
||||||
|
|
@ -0,0 +1,79 @@
|
|||||||
|
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
|
||||||
|
|
11
libsolv.spec
11
libsolv.spec
@ -40,13 +40,19 @@
|
|||||||
|
|
||||||
Name: lib%{libname}
|
Name: lib%{libname}
|
||||||
Version: 0.7.1
|
Version: 0.7.1
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
Summary: Package dependency solver
|
Summary: Package dependency solver
|
||||||
|
|
||||||
License: BSD
|
License: BSD
|
||||||
URL: https://github.com/openSUSE/libsolv
|
URL: https://github.com/openSUSE/libsolv
|
||||||
Source: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
|
Source: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
|
||||||
|
|
||||||
|
# Backports from upstream
|
||||||
|
Patch0001: 0001-Fix-off-by-one-error-in-the-oneof-parsing-code.patch
|
||||||
|
Patch0002: 0002-Do-not-auto-erase-disabled-packages.patch
|
||||||
|
Patch0003: 0003-Note-to-self-do-not-commit-unfinished-test-cases.patch
|
||||||
|
Patch0004: 0004-Do-not-autouninstall-packages-because-of-forcebest-u.patch
|
||||||
|
|
||||||
BuildRequires: cmake
|
BuildRequires: cmake
|
||||||
BuildRequires: gcc-c++
|
BuildRequires: gcc-c++
|
||||||
BuildRequires: ninja-build
|
BuildRequires: ninja-build
|
||||||
@ -288,6 +294,9 @@ Python 3 version.
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Nov 30 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org - 0.7.1-2
|
||||||
|
- Backport fixes for autouninstall
|
||||||
|
|
||||||
* Wed Oct 31 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.7.1-1
|
* Wed Oct 31 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.7.1-1
|
||||||
- Update to 0.7.1
|
- Update to 0.7.1
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user