diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2020-11-27 14:44:27 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2020-11-27 14:44:27 +0900 |
commit | 0de6a1fb83326a7af7c401e706a808da0c042a0f (patch) | |
tree | c25d09843344a209ad40c1823f9b259abccba196 | |
parent | f1a786b6fe3fc2d53f03b25e303dc45ed7e22ba6 (diff) | |
download | libsolv-0de6a1fb83326a7af7c401e706a808da0c042a0f.tar.gz libsolv-0de6a1fb83326a7af7c401e706a808da0c042a0f.tar.bz2 libsolv-0de6a1fb83326a7af7c401e706a808da0c042a0f.zip |
Imported Upstream version 0.7.9upstream/0.7.9
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | VERSION.cmake | 2 | ||||
-rw-r--r-- | ext/repo_conda.c | 20 | ||||
-rw-r--r-- | ext/repo_testcase.c | 11 | ||||
-rw-r--r-- | package/libsolv.changes | 6 | ||||
-rw-r--r-- | src/knownid.h | 2 | ||||
-rw-r--r-- | src/order.c | 29 | ||||
-rw-r--r-- | src/problems.c | 4 | ||||
-rw-r--r-- | src/rules.c | 59 | ||||
-rw-r--r-- | src/rules.h | 1 |
10 files changed, 108 insertions, 30 deletions
@@ -2,6 +2,10 @@ This file contains the major changes between libsolv versions: +Version 0.7.9 +- new features: + * support conda constrains dependencies + Version 0.7.8 - selected bug fixes: * support arch<->noarch package changes when creating patch diff --git a/VERSION.cmake b/VERSION.cmake index 491723a..0ec5582 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 "8") +SET(LIBSOLV_PATCH "9") diff --git a/ext/repo_conda.c b/ext/repo_conda.c index 0828aff..9352b71 100644 --- a/ext/repo_conda.c +++ b/ext/repo_conda.c @@ -43,6 +43,24 @@ parse_deps(struct parsedata *pd, struct solv_jsonparser *jp, Offset *depp) } static int +parse_otherdeps(struct parsedata *pd, struct solv_jsonparser *jp, Id handle, Id keyname) +{ + int type = JP_ARRAY; + while (type > 0 && (type = jsonparser_parse(jp)) > 0 && type != JP_ARRAY_END) + { + if (type == JP_STRING) + { + Id id = pool_conda_matchspec(pd->pool, jp->value); + if (id) + repodata_add_idarray(pd->data, handle, keyname, id); + } + else + type = jsonparser_skip(jp, type); + } + return type; +} + +static int parse_package(struct parsedata *pd, struct solv_jsonparser *jp, char *kfn) { int type = JP_OBJECT; @@ -64,6 +82,8 @@ parse_package(struct parsedata *pd, struct solv_jsonparser *jp, char *kfn) type = parse_deps(pd, jp, &s->requires); else if (type == JP_ARRAY && !strcmp(jp->key, "requires")) type = parse_deps(pd, jp, &s->requires); + else if (type == JP_ARRAY && !strcmp(jp->key, "constrains")) + type = parse_otherdeps(pd, jp, handle, SOLVABLE_CONSTRAINS); else if (type == JP_STRING && !strcmp(jp->key, "license")) repodata_add_poolstr_array(data, handle, SOLVABLE_LICENSE, jp->value); else if (type == JP_STRING && !strcmp(jp->key, "md5")) diff --git a/ext/repo_testcase.c b/ext/repo_testcase.c index 48d8a0e..5cc0327 100644 --- a/ext/repo_testcase.c +++ b/ext/repo_testcase.c @@ -461,6 +461,14 @@ testcase_write_testtags(Repo *repo, FILE *fp) fprintf(fp, "%s\n", testcase_dep2str(pool, q.elements[i])); fprintf(fp, "-Ipr:\n"); } + if (solvable_lookup_idarray(s, SOLVABLE_CONSTRAINS, &q)) + { + int i; + fprintf(fp, "+Cns:\n"); + for (i = 0; i < q.count; i++) + fprintf(fp, "%s\n", testcase_dep2str(pool, q.elements[i])); + fprintf(fp, "-Cns:\n"); + } if (s->vendor) fprintf(fp, "=Vnd: %s\n", pool_id2str(pool, s->vendor)); if (solvable_lookup_idarray(s, SOLVABLE_BUILDFLAVOR, &q)) @@ -690,6 +698,9 @@ testcase_add_testtags(Repo *repo, FILE *fp, int flags) repodata_add_idarray(data, s - pool->solvables, SOLVABLE_PREREQ_IGNOREINST, id); break; } + case 'C' << 16 | 'n' << 8 | 's': + repodata_add_idarray(data, s - pool->solvables, SOLVABLE_CONSTRAINS, testcase_str2dep(pool, line + 6)); + break; case 'F' << 16 | 'l' << 8 | 'v': repodata_add_poolstr_array(data, s - pool->solvables, SOLVABLE_BUILDFLAVOR, line + 6); break; diff --git a/package/libsolv.changes b/package/libsolv.changes index e060b4d..9ae1511 100644 --- a/package/libsolv.changes +++ b/package/libsolv.changes @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Thu Nov 21 16:34:52 CET 2019 - mls@suse.de + +- support conda constrains dependencies +- bump version to 0.7.9 + +------------------------------------------------------------------- Tue Nov 12 11:35:12 CET 2019 - mls@suse.de - support arch<->noarch package changes when creating patch diff --git a/src/knownid.h b/src/knownid.h index 3a88ee2..96c9adf 100644 --- a/src/knownid.h +++ b/src/knownid.h @@ -265,6 +265,8 @@ KNOWNID(UPDATE_STATUS, "update:status"), /* "stable", "testing", ...*/ KNOWNID(LIBSOLV_SELF_DESTRUCT_PKG, "libsolv-self-destruct-pkg()"), /* this package will self-destruct on installation */ +KNOWNID(SOLVABLE_CONSTRAINS, "solvable:constrains"), /* conda */ + KNOWNID(ID_NUM_INTERNAL, 0) #ifdef KNOWNID_INITIALIZE diff --git a/src/order.c b/src/order.c index b8d4b82..cba977b 100644 --- a/src/order.c +++ b/src/order.c @@ -102,14 +102,14 @@ struct orderdata { int ncycles; }; -static int +static void addteedge(struct orderdata *od, int from, int to, int type) { int i; struct s_TransactionElement *te; if (from == to) - return 0; + return; /* printf("edge %d(%s) -> %d(%s) type %x\n", from, pool_solvid2str(pool, od->tes[from].p), to, pool_solvid2str(pool, od->tes[to].p), type); */ @@ -117,13 +117,10 @@ addteedge(struct orderdata *od, int from, int to, int type) for (i = te->edges; od->edgedata[i]; i += 2) if (od->edgedata[i] == to) break; - /* test of brokenness */ - if (type == TYPE_BROKEN) - return od->edgedata[i] && (od->edgedata[i + 1] & TYPE_BROKEN) != 0 ? 1 : 0; if (od->edgedata[i]) { od->edgedata[i + 1] |= type; - return 0; + return; } if (i + 1 == od->nedgedata) { @@ -145,10 +142,9 @@ addteedge(struct orderdata *od, int from, int to, int type) od->edgedata[i + 1] = type; od->edgedata[i + 2] = 0; /* end marker */ od->nedgedata = i + 3; - return 0; } -static int +static void addedge(struct orderdata *od, Id from, Id to, int type) { Transaction *trans = od->trans; @@ -166,16 +162,15 @@ addedge(struct orderdata *od, Id from, Id to, int type) from = trans->transaction_installed[from - pool->installed->start]; else { - int ret = 0; Queue ti; Id tibuf[5]; queue_init_buffer(&ti, tibuf, sizeof(tibuf)/sizeof(*tibuf)); transaction_all_obs_pkgs(trans, from, &ti); for (i = 0; i < ti.count; i++) - ret |= addedge(od, ti.elements[i], to, type); + addedge(od, ti.elements[i], to, type); queue_free(&ti); - return ret; + return; } } s = pool->solvables + to; @@ -186,16 +181,15 @@ addedge(struct orderdata *od, Id from, Id to, int type) to = trans->transaction_installed[to - pool->installed->start]; else { - int ret = 0; Queue ti; Id tibuf[5]; queue_init_buffer(&ti, tibuf, sizeof(tibuf)/sizeof(*tibuf)); transaction_all_obs_pkgs(trans, to, &ti); for (i = 0; i < ti.count; i++) - ret |= addedge(od, from, ti.elements[i], type); + addedge(od, from, ti.elements[i], type); queue_free(&ti); - return ret; + return; } } @@ -204,16 +198,17 @@ addedge(struct orderdata *od, Id from, Id to, int type) if (te->p == to) break; if (i == od->ntes) - return 0; + return; to = i; for (i = 1, te = od->tes + i; i < od->ntes; i++, te++) if (te->p == from) break; if (i == od->ntes) - return 0; + return; + from = i; - return addteedge(od, i, to, type); + addteedge(od, from, to, type); } static inline int diff --git a/src/problems.c b/src/problems.c index b46d624..63165f3 100644 --- a/src/problems.c +++ b/src/problems.c @@ -1341,6 +1341,10 @@ solver_problemruleinfo2str(Solver *solv, SolverRuleinfo type, Id source, Id targ return pool_tmpappend(pool, s, pool_dep2str(pool, dep), 0); case SOLVER_RULE_BLACK: return pool_tmpjoin(pool, "package ", pool_solvid2str(pool, source), " can only be installed by a direct request"); + case SOLVER_RULE_PKG_CONSTRAINS: + s = pool_tmpjoin(pool, "package ", pool_solvid2str(pool, source), 0); + s = pool_tmpappend(pool, s, " has constraint ", pool_dep2str(pool, dep)); + return pool_tmpappend(pool, s, " conflicting with ", pool_solvid2str(pool, target)); default: return "bad problem rule type"; } diff --git a/src/rules.c b/src/rules.c index cb8d17d..e31fe01 100644 --- a/src/rules.c +++ b/src/rules.c @@ -665,6 +665,34 @@ add_complex_deprules(Solver *solv, Id p, Id dep, int type, int dontfix, Queue *w #endif +#ifdef ENABLE_CONDA +void +add_conda_constrains_rule(Solver *solv, Id n, Id dep, int dontfix) +{ + Pool *pool = solv->pool; + Reldep *rd; + Id p, pp, pdep; + if (!ISRELDEP(dep)) + return; + rd = GETRELDEP(pool, dep); + pdep = pool_whatprovides(pool, dep); + FOR_PROVIDES(p, pp, rd->name) + { + Id p2; + if (p == n) + continue; + if (dontfix && pool->solvables[p].repo == solv->installed) + continue; + while ((p2 = pool->whatprovidesdata[pdep]) != 0 && p2 < p) + pdep++; + if (p == p2) + pdep++; + else + addpkgrule(solv, -n, -p, 0, SOLVER_RULE_PKG_CONSTRAINS, dep); + } +} +#endif + /*------------------------------------------------------------------- * * add dependency rules for solvable @@ -693,8 +721,8 @@ solver_addpkgrulesforsolvable(Solver *solv, Solvable *s, Map *m) Queue workq; /* list of solvables we still have to work on */ Id workqbuf[64]; - Queue prereqq; /* list of pre-req ids to ignore */ - Id prereqbuf[16]; + Queue depq; /* list of pre-req ids to ignore */ + Id depqbuf[16]; int i; int dontfix; /* ignore dependency errors for installed solvables */ @@ -710,7 +738,7 @@ solver_addpkgrulesforsolvable(Solver *solv, Solvable *s, Map *m) queue_init_buffer(&workq, workqbuf, sizeof(workqbuf)/sizeof(*workqbuf)); queue_push(&workq, s - pool->solvables); /* push solvable Id to work queue */ - queue_init_buffer(&prereqq, prereqbuf, sizeof(prereqbuf)/sizeof(*prereqbuf)); + queue_init_buffer(&depq, depqbuf, sizeof(depqbuf)/sizeof(*depqbuf)); /* loop until there's no more work left */ while (workq.count) @@ -770,20 +798,18 @@ solver_addpkgrulesforsolvable(Solver *solv, Solvable *s, Map *m) { if (installed && s->repo == installed) { - if (prereqq.count) - queue_empty(&prereqq); - solvable_lookup_idarray(s, SOLVABLE_PREREQ_IGNOREINST, &prereqq); - filterpre = prereqq.count; + solvable_lookup_idarray(s, SOLVABLE_PREREQ_IGNOREINST, &depq); + filterpre = depq.count; } continue; } if (filterpre) { - /* check if this id is filtered. assumes that prereqq.count is small */ - for (i = 0; i < prereqq.count; i++) - if (req == prereqq.elements[i]) + /* check if this id is filtered. assumes that depq.count is small */ + for (i = 0; i < depq.count; i++) + if (req == depq.elements[i]) break; - if (i < prereqq.count) + if (i < depq.count) { POOL_DEBUG(SOLV_DEBUG_RULE_CREATION, "package %s: ignoring filtered pre-req dependency %s\n", pool_solvable2str(pool, s), pool_dep2str(pool, req)); continue; @@ -896,6 +922,15 @@ solver_addpkgrulesforsolvable(Solver *solv, Solvable *s, Map *m) } } +#ifdef ENABLE_CONDA + if (pool->disttype == DISTTYPE_CONDA) + { + solvable_lookup_idarray(s, SOLVABLE_CONSTRAINS, &depq); + for (i = 0; i < depq.count; i++) + add_conda_constrains_rule(solv, n, depq.elements[i], dontfix); + } +#endif + /* that's all we check for src packages */ if (s->arch == ARCH_SRC || s->arch == ARCH_NOSRC) continue; @@ -1099,7 +1134,7 @@ solver_addpkgrulesforsolvable(Solver *solv, Solvable *s, Map *m) } } } - queue_free(&prereqq); + queue_free(&depq); queue_free(&workq); } diff --git a/src/rules.h b/src/rules.h index 9286090..3fcede0 100644 --- a/src/rules.h +++ b/src/rules.h @@ -59,6 +59,7 @@ typedef enum { SOLVER_RULE_PKG_IMPLICIT_OBSOLETES, SOLVER_RULE_PKG_INSTALLED_OBSOLETES, SOLVER_RULE_PKG_RECOMMENDS, + SOLVER_RULE_PKG_CONSTRAINS, SOLVER_RULE_UPDATE = 0x200, SOLVER_RULE_FEATURE = 0x300, SOLVER_RULE_JOB = 0x400, |