Hello community, here is the log from the commit of package libsolv for openSUSE:Factory checked in at 2019-12-07 15:18:41 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libsolv (Old) and /work/SRC/openSUSE:Factory/.libsolv.new.4691 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libsolv" Sat Dec 7 15:18:41 2019 rev:75 rq:751739 version:0.7.9 Changes: -------- --- /work/SRC/openSUSE:Factory/libsolv/libsolv.changes 2019-10-28 16:43:31.748484333 +0100 +++ /work/SRC/openSUSE:Factory/.libsolv.new.4691/libsolv.changes 2019-12-07 15:22:13.587738459 +0100 @@ -1,0 +2,19 @@ +Thu Nov 21 16:34:52 CET 2019 - [email protected] + +- support conda constrains dependencies +- bump version to 0.7.9 + +------------------------------------------------------------------- +Tue Nov 12 11:35:12 CET 2019 - [email protected] + +- support arch<->noarch package changes when creating patch + conflicts from the updateinfo data +- support for SOLVER_BLACKLIST jobs that block the installation + of matched packages unless they are directly selected by an + SOLVER_INSTALL job +- libsolv now also parses the patch status in the updateinfo + parser +- new solvable_matchessolvable() function +- bump version to 0.7.8 + +------------------------------------------------------------------- Old: ---- libsolv-0.7.7.tar.bz2 New: ---- libsolv-0.7.9.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libsolv.spec ++++++ --- /var/tmp/diff_new_pack.84mE24/_old 2019-12-07 15:22:16.767738018 +0100 +++ /var/tmp/diff_new_pack.84mE24/_new 2019-12-07 15:22:16.767738018 +0100 @@ -52,7 +52,7 @@ %bcond_with zypp Name: libsolv -Version: 0.7.7 +Version: 0.7.9 Release: 0 Summary: Package dependency solver using a satisfiability algorithm License: BSD-3-Clause ++++++ libsolv-0.7.7.tar.bz2 -> libsolv-0.7.9.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsolv-0.7.7/NEWS new/libsolv-0.7.9/NEWS --- old/libsolv-0.7.7/NEWS 2019-10-18 10:59:11.000000000 +0200 +++ new/libsolv-0.7.9/NEWS 2019-11-21 16:39:09.000000000 +0100 @@ -2,6 +2,23 @@ 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 + conflicts from the updateinfo data + * also support other rpm database types +- new features: + * support for SOLVER_BLACKLIST jobs that block the installation + of matched packages unless they are directly selected by an + SOLVER_INSTALL job + * libsolv now also parses the patch status in the updateinfo + parser + * new solvable_matchessolvable() function + Version 0.7.7 - selected bug fixes: * fix updating of too many packages in focusbest mode diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsolv-0.7.7/VERSION.cmake new/libsolv-0.7.9/VERSION.cmake --- old/libsolv-0.7.7/VERSION.cmake 2019-10-18 10:59:11.000000000 +0200 +++ new/libsolv-0.7.9/VERSION.cmake 2019-11-21 16:39:09.000000000 +0100 @@ -49,5 +49,5 @@ SET(LIBSOLV_MAJOR "0") SET(LIBSOLV_MINOR "7") -SET(LIBSOLV_PATCH "7") +SET(LIBSOLV_PATCH "9") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsolv-0.7.7/ext/libsolvext.ver new/libsolv-0.7.9/ext/libsolvext.ver --- old/libsolv-0.7.7/ext/libsolvext.ver 2019-04-04 16:28:06.000000000 +0200 +++ new/libsolv-0.7.9/ext/libsolvext.ver 2019-11-08 14:39:59.000000000 +0100 @@ -42,6 +42,7 @@ repo_add_zyppdb_products; repo_find_all_pubkeys; repo_find_pubkey; + repo_mark_retracted_packages; repo_verify_sigdata; rpm_byfp; rpm_byrpmdbid; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsolv-0.7.7/ext/repo_conda.c new/libsolv-0.7.9/ext/repo_conda.c --- old/libsolv-0.7.7/ext/repo_conda.c 2019-04-17 11:59:22.000000000 +0200 +++ new/libsolv-0.7.9/ext/repo_conda.c 2019-11-14 14:20:15.000000000 +0100 @@ -43,6 +43,24 @@ } 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 @@ 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsolv-0.7.7/ext/repo_testcase.c new/libsolv-0.7.9/ext/repo_testcase.c --- old/libsolv-0.7.7/ext/repo_testcase.c 2019-04-09 16:34:28.000000000 +0200 +++ new/libsolv-0.7.9/ext/repo_testcase.c 2019-11-14 14:20:15.000000000 +0100 @@ -461,6 +461,14 @@ 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 @@ 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsolv-0.7.7/ext/repo_updateinfoxml.c new/libsolv-0.7.9/ext/repo_updateinfoxml.c --- old/libsolv-0.7.7/ext/repo_updateinfoxml.c 2019-10-18 11:09:11.000000000 +0200 +++ new/libsolv-0.7.9/ext/repo_updateinfoxml.c 2019-11-12 11:29:13.000000000 +0100 @@ -298,8 +298,7 @@ { const char *arch = 0, *name = 0; Id evr = makeevr_atts(pool, pd, atts); /* parse "epoch", "version", "release" */ - Id n, a = 0; - Id rel_id; + Id n, a, id; for (; *atts; atts += 2) { @@ -308,17 +307,24 @@ else if (!strcmp(*atts, "name")) name = atts[1]; } - /* generated Id for name */ - n = pool_str2id(pool, name, 1); - rel_id = n; - if (arch) + n = name ? pool_str2id(pool, name, 1) : 0; + a = arch ? pool_str2id(pool, arch, 1) : 0; + + /* generated conflicts for the package */ + if (a && a != ARCH_NOARCH) + { + id = pool_rel2id(pool, n, a, REL_ARCH, 1); + id = pool_rel2id(pool, id, evr, REL_LT, 1); + solvable->conflicts = repo_addid_dep(pd->repo, solvable->conflicts, id, 0); + id = pool_rel2id(pool, n, ARCH_NOARCH, REL_ARCH, 1); + id = pool_rel2id(pool, id, evr, REL_LT, 1); + solvable->conflicts = repo_addid_dep(pd->repo, solvable->conflicts, id, 0); + } + else { - /* generate Id for arch and combine with name */ - a = pool_str2id(pool, arch, 1); - rel_id = pool_rel2id(pool, n, a, REL_ARCH, 1); + id = pool_rel2id(pool, n, evr, REL_LT, 1); + solvable->conflicts = repo_addid_dep(pd->repo, solvable->conflicts, id, 0); } - rel_id = pool_rel2id(pool, rel_id, evr, REL_LT, 1); - solvable->conflicts = repo_addid_dep(pd->repo, solvable->conflicts, rel_id, 0); /* who needs the collection anyway? */ pd->collhandle = repodata_new_handle(pd->data); @@ -490,3 +496,92 @@ return pd.ret; } +#ifdef SUSE + +static int +repo_mark_retracted_packages_cmp(const void *ap, const void *bp, void *dp) +{ + Id *a = (Id *)ap; + Id *b = (Id *)bp; + if (a[1] != b[1]) + return a[1] - b[1]; + if (a[2] != b[2]) + return a[2] - b[2]; + if (a[0] != b[0]) + return a[0] - b[0]; + return 0; +} + + +void +repo_mark_retracted_packages(Repo *repo, Id retractedmarker) +{ + Pool *pool = repo->pool; + int i, p; + Solvable *s; + Id con, *conp; + Id retractedname, retractedevr; + + Queue q; + queue_init(&q); + for (p = 1; p < pool->nsolvables; p++) + { + const char *status; + s = pool->solvables + p; + if (strncmp(pool_id2str(pool, s->name), "patch:", 6) != 0) + { + if (s->arch == ARCH_SRC || s->arch == ARCH_NOSRC) + continue; + queue_push2(&q, p, s->name); + queue_push2(&q, s->evr, s->arch); + continue; + } + status = solvable_lookup_str(s, UPDATE_STATUS); + if (!status || strcmp(status, "retracted") != 0) + continue; + if (!s->conflicts) + continue; + conp = s->repo->idarraydata + s->conflicts; + while ((con = *conp++) != 0) + { + Reldep *rd; + Id name, evr, arch; + if (!ISRELDEP(con)) + continue; + rd = GETRELDEP(pool, con); + if (rd->flags != REL_LT) + continue; + name = rd->name; + evr = rd->evr; + arch = 0; + if (ISRELDEP(name)) + { + rd = GETRELDEP(pool, name); + name = rd->name; + if (rd->flags == REL_ARCH) + arch = rd->evr; + } + queue_push2(&q, 0, name); + queue_push2(&q, evr, arch); + } + } + if (q.count) + solv_sort(q.elements, q.count / 4, sizeof(Id) * 4, repo_mark_retracted_packages_cmp, repo->pool); + retractedname = retractedevr = 0; + for (i = 0; i < q.count; i += 4) + { + if (!q.elements[i]) + { + retractedname = q.elements[i + 1]; + retractedevr = q.elements[i + 2]; + } + else if (q.elements[i + 1] == retractedname && q.elements[i + 2] == retractedevr) + { + s = pool->solvables + q.elements[i]; + s->provides = repo_addid_dep(repo, s->provides, retractedmarker, 0); + } + } + queue_free(&q); +} + +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsolv-0.7.7/ext/repo_updateinfoxml.h new/libsolv-0.7.9/ext/repo_updateinfoxml.h --- old/libsolv-0.7.7/ext/repo_updateinfoxml.h 2018-10-01 11:09:18.000000000 +0200 +++ new/libsolv-0.7.9/ext/repo_updateinfoxml.h 2019-11-08 14:39:59.000000000 +0100 @@ -6,3 +6,6 @@ */ extern int repo_add_updateinfoxml(Repo *repo, FILE *fp, int flags); + +extern void repo_mark_retracted_packages(Repo *repo, Id retractedmarker); + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsolv-0.7.7/ext/testcase.c new/libsolv-0.7.9/ext/testcase.c --- old/libsolv-0.7.7/ext/testcase.c 2019-09-30 14:39:28.000000000 +0200 +++ new/libsolv-0.7.9/ext/testcase.c 2019-11-08 14:39:59.000000000 +0100 @@ -59,6 +59,7 @@ { SOLVER_ALLOWUNINSTALL, "allowuninstall" }, { SOLVER_FAVOR, "favor" }, { SOLVER_DISFAVOR, "disfavor" }, + { SOLVER_BLACKLIST, "blacklist" }, { 0, 0 } }; @@ -1190,6 +1191,7 @@ { SOLVER_RULE_LEARNT, "learnt" }, { SOLVER_RULE_BEST, "best" }, { SOLVER_RULE_YUMOBS, "yumobs" }, + { SOLVER_RULE_BLACK, "black" }, { SOLVER_RULE_RECOMMENDS, "recommends" }, { 0, 0 } }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsolv-0.7.7/package/libsolv.changes new/libsolv-0.7.9/package/libsolv.changes --- old/libsolv-0.7.7/package/libsolv.changes 2019-10-18 10:59:11.000000000 +0200 +++ new/libsolv-0.7.9/package/libsolv.changes 2019-11-21 16:39:09.000000000 +0100 @@ -1,4 +1,23 @@ ------------------------------------------------------------------- +Thu Nov 21 16:34:52 CET 2019 - [email protected] + +- support conda constrains dependencies +- bump version to 0.7.9 + +------------------------------------------------------------------- +Tue Nov 12 11:35:12 CET 2019 - [email protected] + +- support arch<->noarch package changes when creating patch + conflicts from the updateinfo data +- support for SOLVER_BLACKLIST jobs that block the installation + of matched packages unless they are directly selected by an + SOLVER_INSTALL job +- libsolv now also parses the patch status in the updateinfo + parser +- new solvable_matchessolvable() function +- bump version to 0.7.8 + +------------------------------------------------------------------- Fri Oct 18 10:53:54 CEST 2019 - [email protected] - fix updating of too many packages in focusbest mode diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsolv-0.7.7/src/knownid.h new/libsolv-0.7.9/src/knownid.h --- old/libsolv-0.7.7/src/knownid.h 2019-10-18 13:37:20.000000000 +0200 +++ new/libsolv-0.7.9/src/knownid.h 2019-11-14 14:20:15.000000000 +0100 @@ -263,6 +263,10 @@ 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsolv-0.7.7/src/order.c new/libsolv-0.7.9/src/order.c --- old/libsolv-0.7.7/src/order.c 2019-10-08 14:14:11.000000000 +0200 +++ new/libsolv-0.7.9/src/order.c 2019-11-14 15:54:12.000000000 +0100 @@ -102,14 +102,14 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsolv-0.7.7/src/problems.c new/libsolv-0.7.9/src/problems.c --- old/libsolv-0.7.7/src/problems.c 2018-12-19 14:30:15.000000000 +0100 +++ new/libsolv-0.7.9/src/problems.c 2019-11-15 11:59:29.000000000 +0100 @@ -719,6 +719,12 @@ } return; } + if (why >= solv->blackrules && why < solv->blackrules_end) + { + queue_push(solutionq, SOLVER_SOLUTION_BLACK); + assert(solv->rules[why].p < 0); + queue_push(solutionq, -solv->rules[why].p); + } } /* @@ -981,6 +987,8 @@ * -> add (SOLVER_INSTALL|SOLVER_SOLVABLE, rp) to the job * SOLVER_SOLUTION_BEST pkgid * -> add (SOLVER_INSTALL|SOLVER_SOLVABLE, rp) to the job + * SOLVER_SOLUTION_BLACK pkgid + * -> add (SOLVER_INSTALL|SOLVER_SOLVABLE, rp) to the job * SOLVER_SOLUTION_JOB jobidx * -> remove job (jobidx - 1, jobidx) from job queue * SOLVER_SOLUTION_POOLJOB jobidx @@ -1331,6 +1339,12 @@ s = pool_tmpjoin(pool, "both package ", pool_solvid2str(pool, source), " and "); s = pool_tmpjoin(pool, s, pool_solvid2str(pool, target), " obsolete "); 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"; } @@ -1385,6 +1399,11 @@ else return pool_tmpjoin(pool, "install ", pool_solvable2str(pool, s), " despite the old version"); } + else if (p == SOLVER_SOLUTION_BLACK) + { + Solvable *s = pool->solvables + rp; + return pool_tmpjoin(pool, "install ", pool_solvable2str(pool, s), 0); + } else if (p > 0 && rp == 0) return pool_tmpjoin(pool, "allow deinstallation of ", pool_solvid2str(pool, p), 0); else if (p > 0 && rp > 0) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsolv-0.7.7/src/problems.h new/libsolv-0.7.9/src/problems.h --- old/libsolv-0.7.7/src/problems.h 2018-10-22 15:37:12.000000000 +0200 +++ new/libsolv-0.7.9/src/problems.h 2019-11-08 14:39:59.000000000 +0100 @@ -22,11 +22,12 @@ struct s_Solver; -#define SOLVER_SOLUTION_JOB (0) -#define SOLVER_SOLUTION_DISTUPGRADE (-1) -#define SOLVER_SOLUTION_INFARCH (-2) -#define SOLVER_SOLUTION_BEST (-3) -#define SOLVER_SOLUTION_POOLJOB (-4) +#define SOLVER_SOLUTION_JOB (0) +#define SOLVER_SOLUTION_DISTUPGRADE (-1) +#define SOLVER_SOLUTION_INFARCH (-2) +#define SOLVER_SOLUTION_BEST (-3) +#define SOLVER_SOLUTION_POOLJOB (-4) +#define SOLVER_SOLUTION_BLACK (-5) void solver_recordproblem(struct s_Solver *solv, Id rid); void solver_fixproblem(struct s_Solver *solv, Id rid); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsolv-0.7.7/src/rules.c new/libsolv-0.7.9/src/rules.c --- old/libsolv-0.7.7/src/rules.c 2019-10-08 13:42:19.000000000 +0200 +++ new/libsolv-0.7.9/src/rules.c 2019-11-15 13:04:10.000000000 +0100 @@ -498,6 +498,16 @@ #ifdef ENABLE_COMPLEX_DEPS +#ifdef SUSE +static inline int +suse_isptf(Pool *pool, Solvable *s) +{ + if (!strncmp("ptf-", pool_id2str(pool, s->name), 4)) + return 1; + return 0; +} +#endif + static void add_complex_deprules(Solver *solv, Id p, Id dep, int type, int dontfix, Queue *workq, Map *m) { @@ -511,6 +521,10 @@ /* CNF expansion for requires, DNF + INVERT expansion for conflicts */ if (type == SOLVER_RULE_PKG_CONFLICTS) flags |= CPLXDEPS_TODNF | CPLXDEPS_EXPAND | CPLXDEPS_INVERT; +#ifdef SUSE + if (type == SOLVER_RULE_PKG_REQUIRES && suse_isptf(pool, pool->solvables + p)) + flags |= CPLXDEPS_NAME; /* do not match provides */ +#endif i = pool_normalize_complex_dep(pool, dep, &bq, flags); /* handle special cases */ @@ -651,6 +665,34 @@ #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 @@ -679,8 +721,8 @@ 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 */ @@ -696,7 +738,7 @@ 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) @@ -756,20 +798,18 @@ { 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; @@ -882,6 +922,15 @@ } } +#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; @@ -1085,7 +1134,7 @@ } } } - queue_free(&prereqq); + queue_free(&depq); queue_free(&workq); } @@ -2101,6 +2150,97 @@ } } +/*********************************************************************** + *** + *** Black rule part + ***/ + +static inline void +disableblackrule(Solver *solv, Id p) +{ + Rule *r; + int i; + for (i = solv->blackrules, r = solv->rules + i; i < solv->blackrules_end; i++, r++) + if (r->p == -p) + solver_disablerule(solv, r); +} + +static inline void +reenableblackrule(Solver *solv, Id p) +{ + Pool *pool = solv->pool; + Rule *r; + int i; + for (i = solv->blackrules, r = solv->rules + i; i < solv->blackrules_end; i++, r++) + if (r->p == -p) + { + solver_enablerule(solv, r); + IF_POOLDEBUG (SOLV_DEBUG_SOLUTIONS) + { + POOL_DEBUG(SOLV_DEBUG_SOLUTIONS, "@@@ re-enabling "); + solver_printruleclass(solv, SOLV_DEBUG_SOLUTIONS, r); + } + } +} + +void +solver_addblackrules(Solver *solv) +{ + int i; + Id how, select, what, p, pp; + Queue *job = &solv->job; + Pool *pool = solv->pool; + Repo *installed = solv->installed; + Map updatemap; + + map_init(&updatemap, 0); + solv->blackrules = solv->nrules; + if (installed) + { + for (i = 0; i < job->count; i += 2) + { + how = job->elements[i]; + select = job->elements[i] & SOLVER_SELECTMASK; + what = job->elements[i + 1]; + switch (how & SOLVER_JOBMASK) + { + case SOLVER_BLACKLIST: + FOR_JOB_SELECT(p, pp, select, what) + { + Solvable *s = pool->solvables + p; + if (s->repo != installed) + continue; + if (!updatemap.size) + map_grow(&updatemap, pool->ss.nstrings); + if (s->name > 0 && s->name < pool->ss.nstrings) + MAPSET(&updatemap, s->name); + } + } + } + } + for (i = 0; i < job->count; i += 2) + { + how = job->elements[i]; + select = job->elements[i] & SOLVER_SELECTMASK; + what = job->elements[i + 1]; + switch (how & SOLVER_JOBMASK) + { + case SOLVER_BLACKLIST: + FOR_JOB_SELECT(p, pp, select, what) + { + Solvable *s = pool->solvables + p; + if (s->repo == installed) + continue; + if (updatemap.size && s->name > 0 && s->name < pool->ss.nstrings && MAPTST(&updatemap, s->name)) + continue; /* installed package with same name is already blacklisted */ + solver_addrule(solv, -p, 0, 0); + } + break; + } + } + map_free(&updatemap); + solv->blackrules_end = solv->nrules; +} /*********************************************************************** *** @@ -2114,6 +2254,7 @@ #define DISABLE_UPDATE 1 #define DISABLE_INFARCH 2 #define DISABLE_DUP 3 +#define DISABLE_BLACK 4 static void jobtodisablelist(Solver *solv, Id how, Id what, Queue *q) @@ -2213,6 +2354,16 @@ } } } + if ((set & SOLVER_SETEVR) != 0 && solv->blackrules != solv->blackrules_end) + { + if (select == SOLVER_SOLVABLE) + queue_push2(q, DISABLE_BLACK, what); + else + { + FOR_JOB_SELECT(p, pp, select, what) + queue_push2(q, DISABLE_BLACK, p); + } + } if (!installed || installed->end == installed->start) return; /* now the hard part: disable some update rules */ @@ -2386,6 +2537,9 @@ case DISABLE_DUP: disableduprule(solv, arg); break; + case DISABLE_BLACK: + disableblackrule(solv, arg); + break; default: break; } @@ -2489,6 +2643,9 @@ case DISABLE_DUP: reenableduprule(solv, arg); break; + case DISABLE_BLACK: + reenableblackrule(solv, arg); + break; } } queue_free(&q); @@ -2815,6 +2972,12 @@ *depp = solv->yumobsrules_info[rid - solv->yumobsrules]; return SOLVER_RULE_YUMOBS; } + if (rid >= solv->blackrules && rid < solv->blackrules_end) + { + if (fromp) + *fromp = -r->p; + return SOLVER_RULE_BLACK; + } if (rid >= solv->choicerules && rid < solv->choicerules_end) return SOLVER_RULE_CHOICE; if (rid >= solv->recommendsrules && rid < solv->recommendsrules_end) @@ -2845,10 +3008,14 @@ return SOLVER_RULE_BEST; if (rid >= solv->yumobsrules && rid < solv->yumobsrules_end) return SOLVER_RULE_YUMOBS; + if (rid >= solv->blackrules && rid < solv->blackrules_end) + return SOLVER_RULE_BLACK; if (rid >= solv->choicerules && rid < solv->choicerules_end) return SOLVER_RULE_CHOICE; if (rid >= solv->recommendsrules && rid < solv->recommendsrules_end) return SOLVER_RULE_RECOMMENDS; + if (rid >= solv->blackrules && rid < solv->blackrules_end) + return SOLVER_RULE_BLACK; if (rid >= solv->learntrules && rid < solv->nrules) return SOLVER_RULE_LEARNT; return SOLVER_RULE_UNKNOWN; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsolv-0.7.7/src/rules.h new/libsolv-0.7.9/src/rules.h --- old/libsolv-0.7.7/src/rules.h 2019-06-03 15:49:47.000000000 +0200 +++ new/libsolv-0.7.9/src/rules.h 2019-11-14 14:20:15.000000000 +0100 @@ -59,6 +59,7 @@ 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, @@ -72,7 +73,8 @@ SOLVER_RULE_LEARNT = 0x800, SOLVER_RULE_BEST = 0x900, SOLVER_RULE_YUMOBS = 0xa00, - SOLVER_RULE_RECOMMENDS = 0xb00 + SOLVER_RULE_RECOMMENDS = 0xb00, + SOLVER_RULE_BLACK = 0xc00 } SolverRuleinfo; #define SOLVER_RULE_TYPEMASK 0xff00 @@ -134,6 +136,9 @@ /* yumobs rules */ extern void solver_addyumobsrules(struct s_Solver *solv); +/* black rules */ +extern void solver_addblackrules(struct s_Solver *solv); + /* recommends rules */ extern void solver_addrecommendsrules(struct s_Solver *solv); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsolv-0.7.7/src/solver.c new/libsolv-0.7.9/src/solver.c --- old/libsolv-0.7.7/src/solver.c 2019-09-25 15:40:25.000000000 +0200 +++ new/libsolv-0.7.9/src/solver.c 2019-11-08 14:39:59.000000000 +0100 @@ -3377,6 +3377,7 @@ int hasbestinstalljob = 0; int hasfavorjob = 0; int haslockjob = 0; + int hasblacklistjob = 0; solve_start = solv_timems(0); @@ -3987,6 +3988,10 @@ POOL_DEBUG(SOLV_DEBUG_JOB, "job: %s %s\n", (how & SOLVER_JOBMASK) == SOLVER_FAVOR ? "favor" : "disfavor", solver_select2str(pool, select, what)); hasfavorjob = 1; break; + case SOLVER_BLACKLIST: + POOL_DEBUG(SOLV_DEBUG_JOB, "job: blacklist %s\n", solver_select2str(pool, select, what)); + hasblacklistjob = 1; + break; default: POOL_DEBUG(SOLV_DEBUG_JOB, "job: unknown job\n"); break; @@ -4040,6 +4045,11 @@ else solv->yumobsrules = solv->yumobsrules_end = solv->nrules; + if (hasblacklistjob) + solver_addblackrules(solv); + else + solv->blackrules = solv->blackrules_end = solv->nrules; + if (solv->havedisfavored && solv->strongrecommends && solv->recommendsruleq) solver_addrecommendsrules(solv); else @@ -4851,6 +4861,9 @@ case SOLVER_DISFAVOR: strstart = "disfavor "; break; + case SOLVER_BLACKLIST: + strstart = "blacklist "; + break; default: strstart = "unknown job "; break; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsolv-0.7.7/src/solver.h new/libsolv-0.7.9/src/solver.h --- old/libsolv-0.7.7/src/solver.h 2019-04-03 16:39:20.000000000 +0200 +++ new/libsolv-0.7.9/src/solver.h 2019-11-08 14:39:59.000000000 +0100 @@ -76,6 +76,9 @@ Id yumobsrules_end; Id *yumobsrules_info; /* the dependency for each rule */ + Id blackrules; /* rules from blacklisted packages */ + Id blackrules_end; + Id choicerules; /* choice rules (always weak) */ Id choicerules_end; Id *choicerules_info; /* the rule we used to generate the choice rule */ @@ -244,6 +247,7 @@ #define SOLVER_ALLOWUNINSTALL 0x0b00 #define SOLVER_FAVOR 0x0c00 #define SOLVER_DISFAVOR 0x0d00 +#define SOLVER_BLACKLIST 0x0e00 #define SOLVER_JOBMASK 0xff00 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsolv-0.7.7/src/solverdebug.c new/libsolv-0.7.9/src/solverdebug.c --- old/libsolv-0.7.7/src/solverdebug.c 2018-12-18 16:44:45.000000000 +0100 +++ new/libsolv-0.7.9/src/solverdebug.c 2019-11-08 14:39:59.000000000 +0100 @@ -128,6 +128,8 @@ POOL_DEBUG(type, "FEATURE "); else if (p >= solv->yumobsrules && p < solv->yumobsrules_end) POOL_DEBUG(type, "YUMOBS "); + else if (p >= solv->blackrules && p < solv->blackrules_end) + POOL_DEBUG(type, "BLACK "); else if (p >= solv->recommendsrules && p < solv->recommendsrules_end) POOL_DEBUG(type, "RECOMMENDS "); solver_printrule(solv, type, r); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsolv-0.7.7/src/transaction.c new/libsolv-0.7.9/src/transaction.c --- old/libsolv-0.7.7/src/transaction.c 2018-10-22 14:48:52.000000000 +0200 +++ new/libsolv-0.7.9/src/transaction.c 2019-11-08 15:16:37.000000000 +0100 @@ -646,6 +646,8 @@ s = pool->solvables + p; if (!s->repo || s->repo == installed) continue; + if (!MAPTST(&trans->transactsmap, p)) + continue; multi = trans->multiversionmap.size && MAPTST(&trans->multiversionmap, p); FOR_PROVIDES(p2, pp2, s->name) { @@ -726,9 +728,10 @@ { Repo *installed = pool->installed; int i, needmulti; - Id p; + Id p, pp; Solvable *s; Transaction *trans; + Map selfdestructmap; trans = transaction_create(pool); if (multiversionmap && !multiversionmap->size) @@ -736,6 +739,13 @@ queue_empty(&trans->steps); map_init(&trans->transactsmap, pool->nsolvables); needmulti = 0; + map_init(&selfdestructmap, 0); + FOR_PROVIDES(p, pp, LIBSOLV_SELF_DESTRUCT_PKG) + { + if (!selfdestructmap.size) + map_grow(&selfdestructmap, pool->nsolvables); + MAPSET(&selfdestructmap, p); + } for (i = 0; i < decisionq->count; i++) { p = decisionq->elements[i]; @@ -746,11 +756,14 @@ MAPSET(&trans->transactsmap, -p); if (!(installed && s->repo == installed) && p > 0) { + if (selfdestructmap.size && MAPTST(&selfdestructmap, p)) + continue; MAPSET(&trans->transactsmap, p); if (multiversionmap && MAPTST(multiversionmap, p)) needmulti = 1; } } + map_free(&selfdestructmap); MAPCLR(&trans->transactsmap, SYSTEMSOLVABLE); if (needmulti) map_init_clone(&trans->multiversionmap, multiversionmap); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsolv-0.7.7/test/testcases/blacklist/ptf new/libsolv-0.7.9/test/testcases/blacklist/ptf --- old/libsolv-0.7.7/test/testcases/blacklist/ptf 1970-01-01 01:00:00.000000000 +0100 +++ new/libsolv-0.7.9/test/testcases/blacklist/ptf 2019-11-08 14:39:59.000000000 +0100 @@ -0,0 +1,52 @@ +repo system 0 testtags <inline> +#>=Pkg: ptf-2 1 1 noarch +#>=Prv: ptf-package() +repo available 0 testtags <inline> +#>=Pkg: ptf-1 1 1 noarch +#>=Prv: ptf-package() +#>=Pkg: ptf-2 2 1 noarch +#>=Prv: ptf-package() +#>=Pkg: A 1 1 noarch +#>=Req: ptf-1 + +system i686 * system + +# +# test 1: a ptf package cannot be pulled in via a dependency +# +job blacklist provides ptf-package() +job install name A +result transaction,problems <inline> +#>problem 78613afb info package A-1-1.noarch requires ptf-1, but none of the providers can be installed +#>problem 78613afb solution 23f73f5b deljob install name A +#>problem 78613afb solution b79aeb6f allow ptf-1-1-1.noarch@available + +# +# test 2: a ptf package cannot be pulled in via a unspecific job +# +nextjob +job blacklist provides ptf-package() +job install name ptf-1 +result transaction,problems <inline> +#>problem 021b17e2 info package ptf-1-1-1.noarch cannot only be installed by a direct request +#>problem 021b17e2 solution 932a6c2f deljob install name ptf-1 +#>problem 021b17e2 solution b79aeb6f allow ptf-1-1-1.noarch@available + +# +# test 3: a ptf package can be pulled in via a specific job +# +nextjob +job blacklist provides ptf-package() +job install name ptf-1 [setevr] +result transaction,problems <inline> +#>install ptf-1-1-1.noarch@available + +# +# test 4: a ptf package can be updated +# +nextjob +job blacklist provides ptf-package() +job update all packages +result transaction,problems <inline> +#>upgrade ptf-2-1-1.noarch@system ptf-2-2-1.noarch@available + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsolv-0.7.7/test/testcases/blacklist/retracted new/libsolv-0.7.9/test/testcases/blacklist/retracted --- old/libsolv-0.7.7/test/testcases/blacklist/retracted 1970-01-01 01:00:00.000000000 +0100 +++ new/libsolv-0.7.9/test/testcases/blacklist/retracted 2019-11-08 14:39:59.000000000 +0100 @@ -0,0 +1,22 @@ +repo system 0 testtags <inline> +#>=Pkg: B 1 1 noarch +repo available 0 testtags <inline> +#>=Pkg: patch 1 1 noarch +#>=Con: B < 2-1 +#>=Pkg: B 2 1 noarch +#>=Prv: retracted-patch-package() + +system i686 * system + +job blacklist provides retracted-patch-package() +job install name patch +#>problem 3a66200a info package patch-1-1.noarch conflicts with B < 2-1 provided by B-1-1.noarch +#>problem 3a66200a solution 14805cf8 deljob install name patch +#>problem 3a66200a solution 4a9277b8 allow B-2-1.noarch@available +#>problem 3a66200a solution 718064ed erase B-1-1.noarch@system + +nextjob +job blacklist provides retracted-patch-package() +job install pkg B-2-1.noarch@available +result transaction,problems <inline> +#>upgrade B-1-1.noarch@system B-2-1.noarch@available diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libsolv-0.7.7/tools/repo2solv.c new/libsolv-0.7.9/tools/repo2solv.c --- old/libsolv-0.7.7/tools/repo2solv.c 2019-06-17 13:59:37.000000000 +0200 +++ new/libsolv-0.7.9/tools/repo2solv.c 2019-11-08 14:39:59.000000000 +0100 @@ -868,6 +868,7 @@ #ifdef SUSE if (add_auto) repo_add_autopattern(repo, 0); + repo_mark_retracted_packages(repo, pool_str2id(pool, "retracted-patch-package()", 1)); #endif tool_write(repo, stdout); pool_free(pool);
