return type;
}
+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)
{
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"))
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))
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;
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
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 a constraint ", pool_dep2str(pool, dep));
+ return pool_tmpappend(pool, s, " conflicting with ", pool_solvid2str(pool, target));
default:
return "bad problem rule type";
}
#endif
+#ifdef ENABLE_CONDA
+void
+add_conda_constrains_rule(Solver *solv, Id n, Id dep)
+{
+ 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;
+ 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
}
}
+#ifdef ENABLE_CONDA
+ if (pool->disttype == DISTTYPE_CONDA)
+ {
+ if (prereqq.count) /* reuse the prereq queue */
+ queue_empty(&prereqq);
+ solvable_lookup_idarray(s, SOLVABLE_CONSTRAINS, &prereqq);
+ for (i = 0; i < prereqq.count; i++)
+ add_conda_constrains_rule(solv, n, prereqq.elements[i]);
+ }
+#endif
+
/* that's all we check for src packages */
if (s->arch == ARCH_SRC || s->arch == ARCH_NOSRC)
continue;
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,