From 9c629a27a435dd37b55a3944f8d79accc710a0e4 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès <ludo@gnu.org> Date: Mon, 26 Aug 2013 22:19:21 +0200 Subject: derivations: Add #:dependency-graphs to `build-expression->derivation'. * guix/derivations.scm (build-expression->derivation): Add #:dependency-graphs keyword argument. Pass it to `derivation'. * tests/derivations.scm ("build-expression->derivation with #:dependency-graphs"): New test. * doc/guix.texi (Derivations): Update `build-expression->derivation' description. --- tests/derivations.scm | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/derivations.scm b/tests/derivations.scm index 9b3d92a7bf..f9e6c28ec8 100644 --- a/tests/derivations.scm +++ b/tests/derivations.scm @@ -376,7 +376,7 @@ (and (valid-path? %store p) (file-exists? (string-append p "/good"))))))) -(test-skip (if (%guile-for-build) 0 7)) +(test-skip (if (%guile-for-build) 0 8)) (test-assert "build-expression->derivation and derivation-prerequisites" (let-values (((drv-path drv) @@ -652,6 +652,38 @@ Deriver: ~a~%" (derivation-path->output-path final2)) (build-derivations %store (list final1 final2))))) +(test-assert "build-expression->derivation with #:dependency-graphs" + (let* ((input (add-text-to-store %store "foo" "hello" + (list %bash %mkdir))) + (builder '(copy-file "input" %output)) + (drv (build-expression->derivation %store "dependency-graphs" + (%current-system) + builder '() + #:dependency-graphs + `(("input" . ,input)))) + (out (derivation-path->output-path drv))) + (define (deps path . deps) + (let ((count (length deps))) + (string-append path "\n\n" (number->string count) "\n" + (string-join (sort deps string<?) "\n") + (if (zero? count) "" "\n")))) + + (and (build-derivations %store (list drv)) + (equal? (call-with-input-file out get-string-all) + (string-concatenate + (map cdr + (sort (map (lambda (p d) + (cons p (apply deps p d))) + (list input %bash %mkdir) + (list (list %bash %mkdir) + '() '())) + (lambda (x y) + (match x + ((p1 . _) + (match y + ((p2 . _) + (string<? p1 p2))))))))))))) + (test-end) -- cgit v1.2.3