From c50cbf03c7915f6974aebaf9e6748f754ac8a479 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sat, 2 Mar 2013 19:10:13 +0100 Subject: [PATCH] xbps-query: added support to query virtual packages in repository mode. --- NEWS | 7 +++++++ bin/xbps-query/show-deps.c | 9 +++++---- bin/xbps-query/show-info-files.c | 6 +++--- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index a2e5d7d8..6463f7ab 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,12 @@ xbps-0.21 (???): + * xbps-query(8): packages can be matched by using virtual package + names in repository mode, i.e: + + $ xbps-query -Rp pkgver ntp-daemon + ntp-4.2.6p5_7 + $ + * xbps-pkgdb(8): new option -m --mode to change package installation mode to auto (might be detected as orphan) or manual (explicitly installed). diff --git a/bin/xbps-query/show-deps.c b/bin/xbps-query/show-deps.c index 59e4c50f..896dc42a 100644 --- a/bin/xbps-query/show-deps.c +++ b/bin/xbps-query/show-deps.c @@ -73,8 +73,8 @@ repo_show_pkg_deps(struct xbps_handle *xhp, const char *pattern) { prop_dictionary_t pkgd; - pkgd = xbps_rpool_get_pkg(xhp, pattern); - if (pkgd == NULL) + if (((pkgd = xbps_rpool_get_pkg(xhp, pattern)) == NULL) && + ((pkgd = xbps_rpool_get_virtualpkg(xhp, pattern)) == NULL)) return errno; (void)xbps_callback_array_iter_in_dict(xhp, pkgd, @@ -126,9 +126,10 @@ repo_show_pkg_revdeps(struct xbps_handle *xhp, const char *pkg) if (xbps_pkg_version(pkg)) pkgver = pkg; else { - pkgd = xbps_rpool_get_pkg(xhp, pkg); - if (pkgd == NULL) + if (((pkgd = xbps_rpool_get_pkg(xhp, pkg)) == NULL) && + ((pkgd = xbps_rpool_get_virtualpkg(xhp, pkg)) == NULL)) return ENOENT; + prop_dictionary_get_cstring_nocopy(pkgd, "pkgver", &pkgver); } diff --git a/bin/xbps-query/show-info-files.c b/bin/xbps-query/show-info-files.c index b11c5064..a0f3bfe0 100644 --- a/bin/xbps-query/show-info-files.c +++ b/bin/xbps-query/show-info-files.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2008-2012 Juan Romero Pardines. + * Copyright (c) 2008-2013 Juan Romero Pardines. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -295,8 +295,8 @@ repo_show_pkg_info(struct xbps_handle *xhp, { prop_dictionary_t pkgd; - pkgd = xbps_rpool_get_pkg(xhp, pattern); - if (pkgd == NULL) + if (((pkgd = xbps_rpool_get_pkg(xhp, pattern)) == NULL) && + ((pkgd = xbps_rpool_get_virtualpkg(xhp, pattern)) == NULL)) return errno; if (option)