summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorJelle Licht <jlicht@fsfe.org>2023-02-08 22:05:17 +0100
committerJelle Licht <jlicht@fsfe.org>2023-05-06 13:53:21 +0200
commit7a44c34f4a709f56445c4029963cf5066971d3df (patch)
tree43a3b9589db1d1ce2c1b302e83417c40d66b3519 /gnu
parent00b2e168239d334d62f6f24cd894edc6d226ad47 (diff)
downloadguix-7a44c34f4a709f56445c4029963cf5066971d3df.tar.gz
gnu: node-acorn: Remove lifecycle script.
* gnu/packages/node-xyz.scm (node-acorn)[arguments]<modules>: New argument.
<phases>: Patch out unused 'prepare' script that breaks dependents.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/node-xyz.scm26
1 files changed, 25 insertions, 1 deletions
diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index e89117beca..e3d8c7ca19 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -47,11 +47,35 @@
     (build-system node-build-system)
     (arguments
      '(#:tests? #f
+       #:modules
+       ((guix build node-build-system)
+        (srfi srfi-1)
+        (ice-9 match)
+        (guix build utils))
        #:phases
        (modify-phases %standard-phases
          (add-after 'unpack 'change-directory
            (lambda _
-             (chdir "acorn"))))))
+             (chdir "acorn")))
+         (add-before 'configure 'avoid-prepare-scripts
+           (lambda _
+             ;; We need to remove the prepare script from "package.json", as
+             ;; it would try to use the build environment and would block the
+             ;; automatic building by other packages making use of node-acorn.
+             ;; TODO: Add utility function
+             (with-atomic-json-file-replacement "package.json"
+               (match-lambda
+                 (('@ . pkg-meta-alist)
+                  (cons '@ (map (match-lambda
+                                  (("scripts" @ . scripts-alist)
+                                   `("scripts" @ ,@(filter (match-lambda
+                                                             (("prepare" . _)
+                                                              #f)
+                                                             (_
+                                                              #t))
+                                                           scripts-alist)))
+                                  (other other))
+                                pkg-meta-alist))))))))))
     (home-page "https://github.com/acornjs/acorn/tree/master/acorn")
     (synopsis "Javascript-based Javascript parser")
     (description "Acornjs is a Javascript parser with many options and an