diff options
author | Nicolas Graves <ngraves@ngraves.fr> | 2025-09-11 23:13:21 +0200 |
---|---|---|
committer | Jelle Licht <jlicht@fsfe.org> | 2025-10-13 10:27:06 +0200 |
commit | 60596a792f5a48ce70b9c5466b8a7703b4225680 (patch) | |
tree | 6aa073ee900d674839be6c451237cf0047cd926e | |
parent | c4979574619a744fc7a7959e51719c50e956d694 (diff) |
build-system: node: Refresh phase 'avoid-node-gyp-rebuild.
* guix/build/node-build-system.scm (avoid-node-gyp-rebuild): Refresh
phase by using let* instead of multiple defines.
Change-Id: I30c53f5d7d5bc69444ddcef45cdf8eefcab7db84
Signed-off-by: Jelle Licht <jlicht@fsfe.org>
-rw-r--r-- | guix/build/node-build-system.scm | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm index 125c1f9b29..ab50571857 100644 --- a/guix/build/node-build-system.scm +++ b/guix/build/node-build-system.scm @@ -323,28 +323,25 @@ would try to run 'node-gyp rebuild'." ;; For further details, see: ;; - https://docs.npmjs.com/cli/v8/configuring-npm/package-json#default-values ;; - https://docs.npmjs.com/cli/v8/using-npm/scripts#best-practices - (define installed-package.json - (search-input-file outputs (string-append "/lib/node_modules/" - (module-name ".") - "/package.json"))) - ;; We don't want to use an atomic replacement here, because we often don't - ;; even need to overwrite this file. Therefore, let's use some helpers - ;; that we'd otherwise not need. - (define pkg-meta - (call-with-input-file installed-package.json json->scm)) - (define scripts - (or (assoc-ref pkg-meta "scripts") '())) - - (when (equal? "node-gyp rebuild" (assoc-ref scripts "install")) - (call-with-output-file installed-package.json - (lambda (out) - (scm->json - (assoc-set! pkg-meta - "scripts" - (assoc-set! scripts - "install" - "echo Guix: avoiding node-gyp rebuild")) - out))))) + (let* ((installed-package.json + (search-input-file outputs (string-append "/lib/node_modules/" + (module-name ".") + "/package.json"))) + ;; We don't want to use an atomic replacement here, because we often + ;; don't even need to overwrite this file. Therefore, let's use some + ;; helpers that we'd otherwise not need. + (pkg-meta (call-with-input-file installed-package.json json->scm)) + (scripts (or (assoc-ref pkg-meta "scripts") '()))) + (when (equal? "node-gyp rebuild" (assoc-ref scripts "install")) + (call-with-output-file installed-package.json + (lambda (out) + (scm->json + (assoc-set! pkg-meta + "scripts" + (assoc-set! scripts + "install" + "echo Guix: avoiding node-gyp rebuild")) + out)))))) (define %standard-phases (modify-phases gnu:%standard-phases |