Backport upstream patches

This commit is contained in:
Michal Luscon 2015-10-14 15:18:51 +02:00
parent 002aecb3c9
commit 29e11eeefc
7 changed files with 352 additions and 1 deletions

View File

@ -0,0 +1,55 @@
From 364c90b0d551d1b4b30a4a8de85e7652ff8ac697 Mon Sep 17 00:00:00 2001
From: Michael Schroeder <mls@suse.de>
Date: Tue, 13 Oct 2015 10:36:58 +0200
Subject: [PATCH 1/6] Simplify solver_addduprules a bit
---
src/rules.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/rules.c b/src/rules.c
index ead78d6..480e052 100644
--- a/src/rules.c
+++ b/src/rules.c
@@ -1796,6 +1796,7 @@ void
solver_addduprules(Solver *solv, Map *addedmap)
{
Pool *pool = solv->pool;
+ Repo *installed = solv->installed;
Id p, pp;
Solvable *s, *ps;
int first, i;
@@ -1818,11 +1819,11 @@ solver_addduprules(Solver *solv, Map *addedmap)
break;
if (!MAPTST(&solv->dupinvolvedmap, p))
continue;
- if (solv->installed && ps->repo == solv->installed)
+ if (installed && ps->repo == installed)
{
if (!solv->updatemap.size)
- map_grow(&solv->updatemap, solv->installed->end - solv->installed->start);
- MAPSET(&solv->updatemap, p - solv->installed->start);
+ map_grow(&solv->updatemap, installed->end - installed->start);
+ MAPSET(&solv->updatemap, p - installed->start);
if (!MAPTST(&solv->dupmap, p))
{
Id ip, ipp;
@@ -1835,12 +1836,12 @@ solver_addduprules(Solver *solv, Map *addedmap)
if (is->evr == ps->evr && solvable_identical(ps, is))
break;
}
- if (!ip && solv->dupmap_all && solv->keep_orphans)
+ if (!ip && solv->keep_orphans)
{
/* is this an orphan we should keep? */
- Rule *r = solv->rules + solv->featurerules + (p - solv->installed->start);
+ Rule *r = solv->rules + solv->featurerules + (p - installed->start);
if (!r->p)
- r = solv->rules + solv->updaterules + (p - solv->installed->start);
+ r += solv->updaterules - solv->featurerules;
if (r->p == p && !r->d)
ip = p;
}
--
2.4.3

View File

@ -0,0 +1,26 @@
From 03d4ab0de755a1d20443be70f629f9b0eb3616fa Mon Sep 17 00:00:00 2001
From: Michael Schroeder <mls@suse.de>
Date: Tue, 13 Oct 2015 13:22:14 +0200
Subject: [PATCH 2/6] Drop inline from solver_addtodupmaps
The compiler knows best...
---
src/rules.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/rules.c b/src/rules.c
index 480e052..cb45098 100644
--- a/src/rules.c
+++ b/src/rules.c
@@ -1623,7 +1623,7 @@ add_cleandeps_package(Solver *solv, Id p)
queue_pushunique(solv->cleandeps_updatepkgs, p);
}
-static inline void
+static void
solver_addtodupmaps(Solver *solv, Id p, Id how, int targeted)
{
Pool *pool = solv->pool;
--
2.4.3

View File

@ -0,0 +1,61 @@
From 8daeacc77ee255e997fe8c9c5ab026435853a0e0 Mon Sep 17 00:00:00 2001
From: Michael Schroeder <mls@suse.de>
Date: Tue, 13 Oct 2015 13:24:49 +0200
Subject: [PATCH 3/6] Rename hasdupjobs to needduprules
---
src/solver.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/solver.c b/src/solver.c
index 87b6c45..c7b21d9 100644
--- a/src/solver.c
+++ b/src/solver.c
@@ -3361,7 +3361,7 @@ solver_solve(Solver *solv, Queue *job)
Solvable *s;
Rule *r;
int now, solve_start;
- int hasdupjob = 0;
+ int needduprules = 0;
int hasbestinstalljob = 0;
solve_start = solv_timems(0);
@@ -3633,7 +3633,7 @@ solver_solve(Solver *solv, Queue *job)
solv->bestupdatemap_all = 1;
}
if (!solv->dupmap_all || solv->allowuninstall || solv->allowuninstall_all || solv->allowuninstallmap.size)
- hasdupjob = 1;
+ needduprules = 1;
break;
default:
break;
@@ -3688,7 +3688,7 @@ solver_solve(Solver *solv, Queue *job)
/* create dup maps if needed. We need the maps early to create our
* update rules */
- if (hasdupjob)
+ if (needduprules)
solver_createdupmaps(solv);
/*
@@ -3979,7 +3979,7 @@ solver_solve(Solver *solv, Queue *job)
else
solv->infarchrules = solv->infarchrules_end = solv->nrules;
- if (hasdupjob)
+ if (needduprules)
solver_addduprules(solv, &addedmap);
else
solv->duprules = solv->duprules_end = solv->nrules;
@@ -3989,7 +3989,7 @@ solver_solve(Solver *solv, Queue *job)
else
solv->bestrules = solv->bestrules_end = solv->nrules;
- if (hasdupjob)
+ if (needduprules)
solver_freedupmaps(solv); /* no longer needed */
if (solv->do_yum_obsoletes)
--
2.4.3

View File

@ -0,0 +1,25 @@
From e8ffe5ad6549242908b666f352cf1f59d37c023c Mon Sep 17 00:00:00 2001
From: Michael Schroeder <mls@suse.de>
Date: Tue, 13 Oct 2015 13:28:56 +0200
Subject: [PATCH 4/6] Fix typo in comment
---
src/linkedpkg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/linkedpkg.c b/src/linkedpkg.c
index c5adc9a..7575b0d 100644
--- a/src/linkedpkg.c
+++ b/src/linkedpkg.c
@@ -21,7 +21,7 @@
*
* product:
* created from product data in the repository (which is generated from files
- * in /etc/products.d. In the future we may switch to using product()
+ * in /etc/products.d). In the future we may switch to using product()
* provides of packages.
*
* pattern:
--
2.4.3

View File

@ -0,0 +1,133 @@
From ac0801c908fb25c8d9d1384470c26d6ffc991c3d Mon Sep 17 00:00:00 2001
From: Michael Schroeder <mls@suse.de>
Date: Wed, 14 Oct 2015 11:12:53 +0200
Subject: [PATCH 5/6] Speed up choice rule generation
Reduce the amount of package filtering calls. Brings down the choice
rule creation time from 18ms to 8ms on my system.
---
src/rules.c | 68 ++++++++++++++++++++++++++++++++++++++++---------------------
1 file changed, 45 insertions(+), 23 deletions(-)
diff --git a/src/rules.c b/src/rules.c
index cb45098..97ccc6e 100644
--- a/src/rules.c
+++ b/src/rules.c
@@ -2833,32 +2833,51 @@ solver_rule2rules(Solver *solv, Id rid, Queue *q, int recursive)
/* check if the newest versions of pi still provides the dependency we're looking for */
static int
-solver_choicerulecheck(Solver *solv, Id pi, Rule *r, Map *m)
+solver_choicerulecheck(Solver *solv, Id pi, Rule *r, Map *m, Queue *q)
{
Pool *pool = solv->pool;
Rule *ur;
- Queue q;
- Id p, pp, qbuf[32];
+ Id p, pp;
int i;
- ur = solv->rules + solv->updaterules + (pi - pool->installed->start);
- if (!ur->p)
- ur = solv->rules + solv->featurerules + (pi - pool->installed->start);
- if (!ur->p)
- return 0;
- queue_init_buffer(&q, qbuf, sizeof(qbuf)/sizeof(*qbuf));
- FOR_RULELITERALS(p, pp, ur)
- if (p > 0)
- queue_push(&q, p);
- if (q.count > 1)
- policy_filter_unwanted(solv, &q, POLICY_MODE_CHOOSE);
- for (i = 0; i < q.count; i++)
- if (MAPTST(m, q.elements[i]))
- break;
- /* 1: none of the newest versions provide it */
- i = i == q.count ? 1 : 0;
- queue_free(&q);
- return i;
+ if (!q->count || q->elements[0] != pi)
+ {
+ if (q->count)
+ queue_empty(q);
+ ur = solv->rules + solv->updaterules + (pi - pool->installed->start);
+ if (!ur->p)
+ ur = solv->rules + solv->featurerules + (pi - pool->installed->start);
+ if (!ur->p)
+ return 0;
+ queue_push2(q, pi, 0);
+ FOR_RULELITERALS(p, pp, ur)
+ if (p > 0)
+ queue_push(q, p);
+ }
+ if (q->count == 2)
+ return 1;
+ if (q->count == 3)
+ {
+ p = q->elements[2];
+ return MAPTST(m, p) ? 0 : 1;
+ }
+ if (!q->elements[1])
+ {
+ for (i = 2; i < q->count; i++)
+ if (!MAPTST(m, q->elements[i]))
+ break;
+ if (i == q->count)
+ return 0; /* all provide it, no need to filter */
+ /* some don't provide it, have to filter */
+ queue_deleten(q, 0, 2);
+ policy_filter_unwanted(solv, q, POLICY_MODE_CHOOSE);
+ queue_unshift(q, 1); /* filter mark */
+ queue_unshift(q, pi);
+ }
+ for (i = 2; i < q->count; i++)
+ if (MAPTST(m, q->elements[i]))
+ return 0; /* at least one provides it */
+ return 1; /* none of the new packages provided it */
}
static inline void
@@ -2883,7 +2902,7 @@ solver_addchoicerules(Solver *solv)
Pool *pool = solv->pool;
Map m, mneg;
Rule *r;
- Queue q, qi;
+ Queue q, qi, qcheck;
int i, j, rid, havechoice;
Id p, d, pp;
Id p2, pp2;
@@ -2902,6 +2921,7 @@ solver_addchoicerules(Solver *solv)
solv->choicerules_ref = solv_calloc(solv->pkgrules_end, sizeof(Id));
queue_init(&q);
queue_init(&qi);
+ queue_init(&qcheck);
map_init(&m, pool->nsolvables);
map_init(&mneg, pool->nsolvables);
/* set up negative assertion map from infarch and dup rules */
@@ -3019,7 +3039,7 @@ solver_addchoicerules(Solver *solv)
p2 = qi.elements[i];
if (!p2)
continue;
- if (solver_choicerulecheck(solv, p2, r, &m))
+ if (solver_choicerulecheck(solv, p2, r, &m, &qcheck))
{
/* oops, remove element p from q */
queue_removeelement(&q, qi.elements[i + 1]);
@@ -3028,6 +3048,7 @@ solver_addchoicerules(Solver *solv)
qi.elements[j++] = p2;
}
queue_truncate(&qi, j);
+
if (!q.count || !qi.count)
{
FOR_RULELITERALS(p, pp, r)
@@ -3099,6 +3120,7 @@ solver_addchoicerules(Solver *solv)
}
queue_free(&q);
queue_free(&qi);
+ queue_free(&qcheck);
map_free(&m);
map_free(&mneg);
solv->choicerules_end = solv->nrules;
--
2.4.3

View File

@ -0,0 +1,41 @@
From 8542225bad5c1616b4ebe1ab78a6bf320726afd9 Mon Sep 17 00:00:00 2001
From: Michael Schroeder <mls@suse.de>
Date: Wed, 14 Oct 2015 14:30:46 +0200
Subject: [PATCH 6/6] Make keep_orphans also keep multiversion orphans
installed
Also make keep_orphanse add multiversion orphans to the
update rule, thus enforcing that they stay installed.
---
src/rules.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/rules.c b/src/rules.c
index 97ccc6e..381cb22 100644
--- a/src/rules.c
+++ b/src/rules.c
@@ -1302,6 +1302,8 @@ solver_addupdaterule(Solver *solv, Solvable *s, int allow_all)
if (j == 0 && p == -SYSTEMSOLVABLE && solv->dupmap_all)
{
queue_push(&solv->orphaned, s - pool->solvables); /* also treat as orphaned */
+ if (solv->keep_orphans && !(solv->droporphanedmap_all || (solv->droporphanedmap.size && MAPTST(&solv->droporphanedmap, s - pool->solvables - solv->installed->start))))
+ p = s - pool->solvables; /* keep this orphaned package installed */
j = qs.count;
}
qs.count = j;
@@ -1844,6 +1846,12 @@ solver_addduprules(Solver *solv, Map *addedmap)
r += solv->updaterules - solv->featurerules;
if (r->p == p && !r->d)
ip = p;
+ else if (solv->dupmap_all && solv->multiversion.size)
+ {
+ r = solv->rules + solv->updaterules + (p - solv->installed->start);
+ if (r->p == p)
+ ip = p;
+ }
}
if (!ip)
solver_addrule(solv, -p, 0, 0); /* no match, sorry */
--
2.4.3

View File

@ -30,7 +30,7 @@
Name: libsolv
Version: 0.6.14
Release: 1%{?dist}
Release: 2%{?dist}
License: BSD
Url: https://github.com/openSUSE/libsolv
Source: https://github.com/openSUSE/libsolv/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
@ -40,6 +40,13 @@ Patch1: 0001-Move-allowuninstall-map-creation.patch
Patch2: 0002-Prefer-to-autouninstall-orphans.patch
Patch3: 0003-Check-keep_orphans-flag-in-solver_addduprules.patch
Patch4: 0004-Fix-spelling-duh.patch
Patch5: 0001-Simplify-solver_addduprules-a-bit.patch
Patch6: 0002-Drop-inline-from-solver_addtodupmaps.patch
Patch7: 0003-Rename-hasdupjobs-to-needduprules.patch
Patch8: 0004-Fix-typo-in-comment.patch
Patch9: 0005-Speed-up-choice-rule-generation.patch
Patch10: 0006-Make-keep_orphans-also-keep-multiversion-orphans-ins.patch
BuildRequires: git-core
Group: Development/Libraries
@ -229,6 +236,9 @@ make ARGS="-V" test
%endif
%changelog
* Wed Oct 14 2015 Michal Luscon <mluscon@redhat.com> - 0.6.14-2
- Backport patches from upstream
* Mon Oct 12 2015 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 0.6.14-1
- Update to 0.6.14
- Backport patches from upstream