From: Michael Schroeder Date: Wed, 30 Jul 2025 10:40:59 +0000 (+0200) Subject: Move pool_dep_fulfilled_in_map into pooldep.c X-Git-Tag: 0.7.35~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=276d550835db5603804277f1b2f9d8e415792c25;p=thirdparty%2Flibsolv.git Move pool_dep_fulfilled_in_map into pooldep.c --- diff --git a/src/pool.c b/src/pool.c index fa5f801d..3be2e444 100644 --- a/src/pool.c +++ b/src/pool.c @@ -754,74 +754,4 @@ int (*pool_get_custom_vendorcheck(Pool *pool))(Pool *, Solvable *, Solvable *) return pool->custom_vendorcheck; } -static int -pool_dep_fulfilled_in_map_cplx(Pool *pool, const Map *map, Reldep *rd) -{ - if (rd->flags == REL_COND) - { - if (ISRELDEP(rd->evr)) - { - Reldep *rd2 = GETRELDEP(pool, rd->evr); - if (rd2->flags == REL_ELSE) - { - if (pool_dep_fulfilled_in_map(pool, map, rd2->name)) - return pool_dep_fulfilled_in_map(pool, map, rd->name); - return pool_dep_fulfilled_in_map(pool, map, rd2->evr); - } - } - if (pool_dep_fulfilled_in_map(pool, map, rd->name)) - return 1; - return !pool_dep_fulfilled_in_map(pool, map, rd->evr); - } - if (rd->flags == REL_UNLESS) - { - if (ISRELDEP(rd->evr)) - { - Reldep *rd2 = GETRELDEP(pool, rd->evr); - if (rd2->flags == REL_ELSE) - { - if (!pool_dep_fulfilled_in_map(pool, map, rd2->name)) - return pool_dep_fulfilled_in_map(pool, map, rd->name); - return pool_dep_fulfilled_in_map(pool, map, rd2->evr); - } - } - if (!pool_dep_fulfilled_in_map(pool, map, rd->name)) - return 0; - return !pool_dep_fulfilled_in_map(pool, map, rd->evr); - } - if (rd->flags == REL_AND) - { - if (!pool_dep_fulfilled_in_map(pool, map, rd->name)) - return 0; - return pool_dep_fulfilled_in_map(pool, map, rd->evr); - } - if (rd->flags == REL_OR) - { - if (pool_dep_fulfilled_in_map(pool, map, rd->name)) - return 1; - return pool_dep_fulfilled_in_map(pool, map, rd->evr); - } - return 0; -} - - -int pool_dep_fulfilled_in_map(Pool *pool, const Map *map, Id dep) -{ - Id p, pp; - - if (ISRELDEP(dep)) { - Reldep *rd = GETRELDEP(pool, dep); - if (rd->flags == REL_COND || rd->flags == REL_UNLESS || - rd->flags == REL_AND || rd->flags == REL_OR) - return pool_dep_fulfilled_in_map_cplx(pool, map, rd); - if (rd->flags == REL_NAMESPACE && rd->name == NAMESPACE_SPLITPROVIDES) - return 0; - } - FOR_PROVIDES(p, pp, dep) { - if (MAPTST(map, p)) - return 1; - } - return 0; -} - /* EOF */ diff --git a/src/pooldep.c b/src/pooldep.c index d397c28d..e7ff68c8 100644 --- a/src/pooldep.c +++ b/src/pooldep.c @@ -345,4 +345,73 @@ pool_whatmatchessolvable(Pool *pool, Id keyname, Id solvid, Queue *q, int marker queue_free(&qq); } +static int +pool_dep_fulfilled_in_map_cplx(Pool *pool, const Map *map, Reldep *rd) +{ + if (rd->flags == REL_COND) + { + if (ISRELDEP(rd->evr)) + { + Reldep *rd2 = GETRELDEP(pool, rd->evr); + if (rd2->flags == REL_ELSE) + { + if (pool_dep_fulfilled_in_map(pool, map, rd2->name)) + return pool_dep_fulfilled_in_map(pool, map, rd->name); + return pool_dep_fulfilled_in_map(pool, map, rd2->evr); + } + } + if (pool_dep_fulfilled_in_map(pool, map, rd->name)) + return 1; + return !pool_dep_fulfilled_in_map(pool, map, rd->evr); + } + if (rd->flags == REL_UNLESS) + { + if (ISRELDEP(rd->evr)) + { + Reldep *rd2 = GETRELDEP(pool, rd->evr); + if (rd2->flags == REL_ELSE) + { + if (!pool_dep_fulfilled_in_map(pool, map, rd2->name)) + return pool_dep_fulfilled_in_map(pool, map, rd->name); + return pool_dep_fulfilled_in_map(pool, map, rd2->evr); + } + } + if (!pool_dep_fulfilled_in_map(pool, map, rd->name)) + return 0; + return !pool_dep_fulfilled_in_map(pool, map, rd->evr); + } + if (rd->flags == REL_AND) + { + if (!pool_dep_fulfilled_in_map(pool, map, rd->name)) + return 0; + return pool_dep_fulfilled_in_map(pool, map, rd->evr); + } + if (rd->flags == REL_OR) + { + if (pool_dep_fulfilled_in_map(pool, map, rd->name)) + return 1; + return pool_dep_fulfilled_in_map(pool, map, rd->evr); + } + return 0; +} + +int +pool_dep_fulfilled_in_map(Pool *pool, const Map *map, Id dep) +{ + Id p, pp; + + if (ISRELDEP(dep)) { + Reldep *rd = GETRELDEP(pool, dep); + if (rd->flags == REL_COND || rd->flags == REL_UNLESS || + rd->flags == REL_AND || rd->flags == REL_OR) + return pool_dep_fulfilled_in_map_cplx(pool, map, rd); + if (rd->flags == REL_NAMESPACE && rd->name == NAMESPACE_SPLITPROVIDES) + return 0; + } + FOR_PROVIDES(p, pp, dep) { + if (MAPTST(map, p)) + return 1; + } + return 0; +} /* EOF */