From 26781f8c44b4495fba2d0f4a39fe6379b08f32ce Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Tue, 10 Sep 2019 15:38:40 +0900 Subject: [PATCH 1/1] Imported Upstream version 0.7.1 --- NEWS | 3 +++ README | 21 +++++++++++++-------- VERSION.cmake | 2 +- ext/repo_autopattern.c | 43 +++++++++++++++++++++++++++++++++++++++++++ package/libsolv.changes | 8 ++++++++ src/repo_write.c | 2 +- 6 files changed, 69 insertions(+), 10 deletions(-) diff --git a/NEWS b/NEWS index 16b79a8..1416a16 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,9 @@ This file contains the major changes between libsolv versions: +Version 0.7.1 +- fix nasty off-by-one error in repo_write + Version 0.7.0 - soname bump to "1" - incompatible API changes: diff --git a/README b/README index 243486a..db680c4 100644 --- a/README +++ b/README @@ -1,7 +1,7 @@ This is libsolv, a free package dependency solver using a satisfiability algorithm. -This code is based on two major, but independent, blocks: +The code is based on two major, but independent, blocks: 1. Using a dictionary approach to store and retrieve package and dependency information. @@ -16,12 +16,14 @@ problems. It also takes advantage of the repository storage to minimize memory usage. Supported package formats: + - rpm/rpm5 - deb - arch linux - haiku Supported repository formats: + - rpmmd (primary, filelists, comps, deltainfo/presto, updateinfo) - susetags, suse product formats - mandriva/mageia (synthesis, info, files) @@ -29,13 +31,16 @@ Supported repository formats: - red carpet helix format - haiku +Build instructions +================== + Requires: cmake 2.4.x -mkdir build -cd build -cmake .. -make + mkdir build + cd build + cmake .. + make -To create a package: -make srcpackage -see package/ +//// +vim: syntax=asciidoc +//// diff --git a/VERSION.cmake b/VERSION.cmake index 6ed2c6f..bd4e5e6 100644 --- a/VERSION.cmake +++ b/VERSION.cmake @@ -49,5 +49,5 @@ SET(LIBSOLVEXT_SOVERSION "1") SET(LIBSOLV_MAJOR "0") SET(LIBSOLV_MINOR "7") -SET(LIBSOLV_PATCH "0") +SET(LIBSOLV_PATCH "1") diff --git a/ext/repo_autopattern.c b/ext/repo_autopattern.c index f6e1004..4c09e79 100644 --- a/ext/repo_autopattern.c +++ b/ext/repo_autopattern.c @@ -82,6 +82,33 @@ datestr2timestamp(const char *date) return timegm(&tm); } +/* we just look at the repodata keys and do not iterate + * over the solvables, because iterating would mean a + * load of stub repodata areas */ +static void +find_langkeys(Repo *repo, Id keyname, Queue *q) +{ + Pool *pool = repo->pool; + int rid; + int i; + const char *keyname_str; + size_t keyname_len; + + keyname_str = pool_id2str(pool, keyname); + keyname_len = strlen(keyname_str); + queue_empty(q); + for (rid = 1; rid < repo->nrepodata; rid++) + { + Repodata *data = repo_id2repodata(repo, rid); + for (i = 1; i < data->nkeys; i++) + { + const char *s = pool_id2str(pool, data->keys[i].name); + if (!strncmp(s, keyname_str, keyname_len) && s[keyname_len] == ':') + queue_pushunique(q, data->keys[i].name); + } + } +} + int repo_add_autopattern(Repo *repo, int flags) { @@ -94,6 +121,7 @@ repo_add_autopattern(Repo *repo, int flags) Id pattern_id, product_id; Id autopattern_id = 0, autoproduct_id = 0; int i, j; + Queue categorykeys; queue_init(&patq); queue_init(&patq2); @@ -105,6 +133,8 @@ repo_add_autopattern(Repo *repo, int flags) pattern_id = pool_str2id(pool, "pattern()", 9); product_id = pool_str2id(pool, "product()", 9); + + queue_init(&categorykeys); FOR_REPO_SOLVABLES(repo, p, s) { const char *n = pool_id2str(pool, s->name); @@ -159,6 +189,11 @@ repo_add_autopattern(Repo *repo, int flags) } } } + if (patq2.count) + { + find_langkeys(repo, SOLVABLE_CATEGORY, &categorykeys); + queue_unshift(&categorykeys, SOLVABLE_CATEGORY); + } for (i = 0; i < patq2.count; i += 2) { const char *pn = 0; @@ -273,9 +308,17 @@ repo_add_autopattern(Repo *repo, int flags) repodata_set_str(data, s2 - pool->solvables, SOLVABLE_ISVISIBLE, newname); } } + /* also try to copy the pattern category from the solvable */ + for (j = 0; j < categorykeys.count; j++) + { + Id catkey = categorykeys.elements[j]; + if ((str = solvable_lookup_str(s, catkey)) != 0) + repodata_set_str(data, s2 - pool->solvables, catkey, str); + } } queue_free(&patq); queue_free(&patq2); + queue_free(&categorykeys); if ((flags & ADD_NO_AUTOPRODUCTS) != 0) queue_empty(&prdq2); diff --git a/package/libsolv.changes b/package/libsolv.changes index 6146e99..5467ee3 100644 --- a/package/libsolv.changes +++ b/package/libsolv.changes @@ -1,4 +1,12 @@ ------------------------------------------------------------------- +Wed Oct 31 13:50:22 CET 2018 - mls@suse.de + +- fix nasty off-by-one error in repo_write +- also copy pattern categories from the rpm that defines the + pattern [fate#323785] +- bump version to 0.7.1 + +------------------------------------------------------------------- Wed Oct 24 10:48:56 CEST 2018 - mls@suse.de - new repowriter interface diff --git a/src/repo_write.c b/src/repo_write.c index a975cec..d3b8a83 100644 --- a/src/repo_write.c +++ b/src/repo_write.c @@ -1637,7 +1637,7 @@ for (i = 1; i < target.nkeys; i++) /* we have some relations with a non-zero need */ Reldep *rd; - for (rd = pool->rels + i; i > 1; i--, rd--) + for (rd = pool->rels + i; i > 0; i--, rd--) { int need = needid[reloff + i].need; if (!need) -- 2.7.4