From 03761a446536dc690010522ab522a1541766abd7 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 26 Sep 2013 21:50:05 +0200 Subject: build-system/trivial: Take the 'source' field into account. * guix/build-system/trivial.scm (trivial-build): When SOURCE is true, add it to INPUTS. (trivial-cross-build): Likewise. * tests/packages.scm ("trivial with source"): New test. --- guix/build-system/trivial.scm | 10 ++++++++-- tests/packages.scm | 15 +++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/guix/build-system/trivial.scm b/guix/build-system/trivial.scm index 3c5031c4bd..f91997d1e9 100644 --- a/guix/build-system/trivial.scm +++ b/guix/build-system/trivial.scm @@ -42,7 +42,10 @@ (define* (trivial-build store name source inputs search-paths) "Run build expression BUILDER, an expression, for SYSTEM. SOURCE is ignored." - (build-expression->derivation store name system builder inputs + (build-expression->derivation store name system builder + (if source + `(("source" ,source) ,@inputs) + inputs) #:outputs outputs #:modules modules #:guile-for-build @@ -54,7 +57,10 @@ (define* (trivial-cross-build store name target source inputs native-inputs search-paths native-search-paths) "Like `trivial-build', but in a cross-compilation context." (build-expression->derivation store name system builder - (append native-inputs inputs) + (let ((inputs (append native-inputs inputs))) + (if source + `(("source" ,source) ,@inputs) + inputs)) #:outputs outputs #:modules modules #:guile-for-build diff --git a/tests/packages.scm b/tests/packages.scm index 706739fb70..e0cf4ee001 100644 --- a/tests/packages.scm +++ b/tests/packages.scm @@ -167,6 +167,21 @@ (define read-at (equal? (call-with-input-file p get-bytevector-all) (call-with-input-file i get-bytevector-all)))))) +(test-assert "trivial with source" + (let* ((i (search-path %load-path "ice-9/boot-9.scm")) + (p (package (inherit (dummy-package "trivial-with-source")) + (build-system trivial-build-system) + (source i) + (arguments + `(#:guile ,%bootstrap-guile + #:builder (copy-file (assoc-ref %build-inputs "source") + %output))))) + (d (package-derivation %store p))) + (and (build-derivations %store (list d)) + (let ((p (derivation->output-path d))) + (equal? (call-with-input-file p get-bytevector-all) + (call-with-input-file i get-bytevector-all)))))) + (test-assert "trivial with system-dependent input" (let* ((p (package (inherit (dummy-package "trivial-system-dependent-input")) (build-system trivial-build-system) -- cgit v1.2.3