From: Michael Schroeder Date: Wed, 31 Aug 2016 09:37:54 +0000 (+0200) Subject: Do not rely on whatprovides when searching for a specific package X-Git-Tag: 0.6.24~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=08ddb2b564c6def78336b52e4915ad29fda7ca61;p=thirdparty%2Flibsolv.git Do not rely on whatprovides when searching for a specific package See rhbz#1263888 --- diff --git a/ext/testcase.c b/ext/testcase.c index 5749dfae..a4b98be8 100644 --- a/ext/testcase.c +++ b/ext/testcase.c @@ -767,6 +767,7 @@ testcase_str2solvid(Pool *pool, const char *str) evrid = pool_strn2id(pool, str + i + 1, repostart - (i + 1), 0); if (!evrid) continue; + /* first check whatprovides */ FOR_PROVIDES(p, pp, nid) { Solvable *s = pool->solvables + p; @@ -778,6 +779,31 @@ testcase_str2solvid(Pool *pool, const char *str) continue; return p; } + /* maybe it's not installable and thus not in whatprovides. do a slow search */ + if (repo) + { + Solvable *s; + FOR_REPO_SOLVABLES(repo, p, s) + { + if (s->name != nid || s->evr != evrid) + continue; + if (arch && s->arch != arch) + continue; + return p; + } + } + else + { + FOR_POOL_SOLVABLES(p) + { + Solvable *s = pool->solvables + p; + if (s->name != nid || s->evr != evrid) + continue; + if (arch && s->arch != arch) + continue; + return p; + } + } } } return 0;