xbps-bin(8): make 'show{,-deps,-revdeps}' target work with virtual pkgs.

This commit is contained in:
Juan RP
2011-07-25 16:40:34 +02:00
parent 2e5d5e7f49
commit e26b6e23e6
4 changed files with 21 additions and 9 deletions

3
NEWS
View File

@ -1,5 +1,8 @@
xbps-0.10.0 (???): 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 * libxbps: fixed NetBSD's dewey matching code to properly identify
that a version X.Y.Z should be greater than X.Y_Z. that a version X.Y.Z should be greater than X.Y_Z.

View File

@ -38,24 +38,25 @@ int
xbps_show_pkg_deps(const char *pkgname) xbps_show_pkg_deps(const char *pkgname)
{ {
prop_dictionary_t pkgd, propsd; prop_dictionary_t pkgd, propsd;
const char *rpkgname;
int rv = 0; int rv = 0;
assert(pkgname != NULL); assert(pkgname != NULL);
pkgd = xbps_find_pkg_dict_installed(pkgname, false); pkgd = xbps_find_virtualpkg_dict_installed(pkgname, false);
if (pkgd == NULL) { if (pkgd == NULL) {
printf("Package %s is not installed.\n", pkgname); printf("Package %s is not installed.\n", pkgname);
return 0; return 0;
} }
prop_dictionary_get_cstring_nocopy(pkgd, "pkgname", &rpkgname);
prop_object_release(pkgd); prop_object_release(pkgd);
/* /*
* Check for props.plist metadata file. * 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) { if (propsd == NULL) {
fprintf(stderr, fprintf(stderr,
"%s: unexistent %s metadata file.\n", pkgname, "%s: unexistent %s metadata file.\n", rpkgname,
XBPS_PKGPROPS); XBPS_PKGPROPS);
return errno; return errno;
} }
@ -73,7 +74,7 @@ xbps_show_pkg_reverse_deps(const char *pkgname)
prop_dictionary_t pkgd; prop_dictionary_t pkgd;
int rv = 0; int rv = 0;
pkgd = xbps_find_pkg_dict_installed(pkgname, false); pkgd = xbps_find_virtualpkg_dict_installed(pkgname, false);
if (pkgd == NULL) { if (pkgd == NULL) {
printf("Package %s is not installed.\n", pkgname); printf("Package %s is not installed.\n", pkgname);
return 0; return 0;

View File

@ -55,7 +55,7 @@
*/ */
#define XBPS_PKGINDEX_VERSION "1.2" #define XBPS_PKGINDEX_VERSION "1.2"
#define XBPS_API_VERSION "20110715" #define XBPS_API_VERSION "20110725"
#define XBPS_VERSION "0.10.0" #define XBPS_VERSION "0.10.0"
/** /**

View File

@ -187,15 +187,23 @@ xbps_dictionary_from_metadata_plist(const char *pkgname,
const char *plist) const char *plist)
{ {
const struct xbps_handle *xhp; const struct xbps_handle *xhp;
prop_dictionary_t plistd = NULL; prop_dictionary_t pkgd, plistd = NULL;
const char *rpkgname;
char *plistf; char *plistf;
assert(pkgname != NULL); assert(pkgname != NULL);
assert(plist != NULL); assert(plist != NULL);
xhp = xbps_handle_get(); 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", 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) if (plistf == NULL)
return NULL; return NULL;
@ -203,7 +211,7 @@ xbps_dictionary_from_metadata_plist(const char *pkgname,
free(plistf); free(plistf);
if (plistd == NULL) { if (plistd == NULL) {
xbps_dbg_printf("cannot read from plist file %s for %s: %s\n", xbps_dbg_printf("cannot read from plist file %s for %s: %s\n",
plist, pkgname, strerror(errno)); plist, rpkgname, strerror(errno));
return NULL; return NULL;
} }