[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
02/02: gexp: Aggregate outputs of compound gexps.
From: |
Ludovic Courtès |
Subject: |
02/02: gexp: Aggregate outputs of compound gexps. |
Date: |
Fri, 27 Feb 2015 21:15:22 +0000 |
civodul pushed a commit to branch core-updates
in repository guix.
commit f9efe568c3cd46f0aecb5bdd35731e98a29dbcea
Author: Ludovic Courtès <address@hidden>
Date: Fri Feb 27 22:05:40 2015 +0100
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.
---
guix/gexp.scm | 6 +++---
tests/gexp.scm | 10 ++++++++++
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/guix/gexp.scm b/guix/gexp.scm
index a8349c7..1f64cf7 100644
--- a/guix/gexp.scm
+++ b/guix/gexp.scm
@@ -314,12 +314,12 @@ references."
(cons name result))
((? gexp? exp)
(append (gexp-outputs exp) result))
+ ((lst ...)
+ (fold-right add-reference-output result lst))
(_
result)))
- (fold-right add-reference-output
- '()
- (gexp-references exp)))
+ (add-reference-output (gexp-references exp) '()))
(define* (gexp->sexp exp #:key
(system (%current-system))
diff --git a/tests/gexp.scm b/tests/gexp.scm
index a6fb550..2ec6c8e 100644
--- a/tests/gexp.scm
+++ b/tests/gexp.scm
@@ -230,6 +230,16 @@
(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"
(mlet* %store-monad ((exp -> (gexp (display (ungexp %bootstrap-guile))))
(guile (package-file %bootstrap-guile))