summaryrefslogtreecommitdiff
path: root/tests/derivations.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-11-13 11:22:07 +0100
committerLudovic Courtès <ludo@gnu.org>2013-11-13 11:22:07 +0100
commita716e36de915a275e4eab42b73cf0a2affc4aa33 (patch)
treeaffdccec604ccf00846b7e48f85fcf1861672b87 /tests/derivations.scm
parentf80594cc41d7ad491f14a73d594228bacafdc871 (diff)
downloadpatches-a716e36de915a275e4eab42b73cf0a2affc4aa33.tar
patches-a716e36de915a275e4eab42b73cf0a2affc4aa33.tar.gz
derivations: Allow 'map-derivations' to replace sources.
* guix/derivations.scm (map-derivation)[input->output-paths]: Allow non-derivation inputs. Allow replacements to be store files. Replace in SOURCES too. * tests/derivations.scm ("map-derivation, sources"): New test.
Diffstat (limited to 'tests/derivations.scm')
-rw-r--r--tests/derivations.scm22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/derivations.scm b/tests/derivations.scm
index 09cf81972c..a4e073bf07 100644
--- a/tests/derivations.scm
+++ b/tests/derivations.scm
@@ -720,6 +720,28 @@ Deriver: ~a~%"
(and (build-derivations %store (list (pk 'remapped drv4)))
(call-with-input-file out get-string-all))))
+(test-equal "map-derivation, sources"
+ "hello"
+ (let* ((script1 (add-text-to-store %store "fail.sh" "exit 1"))
+ (script2 (add-text-to-store %store "hi.sh" "echo -n hello > $out"))
+ (bash-full (package-derivation %store (@ (gnu packages bash) bash)))
+ (drv1 (derivation %store "drv-to-remap"
+
+ ;; XXX: This wouldn't work in practice, but if
+ ;; we append "/bin/bash" then we can't replace
+ ;; it with the bootstrap bash, which is a
+ ;; single file.
+ (derivation->output-path bash-full)
+
+ `("-e" ,script1)
+ #:inputs `((,bash-full) (,script1))))
+ (drv2 (map-derivation %store drv1
+ `((,bash-full . ,%bash)
+ (,script1 . ,script2))))
+ (out (derivation->output-path drv2)))
+ (and (build-derivations %store (list (pk 'remapped* drv2)))
+ (call-with-input-file out get-string-all))))
+
(test-end)