libxbps: fix for vpkg providers in multiple repos.
Added new test case by @st3r4g via #206 Closes #206
This commit is contained in:
@@ -59,7 +59,7 @@ store_vars(struct xbps_handle *xhp, xbps_dictionary_t *d,
|
||||
|
||||
if (*d == NULL)
|
||||
*d = xbps_dictionary_create();
|
||||
if (xhp->vpkgd_conf)
|
||||
if (xhp->vpkgd_conf == NULL)
|
||||
xhp->vpkgd_conf = xbps_dictionary_create();
|
||||
|
||||
/*
|
||||
|
||||
@@ -304,7 +304,7 @@ xbps_find_virtualpkg_in_dict(struct xbps_handle *xhp,
|
||||
xbps_dictionary_t pkgd = NULL;
|
||||
const char *vpkg;
|
||||
|
||||
/* Try matching vpkg from configuration files */
|
||||
/* Try matching vpkg via xhp->vpkgd */
|
||||
vpkg = vpkg_user_conf(xhp, pkg, false);
|
||||
if (vpkg != NULL) {
|
||||
if (xbps_pkgpattern_version(vpkg))
|
||||
|
||||
@@ -42,11 +42,15 @@
|
||||
bool
|
||||
xbps_match_virtual_pkg_in_array(xbps_array_t a, const char *str)
|
||||
{
|
||||
if ((xbps_match_pkgname_in_array(a, str)) ||
|
||||
(xbps_match_pkgdep_in_array(a, str)) ||
|
||||
(xbps_match_pkgpattern_in_array(a, str)))
|
||||
if (xbps_pkgpattern_version(str)) {
|
||||
if (xbps_match_pkgdep_in_array(a, str) ||
|
||||
xbps_match_pkgpattern_in_array(a, str))
|
||||
return true;
|
||||
|
||||
} else if (xbps_pkg_version(str)) {
|
||||
return xbps_match_string_in_array(a, str);
|
||||
} else {
|
||||
return xbps_match_pkgname_in_array(a, str);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
11
lib/repo.c
11
lib/repo.c
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user