From: Michael Schroeder Date: Thu, 27 Mar 2014 10:44:11 +0000 (+0100) Subject: autopattern: always chose the lexicographical first one if there are two pattern... X-Git-Tag: 0.6.4~48 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d50ba044c8a10b9979998c2147a4f9973588a8ff;p=thirdparty%2Flibsolv.git autopattern: always chose the lexicographical first one if there are two pattern/product provides --- diff --git a/ext/repo_autopattern.c b/ext/repo_autopattern.c index 01238aab..c947aeff 100644 --- a/ext/repo_autopattern.c +++ b/ext/repo_autopattern.c @@ -133,15 +133,28 @@ repo_add_autopattern(Repo *repo, int flags) if (rd->name == pattern_id) { const char *evrstr = pool_id2str(pool, rd->evr); - if (evrstr[0] == '.') + if (evrstr[0] == '.') /* hack to allow provides that do not create a pattern */ continue; + if (patq2.count && patq2.elements[patq2.count - 2] == p) + { + /* hmm, two provides. choose by evrstr */ + if (strcmp(evrstr, pool_id2str(pool, patq2.elements[patq2.count - 1])) >= 0) + continue; + patq2.count -= 2; + } queue_push2(&patq2, p, rd->evr); - break; } if (rd->name == product_id) { + const char *evrstr = pool_id2str(pool, rd->evr); + if (prdq2.count && prdq2.elements[prdq2.count - 2] == p) + { + /* hmm, two provides. choose by evrstr */ + if (strcmp(evrstr, pool_id2str(pool, prdq2.elements[prdq2.count - 1])) >= 0) + continue; + prdq2.count -= 2; + } queue_push2(&prdq2, p, rd->evr); - break; } } }