libxbps: make xbps_find_virtualpkg_* only look for virtual pkgs.

Before this commit they also looked for non virtual packages, which
is not what it was meant when those functions were added.
This commit is contained in:
Juan RP 2012-04-12 11:57:21 +02:00
parent 53d28fcb35
commit 83bda174ab
4 changed files with 25 additions and 19 deletions

View File

@ -56,7 +56,7 @@
*/
#define XBPS_PKGINDEX_VERSION "1.4"
#define XBPS_API_VERSION "20120410"
#define XBPS_API_VERSION "20120412"
#define XBPS_VERSION "0.16"
/**

View File

@ -156,10 +156,14 @@ xbps_requiredby_pkg_add(struct xbps_handle *xhp, prop_dictionary_t pkgd)
xbps_find_virtualpkg_in_array_by_pattern(
xhp->pkgdb, str);
if (pkgd_pkgdb == NULL) {
rv = ENOENT;
xbps_dbg_printf("%s: couldnt find `%s' "
"entry in pkgdb\n", __func__, str);
break;
pkgd_pkgdb = xbps_find_pkg_in_array_by_pattern(
xhp->pkgdb, str);
if (pkgd_pkgdb == NULL) {
rv = ENOENT;
xbps_dbg_printf("%s: couldnt find `%s' "
"entry in pkgdb\n", __func__, str);
break;
}
}
}
rv = add_pkg_into_reqby(pkgd_pkgdb, pkgver);

View File

@ -58,7 +58,14 @@ find_pkg_in_array(prop_array_t array,
return NULL;
while ((obj = prop_object_iterator_next(iter))) {
if (bypattern) {
if (virtual) {
/*
* Check if package pattern matches
* any virtual package version in dictionary.
*/
if (xbps_match_virtual_pkg_in_dict(obj, str, bypattern))
break;
} else if (bypattern) {
/*
* Check if package pattern matches the
* pkgver string object in dictionary.
@ -75,14 +82,6 @@ find_pkg_in_array(prop_array_t array,
if (strcmp(dpkgn, str) == 0)
break;
}
if (!virtual)
continue;
/*
* Finally check if package pattern matches
* any virtual package version in dictionary.
*/
if (xbps_match_virtual_pkg_in_dict(obj, str, bypattern))
break;
}
prop_object_iterator_release(iter);
if (obj == NULL) {

View File

@ -68,11 +68,14 @@ xbps_check_is_installed_pkg_by_pattern(const char *pattern)
dict = xbps_find_virtualpkg_dict_installed(pattern, true);
if (dict == NULL) {
if (errno == ENOENT) {
errno = 0;
return 0; /* not installed */
}
return -1; /* error */
dict = xbps_find_pkg_dict_installed(pattern, true);
if (dict == NULL) {
if (errno == ENOENT) {
errno = 0;
return 0; /* not installed */
}
return -1; /* error */
}
}
/*
* Check that package state is fully installed, not