mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 15:36:20 -05:00
gexp: Aggregate outputs of compound gexps.
* guix/gexp.scm (gexp-outputs)[add-reference-output]: Recurse into lists. * tests/gexp.scm ("output list + ungexp-splicing list, combined gexps"): New test.
This commit is contained in:
parent
4b23c4664e
commit
f9efe568c3
2 changed files with 13 additions and 3 deletions
|
@ -314,12 +314,12 @@ (define (add-reference-output ref result)
|
||||||
(cons name result))
|
(cons name result))
|
||||||
((? gexp? exp)
|
((? gexp? exp)
|
||||||
(append (gexp-outputs exp) result))
|
(append (gexp-outputs exp) result))
|
||||||
|
((lst ...)
|
||||||
|
(fold-right add-reference-output result lst))
|
||||||
(_
|
(_
|
||||||
result)))
|
result)))
|
||||||
|
|
||||||
(fold-right add-reference-output
|
(add-reference-output (gexp-references exp) '()))
|
||||||
'()
|
|
||||||
(gexp-references exp)))
|
|
||||||
|
|
||||||
(define* (gexp->sexp exp #:key
|
(define* (gexp->sexp exp #:key
|
||||||
(system (%current-system))
|
(system (%current-system))
|
||||||
|
|
|
@ -230,6 +230,16 @@ (define (match-input thing)
|
||||||
(gexp-outputs exp2))
|
(gexp-outputs exp2))
|
||||||
(= 2 (length (gexp-outputs exp2))))))
|
(= 2 (length (gexp-outputs exp2))))))
|
||||||
|
|
||||||
|
(test-assert "output list + ungexp-splicing list, combined gexps"
|
||||||
|
(let* ((exp0 (gexp (mkdir (ungexp output))))
|
||||||
|
(exp1 (gexp (mkdir (ungexp output "foo"))))
|
||||||
|
(exp2 (gexp (begin (display "hi!")
|
||||||
|
(ungexp-splicing (list exp0 exp1))))))
|
||||||
|
(and (lset= equal?
|
||||||
|
(append (gexp-outputs exp0) (gexp-outputs exp1))
|
||||||
|
(gexp-outputs exp2))
|
||||||
|
(= 2 (length (gexp-outputs exp2))))))
|
||||||
|
|
||||||
(test-assertm "gexp->file"
|
(test-assertm "gexp->file"
|
||||||
(mlet* %store-monad ((exp -> (gexp (display (ungexp %bootstrap-guile))))
|
(mlet* %store-monad ((exp -> (gexp (display (ungexp %bootstrap-guile))))
|
||||||
(guile (package-file %bootstrap-guile))
|
(guile (package-file %bootstrap-guile))
|
||||||
|
|
Loading…
Reference in a new issue