libxbps: fix for vpkg providers in multiple repos.

Added new test case by @st3r4g via #206

Closes #206
This commit is contained in:
Juan RP
2020-01-18 12:50:59 +01:00
parent 5ff3ab5c60
commit ef9260a16e
5 changed files with 45 additions and 12 deletions

View File

@@ -398,8 +398,7 @@ xbps_repo_get_virtualpkg(struct xbps_repo *repo, const char *pkg)
pkgd = xbps_find_virtualpkg_in_dict(repo->xhp, repo->idx, pkg);
if (pkgd) {
xbps_dictionary_set_cstring_nocopy(pkgd,
"repository", repo->uri);
xbps_dictionary_set_cstring_nocopy(pkgd, "repository", repo->uri);
return pkgd;
}
return NULL;
@@ -417,14 +416,14 @@ xbps_repo_get_pkg(struct xbps_repo *repo, const char *pkg)
return NULL;
/* Try matching vpkg from configuration files */
if ((pkgd = xbps_find_virtualpkg_in_conf(repo->xhp, repo->idx, pkg)))
if ((pkgd = xbps_find_virtualpkg_in_conf(repo->xhp, repo->idx, pkg))) {
xbps_dictionary_set_cstring_nocopy(pkgd, "repository", repo->uri);
return pkgd;
}
/* ... otherwise match a real pkg */
pkgd = xbps_find_pkg_in_dict(repo->idx, pkg);
if (pkgd) {
xbps_dictionary_set_cstring_nocopy(pkgd,
"repository", repo->uri);
xbps_dictionary_set_cstring_nocopy(pkgd, "repository", repo->uri);
return pkgd;
}