From b30b838d5055e36be19d030db28838fec4474d98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sat, 6 Apr 2024 23:03:26 +0200 Subject: =?UTF-8?q?gexp:=20Add=20#:guile=20parameter=20to=20=E2=80=98gexp-?= =?UTF-8?q?>file=E2=80=99=20and=20=E2=80=98scheme-file=E2=80=99.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This brings ‘gexp->file’ in line with its documentation and mirrors what’s done for ‘gexp->script’ and ‘program-file’. Fixes . * guix/gexp.scm (gexp->file): Add #:guile, as was already documented. ()[guile]: New field. (scheme-file): Add #:guile. (scheme-file-compiler): Honor ‘guile’ field. * tests/gexp.scm ("gexp->file") ("gexp->file + file-append", "gexp->file + #:splice?") ("gexp->file, cross-compilation") ("gexp->file, cross-compilation with default target") Add #:guile to ‘gexp->file’ calls. ("gexp-modules deletes duplicates") ("gexp->derivation & with-imported-module & computed module") ("gexp->derivation & with-extensions", "scheme-file"): Likewise for ‘scheme-file’ calls. Change-Id: I47536063d5e411e561ec321e535267e92dd06044 Reported-by: Efraim Flashner Change-Id: I58d653c7fbe65c665bafcbd332ac9b264ddeab64 --- guix/gexp.scm | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'guix') diff --git a/guix/gexp.scm b/guix/gexp.scm index 29819878fa..74b4c49f90 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2014-2023 Ludovic Courtès +;;; Copyright © 2014-2024 Ludovic Courtès ;;; Copyright © 2018 Clément Lassieur ;;; Copyright © 2018 Jan Nieuwenhuizen ;;; Copyright © 2019, 2020 Mathieu Othacehe @@ -633,25 +633,29 @@ This is the declarative counterpart of 'gexp->script'." #:target target)))) (define-record-type - (%scheme-file name gexp splice? load-path?) + (%scheme-file name gexp splice? guile load-path?) scheme-file? (name scheme-file-name) ;string (gexp scheme-file-gexp) ;gexp (splice? scheme-file-splice?) ;Boolean + (guile scheme-file-guile) ;package (load-path? scheme-file-set-load-path?)) ;Boolean -(define* (scheme-file name gexp #:key splice? (set-load-path? #t)) +(define* (scheme-file name gexp + #:key splice? + guile (set-load-path? #t)) "Return an object representing the Scheme file NAME that contains GEXP. This is the declarative counterpart of 'gexp->file'." - (%scheme-file name gexp splice? set-load-path?)) + (%scheme-file name gexp splice? guile set-load-path?)) (define-gexp-compiler (scheme-file-compiler (file ) system target) ;; Compile FILE by returning a derivation that builds the file. (match file - (($ name gexp splice? set-load-path?) + (($ name gexp splice? guile set-load-path?) (gexp->file name gexp + #:guile (or guile (default-guile)) #:set-load-path? set-load-path? #:splice? splice? #:system system @@ -2019,6 +2023,7 @@ imported modules in its search path. Look up EXP's modules in MODULE-PATH." #:substitutable? #f))) (define* (gexp->file name exp #:key + (guile (default-guile)) (set-load-path? #t) (module-path %load-path) (splice? #f) @@ -2038,6 +2043,8 @@ Lookup EXP's modules in MODULE-PATH." ((target (if (eq? target 'current) (current-target-system) (return target))) + (guile-for-build + (lower-object guile system #:target #f)) (no-load-path? -> (or (not set-load-path?) (and (null? modules) (null? extensions)))) @@ -2057,6 +2064,7 @@ Lookup EXP's modules in MODULE-PATH." '(ungexp (if splice? exp (gexp ((ungexp exp))))))))) + #:guile-for-build guile-for-build #:local-build? #t #:substitutable? #f #:system system @@ -2073,6 +2081,7 @@ Lookup EXP's modules in MODULE-PATH." exp (gexp ((ungexp exp))))))))) #:module-path module-path + #:guile-for-build guile-for-build #:local-build? #t #:substitutable? #f #:system system -- cgit v1.2.3