Backport couple of patches from upstream

Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
This commit is contained in:
Igor Gnatenko 2016-07-20 14:22:34 +02:00
parent 65d7859081
commit 71e9491cb0
5 changed files with 149 additions and 3 deletions

View File

@ -0,0 +1,31 @@
From cfd34d63f0884b32603cdbf91c3dc952b7b35948 Mon Sep 17 00:00:00 2001
From: Michael Schroeder <mls@suse.de>
Date: Tue, 12 Jul 2016 14:14:20 +0200
Subject: [PATCH] Also look at the arch when sorting obsoleters
---
src/transaction.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/transaction.c b/src/transaction.c
index ffe1ec2..9a32966 100644
--- a/src/transaction.c
+++ b/src/transaction.c
@@ -56,6 +56,14 @@ obsq_sortcmp(const void *ap, const void *bp, void *dp)
r = pool_evrcmp(pool, oas->evr, obs->evr, EVRCMP_COMPARE);
if (r)
return -r; /* highest version first */
+ if (oas->arch != obs->arch)
+ {
+ /* bring same arch to front */
+ if (oas->arch == s->arch)
+ return -1;
+ if (obs->arch == s->arch)
+ return 1;
+ }
return oa - ob;
}
--
2.7.4

View File

@ -1,7 +1,7 @@
From 4e245d61daa731ebab0ac7e0f7bd87ba6c63f116 Mon Sep 17 00:00:00 2001
From: Michael Schroeder <mls@suse.de>
Date: Tue, 14 Jun 2016 13:15:40 +0200
Subject: [PATCH] Change cleandeps code so that it keeps all providers
Subject: [PATCH 1/2] Change cleandeps code so that it keeps all providers
It will report less unneeded packages, but it will also not
erase the wrong providers.

View File

@ -0,0 +1,53 @@
From 488688b06ceab6c6ab44e5649d1f1db272e7bb28 Mon Sep 17 00:00:00 2001
From: Michael Schroeder <mls@suse.de>
Date: Wed, 20 Jul 2016 13:37:39 +0200
Subject: [PATCH] Take lockstep into account when calculating unneeded packages
---
src/rules.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/src/rules.c b/src/rules.c
index 797916f..aa90b5f 100644
--- a/src/rules.c
+++ b/src/rules.c
@@ -4388,6 +4388,36 @@ solver_createcleandepsmap(Solver *solv, Map *cleandepsmap, int unneeded)
#ifdef CLEANDEPSDEBUG
printf("adding back %s\n", pool_solvable2str(pool, s));
#endif
+ if (s->repo == installed && pool->implicitobsoleteusescolors)
+ {
+ Id a, bestarch = 0;
+ FOR_PROVIDES(p, pp, s->name)
+ {
+ Solvable *ps = pool->solvables + p;
+ if (ps->name != s->name || ps->repo == installed)
+ continue;
+ a = ps->arch;
+ a = (a <= pool->lastarch) ? pool->id2arch[a] : 0;
+ if (a && a != 1 && (!bestarch || a < bestarch))
+ bestarch = a;
+ }
+ if (bestarch && (s->arch > pool->lastarch || pool->id2arch[s->arch] != bestarch))
+ {
+ FOR_PROVIDES(p, pp, s->name)
+ {
+ Solvable *ps = pool->solvables + p;
+ if (ps->repo == installed && ps->name == s->name && ps->evr == s->evr && ps->arch != s->arch && ps->arch < pool->lastarch && pool->id2arch[ps->arch] == bestarch)
+ if (!MAPTST(&im, p))
+ {
+#ifdef CLEANDEPSDEBUG
+ printf("%s lockstep %s\n", pool_solvid2str(pool, ip), pool_solvid2str(pool, p));
+#endif
+ MAPSET(&im, p);
+ queue_push(&iq, p);
+ }
+ }
+ }
+ }
if (s->requires)
{
reqp = s->repo->idarraydata + s->requires;
--
2.7.4

View File

@ -0,0 +1,50 @@
From b2fd114deaad01295b42a601ea66074fe8028a5c Mon Sep 17 00:00:00 2001
From: Michael Schroeder <mls@suse.de>
Date: Tue, 14 Jun 2016 14:51:22 +0200
Subject: [PATCH 2/2] Improve last commit so that self-providing requires don't
pull in other providers
---
src/rules.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/src/rules.c b/src/rules.c
index 07c293a..797916f 100644
--- a/src/rules.c
+++ b/src/rules.c
@@ -3870,6 +3870,8 @@ complex_cleandeps_addback(Pool *pool, Id ip, Id req, Map *im, Map *installedm, Q
if (!MAPTST(installedm, -p))
break;
}
+ else if (p == ip)
+ break;
}
if (!p)
{
@@ -4399,6 +4401,11 @@ solver_createcleandepsmap(Solver *solv, Map *cleandepsmap, int unneeded)
}
#endif
FOR_PROVIDES(p, pp, req)
+ if (p == ip)
+ break;
+ if (p)
+ continue;
+ FOR_PROVIDES(p, pp, req)
{
if (MAPTST(&im, p))
continue;
@@ -4430,6 +4437,11 @@ solver_createcleandepsmap(Solver *solv, Map *cleandepsmap, int unneeded)
}
#endif
FOR_PROVIDES(p, pp, req)
+ if (p == ip)
+ break;
+ if (p)
+ continue;
+ FOR_PROVIDES(p, pp, req)
{
if (MAPTST(&im, p))
continue;
--
2.7.4

View File

@ -53,15 +53,24 @@
Name: lib%{libname}
Version: 0.6.22
Release: 2%{?dist}
Release: 3%{?dist}
Summary: Package dependency solver
License: BSD
URL: https://github.com/openSUSE/libsolv
Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
# https://github.com/openSUSE/libsolv/commit/4e245d61daa731ebab0ac7e0f7bd87ba6c63f116
# Backported patches
# do not remove "unneeded" packages even something another provides required thing
# (broken case for 3rd shitty-rpms)
Patch0001: 0001-Change-cleandeps-code-so-that-it-keeps-all-providers.patch
Patch0002: 0002-Improve-last-commit-so-that-self-providing-requires-.patch
# when obsoleting packages - prefer same architecture
# (as we don't use %{?isa} for Obsoletes)
Patch0002: 0001-Also-look-at-the-arch-when-sorting-obsoleters.patch
# Don't show "unneded" packages after enforced multilib lockstep
Patch0003: 0001-Take-lockstep-into-account-when-calculating-unneeded.patch
BuildRequires: cmake
BuildRequires: gcc-c++
@ -310,6 +319,9 @@ popd
%endif
%changelog
* Wed Jul 20 2016 Igor Gnatenko <ignatenko@redhat.com> - 0.6.22-3
- Backport couple of patches from upstream
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.6.22-2
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages