Update to 0.7.7

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
This commit is contained in:
Igor Gnatenko 2019-10-19 10:21:52 +02:00
parent 60f4ec4304
commit 65707fea93
No known key found for this signature in database
GPG Key ID: 695714BD1BBC5F4C
6 changed files with 7 additions and 394 deletions

1
.gitignore vendored
View File

@ -49,3 +49,4 @@
/libsolv-0.7.4.tar.gz /libsolv-0.7.4.tar.gz
/libsolv-0.7.5.tar.gz /libsolv-0.7.5.tar.gz
/libsolv-0.7.6.tar.gz /libsolv-0.7.6.tar.gz
/libsolv-0.7.7.tar.gz

View File

@ -1,224 +0,0 @@
From bfdc347fdfc350a9b290543fac905cb21f9a71a8 Mon Sep 17 00:00:00 2001
From: Michael Schroeder <mls@suse.de>
Date: Mon, 30 Sep 2019 14:35:57 +0200
Subject: [PATCH] Add POOL_FLAG_WHATPROVIDESWITHDISABLED pool flag
This makes libsolv keep disabled packages (i.e. packages
not in the considered map) in the whatprovides hash.
It is useful if you want to modify the considered map after
the whatprovides hash is generated.
Note that using the flag will change the reported problems
as disabled packages are now seen by the solver but
considered uninstallable.
---
ext/testcase.c | 1 +
src/policy.c | 2 ++
src/pool.c | 16 +++++++++-------
src/pool.h | 2 ++
src/repo.h | 20 ++++++++++++++++++++
src/rules.c | 22 ++++++++++++++++++++++
6 files changed, 56 insertions(+), 7 deletions(-)
diff --git a/ext/testcase.c b/ext/testcase.c
index fcebcfa..bd0643a 100644
--- a/ext/testcase.c
+++ b/ext/testcase.c
@@ -152,6 +152,7 @@ static struct poolflags2str {
{ POOL_FLAG_NOOBSOLETESMULTIVERSION, "noobsoletesmultiversion", 0 },
{ POOL_FLAG_ADDFILEPROVIDESFILTERED, "addfileprovidesfiltered", 0 },
{ POOL_FLAG_NOWHATPROVIDESAUX, "nowhatprovidesaux", 0 },
+ { POOL_FLAG_WHATPROVIDESWITHDISABLED, "whatprovideswithdisabled", 0 },
{ 0, 0, 0 }
};
diff --git a/src/policy.c b/src/policy.c
index 823a008..10a2c4d 100644
--- a/src/policy.c
+++ b/src/policy.c
@@ -1579,6 +1579,8 @@ policy_findupdatepackages(Solver *solv, Solvable *s, Queue *qs, int allow_all)
continue;
ps = pool->solvables + p;
+ if (pool->considered && pool->whatprovideswithdisabled && ps->repo != pool->installed && pool_disabled_solvable(pool, ps))
+ continue;
if (s->name == ps->name) /* name match */
{
if (pool->implicitobsoleteusescolors && !pool_colormatch(pool, s, ps))
diff --git a/src/pool.c b/src/pool.c
index 4b63727..d2053b9 100644
--- a/src/pool.c
+++ b/src/pool.c
@@ -202,6 +202,8 @@ pool_get_flag(Pool *pool, int flag)
return pool->addfileprovidesfiltered;
case POOL_FLAG_NOWHATPROVIDESAUX:
return pool->nowhatprovidesaux;
+ case POOL_FLAG_WHATPROVIDESWITHDISABLED:
+ return pool->whatprovideswithdisabled;
default:
break;
}
@@ -247,6 +249,9 @@ pool_set_flag(Pool *pool, int flag, int value)
case POOL_FLAG_NOWHATPROVIDESAUX:
pool->nowhatprovidesaux = value;
break;
+ case POOL_FLAG_WHATPROVIDESWITHDISABLED:
+ pool->whatprovideswithdisabled = value;
+ break;
default:
break;
}
@@ -473,9 +478,7 @@ pool_createwhatprovides(Pool *pool)
s = pool->solvables + i;
if (!s->provides || !s->repo || s->repo->disabled)
continue;
- /* we always need the installed solvable in the whatprovides data,
- otherwise obsoletes/conflicts on them won't work */
- if (s->repo != installed && !pool_installable(pool, s))
+ if (!pool_installable_whatprovides(pool, s))
continue;
pp = s->repo->idarraydata + s->provides;
while ((id = *pp++) != 0)
@@ -534,9 +537,8 @@ pool_createwhatprovides(Pool *pool)
s = pool->solvables + i;
if (!s->provides || !s->repo || s->repo->disabled)
continue;
- if (s->repo != installed && !pool_installable(pool, s))
+ if (!pool_installable_whatprovides(pool, s))
continue;
-
/* for all provides of this solvable */
pp = s->repo->idarraydata + s->provides;
while ((id = *pp++) != 0)
@@ -963,7 +965,7 @@ pool_addstdproviders(Pool *pool, Id d)
* and those should not use filelist entries */
if (s->repo->disabled)
continue;
- if (s->repo != pool->installed && !pool_installable(pool, s))
+ if (!pool_installable_whatprovides(pool, s))
continue;
queue_push(&q, di.solvid);
}
@@ -1243,7 +1245,7 @@ pool_addrelproviders(Pool *pool, Id d)
FOR_POOL_SOLVABLES(p)
{
Solvable *s = pool->solvables + p;
- if (s->repo != pool->installed && !pool_installable(pool, s))
+ if (!pool_installable_whatprovides(pool, s))
continue;
if (s->arch == evr)
queue_push(&plist, p);
diff --git a/src/pool.h b/src/pool.h
index c90c29a..aa173ea 100644
--- a/src/pool.h
+++ b/src/pool.h
@@ -166,6 +166,7 @@ struct s_Pool {
Id *whatprovidesauxdata;
Offset whatprovidesauxdataoff;
+ int whatprovideswithdisabled;
#endif
};
@@ -204,6 +205,7 @@ struct s_Pool {
#define POOL_FLAG_ADDFILEPROVIDESFILTERED 9
#define POOL_FLAG_IMPLICITOBSOLETEUSESCOLORS 10
#define POOL_FLAG_NOWHATPROVIDESAUX 11
+#define POOL_FLAG_WHATPROVIDESWITHDISABLED 12
/* ----------------------------------------------- */
diff --git a/src/repo.h b/src/repo.h
index 58704f1..9a5e981 100644
--- a/src/repo.h
+++ b/src/repo.h
@@ -123,6 +123,26 @@ static inline int pool_installable(const Pool *pool, Solvable *s)
return 1;
}
+#ifdef LIBSOLV_INTERNAL
+static inline int pool_installable_whatprovides(const Pool *pool, Solvable *s)
+{
+ /* we always need the installed solvable in the whatprovides data,
+ otherwise obsoletes/conflicts on them won't work */
+ if (s->repo != pool->installed)
+ {
+ if (s->arch == ARCH_SRC || s->arch == ARCH_NOSRC || pool_badarch_solvable(pool, s))
+ return 0;
+ if (pool->considered && !pool->whatprovideswithdisabled)
+ {
+ Id id = s - pool->solvables;
+ if (!MAPTST(pool->considered, id))
+ return 0;
+ }
+ }
+ return 1;
+}
+#endif
+
/* not in solvable.h because we need the repo definition */
static inline Solvable *solvable_free(Solvable *s, int reuseids)
{
diff --git a/src/rules.c b/src/rules.c
index 3aef6ee..4075b9d 100644
--- a/src/rules.c
+++ b/src/rules.c
@@ -3323,6 +3323,21 @@ prune_best_update(Solver *solv, Id p, Queue *q)
policy_filter_unwanted(solv, q, POLICY_MODE_RECOMMEND);
}
+static void
+prune_disabled(Pool *pool, Queue *q)
+{
+ int i, j;
+ for (i = j = 0; i < q->count; i++)
+ {
+ Id p = q->elements[i];
+ Solvable *s = pool->solvables + p;
+ if (s->repo && s->repo != pool->installed && !MAPTST(pool->considered, p))
+ continue;
+ q->elements[j++] = p;
+ }
+ queue_truncate(q, j);
+}
+
void
solver_addbestrules(Solver *solv, int havebestinstalljobs, int haslockjob)
{
@@ -3377,15 +3392,19 @@ solver_addbestrules(Solver *solv, int havebestinstalljobs, int haslockjob)
else if (p2 < 0)
queue_push(&q2, p2);
}
+ if (pool->considered && pool->whatprovideswithdisabled)
+ prune_disabled(pool, &q);
if (!q.count)
continue; /* orphaned */
/* select best packages, just look at prio and version */
oldcnt = q.count;
policy_filter_unwanted(solv, &q, POLICY_MODE_RECOMMEND);
if (q.count == oldcnt)
continue; /* nothing filtered */
if (lockedmap)
{
+ queue_insertn(&q, 0, q2.count, q2.elements);
+ queue_empty(&q2);
FOR_RULELITERALS(p2, pp2, r)
{
if (p2 <= 0)
@@ -3399,9 +3418,12 @@ solver_addbestrules(Solver *solv, int havebestinstalljobs, int haslockjob)
continue;
queue_push(&q2, p2);
}
+ if (pool->considered && pool->whatprovideswithdisabled)
+ prune_disabled(pool, &q2);
policy_filter_unwanted(solv, &q2, POLICY_MODE_RECOMMEND);
for (k = 0; k < q2.count; k++)
queue_pushunique(&q, q2.elements[k]);
+ queue_empty(&q2);
}
if (q2.count)
queue_insertn(&q, 0, q2.count, q2.elements);
--
libgit2 0.28.2

View File

@ -1,54 +0,0 @@
From 954862319e32e97b20afd0f598cd461ece320e4f Mon Sep 17 00:00:00 2001
From: Michael Schroeder <mls@suse.de>
Date: Tue, 8 Oct 2019 13:40:45 +0200
Subject: [PATCH] Fix handling of disabled installed packages in distupgrade
Such packages must not be touched, i.e. they must stay installed.
---
src/pool.c | 1 -
src/rules.c | 10 ++++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/pool.c b/src/pool.c
index d2053b9..76636a7 100644
--- a/src/pool.c
+++ b/src/pool.c
@@ -455,7 +455,6 @@ pool_createwhatprovides(Pool *pool)
Offset *whatprovides;
Id *whatprovidesdata, *dp, *whatprovidesauxdata;
Offset *whatprovidesaux;
- Repo *installed = pool->installed;
unsigned int now;
now = solv_timems(0);
diff --git a/src/rules.c b/src/rules.c
index 4075b9d..57895c0 100644
--- a/src/rules.c
+++ b/src/rules.c
@@ -1373,6 +1373,14 @@ solver_addupdaterule(Solver *solv, Solvable *s)
int dupinvolved = 0;
p = s - pool->solvables;
+
+ if (pool->considered && pool_disabled_solvable(pool, s))
+ {
+ /* disabled installed solvables must stay installed */
+ solver_addrule(solv, p, 0, 0);
+ return;
+ }
+
/* Orphan detection. We cheat by looking at the feature rule, which
* we already calculated */
r = solv->rules + solv->featurerules + (p - solv->installed->start);
@@ -2003,6 +2011,8 @@ solver_addduprules(Solver *solv, Map *addedmap)
continue;
if (installed && ps->repo == installed)
{
+ if (pool->considered && pool_disabled_solvable(pool, ps))
+ continue; /* always keep disabled installed packages */
if (!MAPTST(&solv->dupmap, p))
{
Id ip, ipp;
--
libgit2 0.28.2

View File

@ -1,110 +0,0 @@
From 7477a28ca57c9fd2df73e24a36d2a0f0734662ef Mon Sep 17 00:00:00 2001
From: Michael Schroeder <mls@suse.de>
Date: Tue, 8 Oct 2019 13:41:45 +0200
Subject: [PATCH] Add testcases for POOL_FLAG_WHATPROVIDESWITHDISABLED
---
test/testcases/whatprovideswithdisabled/dup.t | 14 ++++++++++++++
test/testcases/whatprovideswithdisabled/dup2.t | 14 ++++++++++++++
test/testcases/whatprovideswithdisabled/forcebest_in.t | 19 +++++++++++++++++++
test/testcases/whatprovideswithdisabled/forcebest_up.t | 20 ++++++++++++++++++++
4 files changed, 67 insertions(+)
create mode 100644 test/testcases/whatprovideswithdisabled/dup.t
create mode 100644 test/testcases/whatprovideswithdisabled/dup2.t
create mode 100644 test/testcases/whatprovideswithdisabled/forcebest_in.t
create mode 100644 test/testcases/whatprovideswithdisabled/forcebest_up.t
diff --git a/test/testcases/whatprovideswithdisabled/dup.t b/test/testcases/whatprovideswithdisabled/dup.t
new file mode 100644
index 0000000..825a0c4
--- /dev/null
+++ b/test/testcases/whatprovideswithdisabled/dup.t
@@ -0,0 +1,14 @@
+repo system 0 testtags <inline>
+#>=Pkg: A 1 1 noarch
+#>=Vnd: foo
+repo available 0 testtags <inline>
+#>=Pkg: A 2 1 noarch
+#>=Vnd: foo
+system i686 rpm system
+poolflags whatprovideswithdisabled
+
+disable pkg A-2-1.noarch@available
+
+job distupgrade all packages
+result transaction,problems <inline>
+
diff --git a/test/testcases/whatprovideswithdisabled/dup2.t b/test/testcases/whatprovideswithdisabled/dup2.t
new file mode 100644
index 0000000..40fe69e
--- /dev/null
+++ b/test/testcases/whatprovideswithdisabled/dup2.t
@@ -0,0 +1,14 @@
+repo system 0 testtags <inline>
+#>=Pkg: A 1 1 noarch
+#>=Vnd: foo
+repo available 0 testtags <inline>
+#>=Pkg: A 2 1 noarch
+#>=Vnd: foo
+system i686 rpm system
+poolflags whatprovideswithdisabled
+
+disable pkg A-1-1.noarch@system
+
+job distupgrade all packages
+result transaction,problems <inline>
+
diff --git a/test/testcases/whatprovideswithdisabled/forcebest_in.t b/test/testcases/whatprovideswithdisabled/forcebest_in.t
new file mode 100644
index 0000000..da5a440
--- /dev/null
+++ b/test/testcases/whatprovideswithdisabled/forcebest_in.t
@@ -0,0 +1,19 @@
+repo system 0 testtags <inline>
+#>=Pkg: D 1 1 noarch
+#>=Vnd: foo
+#>=Con: A = 3-1
+repo available 0 testtags <inline>
+#>=Pkg: A 2 1 noarch
+#>=Vnd: foo
+#>=Pkg: A 3 1 noarch
+#>=Vnd: bar
+system i686 rpm system
+
+poolflags whatprovideswithdisabled
+disable pkg A-3-1.noarch@available
+
+job install name A [forcebest]
+result transaction,problems <inline>
+#>install A-2-1.noarch@available
+
+
diff --git a/test/testcases/whatprovideswithdisabled/forcebest_up.t b/test/testcases/whatprovideswithdisabled/forcebest_up.t
new file mode 100644
index 0000000..f6f5379
--- /dev/null
+++ b/test/testcases/whatprovideswithdisabled/forcebest_up.t
@@ -0,0 +1,20 @@
+repo system 0 testtags <inline>
+#>=Pkg: A 1 1 noarch
+#>=Vnd: foo
+#>=Pkg: D 1 1 noarch
+#>=Vnd: foo
+#>=Con: A = 3-1
+repo available 0 testtags <inline>
+#>=Pkg: A 2 1 noarch
+#>=Vnd: foo
+#>=Pkg: A 3 1 noarch
+#>=Vnd: bar
+system i686 rpm system
+
+poolflags whatprovideswithdisabled
+disable pkg A-3-1.noarch@available
+
+job install name A [forcebest]
+result transaction,problems <inline>
+#>upgrade A-1-1.noarch@system A-2-1.noarch@available
+
--
libgit2 0.28.2

View File

@ -20,16 +20,13 @@
%bcond_without zstd %bcond_without zstd
Name: lib%{libname} Name: lib%{libname}
Version: 0.7.6 Version: 0.7.7
Release: 3%{?dist} Release: 1%{?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
Patch0001: 0001-Add-POOL_FLAG_WHATPROVIDESWITHDISABLED-pool-flag.patch
Patch0002: 0002-Fix-handling-of-disabled-installed-packages-in-distupgrade.patch
Patch0003: 0003-Add-testcases-for-POOL_FLAG_WHATPROVIDESWITHDISABLED.patch
BuildRequires: cmake BuildRequires: cmake
BuildRequires: gcc-c++ BuildRequires: gcc-c++
@ -279,6 +276,9 @@ Python 3 version.
%endif %endif
%changelog %changelog
* Sat Oct 19 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.7.7-1
- Update to 0.7.7
* Mon Oct 14 2019 Jaroslav Mracek <jmracek@redhat.com> - 0.7.6-3 * Mon Oct 14 2019 Jaroslav Mracek <jmracek@redhat.com> - 0.7.6-3
- Backport support of POOL_FLAG_WHATPROVIDESWITHDISABLED pool flag - Backport support of POOL_FLAG_WHATPROVIDESWITHDISABLED pool flag

View File

@ -1 +1 @@
SHA512 (libsolv-0.7.6.tar.gz) = f275545cab73fa7fcf3a4547a0a0ebd21184efccfee176e9f311023d0bf4f979efc1d2882bf6b328fd42493ca724dd8d2ff2d5fb10d1f648723910a50019eadd SHA512 (libsolv-0.7.7.tar.gz) = d357788feda66929baa8de0e6d0312905fdf2e9abefedb4d659bfc433aa7818d1e9fcd89586d38269e0182c817a2a47fb317dea35997ede0640d7ae4f3aad4cc