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'.
This commit is contained in:
Ludovic Courtès 2019-07-09 23:51:44 +02:00
parent 02237f13ee
commit d145832151
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 10 additions and 12 deletions

View File

@ -933,13 +933,10 @@ recursively."
(define input->output-paths (define input->output-paths
(match-lambda (match-lambda
(((? derivation? drv)) ((? derivation-input? input)
(list (derivation->output-path drv))) (derivation-input-output-paths input))
(((? derivation? drv) sub-drvs ...) ((? string? file)
(map (cut derivation->output-path drv <>) (list file))))
sub-drvs))
((file)
(list file))))
(let ((mapping (fold (lambda (pair result) (let ((mapping (fold (lambda (pair result)
(match pair (match pair
@ -958,11 +955,11 @@ recursively."
(($ <derivation-input> drv (sub-drvs ...)) (($ <derivation-input> drv (sub-drvs ...))
(match (vhash-assoc (derivation-file-name drv) mapping) (match (vhash-assoc (derivation-file-name drv) mapping)
((_ . (? derivation? replacement)) ((_ . (? derivation? replacement))
(cons replacement sub-drvs)) (derivation-input replacement sub-drvs))
((_ . replacement) ((_ . (? string? source))
(list replacement)) source)
(#f (#f
(cons (loop drv) sub-drvs))))))) (derivation-input (loop drv) sub-drvs)))))))
(let loop ((drv drv)) (let loop ((drv drv))
(let* ((inputs (map (cut rewritten-input <> loop) (let* ((inputs (map (cut rewritten-input <> loop)
@ -1001,7 +998,8 @@ recursively."
. ,(substitute value initial . ,(substitute value initial
replacements)))) replacements))))
(derivation-builder-environment-vars drv)) (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) #:outputs (derivation-output-names drv)
#:hash (match (derivation-outputs drv) #:hash (match (derivation-outputs drv)
((($ <derivation-output> _ algo hash)) ((($ <derivation-output> _ algo hash))