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.
This commit is contained in:
Ludovic Courtès 2016-07-26 18:18:53 +02:00
parent 201855221f
commit 9e90fc7713
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
2 changed files with 15 additions and 6 deletions

View file

@ -163,9 +163,8 @@ (define (profile-manifest profile)
(call-with-input-file file read-manifest) (call-with-input-file file read-manifest)
(manifest '())))) (manifest '()))))
(define* (package->manifest-entry package #:optional output) (define* (package->manifest-entry package #:optional (output "out"))
"Return a manifest entry for the OUTPUT of package PACKAGE. When OUTPUT is "Return a manifest entry for the OUTPUT of package PACKAGE."
omitted or #f, use the first output of PACKAGE."
(let ((deps (map (match-lambda (let ((deps (map (match-lambda
((label package) ((label package)
(gexp-input package)) (gexp-input package))
@ -175,7 +174,7 @@ (define* (package->manifest-entry package #:optional output)
(manifest-entry (manifest-entry
(name (package-name package)) (name (package-name package))
(version (package-version package)) (version (package-version package))
(output (or output (car (package-outputs package)))) (output output)
(item package) (item package)
(dependencies (delete-duplicates deps)) (dependencies (delete-duplicates deps))
(search-paths (package-transitive-native-search-paths package))))) (search-paths (package-transitive-native-search-paths package)))))
@ -188,8 +187,8 @@ (define (packages->manifest packages)
(map (match-lambda (map (match-lambda
((package output) ((package output)
(package->manifest-entry package output)) (package->manifest-entry package output))
(package ((? package? package)
(package->manifest-entry package))) (package->manifest-entry package)))
packages))) packages)))
(define (manifest->gexp manifest) (define (manifest->gexp manifest)

View file

@ -207,6 +207,16 @@ (define glibc
#:hooks '()))) #:hooks '())))
(return (derivation-inputs drv)))) (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" (test-assertm "profile-manifest, search-paths"
(mlet* %store-monad (mlet* %store-monad
((guile -> (package ((guile -> (package