summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-10-21 16:57:50 +0200
committerLudovic Courtès <ludo@gnu.org>2012-10-21 17:52:16 +0200
commit592ef6c88fa8342d23142154c8392f6f1032275f (patch)
tree30ac28eb6d35a9c336cb8aaacd85554f6c591c0f /tests
parent095c7a2683509d8a12e1febfd667fdf7d20127e3 (diff)
downloadguix-592ef6c88fa8342d23142154c8392f6f1032275f.tar.gz
packages: Add support for system-dependent inputs.
* guix/packages.scm (package-derivation)[intern]: New procedure.  Pass
  #t as the `recursive?' argument, instead of #f.
  [expand-input]: New procedure, with code formerly in the body.
  Support inputs where the input is a procedure returning a file name or
  an <origin>.
  Use `expand-input' in the body.

* tests/packages.scm ("trivial with system-dependent input"): New test.
Diffstat (limited to 'tests')
-rw-r--r--tests/packages.scm19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/packages.scm b/tests/packages.scm
index 1319bf8634..ff23a7bf41 100644
--- a/tests/packages.scm
+++ b/tests/packages.scm
@@ -95,6 +95,25 @@
            (equal? '(hello guix)
                    (call-with-input-file (string-append p "/test") read))))))
 
+(test-assert "trivial with system-dependent input"
+  (let* ((p (package (inherit (dummy-package "trivial-system-dependent-input"))
+              (build-system trivial-build-system)
+              (source #f)
+              (arguments
+               `(#:guile ,%bootstrap-guile
+                 #:builder
+                 (let ((out  (assoc-ref %outputs "out"))
+                       (bash (assoc-ref %build-inputs "bash")))
+                   (zero? (system* bash "-c"
+                                   (format #f "echo hello > ~a" out))))))
+              (inputs `(("bash" ,(lambda (system)
+                                   (search-bootstrap-binary "bash"
+                                                            system)))))))
+         (d (package-derivation %store p)))
+    (and (build-derivations %store (list d))
+         (let ((p (pk 'drv d (derivation-path->output-path d))))
+           (eq? 'hello (call-with-input-file p read))))))
+
 (test-assert "GNU Hello"
   (let ((hello (package-with-explicit-inputs hello %bootstrap-inputs
                                              #:guile %bootstrap-guile)))