summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-07-26 18:18:53 +0200
committerLudovic Courtès <ludo@gnu.org>2016-07-26 18:18:53 +0200
commit9e90fc771386a288e1bcf032edbb75bbfc472e7c (patch)
tree9e292feeccc9ed20ba52a3f7b9001b7a4a6d176b
parent201855221fa426851556b973e39f21e5ced7dfdf (diff)
downloadguix-9e90fc771386a288e1bcf032edbb75bbfc472e7c.tar.gz
profiles: Output in 'package->manifest-entry' defaults to "out".
Fixes <http://bugs.gnu.org/24029>.
Reported by Dylan Jeffers <sapientech@openmailbox.org>.

* guix/profiles.scm (package->manifest-entry): Change #:output to
default to "out".
(packages->manifest): Add 'package?' in second 'match' clause.
* tests/profiles.scm ("package->manifest-entry defaults to \"out\""):
New test.
-rw-r--r--guix/profiles.scm11
-rw-r--r--tests/profiles.scm10
2 files changed, 15 insertions, 6 deletions
diff --git a/guix/profiles.scm b/guix/profiles.scm
index 1adb143c16..db807a8136 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -163,9 +163,8 @@
         (call-with-input-file file read-manifest)
         (manifest '()))))
 
-(define* (package->manifest-entry package #:optional output)
-  "Return a manifest entry for the OUTPUT of package PACKAGE.  When OUTPUT is
-omitted or #f, use the first output of PACKAGE."
+(define* (package->manifest-entry package #:optional (output "out"))
+  "Return a manifest entry for the OUTPUT of package PACKAGE."
   (let ((deps (map (match-lambda
                     ((label package)
                      (gexp-input package))
@@ -175,7 +174,7 @@ omitted or #f, use the first output of PACKAGE."
     (manifest-entry
      (name (package-name package))
      (version (package-version package))
-     (output (or output (car (package-outputs package))))
+     (output output)
      (item package)
      (dependencies (delete-duplicates deps))
      (search-paths (package-transitive-native-search-paths package)))))
@@ -188,8 +187,8 @@ denoting a specific output of a package."
    (map (match-lambda
          ((package output)
           (package->manifest-entry package output))
-         (package
-           (package->manifest-entry package)))
+         ((? package? package)
+          (package->manifest-entry package)))
         packages)))
 
 (define (manifest->gexp manifest)
diff --git a/tests/profiles.scm b/tests/profiles.scm
index fc1dfd2bfc..028d7b6fb4 100644
--- a/tests/profiles.scm
+++ b/tests/profiles.scm
@@ -207,6 +207,16 @@
                                        #:hooks '())))
     (return (derivation-inputs drv))))
 
+(test-assert "package->manifest-entry defaults to \"out\""
+  (let ((outputs (package-outputs packages:glibc)))
+    (equal? (manifest-entry-output
+             (package->manifest-entry (package
+                                        (inherit packages:glibc)
+                                        (outputs (reverse outputs)))))
+            (manifest-entry-output
+             (package->manifest-entry packages:glibc))
+            "out")))
+
 (test-assertm "profile-manifest, search-paths"
   (mlet* %store-monad
       ((guile ->   (package