guix package: add a "show" option.

* 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.
This commit is contained in:
Cyril Roelandt 2014-07-17 02:36:09 +02:00
parent 9c0fc27968
commit 2aa6efb0b9
3 changed files with 42 additions and 0 deletions

View file

@ -844,6 +844,30 @@ name: gmp
@dots{} @dots{}
@end example @end example
@item --show=@var{package}
Show details about @var{package}, taken from the list of available packages, 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}] @item --list-installed[=@var{regexp}]
@itemx -I [@var{regexp}] @itemx -I [@var{regexp}]
List the currently installed packages in the specified profile, with the List the currently installed packages in the specified profile, with the

View file

@ -517,6 +517,8 @@ (define (show-help)
(display (_ " (display (_ "
-A, --list-available[=REGEXP] -A, --list-available[=REGEXP]
list available packages matching REGEXP")) list available packages matching REGEXP"))
(display (_ "
--show=PACKAGE show details about PACKAGE"))
(newline) (newline)
(show-build-options-help) (show-build-options-help)
(newline) (newline)
@ -615,6 +617,11 @@ (define %options
(values (cons `(query list-available ,(or arg "")) (values (cons `(query list-available ,(or arg ""))
result) result)
#f))) #f)))
(option '("show") #t #t
(lambda (opt name arg result arg-handler)
(values (cons `(query show ,arg)
result)
#f)))
%standard-build-options)) %standard-build-options))
@ -1042,6 +1049,14 @@ (define (list-generation number)
(find-packages-by-description regexp))) (find-packages-by-description regexp)))
#t)) #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) (('search-paths)
(let* ((manifest (profile-manifest profile)) (let* ((manifest (profile-manifest profile))
(entries (manifest-entries manifest)) (entries (manifest-entries manifest))

View file

@ -176,6 +176,9 @@ then false; else true; fi
# Check whether `--list-available' returns something sensible. # Check whether `--list-available' returns something sensible.
guix package -p "$profile" -A 'gui.*e' | grep guile guix package -p "$profile" -A 'gui.*e' | grep guile
# Check whether `--show' returns something sensible.
guix package --show=guile | grep "^Package: guile"
# There's no generation older than 12 months, so the following command should # There's no generation older than 12 months, so the following command should
# have no effect. # have no effect.
generation="`readlink_base "$profile"`" generation="`readlink_base "$profile"`"