From b6da7393c135d98c247f1b199dc0528b4064a061 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sun, 16 Oct 2011 17:21:43 +0200 Subject: [PATCH] libxbps: make the xbps_find_*pkg_dict_installed work as expected. Bump XBPS_API_VERSION due to semantics change in virtual and non virtual functions. --- include/xbps_api.h | 2 +- lib/plist_find.c | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/include/xbps_api.h b/include/xbps_api.h index 9c9c86d1..05df0b8d 100644 --- a/include/xbps_api.h +++ b/include/xbps_api.h @@ -55,7 +55,7 @@ */ #define XBPS_PKGINDEX_VERSION "1.2" -#define XBPS_API_VERSION "20111016" +#define XBPS_API_VERSION "20111016-1" #define XBPS_VERSION "0.10.0" /** diff --git a/lib/plist_find.c b/lib/plist_find.c index ccf4fd3b..094f79ad 100644 --- a/lib/plist_find.c +++ b/lib/plist_find.c @@ -341,12 +341,21 @@ find_pkgd_installed(const char *str, bool bypattern, bool virtual) if (xhp->regpkgdb_dictionary == NULL) return NULL; - pkgd = find_virtualpkg_user_in_dict(xhp->regpkgdb_dictionary, - "packages", str, bypattern); - if (pkgd == NULL) { + /* try normal pkg */ + if (virtual == false) { pkgd = find_pkg_in_dict(xhp->regpkgdb_dictionary, - "packages", str, bypattern, virtual); + "packages", str, bypattern, false); + } else { + /* virtual pkg set by user in conf */ + pkgd = find_virtualpkg_user_in_dict(xhp->regpkgdb_dictionary, + "packages", str, bypattern); + if (pkgd == NULL) { + /* any virtual pkg in dictionary matching pattern */ + pkgd = find_pkg_in_dict(xhp->regpkgdb_dictionary, + "packages", str, bypattern, true); + } } + /* pkg not found */ if (pkgd == NULL) return NULL;