From 592ef6c88fa8342d23142154c8392f6f1032275f Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 21 Oct 2012 16:57:50 +0200 Subject: 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 . Use `expand-input' in the body. * tests/packages.scm ("trivial with system-dependent input"): New test. --- tests/packages.scm | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tests') 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 @@ (define-syntax-rule (dummy-package name* extra-fields ...) (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))) -- cgit v1.2.3