diff options
author | Ludovic Courtès <ludo@gnu.org> | 2013-11-13 00:25:57 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2013-11-13 00:29:05 +0100 |
commit | e387ab7c10b18427b97cd22526f1b135856a083e (patch) | |
tree | c9d6aebc4abfdf1a943d4c8e1016676c659eb64a /tests | |
parent | 56b943de6e61f41d6ebd2dfa65ff886cdfd83759 (diff) | |
download | patches-e387ab7c10b18427b97cd22526f1b135856a083e.tar patches-e387ab7c10b18427b97cd22526f1b135856a083e.tar.gz |
derivations: Add 'map-derivation'.
* guix/derivations.scm (map-derivation): New procedure.
* tests/derivations.scm ("map-derivation"): New test.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/derivations.scm | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/derivations.scm b/tests/derivations.scm index 273db22765..09cf81972c 100644 --- a/tests/derivations.scm +++ b/tests/derivations.scm @@ -26,6 +26,7 @@ #:use-module ((guix packages) #:select (package-derivation)) #:use-module ((gnu packages) #:select (search-bootstrap-binary)) #:use-module (gnu packages bootstrap) + #:use-module ((gnu packages guile) #:select (guile-1.8)) #:use-module (srfi srfi-1) #:use-module (srfi srfi-11) #:use-module (srfi srfi-26) @@ -690,6 +691,35 @@ Deriver: ~a~%" ((p2 . _) (string<? p1 p2))))))))))))) + +(test-equal "map-derivation" + "hello" + (let* ((joke (package-derivation %store guile-1.8)) + (good (package-derivation %store %bootstrap-guile)) + (drv1 (build-expression->derivation %store "original-drv1" + (%current-system) + #f ; systematically fail + '() + #:guile-for-build joke)) + (drv2 (build-expression->derivation %store "original-drv2" + (%current-system) + '(call-with-output-file %output + (lambda (p) + (display "hello" p))) + '())) + (drv3 (build-expression->derivation %store "drv-to-remap" + (%current-system) + '(let ((in (assoc-ref + %build-inputs "in"))) + (copy-file in %output)) + `(("in" ,drv1)) + #:guile-for-build joke)) + (drv4 (map-derivation %store drv3 `((,drv1 . ,drv2) + (,joke . ,good)))) + (out (derivation->output-path drv4))) + (and (build-derivations %store (list (pk 'remapped drv4))) + (call-with-input-file out get-string-all)))) + (test-end) |