From d50ba044c8a10b9979998c2147a4f9973588a8ff Mon Sep 17 00:00:00 2001 From: Michael Schroeder Date: Thu, 27 Mar 2014 11:44:11 +0100 Subject: [PATCH] autopattern: always chose the lexicographical first one if there are two pattern/product provides --- ext/repo_autopattern.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/ext/repo_autopattern.c b/ext/repo_autopattern.c index 01238aa..c947aef 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; } } } -- 2.7.4