From 7a9d47c133953c3961e95b7858b9f5551d602c88 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Thu, 16 Feb 2012 08:55:41 +0100 Subject: [PATCH] xbps-repo: show, show-deps and show-files targets accepts pkgpatterns. --- NEWS | 14 ++++++++++++++ bin/xbps-repo/main.c | 14 ++++++++------ bin/xbps-repo/show.c | 16 ++++++++++++---- 3 files changed, 34 insertions(+), 10 deletions(-) diff --git a/NEWS b/NEWS index ef332ece..72a63b91 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,17 @@ +xbps-0.12.1 (2012-02-14): + + * xbps-repo(8): the `show', `show-deps' and `show-files' targets now accept + package patterns, i.e "xbps-repo show 'foo>=2.0'". If only a `pkgname` + has been specified, the newest package available in repositories will be + shown. + + * xbps-repo(8): print meaningful help usage, added -h option. + + * xbps-bin(8): print a meaningful help usage, added -h option. + + * libxbps: fixed xbps_transaction_install_pkg return value if package + is already installed: this must be EEXIST not ENODEV. + xbps-0.12.0 (2012-02-06): * xbps-bin: new dry-run mode (-n) to show the actions that would diff --git a/bin/xbps-repo/main.c b/bin/xbps-repo/main.c index 91c7e9e2..bdc9dae6 100644 --- a/bin/xbps-repo/main.c +++ b/bin/xbps-repo/main.c @@ -55,6 +55,8 @@ usage(bool fail) "[targets]\n" " find-files [patterns]\n" " Print package name/version for any pattern matched.\n" + " genindex \n" + " Generate a local repository in `directory'.\n" " list\n" " List registered repositories.\n" " pkg-list [index]\n" @@ -62,12 +64,12 @@ usage(bool fail) " If `index' not specified, all registered repositories will be used.\n" " search [patterns]\n" " Search for packages in repositories matching the patterns.\n" - " show \n" - " Print package information for `pkgname'.\n" - " show-deps \n" - " Print package's required dependencies for `pkgname'.\n" - " show-files \n" - " Print package's files list for `pkgname'.\n" + " show \n" + " Print package information for `pkgname' or `pkgpattern'.\n" + " show-deps \n" + " Print package's required dependencies for `pkgname' or `pkgpattern'.\n" + " show-files \n" + " Print package's files list for `pkgname' or `pkgpattern'.\n" " sync\n" " Synchronize package index files for all registered repositories.\n\n" "Refer to xbps-repo(8) for a more detailed description.\n"); diff --git a/bin/xbps-repo/show.c b/bin/xbps-repo/show.c index 638174f7..060e6238 100644 --- a/bin/xbps-repo/show.c +++ b/bin/xbps-repo/show.c @@ -44,11 +44,15 @@ #include "defs.h" int -show_pkg_info_from_repolist(const char *pkgname, const char *option) +show_pkg_info_from_repolist(const char *pattern, const char *option) { prop_dictionary_t pkgd; - pkgd = xbps_repository_pool_find_pkg(pkgname, false, false); + if (xbps_pkgpattern_version(pattern)) + pkgd = xbps_repository_pool_find_pkg(pattern, true, false); + else + pkgd = xbps_repository_pool_find_pkg(pattern, false, true); + if (pkgd == NULL) return errno; @@ -63,12 +67,16 @@ show_pkg_info_from_repolist(const char *pkgname, const char *option) } int -show_pkg_deps_from_repolist(const char *pkgname) +show_pkg_deps_from_repolist(const char *pattern) { prop_dictionary_t pkgd; const char *ver, *repoloc; - pkgd = xbps_repository_pool_find_pkg(pkgname, false, false); + if (xbps_pkgpattern_version(pattern)) + pkgd = xbps_repository_pool_find_pkg(pattern, true, false); + else + pkgd = xbps_repository_pool_find_pkg(pattern, false, true); + if (pkgd == NULL) return errno;