From mboxrd@z Thu Jan 1 00:00:00 1970 From: Cyril Roelandt Subject: [PATCH v2 2/2] guix package: add a "show" option. Date: Thu, 17 Jul 2014 02:54:10 +0200 Message-ID: <1405558450-13602-2-git-send-email-tipecaml@gmail.com> References: <87r41mjozg.fsf@gnu.org> <1405558450-13602-1-git-send-email-tipecaml@gmail.com> Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37662) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X7a6O-0007C2-KZ for guix-devel@gnu.org; Wed, 16 Jul 2014 21:03:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X7a6H-00031t-9c for guix-devel@gnu.org; Wed, 16 Jul 2014 21:03:16 -0400 Received: from mail-we0-x229.google.com ([2a00:1450:400c:c03::229]:64212) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X7a6H-00031G-2o for guix-devel@gnu.org; Wed, 16 Jul 2014 21:03:09 -0400 Received: by mail-we0-f169.google.com with SMTP id u56so1709974wes.14 for ; Wed, 16 Jul 2014 18:03:08 -0700 (PDT) In-Reply-To: <1405558450-13602-1-git-send-email-tipecaml@gmail.com> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: guix-devel@gnu.org * doc/guix.texi: Update the documentation. * guix/scripts/package.scm: Add a "show" option. * tests/guix-package.sh: Add a test for the "show" option. --- doc/guix.texi | 23 +++++++++++++++++++++++ guix/scripts/package.scm | 15 +++++++++++++++ tests/guix-package.sh | 3 +++ 3 files changed, 41 insertions(+) diff --git a/doc/guix.texi b/doc/guix.texi index 7ea40e5..38aade5 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -839,6 +839,29 @@ name: gmp @dots{} @end example +@item --show=@var{package} +Show details about a given package in @code{recutils} format (@pxref{Top, GNU +recutils databases,, recutils, GNU recutils manual}). + +@example +$ guix package --show=python | recsel -p name,version +name: python +version: 2.7.6 + +name: python +version: 3.3.5 +@end example + +You may also specify the full name of a package to only get details about a +specific version of it: +@example +$ guix package --show=python-3.3.5 | recsel -p name,version +name: python +version: 3.3.5 +@end example + + + @item --list-installed[=@var{regexp}] @itemx -I [@var{regexp}] List the currently installed packages in the specified profile, with the diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index 1c3209f..0d17414 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -517,6 +517,8 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n")) (display (_ " -A, --list-available[=REGEXP] list available packages matching REGEXP")) + (display (_ " + --show=PACKAGE show details about PACKAGE")) (newline) (show-build-options-help) (newline) @@ -615,6 +617,11 @@ Install, remove, or upgrade PACKAGES in a single transaction.\n")) (values (cons `(query list-available ,(or arg "")) result) #f))) + (option '("show") #t #t + (lambda (opt name arg result arg-handler) + (values (cons `(query show ,arg) + result) + #f))) %standard-build-options)) @@ -1042,6 +1049,14 @@ more information.~%")) (find-packages-by-description regexp))) #t)) + (('show requested-name) + (let-values (((name version) + (package-name->name+version requested-name))) + (leave-on-EPIPE + (for-each (cute package->recutils <> (current-output-port)) + (find-packages-by-name name version))) + #t)) + (('search-paths) (let* ((manifest (profile-manifest profile)) (entries (manifest-entries manifest)) diff --git a/tests/guix-package.sh b/tests/guix-package.sh index 4d75955..d388514 100644 --- a/tests/guix-package.sh +++ b/tests/guix-package.sh @@ -176,6 +176,9 @@ then false; else true; fi # Check whether `--list-available' returns something sensible. guix package -p "$profile" -A 'gui.*e' | grep guile +# Check whether `--show' returns something sensible. +guix package -p "$profile" --show=guile | grep "^Package: guile" + # There's no generation older than 12 months, so the following command should # have no effect. generation="`readlink_base "$profile"`" -- 1.8.4.rc3