From e26b6e23e698be814ef168fa12f7cd83cc192e40 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Mon, 25 Jul 2011 16:40:34 +0200 Subject: [PATCH] xbps-bin(8): make 'show{,-deps,-revdeps}' target work with virtual pkgs. --- NEWS | 3 +++ bin/xbps-bin/show-deps.c | 11 ++++++----- include/xbps_api.h | 2 +- lib/plist.c | 14 +++++++++++--- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/NEWS b/NEWS index 246dd0e4..17b08544 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,8 @@ xbps-0.10.0 (???): + * xbps-bin(8): the 'show', 'show-deps' and 'show-revdeps' targets now + work with virtual packages. + * libxbps: fixed NetBSD's dewey matching code to properly identify that a version X.Y.Z should be greater than X.Y_Z. diff --git a/bin/xbps-bin/show-deps.c b/bin/xbps-bin/show-deps.c index c17dd9f0..3b526b1f 100644 --- a/bin/xbps-bin/show-deps.c +++ b/bin/xbps-bin/show-deps.c @@ -38,24 +38,25 @@ int xbps_show_pkg_deps(const char *pkgname) { prop_dictionary_t pkgd, propsd; + const char *rpkgname; int rv = 0; assert(pkgname != NULL); - pkgd = xbps_find_pkg_dict_installed(pkgname, false); + pkgd = xbps_find_virtualpkg_dict_installed(pkgname, false); if (pkgd == NULL) { printf("Package %s is not installed.\n", pkgname); return 0; } + prop_dictionary_get_cstring_nocopy(pkgd, "pkgname", &rpkgname); prop_object_release(pkgd); - /* * Check for props.plist metadata file. */ - propsd = xbps_dictionary_from_metadata_plist(pkgname, XBPS_PKGPROPS); + propsd = xbps_dictionary_from_metadata_plist(rpkgname, XBPS_PKGPROPS); if (propsd == NULL) { fprintf(stderr, - "%s: unexistent %s metadata file.\n", pkgname, + "%s: unexistent %s metadata file.\n", rpkgname, XBPS_PKGPROPS); return errno; } @@ -73,7 +74,7 @@ xbps_show_pkg_reverse_deps(const char *pkgname) prop_dictionary_t pkgd; int rv = 0; - pkgd = xbps_find_pkg_dict_installed(pkgname, false); + pkgd = xbps_find_virtualpkg_dict_installed(pkgname, false); if (pkgd == NULL) { printf("Package %s is not installed.\n", pkgname); return 0; diff --git a/include/xbps_api.h b/include/xbps_api.h index b446f748..4686a06e 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 "20110715" +#define XBPS_API_VERSION "20110725" #define XBPS_VERSION "0.10.0" /** diff --git a/lib/plist.c b/lib/plist.c index 023836ca..63d9a80e 100644 --- a/lib/plist.c +++ b/lib/plist.c @@ -187,15 +187,23 @@ xbps_dictionary_from_metadata_plist(const char *pkgname, const char *plist) { const struct xbps_handle *xhp; - prop_dictionary_t plistd = NULL; + prop_dictionary_t pkgd, plistd = NULL; + const char *rpkgname; char *plistf; assert(pkgname != NULL); assert(plist != NULL); xhp = xbps_handle_get(); + pkgd = xbps_find_virtualpkg_dict_installed(pkgname, false); + if (pkgd == NULL) + return NULL; + + prop_dictionary_get_cstring_nocopy(pkgd, "pkgname", &rpkgname); + prop_object_release(pkgd); + plistf = xbps_xasprintf("%s/%s/metadata/%s/%s", - xhp->rootdir, XBPS_META_PATH, pkgname, plist); + xhp->rootdir, XBPS_META_PATH, rpkgname, plist); if (plistf == NULL) return NULL; @@ -203,7 +211,7 @@ xbps_dictionary_from_metadata_plist(const char *pkgname, free(plistf); if (plistd == NULL) { xbps_dbg_printf("cannot read from plist file %s for %s: %s\n", - plist, pkgname, strerror(errno)); + plist, rpkgname, strerror(errno)); return NULL; }