From: Michael Schroeder Date: Fri, 8 Apr 2016 13:33:57 +0000 (+0200) Subject: Better support of complex deps in pool_match_dep and selection_make_matchdeps X-Git-Tag: 0.6.20~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bc337603a8ce9b1b2384fe92e76ccb12bb860c91;p=thirdparty%2Flibsolv.git Better support of complex deps in pool_match_dep and selection_make_matchdeps --- diff --git a/src/pool.c b/src/pool.c index 34fd7873..ecc3686e 100644 --- a/src/pool.c +++ b/src/pool.c @@ -813,6 +813,45 @@ pool_match_dep(Pool *pool, Id d1, Id d2) if (d1 == d2) return 1; + + if (ISRELDEP(d1)) + { + /* we use potentially matches for complex deps */ + rd1 = GETRELDEP(pool, d1); + if (rd1->flags == REL_AND || rd1->flags == REL_OR || rd1->flags == REL_WITH || rd1->flags == REL_COND) + { + if (pool_match_dep(pool, rd1->name, d2)) + return 1; + if (rd1->flags == REL_COND && ISRELDEP(rd1->evr)) + { + rd1 = GETRELDEP(pool, rd1->evr); + if (rd1->flags != REL_ELSE) + return 0; + } + if (rd1->flags != REL_COND && pool_match_dep(pool, rd1->evr, d2)) + return 1; + return 0; + } + } + if (ISRELDEP(d2)) + { + /* we use potentially matches for complex deps */ + rd2 = GETRELDEP(pool, d2); + if (rd2->flags == REL_AND || rd2->flags == REL_OR || rd2->flags == REL_WITH || rd2->flags == REL_COND) + { + if (pool_match_dep(pool, d1, rd2->name)) + return 1; + if (rd2->flags == REL_COND && ISRELDEP(rd2->evr)) + { + rd2 = GETRELDEP(pool, rd2->evr); + if (rd2->flags != REL_ELSE) + return 0; + } + if (rd2->flags != REL_COND && pool_match_dep(pool, d1, rd2->evr)) + return 1; + return 0; + } + } if (!ISRELDEP(d1)) { if (!ISRELDEP(d2)) diff --git a/src/selection.c b/src/selection.c index 8856436f..7d9a918c 100644 --- a/src/selection.c +++ b/src/selection.c @@ -873,11 +873,17 @@ matchdep(Pool *pool, Id id, char *rname, int rflags, char *revr, int flags) if (ISRELDEP(id)) { Reldep *rd = GETRELDEP(pool, id); - if (rd->flags == REL_AND || rd->flags == REL_OR || rd->flags == REL_WITH) + if (rd->flags == REL_AND || rd->flags == REL_OR || rd->flags == REL_WITH || rd->flags == REL_COND) { if (matchdep(pool, rd->name, rname, rflags, revr, flags)) return 1; - if (matchdep(pool, rd->evr, rname, rflags, revr, flags)) + if (rd->flags == REL_COND && ISRELDEP(rd->evr)) + { + rd = GETRELDEP(pool, rd->evr); + if (rd->flags != REL_ELSE) + return 0; + } + if (rd->flags != REL_COND && matchdep(pool, rd->evr, rname, rflags, revr, flags)) return 1; return 0; }