Subject: [bug#36351] [PATCH 07/10] derivations: 'build-derivations' can be passed derivation inputs.

From: Ludovic Courtès <[email-masked]>
Date: Mon, 24 Jun 2019 14:22:09 +0200

* guix/derivations.scm (build-derivations): Accept <derivation-input>
records among DERIVATIONS.
* tests/derivations.scm ("build-derivations with specific output"): Test
it.
---
 guix/derivations.scm  | 5 +++++
 tests/derivations.scm | 7 +++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/guix/derivations.scm b/guix/derivations.scm
index 403e86749b..433b4551a5 100644
--- a/guix/derivations.scm
+++ b/guix/derivations.scm
@@ -1016,6 +1016,11 @@ derivation/output pairs, using the specified MODE."
   (build-things store (map (match-lambda
                             ((? derivation? drv)
                              (derivation-file-name drv))
+                            ((? derivation-input? input)
+                             (cons (derivation-input-path input)
+                                   (string-join
+                                    (derivation-input-sub-derivations input)
+                                    ",")))
                             ((? string? file) file)
                             (((? derivation? drv) . output)
                              (cons (derivation-file-name drv)
diff --git a/tests/derivations.scm b/tests/derivations.scm
index 54fa588969..d173a78906 100644
--- a/tests/derivations.scm
+++ b/tests/derivations.scm
@@ -807,9 +807,12 @@
              ;; Ask for nothing but the "out" output of DRV.
              (build-derivations store `((,drv . "out")))
 
+             ;; Synonymous:
+             (build-derivations store (list (derivation-input drv '("out"))))
+
              (valid-path? store out)
-             (equal? (pk 'x content) (pk 'y (call-with-input-file out get-string-all)))
-             )))))
+             (equal? (pk 'x content)
+                     (pk 'y (call-with-input-file out get-string-all))))))))
 
 (test-assert "build-expression->derivation and derivation-build-plan"
   (let ((drv (build-expression->derivation %store "fail" #f)))
-- 
2.22.0