build-system/composer: Do not import host-side Guile-JSON modules.

Importing host-side (json …) modules would make builds dependent on the
Guile-JSON version currently installed by the user.  Use
‘with-extensions’ instead.

* guix/build-system/composer.scm (%composer-build-system-modules):
Remove (json …) modules.
(composer-build)[guile-json]: New variable.
[builder]: Wrap body in ‘with-extensions’.

Change-Id: Ibe565572d60481b31292d73c6fa23d42aa3ceecb
This commit is contained in:
Ludovic Courtès 2023-12-18 23:13:38 +01:00
parent 9dab758791
commit 6454788a5c
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 29 additions and 28 deletions

View File

@ -62,10 +62,6 @@
;; Build-side modules imported by default. ;; Build-side modules imported by default.
`((guix build composer-build-system) `((guix build composer-build-system)
(guix build union) (guix build union)
(json)
(json builder)
(json parser)
(json record)
,@%gnu-build-system-modules)) ,@%gnu-build-system-modules))
(define* (lower name (define* (lower name
@ -124,31 +120,36 @@
(guix build utils)))) (guix build utils))))
"Build SOURCE using PHP, and with INPUTS. This assumes that SOURCE provides "Build SOURCE using PHP, and with INPUTS. This assumes that SOURCE provides
a 'composer.json' file as its build system." a 'composer.json' file as its build system."
(define builder (define guile-json
(with-imported-modules imported-modules (module-ref (resolve-interface '(gnu packages guile))
#~(begin 'guile-json-4))
(use-modules #$@(sexp->gexp modules))
#$(with-build-variables inputs outputs (define builder
#~(composer-build (with-extensions (list guile-json)
#:source #$source (with-imported-modules imported-modules
#:system #$system #~(begin
#:outputs %outputs (use-modules #$@(sexp->gexp modules))
#:inputs %build-inputs
#:search-paths '#$(map search-path-specification->sexp #$(with-build-variables inputs outputs
search-paths) #~(composer-build
#:phases #$phases #:source #$source
#:out-of-source? #$out-of-source? #:system #$system
#:composer-file #$composer-file #:outputs %outputs
#:tests? #$tests? #:inputs %build-inputs
#:test-target #$test-target #:search-paths '#$(map search-path-specification->sexp
#:test-flags #$test-flags search-paths)
#:install-target #$install-target #:phases #$phases
#:validate-runpath? #$validate-runpath? #:out-of-source? #$out-of-source?
#:patch-shebangs? #$patch-shebangs? #:composer-file #$composer-file
#:strip-binaries? #$strip-binaries? #:tests? #$tests?
#:strip-flags #$strip-flags #:test-target #$test-target
#:strip-directories #$strip-directories))))) #:test-flags #$test-flags
#:install-target #$install-target
#:validate-runpath? #$validate-runpath?
#:patch-shebangs? #$patch-shebangs?
#:strip-binaries? #$strip-binaries?
#:strip-flags #$strip-flags
#:strip-directories #$strip-directories))))))
(gexp->derivation name builder (gexp->derivation name builder
#:system system #:system system