guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: guix-commits
Subject: 05/05: build-system/composer: Do not import host-side Guile-JSON modules.
Date: Mon, 18 Dec 2023 17:27:00 -0500 (EST)

civodul pushed a commit to branch master
in repository guix.

commit 6454788a5cf79a217bda86d49a6e403cc803747f
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Mon Dec 18 23:13:38 2023 +0100

    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
---
 guix/build-system/composer.scm | 57 +++++++++++++++++++++---------------------
 1 file changed, 29 insertions(+), 28 deletions(-)

diff --git a/guix/build-system/composer.scm b/guix/build-system/composer.scm
index 2bb807e614..2ad7bbb36a 100644
--- a/guix/build-system/composer.scm
+++ b/guix/build-system/composer.scm
@@ -62,10 +62,6 @@
   ;; Build-side modules imported by default.
   `((guix build composer-build-system)
     (guix build union)
-    (json)
-    (json builder)
-    (json parser)
-    (json record)
     ,@%gnu-build-system-modules))
 
 (define* (lower name
@@ -124,31 +120,36 @@
                                     (guix build utils))))
   "Build SOURCE using PHP, and with INPUTS. This assumes that SOURCE provides
 a 'composer.json' file as its build system."
+  (define guile-json
+    (module-ref (resolve-interface '(gnu packages guile))
+                'guile-json-4))
+
   (define builder
-    (with-imported-modules imported-modules
-      #~(begin
-          (use-modules #$@(sexp->gexp modules))
-
-          #$(with-build-variables inputs outputs
-              #~(composer-build
-                 #:source #$source
-                 #:system #$system
-                 #:outputs %outputs
-                 #:inputs %build-inputs
-                 #:search-paths '#$(map search-path-specification->sexp
-                                        search-paths)
-                 #:phases #$phases
-                 #:out-of-source? #$out-of-source?
-                 #:composer-file #$composer-file
-                 #:tests? #$tests?
-                 #:test-target #$test-target
-                 #: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)))))
+    (with-extensions (list guile-json)
+      (with-imported-modules imported-modules
+        #~(begin
+            (use-modules #$@(sexp->gexp modules))
+
+            #$(with-build-variables inputs outputs
+                #~(composer-build
+                   #:source #$source
+                   #:system #$system
+                   #:outputs %outputs
+                   #:inputs %build-inputs
+                   #:search-paths '#$(map search-path-specification->sexp
+                                          search-paths)
+                   #:phases #$phases
+                   #:out-of-source? #$out-of-source?
+                   #:composer-file #$composer-file
+                   #:tests? #$tests?
+                   #:test-target #$test-target
+                   #: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
                     #:system system



reply via email to

[Prev in Thread] Current Thread [Next in Thread]