From 08ddb2b564c6def78336b52e4915ad29fda7ca61 Mon Sep 17 00:00:00 2001 From: Michael Schroeder Date: Wed, 31 Aug 2016 11:37:54 +0200 Subject: [PATCH] Do not rely on whatprovides when searching for a specific package See rhbz#1263888 --- ext/testcase.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) 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; -- 2.47.2