mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 07:26:13 -05:00
gexp: 'ungexp-splicing' properly accounts for nested native inputs.
Previously, (gexp-native-inputs #~#$@(list #~#+foo)) would return '().
This is a followup to 5b14a7902c
.
* guix/gexp.scm (gexp-inputs)[add-reference-inputs]: In the list case,
remove 'if' around 'fold-right'. In 'map' lambda, always inherit N?.
* tests/gexp.scm ("gexp list splicing + ungexp-splicing"): New test.
This commit is contained in:
parent
1cbcbc8600
commit
578dfbe07b
2 changed files with 19 additions and 9 deletions
|
@ -706,15 +706,17 @@ (define (add-reference-inputs ref result)
|
|||
(cons `(,thing ,output) result)
|
||||
result))
|
||||
(($ <gexp-input> (lst ...) output n?)
|
||||
(if (eqv? native? n?)
|
||||
(fold-right add-reference-inputs result
|
||||
;; XXX: For now, automatically convert LST to a list of
|
||||
;; gexp-inputs.
|
||||
(map (match-lambda
|
||||
((? gexp-input? x) x)
|
||||
(x (%gexp-input x "out" (or n? native?))))
|
||||
lst))
|
||||
result))
|
||||
(fold-right add-reference-inputs result
|
||||
;; XXX: For now, automatically convert LST to a list of
|
||||
;; gexp-inputs. Inherit N?.
|
||||
(map (match-lambda
|
||||
((? gexp-input? x)
|
||||
(%gexp-input (gexp-input-thing x)
|
||||
(gexp-input-output x)
|
||||
n?))
|
||||
(x
|
||||
(%gexp-input x "out" n?)))
|
||||
lst)))
|
||||
(_
|
||||
;; Ignore references to other kinds of objects.
|
||||
result)))
|
||||
|
|
|
@ -355,6 +355,14 @@ (define (match-input thing)
|
|||
(equal? (gexp->sexp* exp) ;native
|
||||
(gexp->sexp* exp "mips64el-linux")))))
|
||||
|
||||
(test-assert "gexp list splicing + ungexp-splicing"
|
||||
(let* ((inner (gexp (ungexp-native glibc)))
|
||||
(exp (gexp (list (ungexp-splicing (list inner))))))
|
||||
(and (equal? `((,glibc "out")) (gexp-native-inputs exp))
|
||||
(null? (gexp-inputs exp))
|
||||
(equal? (gexp->sexp* exp) ;native
|
||||
(gexp->sexp* exp "mips64el-linux")))))
|
||||
|
||||
(test-equal "output list"
|
||||
2
|
||||
(let ((exp (gexp (begin (mkdir (ungexp output))
|
||||
|
|
Loading…
Reference in a new issue