From 366729d477960127424076bdac51e7c937857081 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sun, 19 Apr 2020 23:14:56 +0200 Subject: [PATCH 1/2] build-self: Always build the trampoline for the current system. Previously we'd build 'compute-guix-derivation' for the target system. Running it would then fail (unless qemu-binfmt support was set up or something similar). Fixes . Reported by Christopher Baines . * build-aux/build-self.scm (load-path-expression): Add #:system and honor it. (gexp->script): Likewise. (build-program): Pass #:system to 'gexp->script'. --- build-aux/build-self.scm | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/build-aux/build-self.scm b/build-aux/build-self.scm index f86c79f0d0..58ecf20cf4 100644 --- a/build-aux/build-self.scm +++ b/build-aux/build-self.scm @@ -148,14 +148,17 @@ ;;; 1ae16033f34cebe802023922436883867010850f (March 2018.) ;;; -(define (load-path-expression modules path) +(define* (load-path-expression modules path + #:key (system (%current-system))) "Return as a monadic value a gexp that sets '%load-path' and '%load-compiled-path' to point to MODULES, a list of module names. MODULES are searched for in PATH." (mlet %store-monad ((modules (imported-modules modules - #:module-path path)) + #:module-path path + #:system system)) (compiled (compiled-modules modules - #:module-path path))) + #:module-path path + #:system system))) (return (gexp (eval-when (expand load eval) (set! %load-path (cons (ungexp modules) %load-path)) @@ -165,12 +168,14 @@ are searched for in PATH." (define* (gexp->script name exp #:key (guile (default-guile)) - (module-path %load-path)) + (module-path %load-path) + (system (%current-system))) "Return an executable script NAME that runs EXP using GUILE, with EXP's imported modules in its search path." (mlet %store-monad ((set-load-path (load-path-expression (gexp-modules exp) - module-path))) + module-path + #:system system))) (gexp->derivation name (gexp (call-with-output-file (ungexp output) @@ -186,7 +191,8 @@ imported modules in its search path." (write '(ungexp set-load-path) port) (write '(ungexp exp) port) (chmod port #o555)))) - #:module-path module-path))) + #:module-path module-path + #:system system))) (define (date-version-string) @@ -364,7 +370,11 @@ interface (FFI) of Guile.") #$pull-version) #:system system) derivation-file-name)))))) - #:module-path (list source)))) + #:module-path (list source) + + ;; Always build the trampoline for the local system. The + ;; system being targeted will be passed as an argument. + #:system %system))) (define (call-with-clean-environment thunk) (let ((env (environ))) -- 2.26.0