Compare commits

...

No commits in common. "imports/c8s/libsolv-0.7.16-1.el8" and "c8" have entirely different histories.

8 changed files with 702 additions and 106 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/libsolv-0.7.16.tar.gz
SOURCES/libsolv-0.7.20.tar.gz

View File

@ -1 +1 @@
6adefba167c60bbb282bed453bd1b9966311f91d SOURCES/libsolv-0.7.16.tar.gz
35be0bb4422af55bc8434f3c33367dbb7dc50cba SOURCES/libsolv-0.7.20.tar.gz

View File

@ -1,19 +1,17 @@
From 11eab76046e2df31248d358ab85bdbcf366d2c78 Mon Sep 17 00:00:00 2001
From: Nicola Sella <nsella@redhat.com>
Date: Wed, 11 Nov 2020 14:52:14 +0100
Subject: [PATCH 1/1] Add support for computing hashes using OpenSSL
From c56a7db62db6d62b53830f8f1af4d5a70e86d69f Mon Sep 17 00:00:00 2001
From: Jaroslav Rohel <jrohel@redhat.com>
Date: Fri, 25 Oct 2019 14:33:22 +0200
Subject: [PATCH 1/3] Add support for computing hashes using OpenSSL
It adds WITH_OPENSSL build option.
If it is ON, OpenSSL will be used instead of internal implementation
of computing hashes (MD5, SHA1, SHA224, SHA256, SHA384, SHA512).
Rebase of https://github.com/openSUSE/libsolv/commit/9839a88e4fda23b46015170b201c98da7bcdd55e
---
CMakeLists.txt | 13 +++++++++++--
src/CMakeLists.txt | 16 +++++++++++-----
src/CMakeLists.txt | 12 +++++++++---
src/chksum.c | 32 ++++++++++++++++++++++++++++++++
tools/CMakeLists.txt | 2 +-
4 files changed, 55 insertions(+), 8 deletions(-)
4 files changed, 53 insertions(+), 6 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3541f496..e73dc552 100644
@ -61,7 +59,7 @@ index 3541f496..e73dc552 100644
SET (SYSTEM_LIBRARIES ${RPMDB_LIBRARY} ${SYSTEM_LIBRARIES})
ENDIF (ENABLE_RPMDB)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index bbf30bac..ece870ee 100644
index bbf30bac..6b5ea42b 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -18,9 +18,8 @@ SET (libsolv_SRCS
@ -76,7 +74,7 @@ index bbf30bac..ece870ee 100644
SET (libsolv_HEADERS
bitmap.h evr.h hash.h policy.h poolarch.h poolvendor.h pool.h
@@ -43,14 +42,21 @@ IF (WIN32)
@@ -43,6 +42,10 @@ IF (WIN32)
LIST (APPEND libsolv_SRCS ${WIN32_COMPAT_SOURCES})
ENDIF (WIN32)
@ -87,16 +85,13 @@ index bbf30bac..ece870ee 100644
IF (HAVE_LINKER_VERSION_SCRIPT)
SET (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${LINK_FLAGS} -Wl,--version-script=${CMAKE_SOURCE_DIR}/src/libsolv.ver")
ENDIF (HAVE_LINKER_VERSION_SCRIPT)
IF (DISABLE_SHARED)
- ADD_LIBRARY (libsolv STATIC ${libsolv_SRCS})
+ ADD_LIBRARY (libsolv STATIC ${libsolv_SRCS})
@@ -51,6 +54,9 @@ IF (DISABLE_SHARED)
ADD_LIBRARY (libsolv STATIC ${libsolv_SRCS})
ELSE (DISABLE_SHARED)
- ADD_LIBRARY (libsolv SHARED ${libsolv_SRCS})
+ ADD_LIBRARY (libsolv SHARED ${libsolv_SRCS})
+ IF (WITH_OPENSSL)
+ TARGET_LINK_LIBRARIES (libsolv ${OPENSSL_CRYPTO_LIBRARY})
+ ENDIF (WITH_OPENSSL)
ADD_LIBRARY (libsolv SHARED ${libsolv_SRCS})
+ IF (WITH_OPENSSL)
+ TARGET_LINK_LIBRARIES (libsolv ${OPENSSL_CRYPTO_LIBRARY})
+ ENDIF (WITH_OPENSSL)
ENDIF (DISABLE_SHARED)
IF (WIN32)
@ -161,5 +156,5 @@ index f19030eb..d477e195 100644
ADD_EXECUTABLE (mergesolv mergesolv.c )
TARGET_LINK_LIBRARIES (mergesolv toolstuff libsolvext libsolv ${SYSTEM_LIBRARIES})
--
2.26.2
2.31.1

View File

@ -0,0 +1,311 @@
From 9b89a186e3769631b6cee859be9d69063cfdfb94 Mon Sep 17 00:00:00 2001
From: Michael Schroeder <mls@suse.de>
Date: Fri, 25 Feb 2022 16:47:21 +0100
Subject: [PATCH 2/3] Add support for storing user data in a solv file
Userdata can be arbritrary (binary)data with a maximum size of
65535 bytes. It can be read without reading the complete
solv file, but do not forget to rewind the fp after reading
the user data.
New functions:
void
void repowriter_set_userdata(Repowriter *writer, const void *data, int len)
int solv_read_userdata(FILE *fp, unsigned char **datap, int *lenp)
---
src/libsolv.ver | 2 ++
src/pooltypes.h | 6 ++++--
src/repo_solv.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++
src/repo_solv.h | 1 +
src/repo_write.c | 24 ++++++++++++++++++++-
src/repo_write.h | 3 +++
tools/dumpsolv.c | 50 ++++++++++++++++++++++++++++++++++++++++----
7 files changed, 133 insertions(+), 7 deletions(-)
diff --git a/src/libsolv.ver b/src/libsolv.ver
index ee40d0ad..4c6fbf4f 100644
--- a/src/libsolv.ver
+++ b/src/libsolv.ver
@@ -255,6 +255,7 @@ SOLV_1.0 {
repowriter_set_keyqueue;
repowriter_set_repodatarange;
repowriter_set_solvablerange;
+ repowriter_set_userdata;
repowriter_write;
selection_add;
selection_filter;
@@ -288,6 +289,7 @@ SOLV_1.0 {
solv_malloc;
solv_malloc2;
solv_oom;
+ solv_read_userdata;
solv_realloc;
solv_realloc2;
solv_replacebadutf8;
diff --git a/src/pooltypes.h b/src/pooltypes.h
index e1f77b0e..3bde155a 100644
--- a/src/pooltypes.h
+++ b/src/pooltypes.h
@@ -23,9 +23,11 @@
#define SOLV_VERSION_6 6
#define SOLV_VERSION_7 7
#define SOLV_VERSION_8 8
+#define SOLV_VERSION_9 9
-#define SOLV_FLAG_PREFIX_POOL 4
-#define SOLV_FLAG_SIZE_BYTES 8
+#define SOLV_FLAG_PREFIX_POOL 4
+#define SOLV_FLAG_SIZE_BYTES 8
+#define SOLV_FLAG_USERDATA 16
struct s_Stringpool;
typedef struct s_Stringpool Stringpool;
diff --git a/src/repo_solv.c b/src/repo_solv.c
index 761d06e6..2ba602b2 100644
--- a/src/repo_solv.c
+++ b/src/repo_solv.c
@@ -514,6 +514,7 @@ repo_add_solv(Repo *repo, FILE *fp, int flags)
switch (solvversion)
{
case SOLV_VERSION_8:
+ case SOLV_VERSION_9:
break;
default:
return pool_error(pool, SOLV_ERROR_UNSUPPORTED, "unsupported SOLV version");
@@ -552,6 +553,18 @@ repo_add_solv(Repo *repo, FILE *fp, int flags)
return pool_error(pool, SOLV_ERROR_CORRUPT, "main repository contains holes, cannot extend");
}
+ /******* Part 0: skip optional userdata ******************************/
+
+ if (solvflags & SOLV_FLAG_USERDATA)
+ {
+ unsigned int userdatalen = read_u32(&data);
+ if (userdatalen >= 65536)
+ return pool_error(pool, SOLV_ERROR_CORRUPT, "illegal userdata length");
+ while (userdatalen--)
+ if (getc(data.fp) == EOF)
+ return pool_error(pool, SOLV_ERROR_EOF, "unexpected EOF");
+ }
+
/******* Part 1: string IDs *****************************************/
sizeid = read_u32(&data); /* size of string space */
@@ -1353,3 +1366,44 @@ printf("=> %s %s %p\n", pool_id2str(pool, keys[key].name), pool_id2str(pool, key
return 0;
}
+int
+solv_read_userdata(FILE *fp, unsigned char **datap, int *lenp)
+{
+ unsigned char d[4 * 10], *ud = 0;
+ unsigned int n;
+ if (fread(d, sizeof(d), 1, fp) != 1)
+ return SOLV_ERROR_EOF;
+ n = d[0] << 24 | d[1] << 16 | d[2] << 8 | d[3];
+ if (n != ('S' << 24 | 'O' << 16 | 'L' << 8 | 'V'))
+ return SOLV_ERROR_NOT_SOLV;
+ n = d[4] << 24 | d[5] << 16 | d[6] << 8 | d[7];
+ switch(n)
+ {
+ case SOLV_VERSION_8:
+ case SOLV_VERSION_9:
+ break;
+ default:
+ return SOLV_ERROR_UNSUPPORTED;
+ }
+ n = d[32] << 24 | d[33] << 16 | d[34] << 8 | d[35];
+ if (!(n & SOLV_FLAG_USERDATA))
+ n = 0;
+ else
+ n = d[36] << 24 | d[37] << 16 | d[38] << 8 | d[39];
+ if (n >= 65536)
+ return SOLV_ERROR_CORRUPT;
+ if (n)
+ {
+ ud = solv_malloc(n + 1);
+ if (fread(ud, n, 1, fp) != 1)
+ {
+ solv_free(ud);
+ return SOLV_ERROR_EOF;
+ }
+ ud[n] = 0;
+ }
+ *datap = ud;
+ if (lenp)
+ *lenp = (int)n;
+ return 0;
+}
diff --git a/src/repo_solv.h b/src/repo_solv.h
index 0c663949..57bf1772 100644
--- a/src/repo_solv.h
+++ b/src/repo_solv.h
@@ -23,6 +23,7 @@ extern "C" {
#endif
extern int repo_add_solv(Repo *repo, FILE *fp, int flags);
+extern int solv_read_userdata(FILE *fp, unsigned char **datap, int *lenp);
#define SOLV_ADD_NO_STUBS (1 << 8)
diff --git a/src/repo_write.c b/src/repo_write.c
index af4e7599..a11de002 100644
--- a/src/repo_write.c
+++ b/src/repo_write.c
@@ -1071,6 +1071,7 @@ repowriter_create(Repo *repo)
Repowriter *
repowriter_free(Repowriter *writer)
{
+ solv_free(writer->userdata);
return solv_free(writer);
}
@@ -1107,6 +1108,17 @@ repowriter_set_solvablerange(Repowriter *writer, int solvablestart, int solvable
writer->solvableend = solvableend;
}
+void
+repowriter_set_userdata(Repowriter *writer, const void *data, int len)
+{
+ writer->userdata = solv_free(writer->userdata);
+ writer->userdatalen = 0;
+ if (len < 0 || len >= 65536)
+ return;
+ writer->userdata = len ? solv_memdup(data, len) : 0;
+ writer->userdatalen = len;
+}
+
/*
* the code works the following way:
*
@@ -1898,7 +1910,10 @@ for (i = 1; i < target.nkeys; i++)
/* write file header */
write_u32(&target, 'S' << 24 | 'O' << 16 | 'L' << 8 | 'V');
- write_u32(&target, SOLV_VERSION_8);
+ if (writer->userdatalen)
+ write_u32(&target, SOLV_VERSION_9);
+ else
+ write_u32(&target, SOLV_VERSION_8);
/* write counts */
@@ -1911,7 +1926,14 @@ for (i = 1; i < target.nkeys; i++)
solv_flags = 0;
solv_flags |= SOLV_FLAG_PREFIX_POOL;
solv_flags |= SOLV_FLAG_SIZE_BYTES;
+ if (writer->userdatalen)
+ solv_flags |= SOLV_FLAG_USERDATA;
write_u32(&target, solv_flags);
+ if (writer->userdatalen)
+ {
+ write_u32(&target, writer->userdatalen);
+ write_blob(&target, writer->userdata, writer->userdatalen);
+ }
if (nstrings)
{
diff --git a/src/repo_write.h b/src/repo_write.h
index 34716705..7734b013 100644
--- a/src/repo_write.h
+++ b/src/repo_write.h
@@ -32,6 +32,8 @@ typedef struct s_Repowriter {
int (*keyfilter)(Repo *repo, Repokey *key, void *kfdata);
void *kfdata;
Queue *keyq;
+ void *userdata;
+ int userdatalen;
} Repowriter;
/* repowriter flags */
@@ -46,6 +48,7 @@ void repowriter_set_keyfilter(Repowriter *writer, int (*keyfilter)(Repo *repo, R
void repowriter_set_keyqueue(Repowriter *writer, Queue *keyq);
void repowriter_set_repodatarange(Repowriter *writer, int repodatastart, int repodataend);
void repowriter_set_solvablerange(Repowriter *writer, int solvablestart, int solvableend);
+void repowriter_set_userdata(Repowriter *writer, const void *data, int len);
int repowriter_write(Repowriter *writer, FILE *fp);
/* convenience functions */
diff --git a/tools/dumpsolv.c b/tools/dumpsolv.c
index 13076574..49651fbe 100644
--- a/tools/dumpsolv.c
+++ b/tools/dumpsolv.c
@@ -13,6 +13,7 @@
static int with_attr;
static int dump_json;
+static int dump_userdata;
#include "pool.h"
#include "chksum.h"
@@ -394,10 +395,7 @@ int main(int argc, char **argv)
int c, i, j, n;
Solvable *s;
- pool = pool_create();
- pool_setloadcallback(pool, loadcallback, 0);
-
- while ((c = getopt(argc, argv, "haj")) >= 0)
+ while ((c = getopt(argc, argv, "uhaj")) >= 0)
{
switch(c)
{
@@ -410,11 +408,55 @@ int main(int argc, char **argv)
case 'j':
dump_json = 1;
break;
+ case 'u':
+ dump_userdata++;
+ break;
default:
usage(1);
break;
}
}
+ if (dump_userdata)
+ {
+ if (optind == argc)
+ argc++;
+ for (; optind < argc; optind++)
+ {
+ unsigned char *userdata = 0;
+ int r, userdatalen = 0;
+ if (argv[optind] && freopen(argv[optind], "r", stdin) == 0)
+ {
+ perror(argv[optind]);
+ exit(1);
+ }
+ r = solv_read_userdata(stdin, &userdata, &userdatalen);
+ if (r)
+ {
+ fprintf(stderr, "could not read userdata: error %d\n", r);
+ exit(1);
+ }
+ if (dump_userdata > 1)
+ {
+ /* dump raw */
+ if (userdatalen && fwrite(userdata, userdatalen, 1, stdout) != 1)
+ {
+ perror("fwrite");
+ exit(1);
+ }
+ }
+ else
+ {
+ for (r = 0; r < userdatalen; r++)
+ printf("%02x", userdata[r]);
+ printf("\n");
+ }
+ solv_free(userdata);
+ }
+ exit(0);
+ }
+
+ pool = pool_create();
+ pool_setloadcallback(pool, loadcallback, 0);
if (!dump_json)
pool_setdebuglevel(pool, 1);
if (dump_json)
--
2.31.1

View File

@ -0,0 +1,68 @@
From 07a1a0fd83f108a0e9b1f801b52ff2bd26722097 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
Date: Thu, 27 Jan 2022 08:38:27 +0100
Subject: [PATCH] Allow accessing toolversion at runtime and increase it
---
src/libsolv.ver | 1 +
src/solvversion.c | 1 +
src/solvversion.h.in | 3 ++-
tools/common_write.c | 1 +
4 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/libsolv.ver b/src/libsolv.ver
index 4c6fbf4f..89517f50 100644
--- a/src/libsolv.ver
+++ b/src/libsolv.ver
@@ -306,6 +306,7 @@ SOLV_1.0 {
solv_version_major;
solv_version_minor;
solv_version_patch;
+ solv_toolversion;
solvable_add_deparray;
solvable_add_idarray;
solvable_add_poolstr_array;
diff --git a/src/solvversion.c b/src/solvversion.c
index d66e1958..51d57a63 100644
--- a/src/solvversion.c
+++ b/src/solvversion.c
@@ -11,3 +11,4 @@ const char solv_version[] = LIBSOLV_VERSION_STRING;
int solv_version_major = LIBSOLV_VERSION_MAJOR;
int solv_version_minor = LIBSOLV_VERSION_MINOR;
int solv_version_patch = LIBSOLV_VERSION_PATCH;
+const char solv_toolversion[] = LIBSOLV_TOOLVERSION;
diff --git a/src/solvversion.h.in b/src/solvversion.h.in
index 43b566a1..da0ad743 100644
--- a/src/solvversion.h.in
+++ b/src/solvversion.h.in
@@ -23,6 +23,7 @@ extern const char solv_version[];
extern int solv_version_major;
extern int solv_version_minor;
extern int solv_version_patch;
+extern const char solv_toolversion[];
#cmakedefine LIBSOLV_FEATURE_LINKED_PKGS
#cmakedefine LIBSOLV_FEATURE_COMPLEX_DEPS
@@ -48,6 +49,6 @@ extern int solv_version_patch;
#cmakedefine LIBSOLVEXT_FEATURE_ZCHUNK_COMPRESSION
/* see tools/common_write.c for toolversion history */
-#define LIBSOLV_TOOLVERSION "1.1"
+#define LIBSOLV_TOOLVERSION "1.2"
#endif
diff --git a/tools/common_write.c b/tools/common_write.c
index 36f8dd89..8fda3e33 100644
--- a/tools/common_write.c
+++ b/tools/common_write.c
@@ -19,6 +19,7 @@
/* toolversion history
* 1.0: initial tool version
* 1.1: changed PRODUCT_ENDOFLIFE parsing
+ * 1.2: added UPDATE_COLLECTIONLIST to updateinfo
*/
static int
--
2.31.1

View File

@ -0,0 +1,60 @@
From 91125fe786cb6de2f050430fa51e11c501f17aed Mon Sep 17 00:00:00 2001
From: Michael Schroeder <mls@suse.de>
Date: Tue, 18 Apr 2023 11:57:50 +0200
Subject: [PATCH] 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
From 11fac9a31e892125e19246101b5604322836467d Mon Sep 17 00:00:00 2001
From: Michael Schroeder <mls@suse.de>
Date: Tue, 18 Apr 2023 12:36:40 +0200
Subject: [PATCH] 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 <inline>
+#>=Pkg: xorg-x11-server-Xorg 1.20.11 18.el9 noarch
+#>=Req: missing-req
+#>=Pkg: pass 1.7.4 6.el9 noarch
+#>=Rec: xclip <IF> (xorg-x11-server-Xorg <ELSE> wl-clipboard)
+repo @System 0 empty
+system unset * @System
+job install pkg pass-1.7.4-6.el9.noarch@appstream
+result transaction,problems <inline>
+#>install pass-1.7.4-6.el9.noarch@appstream
--
2.40.1

View File

@ -0,0 +1,125 @@
From 78b2d8148bea1dc12b854d9c11691d5f1bc33fd8 Mon Sep 17 00:00:00 2001
From: Michael Schroeder <mls@suse.de>
Date: Wed, 19 Apr 2023 13:09:10 +0200
Subject: [PATCH] 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 212df322..bbabc55f 100644
--- a/src/rules.c
+++ b/src/rules.c
@@ -1668,6 +1668,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 */
@@ -2456,6 +2466,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)
@@ -2465,6 +2489,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
From dc4c91a71eda2950df11724945ebd5151883a041 Mon Sep 17 00:00:00 2001
From: Michael Schroeder <mls@suse.de>
Date: Fri, 21 Apr 2023 16:15:10 +0200
Subject: [PATCH] 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 bbabc55f..c909ae0b 100644
--- a/src/rules.c
+++ b/src/rules.c
@@ -2279,6 +2279,31 @@ solver_addblackrules(Solver *solv)
#define DISABLE_DUP 3
#define DISABLE_BLACK 4
+/* 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)
{
@@ -2490,7 +2515,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

View File

@ -1,23 +1,13 @@
%global libname solv
%if (0%{?rhel} && 0%{?rhel} <= 7) || (0%{?fedora} && 0%{?fedora} <= 29)
%bcond_without python2_bindings
%else
%bcond_with python2_bindings
%endif
%if 0%{?rhel} && 0%{?rhel} <= 7
%bcond_with perl_bindings
%bcond_with ruby_bindings
%bcond_with python3_bindings
%else
%bcond_without python_bindings
%bcond_without perl_bindings
%bcond_without ruby_bindings
%bcond_without python3_bindings
%endif
# Creates special prefixed pseudo-packages from appdata metadata
%bcond_without appdata
# Creates special prefixed "group:", "category:" pseudo-packages
%bcond_without comps
%bcond_without conda
# For rich dependencies
%bcond_without complex_deps
%if 0%{?rhel}
@ -27,6 +17,7 @@
%bcond_with arch_repo
# For handling deb + rpm at the same time
%bcond_with multi_semantics
%bcond_with zchunk
%else
%bcond_without helix_repo
%bcond_without suse_repo
@ -34,15 +25,19 @@
%bcond_without arch_repo
# For handling deb + rpm at the same time
%bcond_without multi_semantics
%bcond_without zchunk
%endif
%bcond_without zstd
#global commitnum 2901
#global commit 47fbaa2a0892866d30ec0e1b4c885532d0aca7b8
#global shortcommit %(c=%{commit}; echo ${c:0:7})
#global shortcommit %%(c=%%{commit}; echo ${c:0:7})
%define __cmake_switch(b:) %{expand:%%{?with_%{-b*}:ON}}%{expand:%%{!?with_%{-b*}:OFF}}
Name: lib%{libname}
Version: 0.7.16
Release: 1%{?commit:.git.%{commitnum}.%{?shortcommit}}%{?dist}
Version: 0.7.20
Release: 6%{?dist}
Summary: Package dependency solver
License: BSD
@ -54,6 +49,10 @@ Source: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
%endif
# https://bugzilla.redhat.com/show_bug.cgi?id=1630300
Patch1: 0001-Add-support-for-computing-hashes-using-OpenSSL.patch
Patch2: 0002-Add-support-for-storing-user-data-in-a-solv-file.patch
Patch3: 0003-Allow-accessing-toolversion-at-runtime-and-increase-.patch
Patch4: 0004-Treat-condition-both-as-positive-and-negative-litera.patch
Patch5: 0005-Allow_break_arch_lock_step_on_erase.patch
BuildRequires: cmake
BuildRequires: gcc-c++
@ -68,6 +67,16 @@ BuildRequires: pkgconfig(openssl)
BuildRequires: xz-devel
# -DENABLE_BZIP2_COMPRESSION=ON
BuildRequires: bzip2-devel
%if %{with zstd}
# -DENABLE_ZSTD_COMPRESSION=ON
BuildRequires: libzstd-devel
%endif
%if %{with zchunk}
# -DENABLE_ZCHUNK_COMPRESSION=ON
BuildRequires: pkgconfig(zck)
%endif
# https://bugzilla.redhat.com/show_bug.cgi?id=1830346
Conflicts: rpm%{?_isa} < 4.14.3
%description
A free package dependency solver using a satisfiability algorithm. The
@ -90,13 +99,8 @@ Development files for %{name}.
%package tools
Summary: Package dependency solver tools
Requires: %{name}%{?_isa} = %{version}-%{release}
# repo2solv dependencies. All of those are used in shell-script.
Requires: %{_bindir}/gzip
Requires: %{_bindir}/bzip2
Requires: %{_bindir}/lzma
Requires: %{_bindir}/xz
Requires: %{_bindir}/cat
Requires: %{_bindir}/find
# repo2solv dependencies. Used as execl()
Requires: /usr/bin/find
%description tools
Package dependency solver tools.
@ -105,8 +109,8 @@ Package dependency solver tools.
Summary: Applications demoing the %{name} library
Requires: %{name}%{?_isa} = %{version}-%{release}
# solv dependencies. Used as execlp() and system()
Requires: %{_bindir}/curl
Requires: %{_bindir}/gpg2
Requires: /usr/bin/curl
Requires: /usr/bin/gpg2
%description demo
Applications demoing the %{name} library.
@ -134,21 +138,7 @@ Requires: %{name}%{?_isa} = %{version}-%{release}
Ruby bindings for the %{name} library.
%endif
%if %{with python2_bindings}
%package -n python2-%{libname}
Summary: Python bindings for the %{name} library
%{?python_provide:%python_provide python2-%{libname}}
BuildRequires: swig
BuildRequires: python2-devel
Requires: %{name}%{?_isa} = %{version}-%{release}
%description -n python2-%{libname}
Python bindings for the %{name} library.
Python 2 version.
%endif
%if %{with python3_bindings}
%if %{with python_bindings}
%package -n python3-%{libname}
Summary: Python bindings for the %{name} library
%{?python_provide:%python_provide python3-%{libname}}
@ -166,52 +156,51 @@ Python 3 version.
%autosetup -p1 %{?commit:-n %{name}-%{commit}}
%build
%cmake . -B"%{_vpath_builddir}" -GNinja \
-DFEDORA=1 \
-DENABLE_RPMDB=ON \
-DENABLE_RPMDB_BYRPMHEADER=ON \
-DENABLE_RPMDB_LIBRPM=ON \
-DENABLE_RPMPKG_LIBRPM=ON \
-DENABLE_RPMMD=ON \
%{?with_comps:-DENABLE_COMPS=ON} \
%{?with_appdata:-DENABLE_APPDATA=ON} \
-DUSE_VENDORDIRS=ON \
-DWITH_LIBXML2=ON \
-DWITH_OPENSSL=ON \
-DENABLE_LZMA_COMPRESSION=ON \
-DENABLE_BZIP2_COMPRESSION=ON \
%{?with_helix_repo:-DENABLE_HELIXREPO=ON} \
%{?with_suse_repo:-DENABLE_SUSEREPO=ON} \
%{?with_debian_repo:-DENABLE_DEBIAN=ON} \
%{?with_arch_repo:-DENABLE_ARCHREPO=ON} \
%{?with_multi_semantics:-DMULTI_SEMANTICS=ON} \
%{?with_complex_deps:-DENABLE_COMPLEX_DEPS=1} \
%{?with_perl_bindings:-DENABLE_PERL=ON} \
%{?with_ruby_bindings:-DENABLE_RUBY=ON} \
%if %{with python2_bindings} || %{with python3_bindings}
-DENABLE_PYTHON=ON \
%if %{with python2_bindings}
-DPythonLibs_FIND_VERSION=%{python2_version} \
-DPythonLibs_FIND_VERSION_MAJOR=2 \
%if %{with python3_bindings}
-DENABLE_PYTHON3=ON \
-DPYTHON3_EXECUTABLE=%{__python3} \
%endif
%else
-DPythonLibs_FIND_VERSION=%{python3_version} \
-DPythonLibs_FIND_VERSION_MAJOR=3 \
%cmake -GNinja \
-DFEDORA=1 \
-DENABLE_RPMDB=ON \
-DENABLE_RPMDB_BYRPMHEADER=ON \
-DENABLE_RPMDB_LIBRPM=ON \
-DENABLE_RPMPKG_LIBRPM=ON \
-DENABLE_RPMMD=ON \
-DENABLE_COMPS=%{__cmake_switch -b comps} \
-DENABLE_APPDATA=%{__cmake_switch -b appdata} \
-DUSE_VENDORDIRS=ON \
-DWITH_LIBXML2=ON \
-DWITH_OPENSSL=ON \
-DENABLE_LZMA_COMPRESSION=ON \
-DENABLE_BZIP2_COMPRESSION=ON \
-DENABLE_ZSTD_COMPRESSION=%{__cmake_switch -b zstd} \
-DENABLE_ZCHUNK_COMPRESSION=%{__cmake_switch -b zchunk} \
%if %{with zchunk}
-DWITH_SYSTEM_ZCHUNK=ON \
%endif
-DENABLE_HELIXREPO=%{__cmake_switch -b helix_repo} \
-DENABLE_SUSEREPO=%{__cmake_switch -b suse_repo} \
-DENABLE_DEBIAN=%{__cmake_switch -b debian_repo} \
-DENABLE_ARCHREPO=%{__cmake_switch -b arch_repo} \
-DMULTI_SEMANTICS=%{__cmake_switch -b multi_semantics} \
-DENABLE_COMPLEX_DEPS=%{__cmake_switch -b complex_deps} \
-DENABLE_CONDA=%{__cmake_switch -b conda} \
-DENABLE_PERL=%{__cmake_switch -b perl_bindings} \
-DENABLE_RUBY=%{__cmake_switch -b ruby_bindings} \
-DENABLE_PYTHON=%{__cmake_switch -b python_bindings} \
%if %{with python_bindings}
-DPYTHON_EXECUTABLE=%{python3} \
%endif
%{nil}
%ninja_build -C "%{_vpath_builddir}"
%cmake_build
%install
%ninja_install -C "%{_vpath_builddir}"
%cmake_install
%check
%ninja_test -C "%{_vpath_builddir}"
%ctest
%ldconfig_scriptlets
# Python smoke test (not tested in %%ctest):
export PYTHONPATH=%{buildroot}%{python3_sitearch}
export LD_LIBRARY_PATH=%{buildroot}%{_libdir}
%python3 -c 'import solv'
%files
%license LICENSE*
@ -266,6 +255,9 @@ Python 3 version.
%if %{with suse_repo}
%solv_tool susetags2solv
%endif
%if %{with conda}
%{_bindir}/conda2solv
%endif
%files demo
%solv_tool solv
@ -281,13 +273,7 @@ Python 3 version.
%{ruby_vendorarchdir}/%{libname}.so
%endif
%if %{with python2_bindings}
%files -n python2-%{libname}
%{python2_sitearch}/_%{libname}.so
%{python2_sitearch}/%{libname}.py*
%endif
%if %{with python3_bindings}
%if %{with python_bindings}
%files -n python3-%{libname}
%{python3_sitearch}/_%{libname}.so
%{python3_sitearch}/%{libname}.py
@ -295,6 +281,57 @@ Python 3 version.
%endif
%changelog
* Wed Jun 21 2023 Jaroslav Rohel <jrohel@redhat.com> - 0.7.20-6
- Backport Allow to break arch lock-step on erase operations (RhBug:2172288,2172292)
* Wed May 17 2023 Jaroslav Rohel <jrohel@redhat.com> - 0.7.20-5
- Backport Treat condition both as positive and negative literal in pool_add_pos_literals_complex_dep
(RhBug:2185061,2190136)
* Wed Dec 07 2022 Nicola Sella <nsella@redhat.com> - 0.7.20-4
- Drop patch to fix pick of old build (RhBug:2150300,RhBug:2151551)
* Thu May 05 2022 Lukas Hrazky <lhrazky@redhat.com> - 0.7.20-3
- Allow accessing toolversion at runtime and increase it
* Wed May 04 2022 Lukas Hrazky <lhrazky@redhat.com> - 0.7.20-2
- Add support for storing user data in a solv file
- Improve choice rule generation
* Tue Nov 09 2021 Pavla Kratochvilova <pkratoch@redhat.com> - 0.7.20-1
- Update to 0.7.20
- new SOLVER_EXCLUDEFROMWEAK job to ignore pkgs for weak dependencies
- support for environments in comps parser
- fix misparsing of '&' in attributes with libxml2
- choice rules: treat orphaned packages as newest
- fix compatibility with Python 3.10
* Tue Jul 27 2021 Pavla Kratochvilova <pkratoch@redhat.org> - 0.7.19-1
- Update to 0.7.19
- repo_add_conda: add flag to skip v2 packages
- fix rare segfault in resolve_jobrules() that could happen if new rules are learnt
- fix error handling in solv_xfopen_fd()
- fix memory leaks
* Fri Apr 30 2021 Pavla Kratochvilova <pkratoch@redhat.org> - 0.7.17-2
- Fix rpm dependency
* Thu Apr 29 2021 Pavla Kratochvilova <pkratoch@redhat.org> - 0.7.17-1
- Update to 0.7.17
- selected bug fixes:
* repo_write: fix handling of nested flexarray
* improve choicerule generation a bit more to cover more cases
* harden testcase parser against repos being added too late
* support python-3.10
* check %_dbpath macro in rpmdb code
- new features:
* handle default/visible/langonly attributes in comps parser
* support multiple collections in updateinfo parser
* add '-D' option in rpmdb2solv to set the dbpath
* Thu Jan 14 2021 Nicola Sella <nsella@redhat.com> - 0.7.16-2
- Enable zstd compression in libsolv
* Wed Nov 11 2020 Nicola Sella <nsella@redhat.com> - 0.7.16-1
- Update to 0.7.16
- selected bug fixes: