summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2019-07-09 23:51:44 +0200
committerLudovic Courtès <ludo@gnu.org>2019-07-15 10:01:05 +0200
commitd1458321518b07dec045deddc2e635c1a69b9e93 (patch)
tree5eff190276de4e330a9dde49111602fb90d86772
parent02237f13ee0a423dce04f14538e9f765b8dc15da (diff)
downloadguix-d1458321518b07dec045deddc2e635c1a69b9e93.tar.gz
derivations: 'map-derivation' uses the new 'derivation' calling convention.
* guix/derivations.scm (map-derivation)[input->output-paths]: Adjust to
deal with an argument that's either 'derivation-input?' or a string.
[rewritten-input]: Return a <derivation-input> or a string.
Pass #:inputs and #:sources to 'derivation'.
-rw-r--r--guix/derivations.scm22
1 files changed, 10 insertions, 12 deletions
diff --git a/guix/derivations.scm b/guix/derivations.scm
index bd0af320c4..a18478502d 100644
--- a/guix/derivations.scm
+++ b/guix/derivations.scm
@@ -933,13 +933,10 @@ recursively."
 
   (define input->output-paths
     (match-lambda
-     (((? derivation? drv))
-      (list (derivation->output-path drv)))
-     (((? derivation? drv) sub-drvs ...)
-      (map (cut derivation->output-path drv <>)
-           sub-drvs))
-     ((file)
-      (list file))))
+      ((? derivation-input? input)
+       (derivation-input-output-paths input))
+      ((? string? file)
+       (list file))))
 
   (let ((mapping (fold (lambda (pair result)
                          (match pair
@@ -958,11 +955,11 @@ recursively."
           (($ <derivation-input> drv (sub-drvs ...))
            (match (vhash-assoc (derivation-file-name drv) mapping)
              ((_ . (? derivation? replacement))
-              (cons replacement sub-drvs))
-             ((_ . replacement)
-              (list replacement))
+              (derivation-input replacement sub-drvs))
+             ((_ . (? string? source))
+              source)
              (#f
-              (cons (loop drv) sub-drvs)))))))
+              (derivation-input (loop drv) sub-drvs)))))))
 
     (let loop ((drv drv))
       (let* ((inputs       (map (cut rewritten-input <> loop)
@@ -1001,7 +998,8 @@ recursively."
                                         . ,(substitute value initial
                                                        replacements))))
                                     (derivation-builder-environment-vars drv))
-                    #:inputs (append (map list sources) inputs)
+                    #:inputs (filter derivation-input? inputs)
+                    #:sources (append sources (filter string? inputs))
                     #:outputs (derivation-output-names drv)
                     #:hash (match (derivation-outputs drv)
                              ((($ <derivation-output> _ algo hash))