]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
Do not rely on whatprovides when searching for a specific package
authorMichael Schroeder <mls@suse.de>
Wed, 31 Aug 2016 09:37:54 +0000 (11:37 +0200)
committerMichael Schroeder <mls@suse.de>
Wed, 31 Aug 2016 09:37:54 +0000 (11:37 +0200)
See rhbz#1263888

ext/testcase.c

index 5749dfae940ac82b46cce5d30b8e55407106f8dc..a4b98be87fedf90239b8375bd94df56b52f03d37 100644 (file)
@@ -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;