From 860a6f1ae06151d76d39a402d3d92cc7ea6f36ff Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 4 Dec 2012 23:46:50 +0100 Subject: derivations: Fix erroneous call to `add-to-store' for local files as input. * guix/derivations.scm (derivation)[inputs]: Fix typo in call to `add-to-store'. * tests/derivations.scm ("derivation with local file as input"): New test. * tests/packages.scm ("trivial with local file as input"): New test. --- tests/derivations.scm | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tests/derivations.scm') diff --git a/tests/derivations.scm b/tests/derivations.scm index bcedfbf948..14e1863a12 100644 --- a/tests/derivations.scm +++ b/tests/derivations.scm @@ -124,6 +124,29 @@ (string=? (call-with-input-file path read-line) "hello, world")))))) +(test-assert "derivation with local file as input" + (let* ((builder (add-text-to-store + %store "my-builder.sh" + "(while read line ; do echo $line ; done) < $in > $out" + '())) + (input (search-path %load-path "ice-9/boot-9.scm")) + (drv-path (derivation %store "derivation-with-input-file" + (%current-system) + "/bin/sh" `(,builder) + `(("in" + ;; Cheat to pass the actual file + ;; name to the builder. + . ,(add-to-store %store + (basename input) + #t #t "sha256" + input))) + `((,builder) + (,input))))) ; ← local file name + (and (build-derivations %store (list drv-path)) + (let ((p (derivation-path->output-path drv-path))) + (and (call-with-input-file p get-bytevector-all) + (call-with-input-file input get-bytevector-all)))))) + (test-assert "fixed-output derivation" (let* ((builder (add-text-to-store %store "my-fixed-builder.sh" "echo -n hello > $out" '())) -- cgit v1.2.3