diff options
Diffstat (limited to 'src/rules.c')
-rw-r--r-- | src/rules.c | 59 |
1 files changed, 47 insertions, 12 deletions
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); } |