packages: Add 'specifications->manifest'.
* gnu/packages.scm (specifications->manifest): New procedure. * doc/guix.texi (Invoking guix package): Change example from using '(compose list specification->package+output)' to using 'specifications->manifest'.
This commit is contained in:
parent
c580ff6724
commit
c08ea55e7e
|
@ -1742,18 +1742,17 @@ of packages:
|
||||||
(list guile-2.0 "debug")))
|
(list guile-2.0 "debug")))
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
@findex specification->package+output
|
@findex specifications->manifest
|
||||||
In this example we have to know which modules define the @code{emacs}
|
In this example we have to know which modules define the @code{emacs}
|
||||||
and @code{guile-2.0} variables to provide the right
|
and @code{guile-2.0} variables to provide the right
|
||||||
@code{use-package-modules} line, which can be cumbersome. We can
|
@code{use-package-modules} line, which can be cumbersome. We can
|
||||||
instead provide regular package specifications and let
|
instead provide regular package specifications and let
|
||||||
@code{specification->package-output} look up the corresponding package
|
@code{specifications->manifest} look up the corresponding package
|
||||||
objects, like this:
|
objects, like this:
|
||||||
|
|
||||||
@example
|
@example
|
||||||
(packages->manifest
|
(specifications->manifest
|
||||||
(map (compose list specification->package+output)
|
'("emacs" "guile@@2.2" "guile@@2.2:debug"))
|
||||||
'("emacs" "guile@@2.0" "guile@@2.0:debug")))
|
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
@item --roll-back
|
@item --roll-back
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#:use-module ((guix build utils)
|
#:use-module ((guix build utils)
|
||||||
#:select ((package-name->name+version
|
#:select ((package-name->name+version
|
||||||
. hyphen-separated-name->name+version)))
|
. hyphen-separated-name->name+version)))
|
||||||
|
#:autoload (guix profiles) (packages->manifest)
|
||||||
#:use-module (ice-9 vlist)
|
#:use-module (ice-9 vlist)
|
||||||
#:use-module (ice-9 match)
|
#:use-module (ice-9 match)
|
||||||
#:use-module (srfi srfi-1)
|
#:use-module (srfi srfi-1)
|
||||||
|
@ -53,7 +54,8 @@
|
||||||
find-newest-available-packages
|
find-newest-available-packages
|
||||||
|
|
||||||
specification->package
|
specification->package
|
||||||
specification->package+output))
|
specification->package+output
|
||||||
|
specifications->manifest))
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
;;;
|
;;;
|
||||||
|
@ -278,3 +280,11 @@ version; if SPEC does not specify an output, return OUTPUT."
|
||||||
(leave (G_ "package `~a' lacks output `~a'~%")
|
(leave (G_ "package `~a' lacks output `~a'~%")
|
||||||
(package-full-name package)
|
(package-full-name package)
|
||||||
sub-drv))))))
|
sub-drv))))))
|
||||||
|
|
||||||
|
(define (specifications->manifest specs)
|
||||||
|
"Given SPECS, a list of specifications such as \"emacs@25.2\" or
|
||||||
|
\"guile:debug\", return a profile manifest."
|
||||||
|
;; This procedure exists mostly so users of 'guix package -m' don't have to
|
||||||
|
;; fiddle with multiple-value returns.
|
||||||
|
(packages->manifest
|
||||||
|
(map (compose list specification->package+output) specs)))
|
||||||
|
|
Loading…
Reference in New Issue