From 0f0c66fafb2cde5f3d68ede2dd5ad7e024e59cd2 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sun, 16 Oct 2011 10:27:02 +0200 Subject: [PATCH] xbps_dictionary_from_metadata_plist: if pkgname not found try from a virtual pkg. --- lib/plist.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/lib/plist.c b/lib/plist.c index 141f020e..e5efcfe6 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -195,18 +195,25 @@ xbps_dictionary_from_metadata_plist(const char *pkgname, assert(plist != NULL); xhp = xbps_handle_get(); - pkgd = xbps_find_virtualpkg_dict_installed(pkgname, false); - if (pkgd) { - prop_dictionary_get_cstring_nocopy(pkgd, "pkgname", &rpkgname); - prop_object_release(pkgd); - pkgname = rpkgname; - } - plistf = xbps_xasprintf("%s/%s/metadata/%s/%s", xhp->rootdir, XBPS_META_PATH, pkgname, plist); if (plistf == NULL) return NULL; + if (access(plistf, R_OK) == -1) { + pkgd = xbps_find_virtualpkg_dict_installed(pkgname, false); + if (pkgd) { + prop_dictionary_get_cstring_nocopy(pkgd, "pkgname", &rpkgname); + prop_object_release(pkgd); + pkgname = rpkgname; + } + free(plistf); + plistf = xbps_xasprintf("%s/%s/metadata/%s/%s", + xhp->rootdir, XBPS_META_PATH, pkgname, plist); + if (plistf == NULL) + return NULL; + } + plistd = prop_dictionary_internalize_from_zfile(plistf); free(plistf); if (plistd == NULL) {