Skip to content
Snippets Groups Projects
Commit d0dc4907 authored by Ludovic Courtès's avatar Ludovic Courtès
Browse files

derivations: 'derivation-path->output-path' honors the 'output' parameter.

* guix/derivations.scm (derivation-path->output-path): Pass OUTPUT.
* tests/derivations.scm ("multiple-output derivation,
  derivation-path->output-path"): New test.
parent d595e456
No related branches found
No related tags found
No related merge requests found
...@@ -441,7 +441,8 @@ (define derivation-path->output-path ...@@ -441,7 +441,8 @@ (define derivation-path->output-path
(lambda* (path #:optional (output "out")) (lambda* (path #:optional (output "out"))
"Read the derivation from PATH (`/nix/store/xxx.drv'), and return the store "Read the derivation from PATH (`/nix/store/xxx.drv'), and return the store
path of its output OUTPUT." path of its output OUTPUT."
(derivation->output-path (call-with-input-file path read-derivation))))) (derivation->output-path (call-with-input-file path read-derivation)
output))))
(define (derivation-path->output-paths path) (define (derivation-path->output-paths path)
"Read the derivation from PATH (`/nix/store/xxx.drv'), and return the "Read the derivation from PATH (`/nix/store/xxx.drv'), and return the
......
...@@ -260,6 +260,23 @@ (define prefix-len (string-length dir)) ...@@ -260,6 +260,23 @@ (define prefix-len (string-length dir))
(and (eq? 'one (call-with-input-file one read)) (and (eq? 'one (call-with-input-file one read))
(eq? 'two (call-with-input-file two read))))))) (eq? 'two (call-with-input-file two read)))))))
(test-assert "multiple-output derivation, derivation-path->output-path"
(let* ((builder (add-text-to-store %store "builder.sh"
"echo one > $out ; echo two > $second"
'()))
(drv (derivation %store "multiple"
%bash `(,builder)
#:outputs '("out" "second")))
(drv-file (derivation-file-name drv))
(one (derivation->output-path drv "out"))
(two (derivation->output-path drv "second"))
(first (derivation-path->output-path drv-file "out"))
(second (derivation-path->output-path drv-file "second")))
(and (not (string=? one two))
(string-suffix? "-second" two)
(string=? first one)
(string=? second two))))
(test-assert "user of multiple-output derivation" (test-assert "user of multiple-output derivation"
;; Check whether specifying several inputs coming from the same ;; Check whether specifying several inputs coming from the same
;; multiple-output derivation works. ;; multiple-output derivation works.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment