[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/03: packages: Add 'specifications->manifest'.

From: Ludovic Courtès
Subject: 02/03: packages: Add 'specifications->manifest'.
Date: Sun, 11 Jun 2017 17:12:49 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit c08ea55e7ec25261e4596bf6726a83c1ed056b94
Author: Ludovic Courtès <address@hidden>
Date:   Sun Jun 11 23:05:23 2017 +0200

    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
 doc/guix.texi    |  9 ++++-----
 gnu/packages.scm | 12 +++++++++++-
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 87aaae8..83f20c8 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -1742,18 +1742,17 @@ of packages:
        (list guile-2.0 "debug")))
 @end example
address@hidden specification->package+output
address@hidden specifications->manifest
 In this example we have to know which modules define the @code{emacs}
 and @code{guile-2.0} variables to provide the right
 @code{use-package-modules} line, which can be cumbersome.  We can
 instead provide regular package specifications and let
address@hidden>package-output} look up the corresponding package
address@hidden>manifest} look up the corresponding package
 objects, like this:
- (map (compose list specification->package+output)
-      '("emacs" "guile@@2.0" "guile@@2.0:debug")))
+ '("emacs" "guile@@2.2" "guile@@2.2:debug"))
 @end example
 @item --roll-back
diff --git a/gnu/packages.scm b/gnu/packages.scm
index 5790715..5629061 100644
--- a/gnu/packages.scm
+++ b/gnu/packages.scm
@@ -29,6 +29,7 @@
   #:use-module ((guix build utils)
                 #:select ((package-name->name+version
                            . hyphen-separated-name->name+version)))
+  #:autoload   (guix profiles) (packages->manifest)
   #:use-module (ice-9 vlist)
   #:use-module (ice-9 match)
   #:use-module (srfi srfi-1)
@@ -53,7 +54,8 @@
-            specification->package+output))
+            specification->package+output
+            specifications->manifest))
 ;;; Commentary:
@@ -278,3 +280,11 @@ version; if SPEC does not specify an output, return 
            (leave (G_ "package `~a' lacks output `~a'~%")
                   (package-full-name package)
+(define (specifications->manifest specs)
+  "Given SPECS, a list of specifications such as \"address@hidden" 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)))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]