all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp.
@ 2021-11-14 12:41 Philip McGrath
  2021-11-14 12:58 ` [bug#51838] [PATCH 01/11] gnu: node: Avoid duplicating build phases Philip McGrath
                   ` (46 more replies)
  0 siblings, 47 replies; 458+ messages in thread
From: Philip McGrath @ 2021-11-14 12:41 UTC (permalink / raw)
  To: 51838; +Cc: Philip McGrath, Pierre Langlois

This patch series adds support to `node-build-system` for building native
add-ons using `node-gyp`. To confirm that the changes to the build system
work, the patch series also adds two packages (plus a few dependencies)
representing two major ways of writing Node.js native add-ons:

 1. `node-openzwave-shared` uses `node-nan`: “Native Abstractions for Node.js”.

 2. `node-sqlite3` uses the Node-API via `node-addon-api`.

The patches are adapted from part of a series by Pierre Langlois
at <https://issues.guix.gnu.org/49946>: you can find discussion of an earlier
version of this spun-off series from <https://issues.guix.gnu.org/49946#71>
to <https://issues.guix.gnu.org/49946#83>.
They are also available in a Git repository
at <https://gitlab.com/philip1/guix-patches/-/tree/wip-node-npm-gyp-hist-9>.

In the earlier discussion, Pierre and I both thought it was quite confusing
that the Scheme variable `node` refers to the bootstrap Node.js, while
`node-lts` refers to the newer Node.js that a package specification of
`"node"` would resolve to. My analysis is
at <https://issues.guix.gnu.org/49946#75> (tl;dr it seems like an unintentional
mistake), and Pierre suggested a solution
in <https://issues.guix.gnu.org/49946#81>. I haven't taken that on in this patch
series, but I do think its worth considering.

Philip McGrath (11):
  gnu: node: Avoid duplicating build phases.
  gnu: node: Update to 10.24.1 for bootstrapping.
  guix: node-build-system: Support compiling add-ons with node-gyp.
  gnu: Add node-inherits.
  gnu: Add node-safe-buffer.
  gnu: Add node-string-decoder.
  gnu: Add node-readable-stream.
  gnu: Add node-nan.
  gnu: Add node-openzwave-shared.
  gnu: Add node-addon-api.
  gnu: Add node-sqlite3.

 gnu/packages/node-xyz.scm        | 335 +++++++++++++++++++++++++++++++
 gnu/packages/node.scm            | 143 +++++--------
 gnu/packages/zwave.scm           |  55 +++++
 guix/build-system/node.scm       |  11 +-
 guix/build/node-build-system.scm |  23 +++
 5 files changed, 473 insertions(+), 94 deletions(-)

-- 
2.32.0





^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH 01/11] gnu: node: Avoid duplicating build phases.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
@ 2021-11-14 12:58 ` Philip McGrath
  2021-11-14 13:04   ` [bug#51838] [PATCH 02/11] gnu: node: Update to 10.24.1 for bootstrapping Philip McGrath
  2021-11-20 17:38 ` [bug#51838] [PATCH v2 04/26] gnu: node: Add an npmrc file to set nodedir Timothy Sample
                   ` (45 subsequent siblings)
  46 siblings, 1 reply; 458+ messages in thread
From: Philip McGrath @ 2021-11-14 12:58 UTC (permalink / raw)
  To: 51838; +Cc: Philip McGrath

* gnu/packages/node.scm (node)[arguments]: Split 'patch-files phase
into 'patch-hardcoded-program-references and
'delete-problematic-tests. Adapt 'patch-hardcoded-program-references
and 'configure to work unmodified on node-lts, but don't try to
share 'delete-problematic-tests, because those details seem to change
too much between node versions.
(node, node-lts)[inputs]: Use bash-minimal rather than bash.
(node-lts)[arguments]: Inherit 'patch-hardcoded-program-references,
and 'configure phases from the bootstrap node.
Remove the 'patch-files phase, keeping its remaining
non-inherited work in a new 'replace-llhttp-sources phase.
---
 gnu/packages/node.scm | 105 +++++++++++++-----------------------------
 1 file changed, 32 insertions(+), 73 deletions(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index d0ffe8a398..db1658f03d 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -9,6 +9,7 @@
 ;;; Copyright © 2020, 2021 Pierre Langlois <pierre.langlois@gmx.com>
 ;;; Copyright © 2020 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
+;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -105,14 +106,22 @@ (define-public node
        #:test-target "test-ci-js"
        #:phases
        (modify-phases %standard-phases
-         (add-before 'configure 'patch-files
+         (add-before 'configure 'patch-hardcoded-program-references
            (lambda* (#:key inputs #:allow-other-keys)
+
              ;; Fix hardcoded /bin/sh references.
-             (substitute* '("lib/child_process.js"
-                            "lib/internal/v8_prof_polyfill.js"
-                            "test/parallel/test-child-process-spawnsync-shell.js"
-                            "test/parallel/test-stdio-closed.js"
-                            "test/sequential/test-child-process-emfile.js")
+             (substitute*
+                 (let ((common
+                        '("lib/child_process.js"
+                          "lib/internal/v8_prof_polyfill.js"
+                          "test/parallel/test-child-process-spawnsync-shell.js"
+                          "test/parallel/test-stdio-closed.js"
+                          "test/sequential/test-child-process-emfile.js"))
+                       ;; not in bootstap node:
+                       (sigxfsz "test/parallel/test-fs-write-sigxfsz.js"))
+                   (if (file-exists? sigxfsz)
+                       (cons sigxfsz common)
+                       common))
                (("'/bin/sh'")
                 (string-append "'" (assoc-ref inputs "bash") "/bin/sh'")))
 
@@ -122,7 +131,10 @@ (define-public node
                             "test/parallel/test-child-process-exec-env.js")
                (("'/usr/bin/env'")
                 (string-append "'" (assoc-ref inputs "coreutils")
-                               "/bin/env'")))
+                               "/bin/env'")))))
+         (add-after 'patch-hardcoded-program-references
+             'delete-problematic-tests
+           (lambda* (#:key inputs #:allow-other-keys)
 
              ;; FIXME: These tests fail in the build container, but they don't
              ;; seem to be indicative of real problems in practice.
@@ -217,9 +229,13 @@ (define-public node
                (setenv "CXX" ,(cxx-for-target))
                (setenv "PKG_CONFIG" ,(pkg-config-for-target))
                (apply invoke
-                      (string-append (assoc-ref (or native-inputs inputs)
-                                                "python")
-                                     "/bin/python")
+                      (let ((python
+                             (string-append (assoc-ref (or native-inputs inputs)
+                                                       "python")
+                                            "/bin/python")))
+                        (if (file-exists? python)
+                            python
+                            (string-append python "3")))
                       "configure" flags))))
          (add-after 'patch-shebangs 'patch-npm-shebang
            (lambda* (#:key outputs #:allow-other-keys)
@@ -256,7 +272,7 @@ (define-public node
             (variable "NODE_PATH")
             (files '("lib/node_modules")))))
     (inputs
-     `(("bash" ,bash)
+     `(("bash" ,bash-minimal)
        ("coreutils" ,coreutils)
        ("c-ares" ,c-ares)
        ("http-parser" ,http-parser)
@@ -711,66 +727,8 @@ (define-public node-lts
                                    libuv "/lib:"
                                    zlib "/lib"
                                    "'],"))))))
-           (replace 'configure
-             ;; Node's configure script is actually a python script, so we can't
-             ;; run it with bash.
-             (lambda* (#:key outputs (configure-flags '()) native-inputs inputs
-                       #:allow-other-keys)
-               (let* ((prefix (assoc-ref outputs "out"))
-                      (xflags ,(if (%current-target-system)
-                                   `'("--cross-compiling"
-                                     ,(string-append
-                                       "--dest-cpu="
-                                       (match (%current-target-system)
-                                         ((? (cut string-prefix? "arm" <>))
-                                          "arm")
-                                         ((? (cut string-prefix? "aarch64" <>))
-                                          "arm64")
-                                         ((? (cut string-prefix? "i686" <>))
-                                          "ia32")
-                                         ((? (cut string-prefix? "x86_64" <>))
-                                          "x64")
-                                         ((? (cut string-prefix? "powerpc64" <>))
-                                          "ppc64")
-                                         (_ "unsupported"))))
-                                   ''()))
-                      (flags (cons
-                               (string-append "--prefix=" prefix)
-                               (append xflags configure-flags))))
-                 (format #t "build directory: ~s~%" (getcwd))
-                 (format #t "configure flags: ~s~%" flags)
-                 ;; Node's configure script expects the CC environment variable to
-                 ;; be set.
-                 (setenv "CC_host" "gcc")
-                 (setenv "CXX_host" "g++")
-                 (setenv "CC" ,(cc-for-target))
-                 (setenv "CXX" ,(cxx-for-target))
-                 (setenv "PKG_CONFIG" ,(pkg-config-for-target))
-                 (apply invoke
-                        (string-append (assoc-ref (or native-inputs inputs)
-                                                  "python")
-                                       "/bin/python3")
-                        "configure" flags))))
-           (replace 'patch-files
+           (replace 'delete-problematic-tests
              (lambda* (#:key inputs #:allow-other-keys)
-               ;; Fix hardcoded /bin/sh references.
-               (substitute* '("lib/child_process.js"
-                              "lib/internal/v8_prof_polyfill.js"
-                              "test/parallel/test-child-process-spawnsync-shell.js"
-                              "test/parallel/test-fs-write-sigxfsz.js"
-                              "test/parallel/test-stdio-closed.js"
-                              "test/sequential/test-child-process-emfile.js")
-                 (("'/bin/sh'")
-                  (string-append "'" (assoc-ref inputs "bash") "/bin/sh'")))
-
-               ;; Fix hardcoded /usr/bin/env references.
-               (substitute* '("test/parallel/test-child-process-default-options.js"
-                              "test/parallel/test-child-process-env.js"
-                              "test/parallel/test-child-process-exec-env.js")
-                 (("'/usr/bin/env'")
-                  (string-append "'" (assoc-ref inputs "coreutils")
-                                 "/bin/env'")))
-
                ;; FIXME: These tests fail in the build container, but they don't
                ;; seem to be indicative of real problems in practice.
                (for-each delete-file
@@ -806,8 +764,9 @@ (define-public node-lts
                ;; TODO: Regenerate certs instead.
                (for-each delete-file
                          '("test/parallel/test-tls-passphrase.js"
-                           "test/parallel/test-tls-server-verify.js"))
-
+                           "test/parallel/test-tls-server-verify.js"))))
+           (add-after 'delete-problematic-tests 'replace-llhttp-sources
+             (lambda* (#:key inputs #:allow-other-keys)
                ;; Replace pre-generated llhttp sources
                (let ((llhttp (assoc-ref inputs "llhttp")))
                  (copy-file (string-append llhttp "/src/llhttp.c")
@@ -834,7 +793,7 @@ (define-public node-lts
        ("python" ,python)
        ("util-linux" ,util-linux)))
     (inputs
-     `(("bash" ,bash)
+     `(("bash" ,bash-minimal)
        ("coreutils" ,coreutils)
        ("c-ares" ,c-ares)
        ("icu4c" ,icu4c-67)
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH 02/11] gnu: node: Update to 10.24.1 for bootstrapping.
  2021-11-14 12:58 ` [bug#51838] [PATCH 01/11] gnu: node: Avoid duplicating build phases Philip McGrath
@ 2021-11-14 13:04   ` Philip McGrath
  2021-11-14 13:04     ` [bug#51838] [PATCH 03/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                       ` (8 more replies)
  0 siblings, 9 replies; 458+ messages in thread
From: Philip McGrath @ 2021-11-14 13:04 UTC (permalink / raw)
  To: 51838; +Cc: Philip McGrath

* gnu/packages/node.scm (node): Update to 10.24.1.
---
 gnu/packages/node.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index db1658f03d..89a9bc7533 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -57,14 +57,14 @@ (define-module (gnu packages node)
 (define-public node
   (package
     (name "node")
-    (version "10.24.0")
+    (version "10.24.1")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://nodejs.org/dist/v" version
                                   "/node-v" version ".tar.xz"))
               (sha256
                (base32
-                "1k1srdis23782hnd1ymgczs78x9gqhv77v0am7yb54gqcspp70hm"))
+                "032801kg24j04xmf09m0vxzlcz86sv21s24lv9l4cfv08k1c4byp"))
               (modules '((guix build utils)))
               (snippet
                `(begin
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH 03/11] guix: node-build-system: Support compiling add-ons with node-gyp.
  2021-11-14 13:04   ` [bug#51838] [PATCH 02/11] gnu: node: Update to 10.24.1 for bootstrapping Philip McGrath
@ 2021-11-14 13:04     ` Philip McGrath
  2021-11-14 20:44       ` Liliana Marie Prikler
  2021-11-14 13:04     ` [bug#51838] [PATCH 04/11] gnu: Add node-inherits Philip McGrath
                       ` (7 subsequent siblings)
  8 siblings, 1 reply; 458+ messages in thread
From: Philip McGrath @ 2021-11-14 13:04 UTC (permalink / raw)
  To: 51838; +Cc: Pierre Langlois, Philip McGrath

* gnu/packages/node.scm (node)[arguments]: Replace 'patch-npm-shebang
and 'patch-node-shebang with a new 'patch-nested-shebangs that also
handles node-gyp and other shebangs under "/lib/node_modules".
[inputs]: Add Python for node-gyp as "python-for-target".
(node-lts)[inputs]: Likewise.
(libnode)[arguments]: Adjust to delete 'patch-nested-shebangs rather
than 'patch-npm-shebang and 'patch-node-shebang.
* guix/build-system/node.scm (lower): Add optional #:python argument
and corresponding implicit input. Add the version of libuv used
as an input to the #:node package as a new implicit input.
* guix/build/node-build-system.scm (set-node-gyp-paths): New
function. Sets the "npm_config_nodedir" and "npm_config_python"
environment variables. Adds the "node-gyp-bin" directory to "PATH".
(configure-gyp): New function. Run `node-gyp configure` if we see
a `binding.gyp` file.
(%standard-phases): Add 'set-node-gyp-paths after 'set-paths.
Add 'configure-gyp after 'configure.

Co-authored-by: Pierre Langlois <pierre.langlois@gmx.com>
---
 gnu/packages/node.scm            | 34 ++++++++++++++++----------------
 guix/build-system/node.scm       | 11 +++++++++--
 guix/build/node-build-system.scm | 23 +++++++++++++++++++++
 3 files changed, 49 insertions(+), 19 deletions(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 89a9bc7533..ad5179426a 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -237,21 +237,20 @@ (define-public node
                             python
                             (string-append python "3")))
                       "configure" flags))))
-         (add-after 'patch-shebangs 'patch-npm-shebang
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let* ((bindir (string-append (assoc-ref outputs "out")
-                                           "/bin"))
-                    (npm    (string-append bindir "/npm"))
-                    (target (readlink npm)))
-               (with-directory-excursion bindir
-                 (patch-shebang target (list bindir))))))
-         (add-after 'install 'patch-node-shebang
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let* ((bindir (string-append (assoc-ref outputs "out")
-                                           "/bin"))
-                    (npx    (readlink (string-append bindir "/npx"))))
-               (with-directory-excursion bindir
-                 (patch-shebang npx (list bindir)))))))))
+         (add-after 'patch-shebangs 'patch-nested-shebangs
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((prefix (assoc-ref outputs "out"))
+                    (path (map (lambda (dir)
+                                 (string-append dir "/bin"))
+                               (list prefix
+                                     (assoc-ref inputs "python-for-target")))))
+               (for-each
+                (lambda (file)
+                  (patch-shebang file path))
+                (find-files (string-append prefix "/lib/node_modules")
+                            (lambda (file stat)
+                              (executable-file? file))
+                            #:stat lstat))))))))
     (native-inputs
      `(;; Runtime dependencies for binaries used as a bootstrap.
        ("c-ares" ,c-ares)
@@ -274,6 +273,7 @@ (define-public node
     (inputs
      `(("bash" ,bash-minimal)
        ("coreutils" ,coreutils)
+       ("python-for-target" ,python-wrapper) ;; for node-gyp (supports python3)
        ("c-ares" ,c-ares)
        ("http-parser" ,http-parser)
        ("icu4c" ,icu4c)
@@ -795,6 +795,7 @@ (define-public node-lts
     (inputs
      `(("bash" ,bash-minimal)
        ("coreutils" ,coreutils)
+       ("python-for-target" ,python-wrapper) ;; for node-gyp (supports python3)
        ("c-ares" ,c-ares)
        ("icu4c" ,icu4c-67)
        ("libuv" ,libuv-for-node)
@@ -813,5 +814,4 @@ (define-public libnode
         `(cons* "--shared" "--without-npm" ,flags))
        ((#:phases phases '%standard-phases)
         `(modify-phases ,phases
-           (delete 'patch-npm-shebang)
-           (delete 'patch-node-shebang)))))))
+           (delete 'patch-nested-shebangs)))))))
diff --git a/guix/build-system/node.scm b/guix/build-system/node.scm
index 98f63f87ef..fee4142a99 100644
--- a/guix/build-system/node.scm
+++ b/guix/build-system/node.scm
@@ -1,6 +1,8 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2016 Jelle Licht <jlicht@fsfe.org>
 ;;; Copyright © 2019 Timothy Sample <samplet@ngyro.com>
+;;; Copyright © 2021 Pierre Langlois <pierre.langlois@gmx.com>
+;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -24,6 +26,7 @@ (define-module (guix build-system node)
   #:use-module (guix search-paths)
   #:use-module (guix build-system)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system python)
   #:use-module (ice-9 match)
   #:export (%node-build-system-modules
             node-build
@@ -44,11 +47,12 @@ (define (default-node)
 (define* (lower name
                 #:key source inputs native-inputs outputs system target
                 (node (default-node))
+                (python (default-python)) ;; for node-gyp
                 #:allow-other-keys
                 #:rest arguments)
   "Return a bag for NAME."
   (define private-keywords
-    '(#:source #:target #:node #:inputs #:native-inputs))
+    '(#:source #:target #:node #:python #:inputs #:native-inputs))
 
   (and (not target)                    ;XXX: no cross-compilation
        (bag
@@ -58,10 +62,13 @@ (define private-keywords
                               `(("source" ,source))
                               '())
                         ,@inputs
-
                         ;; Keep the standard inputs of 'gnu-build-system'.
                         ,@(standard-packages)))
          (build-inputs `(("node" ,node)
+                         ("python" ,python)
+                        ;; We don't always need libuv, but the libuv and
+                        ;; node versions need to match:
+                        ("libuv" ,@(assoc-ref (package-inputs node) "libuv"))
                          ,@native-inputs))
          (outputs outputs)
          (build node-build)
diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
index 70a367618e..6aeb0149dd 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -2,6 +2,8 @@
 ;;; Copyright © 2015 David Thompson <davet@gnu.org>
 ;;; Copyright © 2016, 2020 Jelle Licht <jlicht@fsfe.org>
 ;;; Copyright © 2019, 2021 Timothy Sample <samplet@ngyro.com>
+;;; Copyright © 2021 Pierre Langlois <pierre.langlois@gmx.com>
+;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -46,6 +48,19 @@ (define (set-home . _)
               (format #t "set HOME to ~s~%" (getenv "HOME")))))))
   #t)
 
+(define* (set-node-gyp-paths #:key inputs #:allow-other-keys)
+  "Initialize environment variables needed for building native addons."
+  (setenv "npm_config_nodedir" (assoc-ref inputs "node"))
+  (setenv "npm_config_python" (assoc-ref inputs "python"))
+  (setenv "PATH"
+          (string-append (getenv "PATH")
+                         ":"
+                         ;; Put this at the end to make it easier to override,
+                         ;; just in case that should ever be necessary:
+                         (assoc-ref inputs "node")
+                         "/lib/node_modules/npm/bin/node-gyp-bin"))
+  #t)
+
 (define (module-name module)
   (let* ((package.json (string-append module "/package.json"))
          (package-meta (call-with-input-file package.json read-json)))
@@ -101,6 +116,12 @@ (define* (configure #:key outputs inputs #:allow-other-keys)
     (invoke npm "--offline" "--ignore-scripts" "install")
     #t))
 
+(define* (configure-gyp #:key inputs #:allow-other-keys)
+  "Run 'node-gyp configure' if we see a 'binding.gyp' file."
+  (if (file-exists? "binding.gyp")
+      (invoke (which "node-gyp") "configure")
+      #t))
+
 (define* (build #:key inputs #:allow-other-keys)
   (let ((package-meta (call-with-input-file "package.json" read-json)))
     (if (and=> (assoc-ref package-meta "scripts")
@@ -144,9 +165,11 @@ (define* (install #:key outputs inputs #:allow-other-keys)
 
 (define %standard-phases
   (modify-phases gnu:%standard-phases
+    (add-after 'set-paths 'set-node-gyp-paths set-node-gyp-paths)
     (add-after 'unpack 'set-home set-home)
     (add-before 'configure 'patch-dependencies patch-dependencies)
     (replace 'configure configure)
+    (add-after 'configure 'configure-gyp configure-gyp)
     (replace 'build build)
     (replace 'check check)
     (add-before 'install 'repack repack)
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH 04/11] gnu: Add node-inherits.
  2021-11-14 13:04   ` [bug#51838] [PATCH 02/11] gnu: node: Update to 10.24.1 for bootstrapping Philip McGrath
  2021-11-14 13:04     ` [bug#51838] [PATCH 03/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
@ 2021-11-14 13:04     ` Philip McGrath
  2021-11-14 13:04     ` [bug#51838] [PATCH 05/11] gnu: Add node-safe-buffer Philip McGrath
                       ` (6 subsequent siblings)
  8 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-11-14 13:04 UTC (permalink / raw)
  To: 51838; +Cc: Philip McGrath

* gnu/packages/node-xyz.scm (node-inherits): New variable.
---
 gnu/packages/node-xyz.scm | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 98c611f227..da6affeb1f 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2020 Giacomo Leidi <goodoldpaul@autistici.org>
 ;;; Copyright © 2021 Noisytoot <noisytoot@disroot.org>
 ;;; Copyright © 2021 Charles <charles.b.jackson@protonmail.com>
+;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -358,6 +359,37 @@ (define-public node-once
 if desired.")
     (license license:isc)))
 
+(define-public node-inherits
+  (package
+    (name "node-inherits")
+    (version "2.0.4")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/isaacs/inherits")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0cpsr5yqwkxpbbbbl0rwk4mcby6zbx841k2zb4c3gb1579i5wq9p"))))
+    (build-system node-build-system)
+    (arguments
+     `(#:tests?
+       #f
+       #:phases
+       (modify-phases %standard-phases
+         ;; Ignore our lack of tap (for tests) as with node-once.
+         (delete 'configure))))
+    (home-page
+     "https://github.com/isaacs/inherits")
+    (synopsis
+     "Browser-friendly inheritance Node.js")
+    (description
+     "Browser-friendly inheritance fully compatible with standard Node.js
+@code{inherits()}.")
+    (license license:isc)))
+
 (define-public node-irc-colors
   (package
     (name "node-irc-colors")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH 05/11] gnu: Add node-safe-buffer.
  2021-11-14 13:04   ` [bug#51838] [PATCH 02/11] gnu: node: Update to 10.24.1 for bootstrapping Philip McGrath
  2021-11-14 13:04     ` [bug#51838] [PATCH 03/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
  2021-11-14 13:04     ` [bug#51838] [PATCH 04/11] gnu: Add node-inherits Philip McGrath
@ 2021-11-14 13:04     ` Philip McGrath
  2021-11-14 13:04     ` [bug#51838] [PATCH 06/11] gnu: Add node-string-decoder Philip McGrath
                       ` (5 subsequent siblings)
  8 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-11-14 13:04 UTC (permalink / raw)
  To: 51838; +Cc: Philip McGrath

* gnu/packages/node-xyz.scm (node-safe-buffer): New variable.
---
 gnu/packages/node-xyz.scm | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index da6affeb1f..44000e0568 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -390,6 +390,36 @@ (define-public node-inherits
 @code{inherits()}.")
     (license license:isc)))
 
+(define-public node-safe-buffer
+  (package
+    (name "node-safe-buffer")
+    (version "5.2.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/feross/safe-buffer")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0r26m0nl41h90ihnl2xf0cqs6z9z7jb87dl5j8yqb7887r9jlbpi"))))
+    (build-system node-build-system)
+    (arguments
+     `(#:tests?
+       #f
+       #:phases
+       (modify-phases %standard-phases
+         ;; Skip checking devDependencies, since we don't have tape.
+         (delete 'configure))))
+    (home-page
+     "https://github.com/feross/safe-buffer")
+    (synopsis "Safer Node.js Buffer API")
+    (description "A safe drop-in replacement the Node.js @code{Buffer} API
+that works in all versions of Node.js, using the built-in implementation when
+available.")
+    (license license:expat)))
+
 (define-public node-irc-colors
   (package
     (name "node-irc-colors")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH 06/11] gnu: Add node-string-decoder.
  2021-11-14 13:04   ` [bug#51838] [PATCH 02/11] gnu: node: Update to 10.24.1 for bootstrapping Philip McGrath
                       ` (2 preceding siblings ...)
  2021-11-14 13:04     ` [bug#51838] [PATCH 05/11] gnu: Add node-safe-buffer Philip McGrath
@ 2021-11-14 13:04     ` Philip McGrath
  2021-11-14 13:04     ` [bug#51838] [PATCH 07/11] gnu: Add node-readable-stream Philip McGrath
                       ` (4 subsequent siblings)
  8 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-11-14 13:04 UTC (permalink / raw)
  To: 51838; +Cc: Philip McGrath

* gnu/packages/node-xyz.scm (node-string-decoder): New variable.
---
 gnu/packages/node-xyz.scm | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 44000e0568..a5ca5631c7 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -420,6 +420,40 @@ (define-public node-safe-buffer
 available.")
     (license license:expat)))
 
+(define-public node-string-decoder
+  (package
+    (name "node-string-decoder")
+    (version "1.3.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nodejs/string_decoder")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0xxvyya9fl9rlkqwmxzqzbz4rdr3jgw4vf37hff7cgscxkhg266k"))))
+    (build-system node-build-system)
+    (arguments
+     `(#:tests?
+       #f
+       #:phases
+       (modify-phases %standard-phases
+         ;; Ignore missing tap dependency (for tests).
+         (delete 'configure))))
+    (inputs
+     `(("node-safe-buffer" ,node-safe-buffer)
+       ("node-inherits" ,node-inherits)))
+    (home-page
+     "https://github.com/nodejs/string_decoder")
+    (synopsis
+     "Node.js core @code{string_decoder} for userland")
+    (description
+     "This package is a mirror of the @code{string_decoder} implementation in
+Node-core.")
+    (license license:expat)))
+
 (define-public node-irc-colors
   (package
     (name "node-irc-colors")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH 07/11] gnu: Add node-readable-stream.
  2021-11-14 13:04   ` [bug#51838] [PATCH 02/11] gnu: node: Update to 10.24.1 for bootstrapping Philip McGrath
                       ` (3 preceding siblings ...)
  2021-11-14 13:04     ` [bug#51838] [PATCH 06/11] gnu: Add node-string-decoder Philip McGrath
@ 2021-11-14 13:04     ` Philip McGrath
  2021-11-14 13:04     ` [bug#51838] [PATCH 08/11] gnu: Add node-nan Philip McGrath
                       ` (3 subsequent siblings)
  8 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-11-14 13:04 UTC (permalink / raw)
  To: 51838; +Cc: Philip McGrath

* gnu/packages/node-xyz.scm (node-readable-stream): New variable.
---
 gnu/packages/node-xyz.scm | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index a5ca5631c7..d0b4d1fa98 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -454,6 +454,44 @@ (define-public node-string-decoder
 Node-core.")
     (license license:expat)))
 
+(define-public node-readable-stream
+  (package
+    (name "node-readable-stream")
+    (version "3.6.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nodejs/readable-stream")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0ybl4cdgsm9c5jq3xq8s01201jk8w0yakh63hlclsfbcdfqhd9ri"))))
+    (build-system node-build-system)
+    (arguments
+     `(#:tests?
+       #f
+       #:phases
+       (modify-phases %standard-phases
+         ;; Ignore numerous missing devDependencies
+         (delete 'configure))))
+    (inputs
+     `(("node-util-deprecate" ,node-util-deprecate)
+       ("node-string-decoder" ,node-string-decoder)
+       ("node-inherits" ,node-inherits)))
+    (home-page
+     "https://github.com/nodejs/readable-stream")
+    (synopsis
+     "Node.js core streams for userland")
+    (description
+     "This package is a mirror of the streams implementations in Node.js.
+
+If you want to guarantee a stable streams base, regardless of what version of
+Node you (or the users of your libraries) are using, use
+@code{readable-stream} only and avoid the @code{stream} module in Node-core.")
+    (license license:expat)))
+
 (define-public node-irc-colors
   (package
     (name "node-irc-colors")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH 08/11] gnu: Add node-nan.
  2021-11-14 13:04   ` [bug#51838] [PATCH 02/11] gnu: node: Update to 10.24.1 for bootstrapping Philip McGrath
                       ` (4 preceding siblings ...)
  2021-11-14 13:04     ` [bug#51838] [PATCH 07/11] gnu: Add node-readable-stream Philip McGrath
@ 2021-11-14 13:04     ` Philip McGrath
  2021-11-14 13:04     ` [bug#51838] [PATCH 09/11] gnu: Add node-openzwave-shared Philip McGrath
                       ` (2 subsequent siblings)
  8 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-11-14 13:04 UTC (permalink / raw)
  To: 51838; +Cc: Philip McGrath

* gnu/packages/node-xyz.scm (node-nan): New variable.
---
 gnu/packages/node-xyz.scm | 41 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index d0b4d1fa98..29ad14f810 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -549,3 +549,44 @@ (define-public node-irc
     (description "@code{node-irc} is an IRC client library for Node.js.
 It has functions for joining, parting, talking, and many other IRC commands.")
     (license license:gpl3+)))
+
+(define-public node-nan
+  (package
+    (name "node-nan")
+    (version "2.15.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nodejs/nan")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "18xslh9va5ld872scrp5y4251ax9s3c6qh0lnl1200lpzbsxy7yd"))))
+    (build-system node-build-system)
+    (arguments
+     `(#:tests?
+       ;; We can't run the npm-driven tests,
+       ;; but a number of C++ tests do run anyway:
+       #f
+       #:phases
+       (modify-phases %standard-phases
+         ;; Ignore missing devDependencies (e.g. "tap", for tests):
+         (delete 'configure))))
+    (inputs
+     `(("readable-stream" ,node-readable-stream)))
+    (home-page "https://github.com/nodejs/nan")
+    (synopsis "Native Abstractions for Node.js")
+    (description "A header file filled with macro and utility goodness for
+making add-on development for Node.js easier across versions 0.8, 0.10, 0.12,
+1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 and 16.
+
+Thanks to the crazy changes in V8 (and some in Node core), keeping native
+addons compiling happily across versions, particularly 0.10 to 0.12 to 4.0, is
+a minor nightmare.  The goal of this project is to store all logic necessary
+to develop native Node.js addons without having to inspect
+@code{NODE_MODULE_VERSION} and get yourself into a macro-tangle.
+
+This project also contains some helper utilities that make addon development a
+bit more pleasant.")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH 09/11] gnu: Add node-openzwave-shared.
  2021-11-14 13:04   ` [bug#51838] [PATCH 02/11] gnu: node: Update to 10.24.1 for bootstrapping Philip McGrath
                       ` (5 preceding siblings ...)
  2021-11-14 13:04     ` [bug#51838] [PATCH 08/11] gnu: Add node-nan Philip McGrath
@ 2021-11-14 13:04     ` Philip McGrath
  2021-11-14 13:04     ` [bug#51838] [PATCH 10/11] gnu: Add node-addon-api Philip McGrath
  2021-11-14 13:04     ` [bug#51838] [PATCH 11/11] gnu: Add node-sqlite3 Philip McGrath
  8 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-11-14 13:04 UTC (permalink / raw)
  To: 51838; +Cc: Philip McGrath

* gnu/packages/zwave.scm (node-openzwave-shared): New variable.
---
 gnu/packages/zwave.scm | 55 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)

diff --git a/gnu/packages/zwave.scm b/gnu/packages/zwave.scm
index 2019ec32df..39028b4f34 100644
--- a/gnu/packages/zwave.scm
+++ b/gnu/packages/zwave.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -21,8 +22,10 @@ (define-module (gnu packages zwave)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix git-download)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system node)
   #:use-module (gnu packages)
   #:use-module (gnu packages base)
+  #:use-module (gnu packages node-xyz)
   #:use-module (gnu packages libusb)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages perl)
@@ -88,3 +91,55 @@ (define-public open-zwave
 and respond to devices on a Z-Wave network, without requiring in-depth
 knowledge of the Z-Wave protocol.")
     (license license:lgpl3+)))
+
+(define-public node-openzwave-shared
+  (package
+    (name "node-openzwave-shared")
+    (version "1.7.2")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/OpenZWave/node-openzwave-shared")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "1bqqy12dzqj05j9wsh50dmn84dddmhz0gjzvd3y20z4hpy1v8rsc"))))
+    (inputs
+     `(("open-zwave" ,open-zwave)
+       ("node-nan" ,node-nan)))
+    (native-inputs
+     `(("which" ,which)
+       ("pkg-config" ,pkg-config)))
+    (build-system node-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (replace 'build
+           (lambda* (#:key inputs #:allow-other-keys)
+             (invoke (which "node-gyp") "build"))))))
+    (home-page "https://github.com/OpenZWave/node-openzwave-shared")
+    (synopsis "Node.js bindings for OpenZWave")
+    (description
+     "With the @code{node-openzwave-shared} package, you can easily control
+and manage your Z-Wave devices (lights, dimmers, blinds, you name it) from
+within Node.js applications.  This library also supports secure
+devices (e.g. door locks) that require encryption.  All widely used Node.js
+versions are supported with the help of @code{node-nan}.
+
+This library is currently able to:
+@itemize @bullet
+@item
+scan a Z-Wave network and report on connected devices;
+@item
+write values to Z-Wave nodes;
+@item
+monitor the network for changes;
+@item
+heal nodes and/or the network; and
+@item
+perform management tasks: add or remove nodes, replace failed nodes,
+manage their group associations, etc.
+@end itemize")
+    (license license:isc)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH 10/11] gnu: Add node-addon-api.
  2021-11-14 13:04   ` [bug#51838] [PATCH 02/11] gnu: node: Update to 10.24.1 for bootstrapping Philip McGrath
                       ` (6 preceding siblings ...)
  2021-11-14 13:04     ` [bug#51838] [PATCH 09/11] gnu: Add node-openzwave-shared Philip McGrath
@ 2021-11-14 13:04     ` Philip McGrath
  2021-11-14 13:04     ` [bug#51838] [PATCH 11/11] gnu: Add node-sqlite3 Philip McGrath
  8 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-11-14 13:04 UTC (permalink / raw)
  To: 51838; +Cc: Philip McGrath

* gnu/packages/node-xyz.scm (node-addon-api): New variable.
---
 gnu/packages/node-xyz.scm | 46 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 29ad14f810..8aa93122df 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -590,3 +590,49 @@ (define-public node-nan
 This project also contains some helper utilities that make addon development a
 bit more pleasant.")
     (license license:expat)))
+
+(define-public node-addon-api
+  (package
+    (name "node-addon-api")
+    (version "4.2.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nodejs/node-addon-api")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1bhvfi2m9nxfz418s619914vmidcnrzbjv6l9nid476c3zlpazch"))))
+    (build-system node-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         ;; Ignore numerous missing devDependencies:
+         (delete 'configure)
+         (add-after 'unpack 'skip-js-tests
+           ;; We can't run the js-based tests,
+           ;; but we can still do the C++ parts
+           (lambda args
+             (substitute* "package.json"
+               (("\"test\": \"node test\"")
+                "\"test\": \"echo stopping after pretest on Guix\"")))))))
+    (home-page "https://github.com/nodejs/node-addon-api")
+    (synopsis "Node.js API (Node-API) header-only C++ wrappers")
+    (description "This module contains header-only C++ wrapper classes which
+simplify the use of the C based Node-API provided by Node.js when using C++.
+It provides a C++ object model and exception handling semantics with low
+overhead.
+
+Node-API is an ABI stable C interface provided by Node.js for building native
+addons.  It is intended to insulate native addons from changes in the
+underlying JavaScript engine and allow modules compiled for one version to run
+on later versions of Node.js without recompilation.  The @code{node-addon-api}
+module, which is not part of Node.js, preserves the benefits of the Node-API
+as it consists only of inline code that depends only on the stable API
+provided by Node-API.
+
+It is important to remember that @emph{other} Node.js interfaces such as
+@code{libuv} (included in a project via @code{#include <uv.h>}) are not
+ABI-stable across Node.js major versions.")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH 11/11] gnu: Add node-sqlite3.
  2021-11-14 13:04   ` [bug#51838] [PATCH 02/11] gnu: node: Update to 10.24.1 for bootstrapping Philip McGrath
                       ` (7 preceding siblings ...)
  2021-11-14 13:04     ` [bug#51838] [PATCH 10/11] gnu: Add node-addon-api Philip McGrath
@ 2021-11-14 13:04     ` Philip McGrath
  8 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-11-14 13:04 UTC (permalink / raw)
  To: 51838; +Cc: Philip McGrath

* gnu/packages/node-xyz.scm (node-sqlite3): New variable.
---
 gnu/packages/node-xyz.scm | 114 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 114 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 8aa93122df..d30b6f6e04 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -22,6 +22,8 @@
 
 (define-module (gnu packages node-xyz)
   #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (gnu packages sqlite)
+  #:use-module (guix gexp)
   #:use-module (guix packages)
   #:use-module (guix git-download)
   #:use-module (guix build-system node))
@@ -636,3 +638,115 @@ (define-public node-addon-api
 @code{libuv} (included in a project via @code{#include <uv.h>}) are not
 ABI-stable across Node.js major versions.")
     (license license:expat)))
+
+(define-public node-sqlite3
+  (package
+    (name "node-sqlite3")
+    (version "5.0.2")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/mapbox/node-sqlite3")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0sbbzzli282nxyfha10zx0k5m8hdp0sf3ipl59khjb7wm449j86h"))
+       (snippet
+        (with-imported-modules '((guix build utils))
+          #~(begin
+              (use-modules (guix build utils))
+              ;; unbundle sqlite
+              '(for-each delete-file-recursively
+                         (find-files "deps" gzip-file?)))))))
+    (inputs
+     `(("node-addon-api" ,node-addon-api)
+       ("sqlite" ,sqlite)))
+    (build-system node-build-system)
+    (arguments
+     `(#:tests?
+       #f ; FIXME: tests depend on node-mocha
+       #:modules
+       ((guix build node-build-system)
+        (guix build json)
+        (srfi srfi-1)
+        (ice-9 match)
+        (guix build utils))
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'configure 'npm-config-sqlite
+           (lambda* (#:key inputs #:allow-other-keys)
+             (setenv "npm_config_sqlite" (assoc-ref inputs "sqlite"))))
+         (add-after 'unpack 'un-cloud-ify
+           ;; Normally, this is "built" using @mapbox/node-pre-gyp,
+           ;; which publishes or downloads pre-built binaries
+           ;; or falls back to building from source.
+           ;; Here, we patch out all of that and just build directly.
+           ;; It would be better to patch a version of @mapbox/node-pre-gyp
+           ;; that always builds from source, but there are a number
+           ;; of dependencies that need to be packaged or removed.
+           (lambda args
+             (with-atomic-file-replacement "package.json"
+               (lambda (in out)
+                 (let ((js (read-json in)))
+                   (match (assoc-ref js "binary")
+                     (('@ . alist)
+                      (setenv "GYP_DEFINES"
+                              (string-append
+                               "module_name="
+                               (assoc-ref alist "module_name")
+                               " "
+                               "module_path="
+                               (assoc-ref alist "module_path")))))
+                   (write-json
+                    (fold (match-lambda*
+                            (((key update) js)
+                             (assoc-set! js
+                                         key
+                                         (match (assoc-ref js key)
+                                           (('@ . alist)
+                                            (cons '@ (update alist)))
+                                           (other
+                                            (update other))))))
+                          js
+                          `(("dependencies"
+                             ,(lambda (deps)
+                                (assoc-remove!
+                                 (assoc-remove! deps "@mapbox/node-pre-gyp")
+                                 "node-pre-gyp")))
+                            ("devDependencies"
+                             ,(lambda (deps)
+                                (assoc-remove!
+                                 (assoc-remove! deps "aws-sdk")
+                                 "@mapbox/cloudfriend")))
+                            ("scripts"
+                             ,(lambda (scripts)
+                                ;; install script would use node-pre-gyp
+                                (assoc-remove! scripts "install")))))
+                    out))))))
+         (add-after 'un-cloud-ify 'remove-missing-dev-deps
+           ;; Remove some missing testing/linting dependencies
+           ;; so we don't have to skip the configure phase entirely.
+           (lambda args
+             (with-atomic-file-replacement "package.json"
+               (lambda (in out)
+                 (write-json
+                  (let ((js (read-json in)))
+                    (assoc-set!
+                     (assoc-remove!
+                      (assoc-remove! (assoc-remove! js "peerDependencies")
+                                     "peerDependenciesMeta")
+                      "optionalDependencies")
+                     "devDependencies"
+                     (match (assoc-ref js "devDependencies")
+                       (('@ . deps)
+                        (cons '@ (assoc-remove! (assoc-remove! deps "eslint")
+                                                "mocha"))))))
+                  out))))))))
+    (home-page "https://github.com/mapbox/node-sqlite3")
+    (synopsis "Asynchronous, non-blocking SQLite3 bindings for Node.js")
+    (description
+     "The Node.js add-on @code{node-sqlite3} provides a set of a asynchronous,
+non-blocking bindings for SQLite3, written in modern C++ and tested for memory
+leaks.")
+     (license license:bsd-3)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH 03/11] guix: node-build-system: Support compiling add-ons with node-gyp.
  2021-11-14 13:04     ` [bug#51838] [PATCH 03/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
@ 2021-11-14 20:44       ` Liliana Marie Prikler
  2021-11-20  4:26         ` Philip McGrath
  0 siblings, 1 reply; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-11-14 20:44 UTC (permalink / raw)
  To: Philip McGrath, 51838; +Cc: Pierre Langlois

Hi Philip

Am Sonntag, den 14.11.2021, 08:04 -0500 schrieb Philip McGrath:
> * gnu/packages/node.scm (node)[arguments]: Replace 'patch-npm-shebang
> and 'patch-node-shebang with a new 'patch-nested-shebangs that also
> handles node-gyp and other shebangs under "/lib/node_modules".
> [inputs]: Add Python for node-gyp as "python-for-target".
> (node-lts)[inputs]: Likewise.
> (libnode)[arguments]: Adjust to delete 'patch-nested-shebangs rather
> than 'patch-npm-shebang and 'patch-node-shebang.
> * guix/build-system/node.scm (lower): Add optional #:python argument
> and corresponding implicit input. Add the version of libuv used
> as an input to the #:node package as a new implicit input.
> * guix/build/node-build-system.scm (set-node-gyp-paths): New
> function. Sets the "npm_config_nodedir" and "npm_config_python"
> environment variables. Adds the "node-gyp-bin" directory to "PATH".
> (configure-gyp): New function. Run `node-gyp configure` if we see
> a `binding.gyp` file.
> (%standard-phases): Add 'set-node-gyp-paths after 'set-paths.
> Add 'configure-gyp after 'configure.
> 
> Co-authored-by: Pierre Langlois <pierre.langlois@gmx.com>
Looking at this patch, it does *a lot* at once and could probably be
separated into more than one.  Particularly, I'd suggest providing
capabilities in node-build-system first, then switching over to the new
thing in node.

> [...]
> --- a/guix/build-system/node.scm
> +++ b/guix/build-system/node.scm
> @@ -1,6 +1,8 @@
>  ;;; GNU Guix --- Functional package management for GNU
>  ;;; Copyright © 2016 Jelle Licht <jlicht@fsfe.org>
>  ;;; Copyright © 2019 Timothy Sample <samplet@ngyro.com>
> +;;; Copyright © 2021 Pierre Langlois <pierre.langlois@gmx.com>
> +;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -24,6 +26,7 @@ (define-module (guix build-system node)
>    #:use-module (guix search-paths)
>    #:use-module (guix build-system)
>    #:use-module (guix build-system gnu)
> +  #:use-module (guix build-system python)
>    #:use-module (ice-9 match)
>    #:export (%node-build-system-modules
>              node-build
> @@ -44,11 +47,12 @@ (define (default-node)
>  (define* (lower name
>                  #:key source inputs native-inputs outputs system
> target
>                  (node (default-node))
> +                (python (default-python)) ;; for node-gyp
>                  #:allow-other-keys
>                  #:rest arguments)
>    "Return a bag for NAME."
>    (define private-keywords
> -    '(#:source #:target #:node #:inputs #:native-inputs))
> +    '(#:source #:target #:node #:python #:inputs #:native-inputs))
>  
>    (and (not target)                    ;XXX: no cross-compilation
>         (bag
> @@ -58,10 +62,13 @@ (define private-keywords
>                                `(("source" ,source))
>                                '())
>                          ,@inputs
> -
>                          ;; Keep the standard inputs of 'gnu-build-
> system'.
>                          ,@(standard-packages)))
>           (build-inputs `(("node" ,node)
> +                         ("python" ,python)
> +                        ;; We don't always need libuv, but the libuv
> and
> +                        ;; node versions need to match:
> +                        ("libuv" ,@(assoc-ref (package-inputs node)
> "libuv"))
>                           ,@native-inputs))
>           (outputs outputs)
>           (build node-build)
Will this python input always or often enough be needed?  What's the
build system ratio on node like, gyp vs. anything else, particularly
with packages close to the node core?

> diff --git a/guix/build/node-build-system.scm b/guix/build/node-
> build-system.scm
> index 70a367618e..6aeb0149dd 100644
> --- a/guix/build/node-build-system.scm
> +++ b/guix/build/node-build-system.scm
> @@ -2,6 +2,8 @@
>  ;;; Copyright © 2015 David Thompson <davet@gnu.org>
>  ;;; Copyright © 2016, 2020 Jelle Licht <jlicht@fsfe.org>
>  ;;; Copyright © 2019, 2021 Timothy Sample <samplet@ngyro.com>
> +;;; Copyright © 2021 Pierre Langlois <pierre.langlois@gmx.com>
> +;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -46,6 +48,19 @@ (define (set-home . _)
>                (format #t "set HOME to ~s~%" (getenv "HOME")))))))
>    #t)
>  
> +(define* (set-node-gyp-paths #:key inputs #:allow-other-keys)
> +  "Initialize environment variables needed for building native
> addons."
> +  (setenv "npm_config_nodedir" (assoc-ref inputs "node"))
> +  (setenv "npm_config_python" (assoc-ref inputs "python"))
> +  (setenv "PATH"
> +          (string-append (getenv "PATH")
> +                         ":"
> +                         ;; Put this at the end to make it easier to
> override,
> +                         ;; just in case that should ever be
> necessary:
> +                         (assoc-ref inputs "node")
> +                         "/lib/node_modules/npm/bin/node-gyp-bin"))
> +  #t)
> +
Is this a necessary step to build node modules?  If not can we skip
this step when packages don't need gyp?

>  (define (module-name module)
>    (let* ((package.json (string-append module "/package.json"))
>           (package-meta (call-with-input-file package.json read-
> json)))
> @@ -101,6 +116,12 @@ (define* (configure #:key outputs inputs
> #:allow-other-keys)
>      (invoke npm "--offline" "--ignore-scripts" "install")
>      #t))
>  
> +(define* (configure-gyp #:key inputs #:allow-other-keys)
> +  "Run 'node-gyp configure' if we see a 'binding.gyp' file."
> +  (if (file-exists? "binding.gyp")
> +      (invoke (which "node-gyp") "configure")
> +      #t))
> +
You might want to make this part of configure itself, though I'm not
sure what the consensus is there when mixing different build system
styles.  (invoke (which ...) ) is also a pretty rare pattern, used in
only four locations so far.

Also, while better than the previous thing in that it actually checks
whether we have something gyp-esque at hand, I'd still prefer users
being able to not run this portion through some flag.  See e.g. #:use-
setuptools? in python or #:glib-or-gtk? in meson.

Cheers





^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH 03/11] guix: node-build-system: Support compiling add-ons with node-gyp.
  2021-11-14 20:44       ` Liliana Marie Prikler
@ 2021-11-20  4:26         ` Philip McGrath
  2021-11-20  4:33           ` [bug#51838] [PATCH v2 01/26] gnu: node: Avoid duplicating build phases Philip McGrath
  2021-11-20  5:10           ` [bug#51838] [PATCH 03/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
  0 siblings, 2 replies; 458+ messages in thread
From: Philip McGrath @ 2021-11-20  4:26 UTC (permalink / raw)
  To: Liliana Marie Prikler, 51838; +Cc: Pierre Langlois

Hi!

On 11/14/21 15:44, Liliana Marie Prikler wrote:
> Looking at this patch, it does *a lot* at once and could probably be
> separated into more than one.  Particularly, I'd suggest providing
> capabilities in node-build-system first, then switching over to the new
> thing in node.

Thanks for these comments. Some of the things to which you drew my 
attention seem to have been workarounds for problems that had since been 
solved at a deeper level. Then, in particular, this comment:


 >> +(define* (configure-gyp #:key inputs #:allow-other-keys)
 >> +  "Run 'node-gyp configure' if we see a 'binding.gyp' file."
 >> +  (if (file-exists? "binding.gyp")
 >> +      (invoke (which "node-gyp") "configure")
 >> +      #t))
 >> +
 > You might want to make this part of configure itself, though I'm not
 > sure what the consensus is there when mixing different build system
 > styles.  (invoke (which ...) ) is also a pretty rare pattern, used in
 > only four locations so far.

prompted me to look more closely at why so much manual work was needed 
in the first place.

It turns out that the `npm install` in the `'configure` phase should 
have handled most of it automatically, but the Guix packages were 
deleting the configure phase to avoid checking for devDependencies that 
aren't in Guix (or that we just don't want, e.g. some dependencies of 
node-sqlite3).

In v2 of this series (which will follow this email), I've removed all of 
the `node-gyp`-specific build-side code and tried a more general 
solution, adding an `#:absent-packages` argument to instruct the 
`'patch-dependencies` phase to remove the specified packages from the 
"package.json" file. This means that the Guix package can still run 
`'configure`/`npm install`, checking properly for the packages that we 
*do* have/want and doing all of the other automatic work `npm install` 
does. I also like that listing the missing packages in the Guix package 
definition provides a sort of documentation of what is missing: for 
example, it is clear which packages could have their tests enabled with 
the addition of a `node-tap` package, without having to inspect all of 
the individual "package.json" files.

I've updated all of the existing Node.js packages that deleted their 
`'configure` phase to use `#:absent-dependencies` instead.

>> @@ -58,10 +62,13 @@ (define private-keywords
>>                                 `(("source" ,source))
>>                                 '())
>>                           ,@inputs
>> -
>>                           ;; Keep the standard inputs of 'gnu-build-
>> system'.
>>                           ,@(standard-packages)))
>>            (build-inputs `(("node" ,node)
>> +                         ("python" ,python)
>> +                        ;; We don't always need libuv, but the libuv
>> and
>> +                        ;; node versions need to match:
>> +                        ("libuv" ,@(assoc-ref (package-inputs node)
>> "libuv"))
>>                            ,@native-inputs))
>>            (outputs outputs)
>>            (build node-build)
> Will this python input always or often enough be needed?  What's the
> build system ratio on node like, gyp vs. anything else, particularly
> with packages close to the node core?

GYP is a Python program, and it (or at least node's fork of it) expects 
to have a python executable available to invoke with sub-programs. Since 
npm depends on node-gyp and GYP, it is pretty close to the core.

In v2, I've just had packages that use node-gyp add Python to their 
inputs. IIRC, that used to not be enough, but it seems underlying 
problems were fixed in the mean time.

An alternative approach would be to configure it using the npmrc file, 
as I do for `nodedir` in v2. I'm not sure that makes much difference 
either way, but in v2 I've tried to minimize the amount of 
`node-gyp`-specific handling.

-Philip




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v2 01/26] gnu: node: Avoid duplicating build phases.
  2021-11-20  4:26         ` Philip McGrath
@ 2021-11-20  4:33           ` Philip McGrath
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 02/26] gnu: node: Update to 10.24.1 for bootstrapping Philip McGrath
                               ` (24 more replies)
  2021-11-20  5:10           ` [bug#51838] [PATCH 03/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
  1 sibling, 25 replies; 458+ messages in thread
From: Philip McGrath @ 2021-11-20  4:33 UTC (permalink / raw)
  To: 51838; +Cc: Liliana Marie Prikler

* gnu/packages/node.scm (node)[arguments]: Split 'patch-files phase
into 'patch-hardcoded-program-references and
'delete-problematic-tests. Adapt 'patch-hardcoded-program-references
and 'configure to work unmodified on node-lts, but don't try to
share 'delete-problematic-tests, because those details seem to change
too much between node versions.
(node, node-lts)[inputs]: Use bash-minimal rather than bash.
(node-lts)[arguments]: Inherit 'patch-hardcoded-program-references,
and 'configure phases from the bootstrap node.
Remove the 'patch-files phase, keeping its remaining
non-inherited work in a new 'replace-llhttp-sources phase.
---
 gnu/packages/node.scm | 105 +++++++++++++-----------------------------
 1 file changed, 32 insertions(+), 73 deletions(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index dccf871d2c..7ebbbc3060 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -9,6 +9,7 @@
 ;;; Copyright © 2020, 2021 Pierre Langlois <pierre.langlois@gmx.com>
 ;;; Copyright © 2020 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
+;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -105,14 +106,22 @@ (define-public node
        #:test-target "test-ci-js"
        #:phases
        (modify-phases %standard-phases
-         (add-before 'configure 'patch-files
+         (add-before 'configure 'patch-hardcoded-program-references
            (lambda* (#:key inputs #:allow-other-keys)
+
              ;; Fix hardcoded /bin/sh references.
-             (substitute* '("lib/child_process.js"
-                            "lib/internal/v8_prof_polyfill.js"
-                            "test/parallel/test-child-process-spawnsync-shell.js"
-                            "test/parallel/test-stdio-closed.js"
-                            "test/sequential/test-child-process-emfile.js")
+             (substitute*
+                 (let ((common
+                        '("lib/child_process.js"
+                          "lib/internal/v8_prof_polyfill.js"
+                          "test/parallel/test-child-process-spawnsync-shell.js"
+                          "test/parallel/test-stdio-closed.js"
+                          "test/sequential/test-child-process-emfile.js"))
+                       ;; not in bootstap node:
+                       (sigxfsz "test/parallel/test-fs-write-sigxfsz.js"))
+                   (if (file-exists? sigxfsz)
+                       (cons sigxfsz common)
+                       common))
                (("'/bin/sh'")
                 (string-append "'" (assoc-ref inputs "bash") "/bin/sh'")))
 
@@ -122,7 +131,10 @@ (define-public node
                             "test/parallel/test-child-process-exec-env.js")
                (("'/usr/bin/env'")
                 (string-append "'" (assoc-ref inputs "coreutils")
-                               "/bin/env'")))
+                               "/bin/env'")))))
+         (add-after 'patch-hardcoded-program-references
+             'delete-problematic-tests
+           (lambda* (#:key inputs #:allow-other-keys)
 
              ;; FIXME: These tests fail in the build container, but they don't
              ;; seem to be indicative of real problems in practice.
@@ -217,9 +229,13 @@ (define-public node
                (setenv "CXX" ,(cxx-for-target))
                (setenv "PKG_CONFIG" ,(pkg-config-for-target))
                (apply invoke
-                      (string-append (assoc-ref (or native-inputs inputs)
-                                                "python")
-                                     "/bin/python")
+                      (let ((python
+                             (string-append (assoc-ref (or native-inputs inputs)
+                                                       "python")
+                                            "/bin/python")))
+                        (if (file-exists? python)
+                            python
+                            (string-append python "3")))
                       "configure" flags))))
          (add-after 'patch-shebangs 'patch-npm-shebang
            (lambda* (#:key outputs #:allow-other-keys)
@@ -256,7 +272,7 @@ (define-public node
             (variable "NODE_PATH")
             (files '("lib/node_modules")))))
     (inputs
-     `(("bash" ,bash)
+     `(("bash" ,bash-minimal)
        ("coreutils" ,coreutils)
        ("c-ares" ,c-ares)
        ("http-parser" ,http-parser)
@@ -712,66 +728,8 @@ (define-public node-lts
                                    libuv "/lib:"
                                    zlib "/lib"
                                    "'],"))))))
-           (replace 'configure
-             ;; Node's configure script is actually a python script, so we can't
-             ;; run it with bash.
-             (lambda* (#:key outputs (configure-flags '()) native-inputs inputs
-                       #:allow-other-keys)
-               (let* ((prefix (assoc-ref outputs "out"))
-                      (xflags ,(if (%current-target-system)
-                                   `'("--cross-compiling"
-                                     ,(string-append
-                                       "--dest-cpu="
-                                       (match (%current-target-system)
-                                         ((? (cut string-prefix? "arm" <>))
-                                          "arm")
-                                         ((? (cut string-prefix? "aarch64" <>))
-                                          "arm64")
-                                         ((? (cut string-prefix? "i686" <>))
-                                          "ia32")
-                                         ((? (cut string-prefix? "x86_64" <>))
-                                          "x64")
-                                         ((? (cut string-prefix? "powerpc64" <>))
-                                          "ppc64")
-                                         (_ "unsupported"))))
-                                   ''()))
-                      (flags (cons
-                               (string-append "--prefix=" prefix)
-                               (append xflags configure-flags))))
-                 (format #t "build directory: ~s~%" (getcwd))
-                 (format #t "configure flags: ~s~%" flags)
-                 ;; Node's configure script expects the CC environment variable to
-                 ;; be set.
-                 (setenv "CC_host" "gcc")
-                 (setenv "CXX_host" "g++")
-                 (setenv "CC" ,(cc-for-target))
-                 (setenv "CXX" ,(cxx-for-target))
-                 (setenv "PKG_CONFIG" ,(pkg-config-for-target))
-                 (apply invoke
-                        (string-append (assoc-ref (or native-inputs inputs)
-                                                  "python")
-                                       "/bin/python3")
-                        "configure" flags))))
-           (replace 'patch-files
+           (replace 'delete-problematic-tests
              (lambda* (#:key inputs #:allow-other-keys)
-               ;; Fix hardcoded /bin/sh references.
-               (substitute* '("lib/child_process.js"
-                              "lib/internal/v8_prof_polyfill.js"
-                              "test/parallel/test-child-process-spawnsync-shell.js"
-                              "test/parallel/test-fs-write-sigxfsz.js"
-                              "test/parallel/test-stdio-closed.js"
-                              "test/sequential/test-child-process-emfile.js")
-                 (("'/bin/sh'")
-                  (string-append "'" (assoc-ref inputs "bash") "/bin/sh'")))
-
-               ;; Fix hardcoded /usr/bin/env references.
-               (substitute* '("test/parallel/test-child-process-default-options.js"
-                              "test/parallel/test-child-process-env.js"
-                              "test/parallel/test-child-process-exec-env.js")
-                 (("'/usr/bin/env'")
-                  (string-append "'" (assoc-ref inputs "coreutils")
-                                 "/bin/env'")))
-
                ;; FIXME: These tests fail in the build container, but they don't
                ;; seem to be indicative of real problems in practice.
                (for-each delete-file
@@ -810,8 +768,9 @@ (define-public node-lts
                ;; TODO: Regenerate certs instead.
                (for-each delete-file
                          '("test/parallel/test-tls-passphrase.js"
-                           "test/parallel/test-tls-server-verify.js"))
-
+                           "test/parallel/test-tls-server-verify.js"))))
+           (add-after 'delete-problematic-tests 'replace-llhttp-sources
+             (lambda* (#:key inputs #:allow-other-keys)
                ;; Replace pre-generated llhttp sources
                (let ((llhttp (assoc-ref inputs "llhttp")))
                  (copy-file (string-append llhttp "/src/llhttp.c")
@@ -838,7 +797,7 @@ (define-public node-lts
        ("python" ,python)
        ("util-linux" ,util-linux)))
     (inputs
-     `(("bash" ,bash)
+     `(("bash" ,bash-minimal)
        ("coreutils" ,coreutils)
        ("c-ares" ,c-ares-for-node)
        ("icu4c" ,icu4c-67)
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v2 02/26] gnu: node: Update to 10.24.1 for bootstrapping.
  2021-11-20  4:33           ` [bug#51838] [PATCH v2 01/26] gnu: node: Avoid duplicating build phases Philip McGrath
@ 2021-11-20  4:33             ` Philip McGrath
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 03/26] gnu: node: Patch shebangs in node_modules Philip McGrath
                               ` (23 subsequent siblings)
  24 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-11-20  4:33 UTC (permalink / raw)
  To: 51838; +Cc: Liliana Marie Prikler

* gnu/packages/node.scm (node): Update to 10.24.1.
---
 gnu/packages/node.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 7ebbbc3060..71b66774a6 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -57,14 +57,14 @@ (define-module (gnu packages node)
 (define-public node
   (package
     (name "node")
-    (version "10.24.0")
+    (version "10.24.1")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://nodejs.org/dist/v" version
                                   "/node-v" version ".tar.xz"))
               (sha256
                (base32
-                "1k1srdis23782hnd1ymgczs78x9gqhv77v0am7yb54gqcspp70hm"))
+                "032801kg24j04xmf09m0vxzlcz86sv21s24lv9l4cfv08k1c4byp"))
               (modules '((guix build utils)))
               (snippet
                `(begin
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v2 03/26] gnu: node: Patch shebangs in node_modules.
  2021-11-20  4:33           ` [bug#51838] [PATCH v2 01/26] gnu: node: Avoid duplicating build phases Philip McGrath
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 02/26] gnu: node: Update to 10.24.1 for bootstrapping Philip McGrath
@ 2021-11-20  4:33             ` Philip McGrath
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 04/26] gnu: node: Add an npmrc file to set nodedir Philip McGrath
                               ` (22 subsequent siblings)
  24 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-11-20  4:33 UTC (permalink / raw)
  To: 51838; +Cc: Liliana Marie Prikler

* gnu/packages/node.scm (node)[arguments]: Replace 'patch-npm-shebang
and 'patch-node-shebang with a new 'patch-nested-shebangs that also
handles node-gyp and other shebangs under "/lib/node_modules".
[inputs]: Add Python for node-gyp as "python-for-target".
(node-lts)[inputs]: Likewise.
(libnode)[arguments]: Adjust to delete 'patch-nested-shebangs rather
than 'patch-npm-shebang and 'patch-node-shebang.
---
 gnu/packages/node.scm | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 71b66774a6..a57a74fb81 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -237,21 +237,20 @@ (define-public node
                             python
                             (string-append python "3")))
                       "configure" flags))))
-         (add-after 'patch-shebangs 'patch-npm-shebang
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let* ((bindir (string-append (assoc-ref outputs "out")
-                                           "/bin"))
-                    (npm    (string-append bindir "/npm"))
-                    (target (readlink npm)))
-               (with-directory-excursion bindir
-                 (patch-shebang target (list bindir))))))
-         (add-after 'install 'patch-node-shebang
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let* ((bindir (string-append (assoc-ref outputs "out")
-                                           "/bin"))
-                    (npx    (readlink (string-append bindir "/npx"))))
-               (with-directory-excursion bindir
-                 (patch-shebang npx (list bindir)))))))))
+         (add-after 'patch-shebangs 'patch-nested-shebangs
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((prefix (assoc-ref outputs "out"))
+                    (path (map (lambda (dir)
+                                 (string-append dir "/bin"))
+                               (list prefix
+                                     (assoc-ref inputs "python-for-target")))))
+               (for-each
+                (lambda (file)
+                  (patch-shebang file path))
+                (find-files (string-append prefix "/lib/node_modules")
+                            (lambda (file stat)
+                              (executable-file? file))
+                            #:stat lstat))))))))
     (native-inputs
      `(;; Runtime dependencies for binaries used as a bootstrap.
        ("c-ares" ,c-ares)
@@ -274,6 +273,7 @@ (define-public node
     (inputs
      `(("bash" ,bash-minimal)
        ("coreutils" ,coreutils)
+       ("python-for-target" ,python-wrapper) ;; for node-gyp (supports python3)
        ("c-ares" ,c-ares)
        ("http-parser" ,http-parser)
        ("icu4c" ,icu4c)
@@ -799,6 +799,7 @@ (define-public node-lts
     (inputs
      `(("bash" ,bash-minimal)
        ("coreutils" ,coreutils)
+       ("python-for-target" ,python-wrapper) ;; for node-gyp (supports python3)
        ("c-ares" ,c-ares-for-node)
        ("icu4c" ,icu4c-67)
        ("libuv" ,libuv-for-node)
@@ -817,5 +818,4 @@ (define-public libnode
         `(cons* "--shared" "--without-npm" ,flags))
        ((#:phases phases '%standard-phases)
         `(modify-phases ,phases
-           (delete 'patch-npm-shebang)
-           (delete 'patch-node-shebang)))))))
+           (delete 'patch-nested-shebangs)))))))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v2 04/26] gnu: node: Add an npmrc file to set nodedir.
  2021-11-20  4:33           ` [bug#51838] [PATCH v2 01/26] gnu: node: Avoid duplicating build phases Philip McGrath
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 02/26] gnu: node: Update to 10.24.1 for bootstrapping Philip McGrath
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 03/26] gnu: node: Patch shebangs in node_modules Philip McGrath
@ 2021-11-20  4:33             ` Philip McGrath
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 05/26] guix: node-build-system: Add #:absent-dependencies argument Philip McGrath
                               ` (21 subsequent siblings)
  24 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-11-20  4:33 UTC (permalink / raw)
  To: 51838; +Cc: Liliana Marie Prikler

* gnu/packages/node.scm (node, node-lis)[arguments]: Add a phase
'install-npmrc to create a "built-in" npmrc file that configures
"nodedir" to point to the output store path.
(libnode)[arguments]: Delete the 'install-npmrc phase.
---
 gnu/packages/node.scm | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index a57a74fb81..0f67fe79c2 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -250,7 +250,21 @@ (define-public node
                 (find-files (string-append prefix "/lib/node_modules")
                             (lambda (file stat)
                               (executable-file? file))
-                            #:stat lstat))))))))
+                            #:stat lstat)))))
+         (add-after 'install 'install-npmrc
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out")))
+               (with-output-to-file
+                   ;; Use the config file "primarily for distribution
+                   ;; maintainers" rather than "{prefix}/etc/npmrc",
+                   ;; especially because node-build-system uses --prefix
+                   ;; to install things to their store paths:
+                   (string-append out "/lib/node_modules/npm/npmrc")
+                 (lambda ()
+                   ;; Tell npm (mostly node-gyp) where to find our
+                   ;; installed headers so it doesn't try to
+                   ;; download them from the internet:
+                   (format #t "nodedir=~a\n" out)))))))))
     (native-inputs
      `(;; Runtime dependencies for binaries used as a bootstrap.
        ("c-ares" ,c-ares)
@@ -818,4 +832,5 @@ (define-public libnode
         `(cons* "--shared" "--without-npm" ,flags))
        ((#:phases phases '%standard-phases)
         `(modify-phases ,phases
+           (delete 'install-npmrc)
            (delete 'patch-nested-shebangs)))))))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v2 05/26] guix: node-build-system: Add #:absent-dependencies argument.
  2021-11-20  4:33           ` [bug#51838] [PATCH v2 01/26] gnu: node: Avoid duplicating build phases Philip McGrath
                               ` (2 preceding siblings ...)
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 04/26] gnu: node: Add an npmrc file to set nodedir Philip McGrath
@ 2021-11-20  4:33             ` Philip McGrath
  2021-11-20  7:41               ` Liliana Marie Prikler
  2021-11-28 19:27               ` [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Timothy Sample
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 06/26] gnu: node-semver-bootstrap: Use #:absent-dependencies Philip McGrath
                               ` (20 subsequent siblings)
  24 siblings, 2 replies; 458+ messages in thread
From: Philip McGrath @ 2021-11-20  4:33 UTC (permalink / raw)
  To: 51838; +Cc: Liliana Marie Prikler

Many of Guix's Node.js packages are built without some of the
dependencies they specify in their "package-lock.json" files,
either because we don't have them packaged yet (e.g. test
utilities) or because we don't want them (e.g. to reduce the
closure size). Previously, Guix package definitions would work
around this situation by deleting the `'configure`
phase (i.e. the initial `npm install`).

This commit adds an optional #:absent-dependencies argument to
`node-build-system` to list Node.js packages that should be
removed from the "package.json" file.Retaining the `'configure`
phase avoids skipping checks for the dependencies that are
intended to be present and other actions performed by `npm
install`, such as automatically building native add-ons with
`node-gyp` when the "gypfile" key is present.

* guix/build-system/node.scm (lower, node-build): Add optional
argument #:absent-dependencies with default of ''(). Pass it on
to the build-side code.
* guix/build/node-build-system.scm (patch-dependencies): Respect
the #:absent-dependencies argument, removing specified npm
packages from the "dependencies" or "devDependencies" tables
in "package.json". Also, strictly follow the linearity rules
for `assoc-set!` and friends.
---
 guix/build-system/node.scm       |  3 ++
 guix/build/node-build-system.scm | 55 ++++++++++++++++++++++----------
 2 files changed, 41 insertions(+), 17 deletions(-)

diff --git a/guix/build-system/node.scm b/guix/build-system/node.scm
index 98f63f87ef..75ae34508f 100644
--- a/guix/build-system/node.scm
+++ b/guix/build-system/node.scm
@@ -44,6 +44,7 @@ (define (default-node)
 (define* (lower name
                 #:key source inputs native-inputs outputs system target
                 (node (default-node))
+                (absent-dependencies ''())
                 #:allow-other-keys
                 #:rest arguments)
   "Return a bag for NAME."
@@ -73,6 +74,7 @@ (define* (node-build store name inputs
                      (tests? #t)
                      (phases '(@ (guix build node-build-system)
                                  %standard-phases))
+                     (absent-dependencies ''())
                      (outputs '("out"))
                      (search-paths '())
                      (system (%current-system))
@@ -94,6 +96,7 @@ (define builder
                    #:test-target ,test-target
                    #:tests? ,tests?
                    #:phases ,phases
+                   #:absent-dependencies ,absent-dependencies
                    #:outputs %outputs
                    #:search-paths ',(map search-path-specification->sexp
                                          search-paths)
diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
index 70a367618e..32d6807e3e 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -69,30 +69,51 @@ (define (list-modules directory)
               input-paths)
     index))
 
-(define* (patch-dependencies #:key inputs #:allow-other-keys)
+(define* (patch-dependencies #:key inputs absent-dependencies
+                             #:allow-other-keys)
 
   (define index (index-modules (map cdr inputs)))
 
-  (define (resolve-dependencies package-meta meta-key)
-    (fold (lambda (key+value acc)
-            (match key+value
-              ('@ acc)
-              ((key . value) (acons key (hash-ref index key value) acc))))
+  (define (resolve-dependencies meta-alist meta-key)
+    (match (assoc-ref meta-alist meta-key)
+      (#f
+       '())
+      (('@ . orig-deps)
+       (fold (match-lambda*
+               (('@ acc)
+                acc)
+                (((key . value) acc)
+                 (if (member key absent-dependencies)
+                     acc
+                     (acons key (hash-ref index key value) acc))))
           '()
-          (or (assoc-ref package-meta meta-key) '())))
+          orig-deps))))
 
   (with-atomic-file-replacement "package.json"
     (lambda (in out)
-      (let ((package-meta (read-json in)))
-        (assoc-set! package-meta "dependencies"
-                    (append
-                     '(@)
-                     (resolve-dependencies package-meta "dependencies")
-                     (resolve-dependencies package-meta "peerDependencies")))
-        (assoc-set! package-meta "devDependencies"
-                    (append
-                     '(@)
-                     (resolve-dependencies package-meta "devDependencies")))
+      ;; It is unsafe to rely on 'assoc-set!' to update an
+      ;; existing assosciation list variable:
+      ;; see 'info "(guile)Adding or Setting Alist Entries"'.
+      (let* ((package-meta (read-json in))
+             (alist (match package-meta
+                      ((@ . alist) alist)))
+             ;; Other relevant keys may include peerDependenciesMeta
+             ;; and optionalDependencies, but it seems to work out fine
+             ;; just to leave those alone.
+             (alist
+              (assoc-set!
+               alist "dependencies"
+               (append
+                '(@)
+                (resolve-dependencies alist "dependencies")
+                (resolve-dependencies alist "peerDependencies"))))
+             (alist
+              (assoc-set!
+               alist "devDependencies"
+               (append
+                '(@)
+                (resolve-dependencies alist "devDependencies"))))
+             (package-meta (cons '@ alist)))
         (write-json package-meta out))))
   #t)
 
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v2 06/26] gnu: node-semver-bootstrap: Use #:absent-dependencies.
  2021-11-20  4:33           ` [bug#51838] [PATCH v2 01/26] gnu: node: Avoid duplicating build phases Philip McGrath
                               ` (3 preceding siblings ...)
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 05/26] guix: node-build-system: Add #:absent-dependencies argument Philip McGrath
@ 2021-11-20  4:33             ` Philip McGrath
  2021-11-20  7:43               ` Liliana Marie Prikler
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 07/26] gnu: node-ms-bootstrap: " Philip McGrath
                               ` (19 subsequent siblings)
  24 siblings, 1 reply; 458+ messages in thread
From: Philip McGrath @ 2021-11-20  4:33 UTC (permalink / raw)
  To: 51838; +Cc: Liliana Marie Prikler

gnu/packages/node.scm (node-semver-bootstrap)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node.scm | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 0f67fe79c2..6c958eebec 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -330,9 +330,8 @@ (define-public node-semver-bootstrap
     (arguments
      `(#:node ,node-bootstrap
        #:tests? #f
-       #:phases
-       (modify-phases %standard-phases
-         (delete 'configure))))
+       #:absent-dependencies
+       '("tap")))
     (home-page "https://github.com/npm/node-semver")
     (properties '((hidden? . #t)))
     (synopsis "Parses semantic versions strings")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v2 07/26] gnu: node-ms-bootstrap: Use #:absent-dependencies.
  2021-11-20  4:33           ` [bug#51838] [PATCH v2 01/26] gnu: node: Avoid duplicating build phases Philip McGrath
                               ` (4 preceding siblings ...)
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 06/26] gnu: node-semver-bootstrap: Use #:absent-dependencies Philip McGrath
@ 2021-11-20  4:33             ` Philip McGrath
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 08/26] gnu: node-binary-search-bootstrap: " Philip McGrath
                               ` (18 subsequent siblings)
  24 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-11-20  4:33 UTC (permalink / raw)
  To: 51838; +Cc: Liliana Marie Prikler

gnu/packages/node.scm (node-ms-bootstrap)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node.scm | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 6c958eebec..ca4bf1ad23 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -358,9 +358,12 @@ (define-public node-ms-bootstrap
     (arguments
      `(#:node ,node-bootstrap
        #:tests? #f
-       #:phases
-       (modify-phases %standard-phases
-         (delete 'configure))))
+       #:absent-dependencies
+       `("eslint"
+         "expect.js"
+         "husky"
+         "lint-staged"
+         "mocha")))
     (home-page "https://github.com/zeit/ms#readme")
     (properties '((hidden? . #t)))
     (synopsis "Tiny millisecond conversion utility")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v2 08/26] gnu: node-binary-search-bootstrap: Use #:absent-dependencies.
  2021-11-20  4:33           ` [bug#51838] [PATCH v2 01/26] gnu: node: Avoid duplicating build phases Philip McGrath
                               ` (5 preceding siblings ...)
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 07/26] gnu: node-ms-bootstrap: " Philip McGrath
@ 2021-11-20  4:33             ` Philip McGrath
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 09/26] gnu: node-debug-bootstrap: " Philip McGrath
                               ` (17 subsequent siblings)
  24 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-11-20  4:33 UTC (permalink / raw)
  To: 51838; +Cc: Liliana Marie Prikler

gnu/packages/node.scm (node-binary-search-bootstrap)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node.scm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index ca4bf1ad23..2cdae34ae1 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -389,9 +389,9 @@ (define-public node-binary-search-bootstrap
     (arguments
      `(#:node ,node-bootstrap
        #:tests? #f
-       #:phases
-       (modify-phases %standard-phases
-         (delete 'configure))))
+       #:absent-dependencies
+       `("chai"
+         "mocha")))
     (home-page "https://github.com/darkskyapp/binary-search#readme")
     (properties '((hidden? . #t)))
     (synopsis "Tiny binary search function with comparators")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v2 09/26] gnu: node-debug-bootstrap: Use #:absent-dependencies.
  2021-11-20  4:33           ` [bug#51838] [PATCH v2 01/26] gnu: node: Avoid duplicating build phases Philip McGrath
                               ` (6 preceding siblings ...)
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 08/26] gnu: node-binary-search-bootstrap: " Philip McGrath
@ 2021-11-20  4:33             ` Philip McGrath
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 10/26] gnu: node-llparse-builder-bootstrap: " Philip McGrath
                               ` (16 subsequent siblings)
  24 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-11-20  4:33 UTC (permalink / raw)
  To: 51838; +Cc: Liliana Marie Prikler

gnu/packages/node.scm (node-debug-bootstrap)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node.scm | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 2cdae34ae1..98a51276e7 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -416,9 +416,18 @@ (define-public node-debug-bootstrap
     (arguments
      `(#:node ,node-bootstrap
        #:tests? #f
-       #:phases
-       (modify-phases %standard-phases
-         (delete 'configure))))
+       #:absent-dependencies
+       `("brfs"
+         "browserify"
+         "coveralls"
+         "istanbul"
+         "karma"
+         "karma-browserify"
+         "karma-chrome-launcher"
+         "karma-mocha"
+         "mocha"
+         "mocha-lcov-reporter"
+         "xo")))
     (inputs `(("node-ms" ,node-ms-bootstrap)))
     (home-page "https://github.com/visionmedia/debug#readme")
     (properties '((hidden? . #t)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v2 10/26] gnu: node-llparse-builder-bootstrap: Use #:absent-dependencies.
  2021-11-20  4:33           ` [bug#51838] [PATCH v2 01/26] gnu: node: Avoid duplicating build phases Philip McGrath
                               ` (7 preceding siblings ...)
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 09/26] gnu: node-debug-bootstrap: " Philip McGrath
@ 2021-11-20  4:33             ` Philip McGrath
  2021-11-20  7:44               ` Liliana Marie Prikler
  2021-11-23 11:04               ` Jelle Licht
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 11/26] gnu: node-llparse-frontend-bootstrap: Use #:absent-dependencies Philip McGrath
                               ` (15 subsequent siblings)
  24 siblings, 2 replies; 458+ messages in thread
From: Philip McGrath @ 2021-11-20  4:33 UTC (permalink / raw)
  To: 51838; +Cc: Liliana Marie Prikler

gnu/packages/node.scm (node-llparse-builder-bootstrap)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
Add a new phase `#:delete-package-lock` to remove the
problematic "package-lock.json".
---
 gnu/packages/node.scm | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 98a51276e7..9d4903a8ca 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -479,9 +479,21 @@ (define-public node-llparse-builder-bootstrap
     (arguments
      `(#:node ,node-bootstrap
        #:tests? #f
+       #:absent-dependencies
+       `("@types/mocha"
+         "@types/node"
+         "mocha"
+         "ts-node"
+         "tslint"
+         "typescript")
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure)
+         (add-before 'configure 'remove-package-lock
+           ;; Having package-lock.json seems to cause npm
+           ;; to look for things on the internet in the configure phase,
+           ;; even if we have them properly installed.
+           (lambda args
+             (delete-file-recursively "package-lock.json")))
          (replace 'build
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((esbuild (string-append (assoc-ref inputs "esbuild")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v2 11/26] gnu: node-llparse-frontend-bootstrap: Use #:absent-dependencies.
  2021-11-20  4:33           ` [bug#51838] [PATCH v2 01/26] gnu: node: Avoid duplicating build phases Philip McGrath
                               ` (8 preceding siblings ...)
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 10/26] gnu: node-llparse-builder-bootstrap: " Philip McGrath
@ 2021-11-20  4:33             ` Philip McGrath
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 12/26] gnu: node-llparse-bootstrap: " Philip McGrath
                               ` (14 subsequent siblings)
  24 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-11-20  4:33 UTC (permalink / raw)
  To: 51838; +Cc: Liliana Marie Prikler

gnu/packages/node.scm (node-llparse-frontend-bootstrap)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node.scm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 9d4903a8ca..298b9376a8 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -547,9 +547,16 @@ (define-public node-llparse-frontend-bootstrap
     (arguments
      `(#:node ,node-bootstrap
        #:tests? #f
+       #:absent-dependencies
+       `("@types/debug"
+         "@types/mocha"
+         "@types/node"
+         "mocha"
+         "ts-node"
+         "tslint"
+         "typescript")
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure)
          (replace 'build
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((esbuild (string-append (assoc-ref inputs "esbuild")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v2 12/26] gnu: node-llparse-bootstrap: Use #:absent-dependencies.
  2021-11-20  4:33           ` [bug#51838] [PATCH v2 01/26] gnu: node: Avoid duplicating build phases Philip McGrath
                               ` (9 preceding siblings ...)
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 11/26] gnu: node-llparse-frontend-bootstrap: Use #:absent-dependencies Philip McGrath
@ 2021-11-20  4:33             ` Philip McGrath
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 13/26] gnu: node-semver: " Philip McGrath
                               ` (13 subsequent siblings)
  24 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-11-20  4:33 UTC (permalink / raw)
  To: 51838; +Cc: Liliana Marie Prikler

gnu/packages/node.scm (node-llparse-bootstrap)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
Add a new phase `#:delete-package-lock` to remove the
problematic "package-lock.json".
---
 gnu/packages/node.scm | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 298b9376a8..6d48816c77 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -609,9 +609,24 @@ (define-public node-llparse-bootstrap
     (arguments
      `(#:node ,node-bootstrap
        #:tests? #f
+       #:absent-dependencies
+       `("@types/debug"
+         "@types/mocha"
+         "@types/node"
+         "esm"
+         "llparse-test-fixture"
+         "mocha"
+         "ts-node"
+         "tslint"
+         "typescript")
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure)
+         (add-before 'configure 'remove-package-lock
+           ;; Having package-lock.json seems to cause npm
+           ;; to look for things on the internet in the configure phase,
+           ;; even if we have them properly installed.
+           (lambda args
+             (delete-file-recursively "package-lock.json")))
          (replace 'build
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((esbuild (string-append (assoc-ref inputs "esbuild")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v2 13/26] gnu: node-semver: Use #:absent-dependencies.
  2021-11-20  4:33           ` [bug#51838] [PATCH v2 01/26] gnu: node: Avoid duplicating build phases Philip McGrath
                               ` (10 preceding siblings ...)
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 12/26] gnu: node-llparse-bootstrap: " Philip McGrath
@ 2021-11-20  4:33             ` Philip McGrath
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 14/26] gnu: node-wrappy: " Philip McGrath
                               ` (12 subsequent siblings)
  24 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-11-20  4:33 UTC (permalink / raw)
  To: 51838; +Cc: Liliana Marie Prikler

gnu/packages/node-xyz.scm (node-semver)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node-xyz.scm | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 98c611f227..93a033d33e 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -289,11 +289,10 @@ (define-public node-semver
                 "06biknqb05r9xsmcflm3ygh50pjvdk84x6r79w43kmck4fn3qn5p"))))
     (build-system node-build-system)
     (arguments
-     '(#:tests? #f ; FIXME: Tests depend on node-tap
-       #:phases
-       (modify-phases %standard-phases
-         ;; The only dependency to check for is tap, which we don't have.
-         (delete 'configure))))
+     '(#:absent-dependencies
+       '("tap")
+       ;; FIXME: Tests depend on node-tap
+       #:tests? #f))
     (home-page "https://github.com/npm/node-semver")
     (synopsis "Parses semantic versions strings")
     (description
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v2 14/26] gnu: node-wrappy: Use #:absent-dependencies.
  2021-11-20  4:33           ` [bug#51838] [PATCH v2 01/26] gnu: node: Avoid duplicating build phases Philip McGrath
                               ` (11 preceding siblings ...)
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 13/26] gnu: node-semver: " Philip McGrath
@ 2021-11-20  4:33             ` Philip McGrath
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 15/26] gnu: node-once: " Philip McGrath
                               ` (11 subsequent siblings)
  24 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-11-20  4:33 UTC (permalink / raw)
  To: 51838; +Cc: Liliana Marie Prikler

gnu/packages/node-xyz.scm (node-wrappy)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node-xyz.scm | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 93a033d33e..77577cb315 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -316,10 +316,8 @@ (define-public node-wrappy
     (build-system node-build-system)
     (arguments
      '(#:tests? #f ; FIXME: Tests depend on node-tap
-       #:phases
-       (modify-phases %standard-phases
-         ;; The only dependency to check for is tap, which we don't have.
-         (delete 'configure))))
+       #:absent-dependencies
+       '("tap")))
     (home-page "https://github.com/npm/wrappy")
     (synopsis "Callback wrapping utility")
     (description "@code{wrappy} is a utility for Node.js to wrap callbacks.")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v2 15/26] gnu: node-once: Use #:absent-dependencies.
  2021-11-20  4:33           ` [bug#51838] [PATCH v2 01/26] gnu: node: Avoid duplicating build phases Philip McGrath
                               ` (12 preceding siblings ...)
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 14/26] gnu: node-wrappy: " Philip McGrath
@ 2021-11-20  4:33             ` Philip McGrath
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 16/26] gnu: node-irc-colors: " Philip McGrath
                               ` (10 subsequent siblings)
  24 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-11-20  4:33 UTC (permalink / raw)
  To: 51838; +Cc: Liliana Marie Prikler

gnu/packages/node-xyz.scm (node-once)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node-xyz.scm | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 77577cb315..eb071320cd 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -338,13 +338,10 @@ (define-public node-once
                 "1z8dcbf28dqdcp4wb0c53wrs90a07nkrax2c9kk26dsk1dhrnxav"))))
     (build-system node-build-system)
     (arguments
-     '(#:tests? #f                      ; FIXME: tests depend on node-tap
-       #:phases
-       (modify-phases %standard-phases
-         ;; The default configure phase fails due to tap being missing, as we do
-         ;; not have tap packaged yet.  It is used only for tests.  This package
-         ;; still works as a dependency of node-glob and node-inflight.
-         (delete 'configure))))
+     '(#:absent-dependencies
+       '("tap")
+       ;; FIXME: Tests depend on node-tap
+       #:tests? #f))
     (inputs
      `(("node-wrappy" ,node-wrappy)))
     (home-page "https://github.com/isaacs/once")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v2 16/26] gnu: node-irc-colors: Use #:absent-dependencies.
  2021-11-20  4:33           ` [bug#51838] [PATCH v2 01/26] gnu: node: Avoid duplicating build phases Philip McGrath
                               ` (13 preceding siblings ...)
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 15/26] gnu: node-once: " Philip McGrath
@ 2021-11-20  4:33             ` Philip McGrath
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 17/26] gnu: node-irc: " Philip McGrath
                               ` (9 subsequent siblings)
  24 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-11-20  4:33 UTC (permalink / raw)
  To: 51838; +Cc: Liliana Marie Prikler

gnu/packages/node-xyz.scm (node-irc-colors)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node-xyz.scm | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index eb071320cd..9646c14243 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -367,12 +367,10 @@ (define-public node-irc-colors
                 "0q3y34rbnlc55jcakmdxkicwazyvyph9r6gaf6hi8k7wj2nfwfli"))))
     (build-system node-build-system)
     (arguments
-     '(#:tests? #f                      ; FIXME: tests depend on node-istanbul
-       #:phases
-       (modify-phases %standard-phases
-         ;; The default configure phase fails due to various packages
-         ;; being missing, as we don't have them packaged yet.
-         (delete 'configure))))
+     '(#:absent-dependencies
+       `("istanbul"
+         "vows")
+       #:tests? #f))
     (home-page "https://github.com/fent/irc-colors.js")
     (synopsis "Node.js module providing color and formatting for IRC")
     (description "@code{node-irc-colors} is a Node.js module that
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v2 17/26] gnu: node-irc: Use #:absent-dependencies.
  2021-11-20  4:33           ` [bug#51838] [PATCH v2 01/26] gnu: node: Avoid duplicating build phases Philip McGrath
                               ` (14 preceding siblings ...)
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 16/26] gnu: node-irc-colors: " Philip McGrath
@ 2021-11-20  4:33             ` Philip McGrath
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 18/26] guix: node-build-system: Add optional #:libuv? argument Philip McGrath
                               ` (8 subsequent siblings)
  24 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-11-20  4:33 UTC (permalink / raw)
  To: 51838; +Cc: Liliana Marie Prikler

gnu/packages/node-xyz.scm (node-irc)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node-xyz.scm | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 9646c14243..998d0a9a90 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -394,12 +394,12 @@ (define-public node-irc
                 "1ln4qfx20jbwg4cp8lp0vf27m5281z2sz16d15xd6150n26cbi4x"))))
     (build-system node-build-system)
     (arguments
-     '(#:tests? #f                      ; FIXME: tests depend on node-faucet
-       #:phases
-       (modify-phases %standard-phases
-         ;; The default configure phase fails due to various packages
-         ;; being missing, as we don't have them packaged yet.
-         (delete 'configure))))
+     '(#:absent-dependencies
+       `("ansi-color"
+         "faucet"
+         "jscs"
+         "tape")
+       #:tests? #f))
     (inputs
      `(("node-irc-colors" ,node-irc-colors)))
     (home-page "https://github.com/martynsmith/node-irc")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v2 18/26] guix: node-build-system: Add optional #:libuv? argument.
  2021-11-20  4:33           ` [bug#51838] [PATCH v2 01/26] gnu: node: Avoid duplicating build phases Philip McGrath
                               ` (15 preceding siblings ...)
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 17/26] gnu: node-irc: " Philip McGrath
@ 2021-11-20  4:33             ` Philip McGrath
  2021-11-20  7:46               ` Liliana Marie Prikler
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 19/26] gnu: Add node-inherits Philip McGrath
                               ` (7 subsequent siblings)
  24 siblings, 1 reply; 458+ messages in thread
From: Philip McGrath @ 2021-11-20  4:33 UTC (permalink / raw)
  To: 51838; +Cc: Liliana Marie Prikler

* guix/build-system/node.scm (lower): Add an optional #:libuv?
argument to tell the build system to add the version of libuv
used as an input to the #:node package as an additional implicit
input, so that packages needing libuv always get the correct version.
---
 guix/build-system/node.scm | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/guix/build-system/node.scm b/guix/build-system/node.scm
index 75ae34508f..f83a7f64ce 100644
--- a/guix/build-system/node.scm
+++ b/guix/build-system/node.scm
@@ -1,6 +1,8 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2016 Jelle Licht <jlicht@fsfe.org>
 ;;; Copyright © 2019 Timothy Sample <samplet@ngyro.com>
+;;; Copyright © 2021 Pierre Langlois <pierre.langlois@gmx.com>
+;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -44,12 +46,13 @@ (define (default-node)
 (define* (lower name
                 #:key source inputs native-inputs outputs system target
                 (node (default-node))
+                (libuv? #f)
                 (absent-dependencies ''())
                 #:allow-other-keys
                 #:rest arguments)
   "Return a bag for NAME."
   (define private-keywords
-    '(#:source #:target #:node #:inputs #:native-inputs))
+    '(#:source #:target #:node #:libuv? #:inputs #:native-inputs))
 
   (and (not target)                    ;XXX: no cross-compilation
        (bag
@@ -59,10 +62,18 @@ (define private-keywords
                               `(("source" ,source))
                               '())
                         ,@inputs
-
                         ;; Keep the standard inputs of 'gnu-build-system'.
                         ,@(standard-packages)))
          (build-inputs `(("node" ,node)
+                         ;; Many packages with native addons need
+                         ;; libuv headers. The libuv version must
+                         ;; be exactly the same as for the node
+                         ;; package we are adding implicitly,
+                         ;; so we take care of adding libuv, too.
+                         ,@(if libuv?
+                               `(("libuv" ,@(assoc-ref (package-inputs node)
+                                                       "libuv")))
+                               '())
                          ,@native-inputs))
          (outputs outputs)
          (build node-build)
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v2 19/26] gnu: Add node-inherits.
  2021-11-20  4:33           ` [bug#51838] [PATCH v2 01/26] gnu: node: Avoid duplicating build phases Philip McGrath
                               ` (16 preceding siblings ...)
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 18/26] guix: node-build-system: Add optional #:libuv? argument Philip McGrath
@ 2021-11-20  4:33             ` Philip McGrath
  2021-11-20  4:34             ` [bug#51838] [PATCH v2 20/26] gnu: Add node-safe-buffer Philip McGrath
                               ` (6 subsequent siblings)
  24 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-11-20  4:33 UTC (permalink / raw)
  To: 51838; +Cc: Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-inherits): New variable.
---
 gnu/packages/node-xyz.scm | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 998d0a9a90..9d8bf27852 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2020 Giacomo Leidi <goodoldpaul@autistici.org>
 ;;; Copyright © 2021 Noisytoot <noisytoot@disroot.org>
 ;;; Copyright © 2021 Charles <charles.b.jackson@protonmail.com>
+;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -352,6 +353,35 @@ (define-public node-once
 if desired.")
     (license license:isc)))
 
+(define-public node-inherits
+  (package
+    (name "node-inherits")
+    (version "2.0.4")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/isaacs/inherits")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0cpsr5yqwkxpbbbbl0rwk4mcby6zbx841k2zb4c3gb1579i5wq9p"))))
+    (build-system node-build-system)
+    (arguments
+     '(#:absent-dependencies
+       '("tap")
+       ;; FIXME: Tests depend on node-tap
+       #:tests? #f))
+    (home-page
+     "https://github.com/isaacs/inherits")
+    (synopsis
+     "Browser-friendly inheritance Node.js")
+    (description
+     "Browser-friendly inheritance fully compatible with standard Node.js
+@code{inherits()}.")
+    (license license:isc)))
+
 (define-public node-irc-colors
   (package
     (name "node-irc-colors")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v2 20/26] gnu: Add node-safe-buffer.
  2021-11-20  4:33           ` [bug#51838] [PATCH v2 01/26] gnu: node: Avoid duplicating build phases Philip McGrath
                               ` (17 preceding siblings ...)
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 19/26] gnu: Add node-inherits Philip McGrath
@ 2021-11-20  4:34             ` Philip McGrath
  2021-11-20  4:34             ` [bug#51838] [PATCH v2 21/26] gnu: Add node-string-decoder Philip McGrath
                               ` (5 subsequent siblings)
  24 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-11-20  4:34 UTC (permalink / raw)
  To: 51838; +Cc: Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-safe-buffer): New variable.
---
 gnu/packages/node-xyz.scm | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 9d8bf27852..6dff0ddba5 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -382,6 +382,34 @@ (define-public node-inherits
 @code{inherits()}.")
     (license license:isc)))
 
+(define-public node-safe-buffer
+  (package
+    (name "node-safe-buffer")
+    (version "5.2.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/feross/safe-buffer")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0r26m0nl41h90ihnl2xf0cqs6z9z7jb87dl5j8yqb7887r9jlbpi"))))
+    (build-system node-build-system)
+    (arguments
+     '(#:absent-dependencies
+       '("tape"
+         "standard")
+       #:tests? #f))
+    (home-page
+     "https://github.com/feross/safe-buffer")
+    (synopsis "Safer Node.js Buffer API")
+    (description "A safe drop-in replacement the Node.js @code{Buffer} API
+that works in all versions of Node.js, using the built-in implementation when
+available.")
+    (license license:expat)))
+
 (define-public node-irc-colors
   (package
     (name "node-irc-colors")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v2 21/26] gnu: Add node-string-decoder.
  2021-11-20  4:33           ` [bug#51838] [PATCH v2 01/26] gnu: node: Avoid duplicating build phases Philip McGrath
                               ` (18 preceding siblings ...)
  2021-11-20  4:34             ` [bug#51838] [PATCH v2 20/26] gnu: Add node-safe-buffer Philip McGrath
@ 2021-11-20  4:34             ` Philip McGrath
  2021-11-20  4:34             ` [bug#51838] [PATCH v2 22/26] gnu: Add node-readable-stream Philip McGrath
                               ` (4 subsequent siblings)
  24 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-11-20  4:34 UTC (permalink / raw)
  To: 51838; +Cc: Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-string-decoder): New variable.
---
 gnu/packages/node-xyz.scm | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 6dff0ddba5..c6cce64f7d 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -410,6 +410,40 @@ (define-public node-safe-buffer
 available.")
     (license license:expat)))
 
+(define-public node-string-decoder
+  (package
+    (name "node-string-decoder")
+    (version "1.3.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nodejs/string_decoder")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0xxvyya9fl9rlkqwmxzqzbz4rdr3jgw4vf37hff7cgscxkhg266k"))))
+    (build-system node-build-system)
+    (arguments
+     '(#:absent-dependencies
+       '("tap"
+         "core-util-is"
+         "babel-polyfill")
+       ;; FIXME: Tests depend on node-tap
+       #:tests? #f))
+    (inputs
+     `(("node-safe-buffer" ,node-safe-buffer)
+       ("node-inherits" ,node-inherits)))
+    (home-page
+     "https://github.com/nodejs/string_decoder")
+    (synopsis
+     "Node.js core @code{string_decoder} for userland")
+    (description
+     "This package is a mirror of the @code{string_decoder} implementation in
+Node-core.")
+    (license license:expat)))
+
 (define-public node-irc-colors
   (package
     (name "node-irc-colors")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v2 22/26] gnu: Add node-readable-stream.
  2021-11-20  4:33           ` [bug#51838] [PATCH v2 01/26] gnu: node: Avoid duplicating build phases Philip McGrath
                               ` (19 preceding siblings ...)
  2021-11-20  4:34             ` [bug#51838] [PATCH v2 21/26] gnu: Add node-string-decoder Philip McGrath
@ 2021-11-20  4:34             ` Philip McGrath
  2021-11-20  4:34             ` [bug#51838] [PATCH v2 23/26] gnu: Add node-nan Philip McGrath
                               ` (3 subsequent siblings)
  24 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-11-20  4:34 UTC (permalink / raw)
  To: 51838; +Cc: Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-readable-stream): New variable.
---
 gnu/packages/node-xyz.scm | 54 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index c6cce64f7d..3e06413908 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -444,6 +444,60 @@ (define-public node-string-decoder
 Node-core.")
     (license license:expat)))
 
+(define-public node-readable-stream
+  (package
+    (name "node-readable-stream")
+    (version "3.6.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nodejs/readable-stream")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0ybl4cdgsm9c5jq3xq8s01201jk8w0yakh63hlclsfbcdfqhd9ri"))))
+    (build-system node-build-system)
+    (arguments
+     `(#:absent-dependencies
+       `("@babel/cli"
+         "@babel/core"
+         "@babel/polyfill"
+         "@babel/preset-env"
+         "airtap"
+         "assert"
+         "bl"
+         "deep-strict-equal"
+         "events.once"
+         "glob"
+         "gunzip-maybe"
+         "hyperquest"
+         "lolex"
+         "nyc"
+         "pump"
+         "rimraf"
+         "tap"
+         "tape"
+         "tar-fs"
+         "util-promisify")
+       #:tests? #f))
+    (inputs
+     `(("node-util-deprecate" ,node-util-deprecate)
+       ("node-string-decoder" ,node-string-decoder)
+       ("node-inherits" ,node-inherits)))
+    (home-page
+     "https://github.com/nodejs/readable-stream")
+    (synopsis
+     "Node.js core streams for userland")
+    (description
+     "This package is a mirror of the streams implementations in Node.js.
+
+If you want to guarantee a stable streams base, regardless of what version of
+Node you (or the users of your libraries) are using, use
+@code{readable-stream} only and avoid the @code{stream} module in Node-core.")
+    (license license:expat)))
+
 (define-public node-irc-colors
   (package
     (name "node-irc-colors")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v2 23/26] gnu: Add node-nan.
  2021-11-20  4:33           ` [bug#51838] [PATCH v2 01/26] gnu: node: Avoid duplicating build phases Philip McGrath
                               ` (20 preceding siblings ...)
  2021-11-20  4:34             ` [bug#51838] [PATCH v2 22/26] gnu: Add node-readable-stream Philip McGrath
@ 2021-11-20  4:34             ` Philip McGrath
  2021-11-20  4:34             ` [bug#51838] [PATCH v2 24/26] gnu: Add node-openzwave-shared Philip McGrath
                               ` (2 subsequent siblings)
  24 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-11-20  4:34 UTC (permalink / raw)
  To: 51838; +Cc: Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-nan): New variable.
---
 gnu/packages/node-xyz.scm | 44 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 3e06413908..ed169c0778 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -553,3 +553,47 @@ (define-public node-irc
     (description "@code{node-irc} is an IRC client library for Node.js.
 It has functions for joining, parting, talking, and many other IRC commands.")
     (license license:gpl3+)))
+
+(define-public node-nan
+  (package
+    (name "node-nan")
+    (version "2.15.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nodejs/nan")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "18xslh9va5ld872scrp5y4251ax9s3c6qh0lnl1200lpzbsxy7yd"))))
+    (build-system node-build-system)
+    (arguments
+     `(#:tests?
+       ;; tests need tap and other dependencies
+       #f
+       #:absent-dependencies
+       '("bindings"
+         "commander"
+         "glob"
+         "request"
+         "node-gyp" ;; would be needed for tests
+         "tap"
+         "xtend")))
+    (inputs
+     `(("readable-stream" ,node-readable-stream)))
+    (home-page "https://github.com/nodejs/nan")
+    (synopsis "Native Abstractions for Node.js")
+    (description "A header file filled with macro and utility goodness for
+making add-on development for Node.js easier across versions 0.8, 0.10, 0.12,
+1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 and 16.
+
+Thanks to the crazy changes in V8 (and some in Node core), keeping native
+addons compiling happily across versions, particularly 0.10 to 0.12 to 4.0, is
+a minor nightmare.  The goal of this project is to store all logic necessary
+to develop native Node.js addons without having to inspect
+@code{NODE_MODULE_VERSION} and get yourself into a macro-tangle.
+
+This project also contains some helper utilities that make addon development a
+bit more pleasant.")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v2 24/26] gnu: Add node-openzwave-shared.
  2021-11-20  4:33           ` [bug#51838] [PATCH v2 01/26] gnu: node: Avoid duplicating build phases Philip McGrath
                               ` (21 preceding siblings ...)
  2021-11-20  4:34             ` [bug#51838] [PATCH v2 23/26] gnu: Add node-nan Philip McGrath
@ 2021-11-20  4:34             ` Philip McGrath
  2021-11-20  4:34             ` [bug#51838] [PATCH v2 25/26] gnu: Add node-addon-api Philip McGrath
  2021-11-20  4:34             ` [bug#51838] [PATCH v2 26/26] gnu: Add node-sqlite3 Philip McGrath
  24 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-11-20  4:34 UTC (permalink / raw)
  To: 51838; +Cc: Liliana Marie Prikler

* gnu/packages/zwave.scm (node-openzwave-shared): New variable.
---
 gnu/packages/zwave.scm | 67 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)

diff --git a/gnu/packages/zwave.scm b/gnu/packages/zwave.scm
index 2019ec32df..8757ddecf2 100644
--- a/gnu/packages/zwave.scm
+++ b/gnu/packages/zwave.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -21,11 +22,14 @@ (define-module (gnu packages zwave)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix git-download)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system node)
   #:use-module (gnu packages)
   #:use-module (gnu packages base)
+  #:use-module (gnu packages node-xyz)
   #:use-module (gnu packages libusb)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages perl)
+  #:use-module (gnu packages python)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages xml))
 
@@ -88,3 +92,66 @@ (define-public open-zwave
 and respond to devices on a Z-Wave network, without requiring in-depth
 knowledge of the Z-Wave protocol.")
     (license license:lgpl3+)))
+
+(define-public node-openzwave-shared
+  (package
+    (name "node-openzwave-shared")
+    (version "1.7.2")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/OpenZWave/node-openzwave-shared")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "1bqqy12dzqj05j9wsh50dmn84dddmhz0gjzvd3y20z4hpy1v8rsc"))))
+    (inputs
+     `(("open-zwave" ,open-zwave)
+       ("node-nan" ,node-nan)))
+    (native-inputs
+     `(("which" ,which)
+       ("python" ,python)
+       ("pkg-config" ,pkg-config)))
+    (build-system node-build-system)
+    (arguments
+     `(#:libuv?
+       #t
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'build
+           (lambda* (#:key inputs #:allow-other-keys)
+             (define node-dir
+               (assoc-ref inputs "node"))
+             (invoke (string-append node-dir "/bin/npx")
+                     "--call"
+                     (string-append
+                      node-dir
+                      "/lib/node_modules/npm/bin/node-gyp-bin/node-gyp"
+                      " "
+                      "rebuild")))))))
+    (home-page "https://github.com/OpenZWave/node-openzwave-shared")
+    (synopsis "Node.js bindings for OpenZWave")
+    (description
+     "With the @code{node-openzwave-shared} package, you can easily control
+and manage your Z-Wave devices (lights, dimmers, blinds, you name it) from
+within Node.js applications.  This library also supports secure
+devices (e.g. door locks) that require encryption.  All widely used Node.js
+versions are supported with the help of @code{node-nan}.
+
+This library is currently able to:
+@itemize @bullet
+@item
+scan a Z-Wave network and report on connected devices;
+@item
+write values to Z-Wave nodes;
+@item
+monitor the network for changes;
+@item
+heal nodes and/or the network; and
+@item
+perform management tasks: add or remove nodes, replace failed nodes,
+manage their group associations, etc.
+@end itemize")
+    (license license:isc)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v2 25/26] gnu: Add node-addon-api.
  2021-11-20  4:33           ` [bug#51838] [PATCH v2 01/26] gnu: node: Avoid duplicating build phases Philip McGrath
                               ` (22 preceding siblings ...)
  2021-11-20  4:34             ` [bug#51838] [PATCH v2 24/26] gnu: Add node-openzwave-shared Philip McGrath
@ 2021-11-20  4:34             ` Philip McGrath
  2021-11-20  4:34             ` [bug#51838] [PATCH v2 26/26] gnu: Add node-sqlite3 Philip McGrath
  24 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-11-20  4:34 UTC (permalink / raw)
  To: 51838; +Cc: Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-addon-api): New variable.
---
 gnu/packages/node-xyz.scm | 63 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index ed169c0778..60dbfc163c 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -22,6 +22,9 @@
 
 (define-module (gnu packages node-xyz)
   #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (gnu packages sqlite)
+  #:use-module (gnu packages python)
+  #:use-module (guix gexp)
   #:use-module (guix packages)
   #:use-module (guix git-download)
   #:use-module (guix build-system node))
@@ -597,3 +600,63 @@ (define-public node-nan
 This project also contains some helper utilities that make addon development a
 bit more pleasant.")
     (license license:expat)))
+
+(define-public node-addon-api
+  (package
+    (name "node-addon-api")
+    (version "4.2.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nodejs/node-addon-api")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1bhvfi2m9nxfz418s619914vmidcnrzbjv6l9nid476c3zlpazch"))))
+    (inputs
+     `(("python" ,python)))
+    (build-system node-build-system)
+    (arguments
+     `(#:absent-dependencies
+       `("benchmark"
+         "bindings"
+         "clang-format"
+         "eslint"
+         "eslint-config-semistandard"
+         "eslint-config-standard"
+         "eslint-plugin-import"
+         "eslint-plugin-node"
+         "eslint-plugin-promise"
+         "fs-extra"
+         "path"
+         "pre-commit"
+         "safe-buffer")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'skip-js-tests
+           ;; We can't run the js-based tests,
+           ;; but we can still do the C++ parts
+           (lambda args
+             (substitute* "package.json"
+               (("\"test\": \"node test\"")
+                "\"test\": \"echo stopping after pretest on Guix\"")))))))
+    (home-page "https://github.com/nodejs/node-addon-api")
+    (synopsis "Node.js API (Node-API) header-only C++ wrappers")
+    (description "This module contains header-only C++ wrapper classes which
+simplify the use of the C based Node-API provided by Node.js when using C++.
+It provides a C++ object model and exception handling semantics with low
+overhead.
+
+Node-API is an ABI stable C interface provided by Node.js for building native
+addons.  It is intended to insulate native addons from changes in the
+underlying JavaScript engine and allow modules compiled for one version to run
+on later versions of Node.js without recompilation.  The @code{node-addon-api}
+module, which is not part of Node.js, preserves the benefits of the Node-API
+as it consists only of inline code that depends only on the stable API
+provided by Node-API.
+
+It is important to remember that @emph{other} Node.js interfaces such as
+@code{libuv} (included in a project via @code{#include <uv.h>}) are not
+ABI-stable across Node.js major versions.")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v2 26/26] gnu: Add node-sqlite3.
  2021-11-20  4:33           ` [bug#51838] [PATCH v2 01/26] gnu: node: Avoid duplicating build phases Philip McGrath
                               ` (23 preceding siblings ...)
  2021-11-20  4:34             ` [bug#51838] [PATCH v2 25/26] gnu: Add node-addon-api Philip McGrath
@ 2021-11-20  4:34             ` Philip McGrath
  2021-11-20  7:48               ` Liliana Marie Prikler
  24 siblings, 1 reply; 458+ messages in thread
From: Philip McGrath @ 2021-11-20  4:34 UTC (permalink / raw)
  To: 51838; +Cc: Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-sqlite3): New variable.
---
 gnu/packages/node-xyz.scm | 107 ++++++++++++++++++++++++++++++++++++--
 1 file changed, 104 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 60dbfc163c..a56281fe18 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -615,7 +615,8 @@ (define-public node-addon-api
        (sha256
         (base32 "1bhvfi2m9nxfz418s619914vmidcnrzbjv6l9nid476c3zlpazch"))))
     (inputs
-     `(("python" ,python)))
+     `(("python" ,python)
+       ("node-safe-buffer" ,node-safe-buffer)))
     (build-system node-build-system)
     (arguments
      `(#:absent-dependencies
@@ -630,8 +631,7 @@ (define-public node-addon-api
          "eslint-plugin-promise"
          "fs-extra"
          "path"
-         "pre-commit"
-         "safe-buffer")
+         "pre-commit")
        #:phases
        (modify-phases %standard-phases
          (add-after 'unpack 'skip-js-tests
@@ -660,3 +660,104 @@ (define-public node-addon-api
 @code{libuv} (included in a project via @code{#include <uv.h>}) are not
 ABI-stable across Node.js major versions.")
     (license license:expat)))
+
+(define-public node-sqlite3
+  (package
+    (name "node-sqlite3")
+    (version "5.0.2")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/mapbox/node-sqlite3")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0sbbzzli282nxyfha10zx0k5m8hdp0sf3ipl59khjb7wm449j86h"))
+       (snippet
+        (with-imported-modules '((guix build utils))
+          #~(begin
+              (use-modules (guix build utils))
+              ;; unbundle sqlite
+              '(for-each delete-file-recursively
+                         (find-files "deps" gzip-file?)))))))
+    (inputs
+     `(("node-addon-api" ,node-addon-api)
+       ("python" ,python)
+       ("sqlite" ,sqlite)))
+    (build-system node-build-system)
+    (arguments
+     `(#:tests?
+       #f ; FIXME: tests depend on node-mocha
+       #:modules
+       ((guix build node-build-system)
+        (guix build json)
+        (srfi srfi-1)
+        (ice-9 match)
+        (guix build utils))
+       #:libuv? #t
+       #:absent-dependencies
+       `(;; Normally, this is "built" using @mapbox/node-pre-gyp,
+         ;; which publishes or downloads pre-built binaries
+         ;; or falls back to building from source.
+         ;; Here, we patch out all of that and just build directly.
+         ;; It would be better to patch a version of @mapbox/node-pre-gyp
+         ;; that always builds from source, as Debian does,
+         ;; but there are a number of dependencies that need
+         ;; to be packaged or removed.
+         "@mapbox/node-pre-gyp"
+         "node-pre-gyp" ;; deprecated name still used in some places
+         "aws-sdk"
+         "@mapbox/cloudfriend"
+         ;; Confusingly, this is only a dependency beceuse of
+         ;; @mapbox/node-pre-gyp: with that removed,
+         ;; npm will use its own copy:
+         "node-gyp"
+         ;; These we'd like, we just don't have them yet:
+         "eslint"
+         "mocha")
+       #:phases
+       (modify-phases %standard-phases
+         ;; We need this step even if we do replace @mapbox/node-pre-gyp
+         ;; because the package expects to build its bundled sqlite
+         (add-before 'configure 'npm-config-sqlite
+           (lambda* (#:key inputs #:allow-other-keys)
+             (setenv "npm_config_sqlite" (assoc-ref inputs "sqlite"))))
+         (add-after 'patch-dependencies 'avoid-node-pre-gyp
+           (lambda args
+             (with-atomic-file-replacement "package.json"
+               (lambda (in out)
+                 (let* ((js (read-json in))
+                        (alist (match js
+                                 (('@ . alist) alist)))
+                        (scripts-alist (match (assoc-ref alist "scripts")
+                                         (('@ . alist) alist)))
+                        (scripts-alist
+                         ;; install script would use node-pre-gyp
+                         (assoc-remove! scripts-alist "install"))
+                        (alist
+                         (assoc-set! alist "scripts" (cons '@ scripts-alist)))
+                        (alist
+                         ;; causes `npm install` (our 'configure phase)
+                         ;; run the appropriate parts of node-gyp
+                         (assoc-set! alist "gypfile" #t))
+                        (binary-alist (match (assoc-ref alist "binary")
+                                        (('@ . alist) alist)))
+                        (js (cons '@ alist)))
+                   ;; compensate for lack of @mapbox/node-pre-gyp
+                   (setenv "GYP_DEFINES"
+                           (string-append
+                            "module_name="
+                            (assoc-ref binary-alist "module_name")
+                            " "
+                            "module_path="
+                            (assoc-ref binary-alist "module_path")))
+                   (write-json js
+                               out)))))))))
+    (home-page "https://github.com/mapbox/node-sqlite3")
+    (synopsis "Asynchronous, non-blocking SQLite3 bindings for Node.js")
+    (description
+     "The Node.js add-on @code{node-sqlite3} provides a set of a asynchronous,
+non-blocking bindings for SQLite3, written in modern C++ and tested for memory
+leaks.")
+     (license license:bsd-3)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH 03/11] guix: node-build-system: Support compiling add-ons with node-gyp.
  2021-11-20  4:26         ` Philip McGrath
  2021-11-20  4:33           ` [bug#51838] [PATCH v2 01/26] gnu: node: Avoid duplicating build phases Philip McGrath
@ 2021-11-20  5:10           ` Philip McGrath
  2021-11-20  7:28             ` Liliana Marie Prikler
  1 sibling, 1 reply; 458+ messages in thread
From: Philip McGrath @ 2021-11-20  5:10 UTC (permalink / raw)
  To: Liliana Marie Prikler, 51838; +Cc: Pierre Langlois

On 11/19/21 23:26, Philip McGrath wrote> In v2 of this series (which 
will follow this email)

I'm not sure what went wrong, but I, at least, received these patches 
out of order. Let me know if I should resend them as v3. They are 
definitely in the right order here: 
https://gitlab.com/philip1/guix-patches/-/tree/guix-issue-51838-v2

-Philip




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH 03/11] guix: node-build-system: Support compiling add-ons with node-gyp.
  2021-11-20  5:10           ` [bug#51838] [PATCH 03/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
@ 2021-11-20  7:28             ` Liliana Marie Prikler
  0 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-11-20  7:28 UTC (permalink / raw)
  To: Philip McGrath, 51838; +Cc: Pierre Langlois

Am Samstag, den 20.11.2021, 00:10 -0500 schrieb Philip McGrath:
> On 11/19/21 23:26, Philip McGrath wrote> In v2 of this series (which 
> will follow this email)
> 
> I'm not sure what went wrong, but I, at least, received these
> patches 
> out of order. Let me know if I should resend them as v3. They are 
> definitely in the right order here: 
> https://gitlab.com/philip1/guix-patches/-/tree/guix-issue-51838-v2
> 
> -Philip
Our mumi frontend to debbugs should be able to deliver them to you as
one convenient mbox: 
https://issues.guix.gnu.org/issue/51838/patch-set/2

Cheers





^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v2 05/26] guix: node-build-system: Add #:absent-dependencies argument.
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 05/26] guix: node-build-system: Add #:absent-dependencies argument Philip McGrath
@ 2021-11-20  7:41               ` Liliana Marie Prikler
  2021-11-20 17:04                 ` Philip McGrath
  2021-11-28 19:27               ` [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Timothy Sample
  1 sibling, 1 reply; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-11-20  7:41 UTC (permalink / raw)
  To: Philip McGrath, 51838

Hi,

Am Freitag, den 19.11.2021, 23:33 -0500 schrieb Philip McGrath:
> Many of Guix's Node.js packages are built without some of the
> dependencies they specify in their "package-lock.json" files,
> either because we don't have them packaged yet (e.g. test
> utilities) or because we don't want them (e.g. to reduce the
> closure size). Previously, Guix package definitions would work
> around this situation by deleting the `'configure`
> phase (i.e. the initial `npm install`).
> 
> This commit adds an optional #:absent-dependencies argument to
> `node-build-system` to list Node.js packages that should be
> removed from the "package.json" file.Retaining the `'configure`
> phase avoids skipping checks for the dependencies that are
> intended to be present and other actions performed by `npm
> install`, such as automatically building native add-ons with
> `node-gyp` when the "gypfile" key is present.
> 
> [...]
This is a somewhat decent approach, but I wonder whether we could
improve this.  Does nodejs complain if a dependency exists in the code,
but is not present in the packages.json?

In the resolve-dependencies subprocedure, we could check whether we
have a matching input somewhere and only include the dependency if we
do.  WDYT?





^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v2 06/26] gnu: node-semver-bootstrap: Use #:absent-dependencies.
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 06/26] gnu: node-semver-bootstrap: Use #:absent-dependencies Philip McGrath
@ 2021-11-20  7:43               ` Liliana Marie Prikler
  0 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-11-20  7:43 UTC (permalink / raw)
  To: Philip McGrath, 51838

Am Freitag, den 19.11.2021, 23:33 -0500 schrieb Philip McGrath:
> gnu/packages/node.scm (node-semver-bootstrap)[arguments]: Add
> `#:absent-dependencies`. Stop deleting the `'configure` phase.
> ---
>  gnu/packages/node.scm | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
> index 0f67fe79c2..6c958eebec 100644
> --- a/gnu/packages/node.scm
> +++ b/gnu/packages/node.scm
> @@ -330,9 +330,8 @@ (define-public node-semver-bootstrap
>      (arguments
>       `(#:node ,node-bootstrap
>         #:tests? #f
> -       #:phases
> -       (modify-phases %standard-phases
> -         (delete 'configure))))
> +       #:absent-dependencies
> +       '("tap")))
>      (home-page "https://github.com/npm/node-semver")
>      (properties '((hidden? . #t)))
>      (synopsis "Parses semantic versions strings")
Not deleting configure SGTM, but recall my note about #:absent-
dependencies.





^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v2 10/26] gnu: node-llparse-builder-bootstrap: Use #:absent-dependencies.
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 10/26] gnu: node-llparse-builder-bootstrap: " Philip McGrath
@ 2021-11-20  7:44               ` Liliana Marie Prikler
  2021-11-20 17:09                 ` Philip McGrath
  2021-11-23 11:04               ` Jelle Licht
  1 sibling, 1 reply; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-11-20  7:44 UTC (permalink / raw)
  To: Philip McGrath, 51838

Am Freitag, den 19.11.2021, 23:33 -0500 schrieb Philip McGrath:
> gnu/packages/node.scm (node-llparse-builder-bootstrap)[arguments]:
> Add `#:absent-dependencies`. Stop deleting the `'configure` phase.
> Add a new phase `#:delete-package-lock` to remove the
> problematic "package-lock.json".
> ---
>  gnu/packages/node.scm | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
> index 98a51276e7..9d4903a8ca 100644
> --- a/gnu/packages/node.scm
> +++ b/gnu/packages/node.scm
> @@ -479,9 +479,21 @@ (define-public node-llparse-builder-bootstrap
>      (arguments
>       `(#:node ,node-bootstrap
>         #:tests? #f
> +       #:absent-dependencies
> +       `("@types/mocha"
> +         "@types/node"
> +         "mocha"
> +         "ts-node"
> +         "tslint"
> +         "typescript")
>         #:phases
>         (modify-phases %standard-phases
> -         (delete 'configure)
> +         (add-before 'configure 'remove-package-lock
> +           ;; Having package-lock.json seems to cause npm
> +           ;; to look for things on the internet in the configure
> phase,
> +           ;; even if we have them properly installed.
> +           (lambda args
> +             (delete-file-recursively "package-lock.json")))
I think a simple delete-file ought to work.  This should also be done
by configure or similar, compare cargo-build-system.





^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v2 18/26] guix: node-build-system: Add optional #:libuv? argument.
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 18/26] guix: node-build-system: Add optional #:libuv? argument Philip McGrath
@ 2021-11-20  7:46               ` Liliana Marie Prikler
  2021-11-20 17:16                 ` Philip McGrath
  0 siblings, 1 reply; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-11-20  7:46 UTC (permalink / raw)
  To: Philip McGrath, 51838

Am Freitag, den 19.11.2021, 23:33 -0500 schrieb Philip McGrath:
> * guix/build-system/node.scm (lower): Add an optional #:libuv?
> argument to tell the build system to add the version of libuv
> used as an input to the #:node package as an additional implicit
> input, so that packages needing libuv always get the correct version.
Would it change something if we always had libuv as implicit input?  I
don't think it'd do much for closure size, but it might impact implicit
package search as proposed by my solution to the #:absent-dependencies
thing.





^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v2 26/26] gnu: Add node-sqlite3.
  2021-11-20  4:34             ` [bug#51838] [PATCH v2 26/26] gnu: Add node-sqlite3 Philip McGrath
@ 2021-11-20  7:48               ` Liliana Marie Prikler
  0 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-11-20  7:48 UTC (permalink / raw)
  To: Philip McGrath, 51838

Warning, this patch does not just add node-sqlite3!

Am Freitag, den 19.11.2021, 23:34 -0500 schrieb Philip McGrath:
> * gnu/packages/node-xyz.scm (node-sqlite3): New variable.
> ---
>  gnu/packages/node-xyz.scm | 107
> ++++++++++++++++++++++++++++++++++++--
>  1 file changed, 104 insertions(+), 3 deletions(-)
> 
> diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
> index 60dbfc163c..a56281fe18 100644
> --- a/gnu/packages/node-xyz.scm
> +++ b/gnu/packages/node-xyz.scm
> @@ -615,7 +615,8 @@ (define-public node-addon-api
>         (sha256
>          (base32
> "1bhvfi2m9nxfz418s619914vmidcnrzbjv6l9nid476c3zlpazch"))))
>      (inputs
> -     `(("python" ,python)))
> +     `(("python" ,python)
> +       ("node-safe-buffer" ,node-safe-buffer)))
>      (build-system node-build-system)
>      (arguments
>       `(#:absent-dependencies
> @@ -630,8 +631,7 @@ (define-public node-addon-api
>           "eslint-plugin-promise"
>           "fs-extra"
>           "path"
> -         "pre-commit"
> -         "safe-buffer")
> +         "pre-commit")
>         #:phases
>         (modify-phases %standard-phases
>           (add-after 'unpack 'skip-js-tests
> @@ -660,3 +660,104 @@ (define-public node-addon-api
>  @code{libuv} (included in a project via @code{#include <uv.h>}) are
> not
>  ABI-stable across Node.js major versions.")
>      (license license:expat)))
> +
> +(define-public node-sqlite3
> +  (package
> +    (name "node-sqlite3")
> +    (version "5.0.2")
> +    (source
> +     (origin
> +       (method git-fetch)
> +       (uri (git-reference
> +             (url "https://github.com/mapbox/node-sqlite3")
> +             (commit (string-append "v" version))))
> +       (file-name (git-file-name name version))
> +       (sha256
> +        (base32
> "0sbbzzli282nxyfha10zx0k5m8hdp0sf3ipl59khjb7wm449j86h"))
> +       (snippet
> +        (with-imported-modules '((guix build utils))
> +          #~(begin
> +              (use-modules (guix build utils))
> +              ;; unbundle sqlite
> +              '(for-each delete-file-recursively
> +                         (find-files "deps" gzip-file?)))))))
> +    (inputs
> +     `(("node-addon-api" ,node-addon-api)
> +       ("python" ,python)
> +       ("sqlite" ,sqlite)))
> +    (build-system node-build-system)
> +    (arguments
> +     `(#:tests?
> +       #f ; FIXME: tests depend on node-mocha
> +       #:modules
> +       ((guix build node-build-system)
> +        (guix build json)
> +        (srfi srfi-1)
> +        (ice-9 match)
> +        (guix build utils))
> +       #:libuv? #t
> +       #:absent-dependencies
> +       `(;; Normally, this is "built" using @mapbox/node-pre-gyp,
> +         ;; which publishes or downloads pre-built binaries
> +         ;; or falls back to building from source.
> +         ;; Here, we patch out all of that and just build directly.
> +         ;; It would be better to patch a version of @mapbox/node-
> pre-gyp
> +         ;; that always builds from source, as Debian does,
> +         ;; but there are a number of dependencies that need
> +         ;; to be packaged or removed.
> +         "@mapbox/node-pre-gyp"
> +         "node-pre-gyp" ;; deprecated name still used in some places
> +         "aws-sdk"
> +         "@mapbox/cloudfriend"
> +         ;; Confusingly, this is only a dependency beceuse of
> +         ;; @mapbox/node-pre-gyp: with that removed,
> +         ;; npm will use its own copy:
> +         "node-gyp"
> +         ;; These we'd like, we just don't have them yet:
> +         "eslint"
> +         "mocha")
> +       #:phases
> +       (modify-phases %standard-phases
> +         ;; We need this step even if we do replace @mapbox/node-
> pre-gyp
> +         ;; because the package expects to build its bundled sqlite
> +         (add-before 'configure 'npm-config-sqlite
> +           (lambda* (#:key inputs #:allow-other-keys)
> +             (setenv "npm_config_sqlite" (assoc-ref inputs
> "sqlite"))))
> +         (add-after 'patch-dependencies 'avoid-node-pre-gyp
> +           (lambda args
> +             (with-atomic-file-replacement "package.json"
> +               (lambda (in out)
> +                 (let* ((js (read-json in))
> +                        (alist (match js
> +                                 (('@ . alist) alist)))
> +                        (scripts-alist (match (assoc-ref alist
> "scripts")
> +                                         (('@ . alist) alist)))
> +                        (scripts-alist
> +                         ;; install script would use node-pre-gyp
> +                         (assoc-remove! scripts-alist "install"))
> +                        (alist
> +                         (assoc-set! alist "scripts" (cons '@
> scripts-alist)))
> +                        (alist
> +                         ;; causes `npm install` (our 'configure
> phase)
> +                         ;; run the appropriate parts of node-gyp
> +                         (assoc-set! alist "gypfile" #t))
> +                        (binary-alist (match (assoc-ref alist
> "binary")
> +                                        (('@ . alist) alist)))
> +                        (js (cons '@ alist)))
> +                   ;; compensate for lack of @mapbox/node-pre-gyp
> +                   (setenv "GYP_DEFINES"
> +                           (string-append
> +                            "module_name="
> +                            (assoc-ref binary-alist "module_name")
> +                            " "
> +                            "module_path="
> +                            (assoc-ref binary-alist "module_path")))
> +                   (write-json js
> +                               out)))))))))
> +    (home-page "https://github.com/mapbox/node-sqlite3")
> +    (synopsis "Asynchronous, non-blocking SQLite3 bindings for
> Node.js")
> +    (description
> +     "The Node.js add-on @code{node-sqlite3} provides a set of a
> asynchronous,
> +non-blocking bindings for SQLite3, written in modern C++ and tested
> for memory
> +leaks.")
> +     (license license:bsd-3)))





^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v2 05/26] guix: node-build-system: Add #:absent-dependencies argument.
  2021-11-20  7:41               ` Liliana Marie Prikler
@ 2021-11-20 17:04                 ` Philip McGrath
  2021-11-20 20:24                   ` Liliana Marie Prikler
  0 siblings, 1 reply; 458+ messages in thread
From: Philip McGrath @ 2021-11-20 17:04 UTC (permalink / raw)
  To: Liliana Marie Prikler, 51838

Hi,

On 11/20/21 02:41, Liliana Marie Prikler wrote:
> Hi,
> 
> Am Freitag, den 19.11.2021, 23:33 -0500 schrieb Philip McGrath:
>> Many of Guix's Node.js packages are built without some of the
>> dependencies they specify in their "package-lock.json" files,
>> either because we don't have them packaged yet (e.g. test
>> utilities) or because we don't want them (e.g. to reduce the
>> closure size). Previously, Guix package definitions would work
>> around this situation by deleting the `'configure`
>> phase (i.e. the initial `npm install`).
>>
>> This commit adds an optional #:absent-dependencies argument to
>> `node-build-system` to list Node.js packages that should be
>> removed from the "package.json" file.Retaining the `'configure`
>> phase avoids skipping checks for the dependencies that are
>> intended to be present and other actions performed by `npm
>> install`, such as automatically building native add-ons with
>> `node-gyp` when the "gypfile" key is present.
>>
>> [...]
> This is a somewhat decent approach, but I wonder whether we could
> improve this.  Does nodejs complain if a dependency exists in the code,
> but is not present in the packages.json?

To the best of my understanding, npm doesn't inspect the js files at all 
by default, so no. (A package.json file might define a build script that 
does more checks.) I think a missing and undeclared dependency manifests 
itself as a runtime error when the require() function is evaluated.

> In the resolve-dependencies subprocedure, we could check whether we
> have a matching input somewhere and only include the dependency if we
> do.  WDYT?

I thought about this, but it seems to me there are two problems. First, 
I'm very unsure about this, but, in the last few days, I've gotten the 
impression there may be some "package.json" packages that don't 
correspond directly to Guix packages. I don't really understand how that 
works, but I think it may have something to do with npm packages that 
can run either on Node.js or on the web and need to use some 
functionality that's part of the Node.js core but not the web platform 
(or vice versa?). I could be wrong about that, but I've tried, 
especially in v2, to only have the build-side code do things I'm 
confident are correct in all cases.

The other issue is that deleting packages with no matching input by 
default would replicate some of the drawbacks of the current `(delete 
'configure)` approach. I think it's better to have an explicit list of 
dependencies that Guix is deleting. If eventually we package all of the 
missing dependencies for Guix, it would be much easier to find the 
packages that ought to use it. And, in the highly dynamic JavaScript 
world, I'm reluctant to give up one of the few static checks we have. If 
a missing package that really was required were automatically deleted 
from "package.json", it seems the failure mode would by a mysterious 
runtime error, potentially many steps down a dependency chain.




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v2 10/26] gnu: node-llparse-builder-bootstrap: Use #:absent-dependencies.
  2021-11-20  7:44               ` Liliana Marie Prikler
@ 2021-11-20 17:09                 ` Philip McGrath
  0 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-11-20 17:09 UTC (permalink / raw)
  To: Liliana Marie Prikler, 51838

On 11/20/21 02:44, Liliana Marie Prikler wrote:
> Am Freitag, den 19.11.2021, 23:33 -0500 schrieb Philip McGrath:
>>          (modify-phases %standard-phases
>> -         (delete 'configure)
>> +         (add-before 'configure 'remove-package-lock
>> +           ;; Having package-lock.json seems to cause npm
>> +           ;; to look for things on the internet in the configure
>> phase,
>> +           ;; even if we have them properly installed.
>> +           (lambda args
>> +             (delete-file-recursively "package-lock.json")))
> I think a simple delete-file ought to work.  This should also be done
> by configure or similar, compare cargo-build-system.

Yes, I thought about having the build system automatically delete 
"package-lock.json", but I'm not 100% sure it's always a problem to have 
it, or if there might even be some circumstance where we want to keep 
it. I'd prefer to wait until we see a significant number of node 
packages deleting their "package-lock.json" files before trying to 
abstract over the pattern.




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v2 18/26] guix: node-build-system: Add optional #:libuv? argument.
  2021-11-20  7:46               ` Liliana Marie Prikler
@ 2021-11-20 17:16                 ` Philip McGrath
  0 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-11-20 17:16 UTC (permalink / raw)
  To: Liliana Marie Prikler, 51838

On 11/20/21 02:46, Liliana Marie Prikler wrote:
> Am Freitag, den 19.11.2021, 23:33 -0500 schrieb Philip McGrath:
>> * guix/build-system/node.scm (lower): Add an optional #:libuv?
>> argument to tell the build system to add the version of libuv
>> used as an input to the #:node package as an additional implicit
>> input, so that packages needing libuv always get the correct version.
> Would it change something if we always had libuv as implicit input?  I
> don't think it'd do much for closure size, but it might impact implicit
> package search as proposed by my solution to the #:absent-dependencies
> thing.

 From a Guix perspective, I don't think it would make much difference, 
since libuv is always needed by node itself. Maybe it would require more 
grafting than would be needed otherwise?

But I think the recommendation for authors of node add-ons is to avoid 
libuv unless it's really needed, because it has fewer stability 
guarantees that other Node.js APIs.





^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v2 04/26] gnu: node: Add an npmrc file to set nodedir.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
  2021-11-14 12:58 ` [bug#51838] [PATCH 01/11] gnu: node: Avoid duplicating build phases Philip McGrath
@ 2021-11-20 17:38 ` Timothy Sample
  2021-11-20 19:55 ` [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Timothy Sample
                   ` (44 subsequent siblings)
  46 siblings, 0 replies; 458+ messages in thread
From: Timothy Sample @ 2021-11-20 17:38 UTC (permalink / raw)
  To: Philip McGrath; +Cc: 51838, Liliana Marie Prikler

Hi!

Just a little typo:

Philip McGrath <philip@philipmcgrath.com> writes:

> * gnu/packages/node.scm (node, node-lis)[arguments]: Add a phase

node-lis should be node-lts.


-- Tim




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
  2021-11-14 12:58 ` [bug#51838] [PATCH 01/11] gnu: node: Avoid duplicating build phases Philip McGrath
  2021-11-20 17:38 ` [bug#51838] [PATCH v2 04/26] gnu: node: Add an npmrc file to set nodedir Timothy Sample
@ 2021-11-20 19:55 ` Timothy Sample
  2021-12-02 21:52   ` Philip McGrath
  2021-11-20 20:04 ` Timothy Sample
                   ` (43 subsequent siblings)
  46 siblings, 1 reply; 458+ messages in thread
From: Timothy Sample @ 2021-11-20 19:55 UTC (permalink / raw)
  To: Philip McGrath; +Cc: 51838, Liliana Marie Prikler

Hello,

Philip McGrath <philip@philipmcgrath.com> writes:

> On 11/20/21 02:46, Liliana Marie Prikler wrote:
>> Am Freitag, den 19.11.2021, 23:33 -0500 schrieb Philip McGrath:
>>> * guix/build-system/node.scm (lower): Add an optional #:libuv?
>>> argument to tell the build system to add the version of libuv
>>> used as an input to the #:node package as an additional implicit
>>> input, so that packages needing libuv always get the correct version.
>> Would it change something if we always had libuv as implicit input?  I
>> don't think it'd do much for closure size, but it might impact implicit
>> package search as proposed by my solution to the #:absent-dependencies
>> thing.
>
> From a Guix perspective, I don't think it would make much difference,
> since libuv is always needed by node itself. Maybe it would require
> more grafting than would be needed otherwise?
>
> But I think the recommendation for authors of node add-ons is to avoid
> libuv unless it's really needed, because it has fewer stability 
> guarantees that other Node.js APIs.

My assumption is that most packages would ignore the libuv headers, and
they wouldn’t retain a reference to it (except via Node.js itself).
Hence, I don’t think it would make any difference either to grafting or
closure size to just always add it.


-- Tim




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (2 preceding siblings ...)
  2021-11-20 19:55 ` [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Timothy Sample
@ 2021-11-20 20:04 ` Timothy Sample
  2021-12-02 22:02   ` Philip McGrath
  2021-11-20 20:08 ` Timothy Sample
                   ` (42 subsequent siblings)
  46 siblings, 1 reply; 458+ messages in thread
From: Timothy Sample @ 2021-11-20 20:04 UTC (permalink / raw)
  To: Philip McGrath; +Cc: 51838, Liliana Marie Prikler

Hello,

Philip McGrath <philip@philipmcgrath.com> writes:

> On 11/20/21 02:41, Liliana Marie Prikler wrote:
>
>> In the resolve-dependencies subprocedure, we could check whether we
>> have a matching input somewhere and only include the dependency if we
>> do.  WDYT?
>
> [...]
>
> The other issue is that deleting packages with no matching input by
> default would replicate some of the drawbacks of the current `(delete 
> 'configure)` approach. I think it's better to have an explicit list of
> dependencies that Guix is deleting. If eventually we package all of
> the missing dependencies for Guix, it would be much easier to find the 
> packages that ought to use it. And, in the highly dynamic JavaScript
> world, I'm reluctant to give up one of the few static checks we
> have. If a missing package that really was required were automatically
> deleted from "package.json", it seems the failure mode would by a
> mysterious runtime error, potentially many steps down a dependency
> chain.

This is well put.  I actually experimented with a similar approach when
we updated the Node.js build system.  This is a big improvement over
deleting the configure phase, which would never scale to more than a
handful of packages.  Having a build-time check that ensures all the
developer-declared dependencies are available (save the “absent” ones)
will be very helpful when we are maintaining hundreds of JavaScript
packages.  :)

For the patch itself, it would be better to move a lot of your commit
message into a comment somewhere in the build system code.  If we had a
section in the manual for Node packages, it would go there, but alas....
I think most people would be happy to see a comment in the build system
code and be saved from having to poke around with ‘git blame’.


-- Tim




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (3 preceding siblings ...)
  2021-11-20 20:04 ` Timothy Sample
@ 2021-11-20 20:08 ` Timothy Sample
  2021-11-23 20:54   ` Pierre Langlois
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 01/41] guix: node-build-system: Add delete-lockfiles phase Liliana Marie Prikler
                   ` (41 subsequent siblings)
  46 siblings, 1 reply; 458+ messages in thread
From: Timothy Sample @ 2021-11-20 20:08 UTC (permalink / raw)
  To: Philip McGrath; +Cc: 51838, Pierre Langlois, Liliana Marie Prikler

Hi Philip,

There are some really valuable changes in here, thanks!  I would like to
start understanding and reviewing the changes so that we can get some of
this good stuff merged in.  However, I have one question that I couldn’t
answer from reading here or at <https://issues.guix.gnu.org/49946>: is
there an agreement between you and Pierre that these patches are the
“right” way to do native addons for Node.js.  More importantly, is the
general plan that we merge these changes, and then Pierre rebases their
Tree-sitter changes on top these?

Pierre, maybe you could weigh in here?

Sorry if I missed something.  I assume everything is OK, but I want to
be sure before I start digging into the details of the patches –
especially those first few more complicated ones.  :)

Thanks!


-- Tim




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v2 05/26] guix: node-build-system: Add #:absent-dependencies argument.
  2021-11-20 17:04                 ` Philip McGrath
@ 2021-11-20 20:24                   ` Liliana Marie Prikler
  0 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-11-20 20:24 UTC (permalink / raw)
  To: Philip McGrath, 51838

Hi,

Am Samstag, den 20.11.2021, 12:04 -0500 schrieb Philip McGrath:
> To the best of my understanding, npm doesn't inspect the js files at
> all by default, so no. (A package.json file might define a build
> script that does more checks.) I think a missing and undeclared
> dependency manifests itself as a runtime error when the require()
> function is evaluated.
Sheesh.

> > In the resolve-dependencies subprocedure, we could check whether we
> > have a matching input somewhere and only include the dependency if
> > we do.  WDYT?
> 
> I thought about this, but it seems to me there are two problems.
> First, I'm very unsure about this, but, in the last few days, I've
> gotten the impression there may be some "package.json" packages that
> don't correspond directly to Guix packages. I don't really understand
> how that works, but I think it may have something to do with npm
> packages that can run either on Node.js or on the web and need to use
> some functionality that's part of the Node.js core but not the web
> platform (or vice versa?). I could be wrong about that, but I've
> tried, especially in v2, to only have the build-side code do things
> I'm confident are correct in all cases.
What does "not directly correspond to Guix packages" mean here?  At the
very least Node must have a way of finding them, probably somewhere in
lib/, no?

While I did say we may want to rewrite these dependencies in
‘configure’, perhaps we can find a middle ground in which we only do so
when a given argument is there.  ant-build-system does that for
instance, so as to cope with packages that actually have no ant build
spec.  WDYT?

> The other issue is that deleting packages with no matching input by 
> default would replicate some of the drawbacks of the current
> `(delete 'configure)` approach. I think it's better to have an
> explicit list of dependencies that Guix is deleting. If eventually we
> package all of the missing dependencies for Guix, it would be much
> easier to find the packages that ought to use it. And, in the highly
> dynamic JavaScript world, I'm reluctant to give up one of the few
> static checks we have. If a missing package that really was required
> were automatically deleted from "package.json", it seems the failure
> mode would by a mysterious runtime error, potentially many steps down
> a dependency chain.
I get where you're coming from, but OTOH if you were to change parts of
the package to suit your own needs – like adding or omitting some
inputs, you now have two places to change, and they're in a tricky
relationship with another.  I think this is setting up some very error-
prone boilerplate.

I hope that in most cases the test suite will cover the important use
cases, but that's not always possible (e.g. with flaky tests,
networking, missing test inputs...)  Furthermore, for better or for
worse, stack traces did become the gold standard of debugging long ago,
so even packages missing "deep down" would probably soon be dug out if
they lead to hard errors.  Soft errors in Javascript though...





^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v2 10/26] gnu: node-llparse-builder-bootstrap: Use #:absent-dependencies.
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 10/26] gnu: node-llparse-builder-bootstrap: " Philip McGrath
  2021-11-20  7:44               ` Liliana Marie Prikler
@ 2021-11-23 11:04               ` Jelle Licht
  2021-11-28 19:35                 ` [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Timothy Sample
  1 sibling, 1 reply; 458+ messages in thread
From: Jelle Licht @ 2021-11-23 11:04 UTC (permalink / raw)
  To: Philip McGrath, 51838; +Cc: Liliana Marie Prikler

Hey Philip,

Philip McGrath <philip@philipmcgrath.com> writes:

> gnu/packages/node.scm (node-llparse-builder-bootstrap)[arguments]: Add
> `#:absent-dependencies`. Stop deleting the `'configure` phase.
> Add a new phase `#:delete-package-lock` to remove the
> problematic "package-lock.json".
> ---
>  gnu/packages/node.scm | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
> index 98a51276e7..9d4903a8ca 100644
> --- a/gnu/packages/node.scm
> +++ b/gnu/packages/node.scm
> @@ -479,9 +479,21 @@ (define-public node-llparse-builder-bootstrap
>      (arguments
>       `(#:node ,node-bootstrap
>         #:tests? #f
> +       #:absent-dependencies
> +       `("@types/mocha"
> +         "@types/node"
> +         "mocha"
> +         "ts-node"
> +         "tslint"
> +         "typescript")
>         #:phases
>         (modify-phases %standard-phases
> -         (delete 'configure)
> +         (add-before 'configure 'remove-package-lock
> +           ;; Having package-lock.json seems to cause npm
> +           ;; to look for things on the internet in the configure phase,
> +           ;; even if we have them properly installed.

package-lock.json lists exact versions _and integrity hashes_; since it
seems unlikely that after node-build-system's finaggling we end up with
an identical hash, we will always have a mismatch and fetch 'proper'
sources online accordingly. As far as npm + package-lock.json are
concerned, we don't have them properly installed.

From what I have seen package-lock.json offers us no benefits (because
we track exact dependency information via the guix store) and can (as
you have seen) prevent builds from working. My 2c: always remove it in a
phase in the build system. It's simply a preference though, so your
please go with what you think is the right choice. You might want to
update the comment nonetheless so it's clear we know what's going on.

> +           (lambda args
> +             (delete-file-recursively "package-lock.json")))
>           (replace 'build
>             (lambda* (#:key inputs #:allow-other-keys)
>               (let ((esbuild (string-append (assoc-ref inputs "esbuild")
> -- 
> 2.32.0




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp.
  2021-11-20 20:08 ` Timothy Sample
@ 2021-11-23 20:54   ` Pierre Langlois
  2021-11-28 19:59     ` Timothy Sample
  0 siblings, 1 reply; 458+ messages in thread
From: Pierre Langlois @ 2021-11-23 20:54 UTC (permalink / raw)
  To: Timothy Sample
  Cc: 51838, Pierre Langlois, Philip McGrath, Liliana Marie Prikler

[-- Attachment #1: Type: text/plain, Size: 1384 bytes --]

Hi Timothy,

Timothy Sample <samplet@ngyro.com> writes:

> Hi Philip,
>
> There are some really valuable changes in here, thanks!  I would like to
> start understanding and reviewing the changes so that we can get some of
> this good stuff merged in.  However, I have one question that I couldn’t
> answer from reading here or at <https://issues.guix.gnu.org/49946>: is
> there an agreement between you and Pierre that these patches are the
> “right” way to do native addons for Node.js.  More importantly, is the
> general plan that we merge these changes, and then Pierre rebases their
> Tree-sitter changes on top these?
>
> Pierre, maybe you could weigh in here?

The overall approach looks good to me, it's better than what I
originally proposed for sure :-).  That being said, I'm not very
familiar with the Node.js ecosystem so I don't know if it's necessarily
the right way, but I suspect the correct way for node isn't very Guix-y
so I'm not too worried about that.

It's on my TODO list to take another look at the patches as well :-),
then yes, I'm planning on rebasing my tree-sitter series on top.

> Sorry if I missed something.  I assume everything is OK, but I want to
> be sure before I start digging into the details of the patches –
> especially those first few more complicated ones.  :)

Thanks for taking a look!

Pierre

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 519 bytes --]

^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp.
  2021-11-20  4:33             ` [bug#51838] [PATCH v2 05/26] guix: node-build-system: Add #:absent-dependencies argument Philip McGrath
  2021-11-20  7:41               ` Liliana Marie Prikler
@ 2021-11-28 19:27               ` Timothy Sample
  2021-12-02 21:50                 ` Philip McGrath
  1 sibling, 1 reply; 458+ messages in thread
From: Timothy Sample @ 2021-11-28 19:27 UTC (permalink / raw)
  To: Philip McGrath; +Cc: 51838, Liliana Marie Prikler

Hi Philip,

Philip McGrath <philip@philipmcgrath.com> writes:

> -  (define (resolve-dependencies package-meta meta-key)
> -    (fold (lambda (key+value acc)
> -            (match key+value
> -              ('@ acc)
> -              ((key . value) (acons key (hash-ref index key value) acc))))
> +  (define (resolve-dependencies meta-alist meta-key)
> +    (match (assoc-ref meta-alist meta-key)
> +      (#f
> +       '())
> +      (('@ . orig-deps)
> +       (fold (match-lambda*
> +               (('@ acc)
> +                acc)
> +                (((key . value) acc)
> +                 (if (member key absent-dependencies)
> +                     acc
> +                     (acons key (hash-ref index key value) acc))))
>            '()
> -          (or (assoc-ref package-meta meta-key) '())))
> +          orig-deps))))

There’s a lot of refactoring going here in addition to change at hand.
To me, it needlessly obscures the actual change (which is just the check
for membership in 'absent-dependencies', AFAICS).

>    (with-atomic-file-replacement "package.json"
>      (lambda (in out)
> -      (let ((package-meta (read-json in)))
> -        (assoc-set! package-meta "dependencies"
> -                    (append
> -                     '(@)
> -                     (resolve-dependencies package-meta "dependencies")
> -                     (resolve-dependencies package-meta "peerDependencies")))
> -        (assoc-set! package-meta "devDependencies"
> -                    (append
> -                     '(@)
> -                     (resolve-dependencies package-meta "devDependencies")))
> +      ;; It is unsafe to rely on 'assoc-set!' to update an
> +      ;; existing assosciation list variable:
> +      ;; see 'info "(guile)Adding or Setting Alist Entries"'.

Good catch!

> +      (let* ((package-meta (read-json in))
> +             (alist (match package-meta
> +                      ((@ . alist) alist)))

Why do we have to unwrap (and then re-wrap later on) the alist?  It
would be nice to explain that in the changelog.  Maybe it’s just me, but
I can’t figure it out!  :)

Thanks!


-- Tim




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp.
  2021-11-23 11:04               ` Jelle Licht
@ 2021-11-28 19:35                 ` Timothy Sample
  2021-12-02 21:18                   ` Philip McGrath
  0 siblings, 1 reply; 458+ messages in thread
From: Timothy Sample @ 2021-11-28 19:35 UTC (permalink / raw)
  To: Jelle Licht; +Cc: 51838, Philip McGrath, Liliana Marie Prikler

Hello!

Jelle Licht <jlicht@fsfe.org> writes:

> Philip McGrath <philip@philipmcgrath.com> writes:
>
>> Add a new phase `#:delete-package-lock` to remove the
>> problematic "package-lock.json".
>
> package-lock.json lists exact versions _and integrity hashes_; since it
> seems unlikely that after node-build-system's finaggling we end up with
> an identical hash, we will always have a mismatch and fetch 'proper'
> sources online accordingly. As far as npm + package-lock.json are
> concerned, we don't have them properly installed.
>
> From what I have seen package-lock.json offers us no benefits (because
> we track exact dependency information via the guix store) and can (as
> you have seen) prevent builds from working. My 2c: always remove it in a
> phase in the build system.

I’m inclined to agree with Jelle and Liliana.  I can’t imagine a
situation in which we would want the lock files.  We could be wrong, but
we can always adjust the build system later if something surprising
happens (e.g., ‘#:keep-lock-file?’ or whatever).


-- Tim




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp.
  2021-11-23 20:54   ` Pierre Langlois
@ 2021-11-28 19:59     ` Timothy Sample
  2021-12-02 22:22       ` Philip McGrath
  0 siblings, 1 reply; 458+ messages in thread
From: Timothy Sample @ 2021-11-28 19:59 UTC (permalink / raw)
  To: Pierre Langlois; +Cc: 51838, Philip McGrath, Liliana Marie Prikler

Hello,

Pierre Langlois <pierre.langlois@gmx.com> writes:

> Hi Timothy,
>
> Timothy Sample <samplet@ngyro.com> writes:
>
>> More importantly, is the general plan that we merge these changes,
>> and then Pierre rebases their Tree-sitter changes on top these?
>>
>> Pierre, maybe you could weigh in here?
>
> The overall approach looks good to me, it's better than what I
> originally proposed for sure :-).  That being said, I'm not very
> familiar with the Node.js ecosystem so I don't know if it's necessarily
> the right way, but I suspect the correct way for node isn't very Guix-y
> so I'm not too worried about that.

The whole Node.js bundles NPM, which bundles node-gyp, which bundles a
fork of GYP [1] is not very Guix-y at all, no.  :/  This is one of those
problems (like bootstrapping GCC) that will take years of incremental
improvements and side projects and all that.

[1] Not to get too off topic, but isn’t “gyp” a slur?  How did Google
ever call something that?

> It's on my TODO list to take another look at the patches as well :-),
> then yes, I'm planning on rebasing my tree-sitter series on top.

Excellent!

>> Sorry if I missed something.  I assume everything is OK, but I want to
>> be sure before I start digging into the details of the patches –
>> especially those first few more complicated ones.  :)
>
> Thanks for taking a look!

I have an idea to simplify the patch series a bit: if we can answer my
question here <https://issues.guix.gnu.org/51838#57> and come to a
conclusion about deleting lock files
<https://issues.guix.gnu.org/51838#58>, I could merge the
‘#:absent-dependencies’ part of the patch series.  I think this might
make future re-rolls easier and help rein in the scope a bit.

Thoughts?  Philip?

Thanks!


-- Tim




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp.
  2021-11-28 19:35                 ` [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Timothy Sample
@ 2021-12-02 21:18                   ` Philip McGrath
  2021-12-03  5:17                     ` Liliana Marie Prikler
  0 siblings, 1 reply; 458+ messages in thread
From: Philip McGrath @ 2021-12-02 21:18 UTC (permalink / raw)
  To: Timothy Sample, Jelle Licht; +Cc: 51838, Liliana Marie Prikler

On 11/28/21 14:35, Timothy Sample wrote:
> Jelle Licht <jlicht@fsfe.org> writes:
>>  From what I have seen package-lock.json offers us no benefits (because
>> we track exact dependency information via the guix store) and can (as
>> you have seen) prevent builds from working. My 2c: always remove it in a
>> phase in the build system.
> 
> I’m inclined to agree with Jelle and Liliana.  I can’t imagine a
> situation in which we would want the lock files.  We could be wrong, but
> we can always adjust the build system later if something surprising
> happens (e.g., ‘#:keep-lock-file?’ or whatever).

This makes sense to me. Should we also delete "yarn.lock" (respected as 
of npm v7)[1] and "npm-shrinkwrap.json"[2]? It seems like the same 
reasons probably apply. We might want to handle 
"node_modules/.package-lock.json"[3], too, but that seems less likely to 
exist.

-Philip

[1]: 
https://blog.npmjs.org/post/621733939456933888/npm-v7-series-why-keep-package-lockjson.html
[2]: 
https://docs.npmjs.com/cli/v8/configuring-npm/package-lock-json#package-lockjson-vs-npm-shrinkwrapjson
[3]: 
https://docs.npmjs.com/cli/v8/configuring-npm/package-lock-json#package-lockjson-vs-npm-shrinkwrapjson




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp.
  2021-11-28 19:27               ` [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Timothy Sample
@ 2021-12-02 21:50                 ` Philip McGrath
  0 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-02 21:50 UTC (permalink / raw)
  To: Timothy Sample; +Cc: 51838, Liliana Marie Prikler

Hi!

On 11/28/21 14:27, Timothy Sample wrote:
> Philip McGrath <philip@philipmcgrath.com> writes:
> 
>> -  (define (resolve-dependencies package-meta meta-key)
>> -    (fold (lambda (key+value acc)
>> -            (match key+value
>> -              ('@ acc)
>> -              ((key . value) (acons key (hash-ref index key value) acc))))
>> +  (define (resolve-dependencies meta-alist meta-key)
>> +    (match (assoc-ref meta-alist meta-key)
>> +      (#f
>> +       '())
>> +      (('@ . orig-deps)
>> +       (fold (match-lambda*
>> +               (('@ acc)
>> +                acc)
>> +                (((key . value) acc)
>> +                 (if (member key absent-dependencies)
>> +                     acc
>> +                     (acons key (hash-ref index key value) acc))))
>>             '()
>> -          (or (assoc-ref package-meta meta-key) '())))
>> +          orig-deps))))
> 
> There’s a lot of refactoring going here in addition to change at hand.
> To me, it needlessly obscures the actual change (which is just the check
> for membership in 'absent-dependencies', AFAICS).

I could split it into two commits, if that would be more clear. But see 
below.

>>     (with-atomic-file-replacement "package.json"
>>       (lambda (in out)
>> -      (let ((package-meta (read-json in)))
>> -        (assoc-set! package-meta "dependencies"
>> -                    (append
>> -                     '(@)
>> -                     (resolve-dependencies package-meta "dependencies")
>> -                     (resolve-dependencies package-meta "peerDependencies")))
>> -        (assoc-set! package-meta "devDependencies"
>> -                    (append
>> -                     '(@)
>> -                     (resolve-dependencies package-meta "devDependencies")))
>> +      ;; It is unsafe to rely on 'assoc-set!' to update an
>> +      ;; existing assosciation list variable:
>> +      ;; see 'info "(guile)Adding or Setting Alist Entries"'.
> 
> Good catch!
> 
>> +      (let* ((package-meta (read-json in))
>> +             (alist (match package-meta
>> +                      ((@ . alist) alist)))
> 
> Why do we have to unwrap (and then re-wrap later on) the alist?  It
> would be nice to explain that in the changelog.  Maybe it’s just me, but
> I can’t figure it out!  :)

The (guix build json) module represents a JSON object as a Scheme pair 
with the symbol @ in the car and an alist in the cdr. I'd guess this is 
because, if JSON objects were represented as Scheme alists, it would be 
impossible to distinguish the empty JSON object from the empty JSON 
array. (Racket's json library instead represents JSON objects with 
immutable hash tables, a disjoint type.)

I found it confusing that:

  1. this format does not seem to be documented;

  2. `resolve-dependencies` has the same shape as `assoc-ref`, but
     returns an unwrapped alist where `assoc-ref` would return
     a wrapped pair with @; and

  3. prior to this patch, the implementation of `resolve-dependencies`
     was written as though the symbol @ could appear at arbitrary
     positions in the list, which made it less than obvious that it would
     actually occur exactly once, at the head.

I tried to address the last point when refactoring, but I see that the 
patch I sent made matters extra confusing by leaving in dead code from 
the old approach (maybe due to a rebase conflict I vaguely remember?). I 
should fix that, and probably also explain some of this in comments.

-Philip





^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp.
  2021-11-20 19:55 ` [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Timothy Sample
@ 2021-12-02 21:52   ` Philip McGrath
  0 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-02 21:52 UTC (permalink / raw)
  To: Timothy Sample; +Cc: 51838, Liliana Marie Prikler

On 11/20/21 14:55, Timothy Sample wrote:
> My assumption is that most packages would ignore the libuv headers, and
> they wouldn’t retain a reference to it (except via Node.js itself).
> Hence, I don’t think it would make any difference either to grafting or
> closure size to just always add it.
That makes sense to me.

-Philip




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp.
  2021-11-20 20:04 ` Timothy Sample
@ 2021-12-02 22:02   ` Philip McGrath
  0 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-02 22:02 UTC (permalink / raw)
  To: Timothy Sample; +Cc: 51838, Liliana Marie Prikler

Hi,

On 11/20/21 15:04, Timothy Sample wrote:
> Hello,
> 
> Philip McGrath <philip@philipmcgrath.com> writes:
> 
>> On 11/20/21 02:41, Liliana Marie Prikler wrote:
>>
>>> In the resolve-dependencies subprocedure, we could check whether we
>>> have a matching input somewhere and only include the dependency if we
>>> do.  WDYT?
>>
>> [...]
>>
>> The other issue is that deleting packages with no matching input by
>> default would replicate some of the drawbacks of the current `(delete
>> 'configure)` approach. I think it's better to have an explicit list of
>> dependencies that Guix is deleting. If eventually we package all of
>> the missing dependencies for Guix, it would be much easier to find the
>> packages that ought to use it. And, in the highly dynamic JavaScript
>> world, I'm reluctant to give up one of the few static checks we
>> have. If a missing package that really was required were automatically
>> deleted from "package.json", it seems the failure mode would by a
>> mysterious runtime error, potentially many steps down a dependency
>> chain.
> 
> This is well put.  I actually experimented with a similar approach when
> we updated the Node.js build system.  This is a big improvement over
> deleting the configure phase, which would never scale to more than a
> handful of packages.  Having a build-time check that ensures all the
> developer-declared dependencies are available (save the “absent” ones)
> will be very helpful when we are maintaining hundreds of JavaScript
> packages.  :)

It's probably also worth noting that many (most?) of our Node.js 
packages currently don't run tests: an unfortunate number don't have any 
tests, and then there's the issue that we haven't packaged JavaScript 
test frameworks for Guix yet.


> For the patch itself, it would be better to move a lot of your commit
> message into a comment somewhere in the build system code.  If we had a
> section in the manual for Node packages, it would go there, but alas....
> I think most people would be happy to see a comment in the build system
> code and be saved from having to poke around with ‘git blame’.

Yes, I'll add comments.

-Philip




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp.
  2021-11-28 19:59     ` Timothy Sample
@ 2021-12-02 22:22       ` Philip McGrath
  0 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-02 22:22 UTC (permalink / raw)
  To: Timothy Sample, Pierre Langlois; +Cc: 51838, Liliana Marie Prikler

Hi,

On 11/28/21 14:59, Timothy Sample wrote:
> Pierre Langlois <pierre.langlois@gmx.com> writes:
>> The overall approach looks good to me, it's better than what I
>> originally proposed for sure :-).  That being said, I'm not very
>> familiar with the Node.js ecosystem so I don't know if it's necessarily
>> the right way, but I suspect the correct way for node isn't very Guix-y
>> so I'm not too worried about that.
> 
> The whole Node.js bundles NPM, which bundles node-gyp, which bundles a
> fork of GYP [1] is not very Guix-y at all, no.  :/  This is one of those
> problems (like bootstrapping GCC) that will take years of incremental
> improvements and side projects and all that.

It's something of a tangent, but, as I discussed briefly with Pierre in 
e.g. <https://issues.guix.gnu.org/49946#73>, I think it would make a lot 
of sense, even if we can't unbundle/bootstrap everything, to make the 
355 dependencies of npm we are already distributing available as Guix 
packages. For example, I think I found a bootstrapping cycle with the 
Unicode data packages: even if the version we're currently using is 
messy, letting other packages use it, too, might unlock much more of the 
JavaScript universe. I've experimented a bit (partially looking at what 
Debian does), and I may look at that some time after this.


> I have an idea to simplify the patch series a bit: if we can answer my
> question here <https://issues.guix.gnu.org/51838#57> and come to a
> conclusion about deleting lock files
> <https://issues.guix.gnu.org/51838#58>, I could merge the
> ‘#:absent-dependencies’ part of the patch series.  I think this might
> make future re-rolls easier and help rein in the scope a bit.

That sounds like a great approach! I had not expected this patch series 
to end up touching every JavaScript package in Guix :)

I was offline a bit for holidays here, and just before that I'd noticed 
a problem with npm generating implicit build commands that tried to 
rebuild node-gyp packages when they are installed. I'll page this stuff 
back in and send a v3 soon that hopefully has at least the 
'#:absent-dependencies' part ready to merge.

-Philip






^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp.
  2021-12-02 21:18                   ` Philip McGrath
@ 2021-12-03  5:17                     ` Liliana Marie Prikler
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
  0 siblings, 1 reply; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-03  5:17 UTC (permalink / raw)
  To: Philip McGrath, Timothy Sample, Jelle Licht; +Cc: 51838

Hi,

Am Donnerstag, den 02.12.2021, 16:18 -0500 schrieb Philip McGrath:
> On 11/28/21 14:35, Timothy Sample wrote:
> > Jelle Licht <jlicht@fsfe.org> writes:
> > >  From what I have seen package-lock.json offers us no benefits
> > > (because we track exact dependency information via the guix
> > > store) and can (as you have seen) prevent builds from working. My
> > > 2c: always remove it in a phase in the build system.
> > 
> > I’m inclined to agree with Jelle and Liliana.  I can’t imagine a
> > situation in which we would want the lock files.  We could be
> > wrong, but we can always adjust the build system later if something
> > surprising happens (e.g., ‘#:keep-lock-file?’ or whatever).
> 
> This makes sense to me. Should we also delete "yarn.lock" (respected
> as of npm v7)[1] and "npm-shrinkwrap.json"[2]? It seems like the
> same reasons probably apply. 
If it breaks builds, then yes.

> We might want to handle "node_modules/.package-lock.json"[3], too,
> but that seems less likely to exist.
What are node_modules in this context?  To me that sounds like
"vendored packages" and if so, they ought to (ideally) be deleted in a
snippet way before unpack.  Meaning you wouldn't have to handle that
case in configure.

Cheers





^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 00/43] guix: node-build-system: Support compiling add-ons with node-gyp.
  2021-12-03  5:17                     ` Liliana Marie Prikler
@ 2021-12-08 20:27                       ` Philip McGrath
  2021-12-08 20:27                         ` [bug#51838] [PATCH v3 01/43] gnu: node: Avoid duplicating build phases Philip McGrath
                                           ` (43 more replies)
  0 siblings, 44 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:27 UTC (permalink / raw)
  To: 51838; +Cc: Timothy Sample, Pierre Langlois, Jelle Licht,
	Liliana Marie Prikler

Hi!

Here is a v3 of this patch series, hopefully incorporating all of the
suggestions. In particular, as Timothy suggested
in <https://issues.guix.gnu.org/51838#59>, I've tried to make sure the earlier
patches, at least through #:absent-dependencies, are able to be applied even
if there is more discussion needed on the later patches.

As I mentioned in <https://issues.guix.gnu.org/51838#64>, while experimenting
with v2 of this series, I discovered an issue with the install script
automatically generated by npm. Patch 21 ``guix: node-build-system: Add
avoid-node-gyp-rebuild phase.'' fixed the issue: I explain the details in
comments there.

This series also adds two additional leaf packages, `node-segfault-handler'
and `node-serialport', that confirm these patches can support additional
styles of native addons. In particular, because the native addon for
`node-serialport' is actually in one of the intermediate packages,
`node-serialport-bindings', it serves as a test case for the new
`avoid-node-gyp-rebuild' phase.

I've also put these patches up
at <https://gitlab.com/philip1/guix-patches/-/tree/guix-issue-51838-v3>,
if anyone finds that useful.

  -Philip

Philip McGrath (43):
  gnu: node: Avoid duplicating build phases.
  gnu: node: Update to 10.24.1 for bootstrapping.
  gnu: node: Patch shebangs in node_modules.
  gnu: node: Add an npmrc file to set nodedir.
  guix: node-build-system: Refactor patch-dependencies phase.
  guix: node-build-system: Add #:absent-dependencies argument.
  gnu: node-semver-bootstrap: Use #:absent-dependencies.
  gnu: node-ms-bootstrap: Use #:absent-dependencies.
  gnu: node-binary-search-bootstrap: Use #:absent-dependencies.
  gnu: node-debug-bootstrap: Use #:absent-dependencies.
  gnu: node-llparse-builder-bootstrap: Use #:absent-dependencies.
  gnu: node-llparse-frontend-bootstrap: Use #:absent-dependencies.
  gnu: node-llparse-bootstrap: Use #:absent-dependencies.
  gnu: node-semver: Use #:absent-dependencies.
  gnu: node-wrappy: Use #:absent-dependencies.
  gnu: node-once: Use #:absent-dependencies.
  gnu: node-irc-colors: Use #:absent-dependencies.
  gnu: node-irc: Use #:absent-dependencies.
  guix: node-build-system: Add implicit libuv input.
  guix: node-build-system: Add delete-lockfiles phase.
  guix: node-build-system: Add avoid-node-gyp-rebuild phase.
  gnu: Add node-inherits.
  gnu: Add node-safe-buffer.
  gnu: Add node-string-decoder.
  gnu: Add node-readable-stream.
  gnu: Add node-nan.
  gnu: Add node-openzwave-shared.
  gnu: Add node-addon-api.
  gnu: Add node-sqlite3.
  gnu: Add node-file-uri-to-path.
  gnu: Add node-bindings.
  gnu: Add node-segfault-handler.
  gnu: Add node-serialport-binding-abstract.
  gnu: Add node-serialport-parser-delimiter.
  gnu: Add node-serialport-parser-readling.
  gnu: Add node-serialport-bindings.
  gnu: Add node-serialport-parser-regex.
  gnu: Add node-serialport-parser-ready.
  gnu: Add node-serialport-parser-inter-byte-timeout.
  gnu: Add node-serialport-parser-cctalk.
  gnu: Add node-serialport-parser-byte-length.
  gnu: Add node-serialport-stream.
  gnu: Add node-serialport.

 gnu/packages/node-xyz.scm        | 833 +++++++++++++++++++++++++++++--
 gnu/packages/node.scm            | 219 ++++----
 gnu/packages/zwave.scm           |  65 +++
 guix/build-system/node.scm       |  28 +-
 guix/build/node-build-system.scm | 129 ++++-
 5 files changed, 1119 insertions(+), 155 deletions(-)

-- 
2.32.0





^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 01/43] gnu: node: Avoid duplicating build phases.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
@ 2021-12-08 20:27                         ` Philip McGrath
  2021-12-08 20:27                         ` [bug#51838] [PATCH v3 02/43] gnu: node: Update to 10.24.1 for bootstrapping Philip McGrath
                                           ` (42 subsequent siblings)
  43 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:27 UTC (permalink / raw)
  To: 51838

* gnu/packages/node.scm (node)[arguments]: Split 'patch-files phase
into 'patch-hardcoded-program-references and
'delete-problematic-tests. Adapt 'patch-hardcoded-program-references
and 'configure to work unmodified on node-lts, but don't try to
share 'delete-problematic-tests, because those details seem to change
too much between node versions.
(node, node-lts)[inputs]: Use bash-minimal rather than bash.
(node-lts)[arguments]: Inherit 'patch-hardcoded-program-references,
and 'configure phases from the bootstrap node.
Remove the 'patch-files phase, keeping its remaining
non-inherited work in a new 'replace-llhttp-sources phase.
---
 gnu/packages/node.scm | 105 +++++++++++++-----------------------------
 1 file changed, 32 insertions(+), 73 deletions(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index dccf871d2c..7ebbbc3060 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -9,6 +9,7 @@
 ;;; Copyright © 2020, 2021 Pierre Langlois <pierre.langlois@gmx.com>
 ;;; Copyright © 2020 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
+;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -105,14 +106,22 @@ (define-public node
        #:test-target "test-ci-js"
        #:phases
        (modify-phases %standard-phases
-         (add-before 'configure 'patch-files
+         (add-before 'configure 'patch-hardcoded-program-references
            (lambda* (#:key inputs #:allow-other-keys)
+
              ;; Fix hardcoded /bin/sh references.
-             (substitute* '("lib/child_process.js"
-                            "lib/internal/v8_prof_polyfill.js"
-                            "test/parallel/test-child-process-spawnsync-shell.js"
-                            "test/parallel/test-stdio-closed.js"
-                            "test/sequential/test-child-process-emfile.js")
+             (substitute*
+                 (let ((common
+                        '("lib/child_process.js"
+                          "lib/internal/v8_prof_polyfill.js"
+                          "test/parallel/test-child-process-spawnsync-shell.js"
+                          "test/parallel/test-stdio-closed.js"
+                          "test/sequential/test-child-process-emfile.js"))
+                       ;; not in bootstap node:
+                       (sigxfsz "test/parallel/test-fs-write-sigxfsz.js"))
+                   (if (file-exists? sigxfsz)
+                       (cons sigxfsz common)
+                       common))
                (("'/bin/sh'")
                 (string-append "'" (assoc-ref inputs "bash") "/bin/sh'")))
 
@@ -122,7 +131,10 @@ (define-public node
                             "test/parallel/test-child-process-exec-env.js")
                (("'/usr/bin/env'")
                 (string-append "'" (assoc-ref inputs "coreutils")
-                               "/bin/env'")))
+                               "/bin/env'")))))
+         (add-after 'patch-hardcoded-program-references
+             'delete-problematic-tests
+           (lambda* (#:key inputs #:allow-other-keys)
 
              ;; FIXME: These tests fail in the build container, but they don't
              ;; seem to be indicative of real problems in practice.
@@ -217,9 +229,13 @@ (define-public node
                (setenv "CXX" ,(cxx-for-target))
                (setenv "PKG_CONFIG" ,(pkg-config-for-target))
                (apply invoke
-                      (string-append (assoc-ref (or native-inputs inputs)
-                                                "python")
-                                     "/bin/python")
+                      (let ((python
+                             (string-append (assoc-ref (or native-inputs inputs)
+                                                       "python")
+                                            "/bin/python")))
+                        (if (file-exists? python)
+                            python
+                            (string-append python "3")))
                       "configure" flags))))
          (add-after 'patch-shebangs 'patch-npm-shebang
            (lambda* (#:key outputs #:allow-other-keys)
@@ -256,7 +272,7 @@ (define-public node
             (variable "NODE_PATH")
             (files '("lib/node_modules")))))
     (inputs
-     `(("bash" ,bash)
+     `(("bash" ,bash-minimal)
        ("coreutils" ,coreutils)
        ("c-ares" ,c-ares)
        ("http-parser" ,http-parser)
@@ -712,66 +728,8 @@ (define-public node-lts
                                    libuv "/lib:"
                                    zlib "/lib"
                                    "'],"))))))
-           (replace 'configure
-             ;; Node's configure script is actually a python script, so we can't
-             ;; run it with bash.
-             (lambda* (#:key outputs (configure-flags '()) native-inputs inputs
-                       #:allow-other-keys)
-               (let* ((prefix (assoc-ref outputs "out"))
-                      (xflags ,(if (%current-target-system)
-                                   `'("--cross-compiling"
-                                     ,(string-append
-                                       "--dest-cpu="
-                                       (match (%current-target-system)
-                                         ((? (cut string-prefix? "arm" <>))
-                                          "arm")
-                                         ((? (cut string-prefix? "aarch64" <>))
-                                          "arm64")
-                                         ((? (cut string-prefix? "i686" <>))
-                                          "ia32")
-                                         ((? (cut string-prefix? "x86_64" <>))
-                                          "x64")
-                                         ((? (cut string-prefix? "powerpc64" <>))
-                                          "ppc64")
-                                         (_ "unsupported"))))
-                                   ''()))
-                      (flags (cons
-                               (string-append "--prefix=" prefix)
-                               (append xflags configure-flags))))
-                 (format #t "build directory: ~s~%" (getcwd))
-                 (format #t "configure flags: ~s~%" flags)
-                 ;; Node's configure script expects the CC environment variable to
-                 ;; be set.
-                 (setenv "CC_host" "gcc")
-                 (setenv "CXX_host" "g++")
-                 (setenv "CC" ,(cc-for-target))
-                 (setenv "CXX" ,(cxx-for-target))
-                 (setenv "PKG_CONFIG" ,(pkg-config-for-target))
-                 (apply invoke
-                        (string-append (assoc-ref (or native-inputs inputs)
-                                                  "python")
-                                       "/bin/python3")
-                        "configure" flags))))
-           (replace 'patch-files
+           (replace 'delete-problematic-tests
              (lambda* (#:key inputs #:allow-other-keys)
-               ;; Fix hardcoded /bin/sh references.
-               (substitute* '("lib/child_process.js"
-                              "lib/internal/v8_prof_polyfill.js"
-                              "test/parallel/test-child-process-spawnsync-shell.js"
-                              "test/parallel/test-fs-write-sigxfsz.js"
-                              "test/parallel/test-stdio-closed.js"
-                              "test/sequential/test-child-process-emfile.js")
-                 (("'/bin/sh'")
-                  (string-append "'" (assoc-ref inputs "bash") "/bin/sh'")))
-
-               ;; Fix hardcoded /usr/bin/env references.
-               (substitute* '("test/parallel/test-child-process-default-options.js"
-                              "test/parallel/test-child-process-env.js"
-                              "test/parallel/test-child-process-exec-env.js")
-                 (("'/usr/bin/env'")
-                  (string-append "'" (assoc-ref inputs "coreutils")
-                                 "/bin/env'")))
-
                ;; FIXME: These tests fail in the build container, but they don't
                ;; seem to be indicative of real problems in practice.
                (for-each delete-file
@@ -810,8 +768,9 @@ (define-public node-lts
                ;; TODO: Regenerate certs instead.
                (for-each delete-file
                          '("test/parallel/test-tls-passphrase.js"
-                           "test/parallel/test-tls-server-verify.js"))
-
+                           "test/parallel/test-tls-server-verify.js"))))
+           (add-after 'delete-problematic-tests 'replace-llhttp-sources
+             (lambda* (#:key inputs #:allow-other-keys)
                ;; Replace pre-generated llhttp sources
                (let ((llhttp (assoc-ref inputs "llhttp")))
                  (copy-file (string-append llhttp "/src/llhttp.c")
@@ -838,7 +797,7 @@ (define-public node-lts
        ("python" ,python)
        ("util-linux" ,util-linux)))
     (inputs
-     `(("bash" ,bash)
+     `(("bash" ,bash-minimal)
        ("coreutils" ,coreutils)
        ("c-ares" ,c-ares-for-node)
        ("icu4c" ,icu4c-67)
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 02/43] gnu: node: Update to 10.24.1 for bootstrapping.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
  2021-12-08 20:27                         ` [bug#51838] [PATCH v3 01/43] gnu: node: Avoid duplicating build phases Philip McGrath
@ 2021-12-08 20:27                         ` Philip McGrath
  2021-12-08 20:27                         ` [bug#51838] [PATCH v3 03/43] gnu: node: Patch shebangs in node_modules Philip McGrath
                                           ` (41 subsequent siblings)
  43 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:27 UTC (permalink / raw)
  To: 51838

* gnu/packages/node.scm (node): Update to 10.24.1.
---
 gnu/packages/node.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 7ebbbc3060..71b66774a6 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -57,14 +57,14 @@ (define-module (gnu packages node)
 (define-public node
   (package
     (name "node")
-    (version "10.24.0")
+    (version "10.24.1")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://nodejs.org/dist/v" version
                                   "/node-v" version ".tar.xz"))
               (sha256
                (base32
-                "1k1srdis23782hnd1ymgczs78x9gqhv77v0am7yb54gqcspp70hm"))
+                "032801kg24j04xmf09m0vxzlcz86sv21s24lv9l4cfv08k1c4byp"))
               (modules '((guix build utils)))
               (snippet
                `(begin
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 03/43] gnu: node: Patch shebangs in node_modules.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
  2021-12-08 20:27                         ` [bug#51838] [PATCH v3 01/43] gnu: node: Avoid duplicating build phases Philip McGrath
  2021-12-08 20:27                         ` [bug#51838] [PATCH v3 02/43] gnu: node: Update to 10.24.1 for bootstrapping Philip McGrath
@ 2021-12-08 20:27                         ` Philip McGrath
  2021-12-08 20:27                         ` [bug#51838] [PATCH v3 04/43] gnu: node: Add an npmrc file to set nodedir Philip McGrath
                                           ` (40 subsequent siblings)
  43 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:27 UTC (permalink / raw)
  To: 51838

* gnu/packages/node.scm (node)[arguments]: Replace 'patch-npm-shebang
and 'patch-node-shebang with a new 'patch-nested-shebangs that also
handles node-gyp and other shebangs under "/lib/node_modules".
[inputs]: Add Python for node-gyp as "python-for-target".
(node-lts)[inputs]: Likewise.
(libnode)[arguments]: Adjust to delete 'patch-nested-shebangs rather
than 'patch-npm-shebang and 'patch-node-shebang.
---
 gnu/packages/node.scm | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 71b66774a6..a57a74fb81 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -237,21 +237,20 @@ (define-public node
                             python
                             (string-append python "3")))
                       "configure" flags))))
-         (add-after 'patch-shebangs 'patch-npm-shebang
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let* ((bindir (string-append (assoc-ref outputs "out")
-                                           "/bin"))
-                    (npm    (string-append bindir "/npm"))
-                    (target (readlink npm)))
-               (with-directory-excursion bindir
-                 (patch-shebang target (list bindir))))))
-         (add-after 'install 'patch-node-shebang
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let* ((bindir (string-append (assoc-ref outputs "out")
-                                           "/bin"))
-                    (npx    (readlink (string-append bindir "/npx"))))
-               (with-directory-excursion bindir
-                 (patch-shebang npx (list bindir)))))))))
+         (add-after 'patch-shebangs 'patch-nested-shebangs
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((prefix (assoc-ref outputs "out"))
+                    (path (map (lambda (dir)
+                                 (string-append dir "/bin"))
+                               (list prefix
+                                     (assoc-ref inputs "python-for-target")))))
+               (for-each
+                (lambda (file)
+                  (patch-shebang file path))
+                (find-files (string-append prefix "/lib/node_modules")
+                            (lambda (file stat)
+                              (executable-file? file))
+                            #:stat lstat))))))))
     (native-inputs
      `(;; Runtime dependencies for binaries used as a bootstrap.
        ("c-ares" ,c-ares)
@@ -274,6 +273,7 @@ (define-public node
     (inputs
      `(("bash" ,bash-minimal)
        ("coreutils" ,coreutils)
+       ("python-for-target" ,python-wrapper) ;; for node-gyp (supports python3)
        ("c-ares" ,c-ares)
        ("http-parser" ,http-parser)
        ("icu4c" ,icu4c)
@@ -799,6 +799,7 @@ (define-public node-lts
     (inputs
      `(("bash" ,bash-minimal)
        ("coreutils" ,coreutils)
+       ("python-for-target" ,python-wrapper) ;; for node-gyp (supports python3)
        ("c-ares" ,c-ares-for-node)
        ("icu4c" ,icu4c-67)
        ("libuv" ,libuv-for-node)
@@ -817,5 +818,4 @@ (define-public libnode
         `(cons* "--shared" "--without-npm" ,flags))
        ((#:phases phases '%standard-phases)
         `(modify-phases ,phases
-           (delete 'patch-npm-shebang)
-           (delete 'patch-node-shebang)))))))
+           (delete 'patch-nested-shebangs)))))))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 04/43] gnu: node: Add an npmrc file to set nodedir.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (2 preceding siblings ...)
  2021-12-08 20:27                         ` [bug#51838] [PATCH v3 03/43] gnu: node: Patch shebangs in node_modules Philip McGrath
@ 2021-12-08 20:27                         ` Philip McGrath
  2021-12-12 15:19                           ` Pierre Langlois
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 05/43] guix: node-build-system: Refactor patch-dependencies phase Philip McGrath
                                           ` (39 subsequent siblings)
  43 siblings, 1 reply; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:27 UTC (permalink / raw)
  To: 51838

* gnu/packages/node.scm (node, node-lts)[arguments]: Add a phase
'install-npmrc to create a "built-in" npmrc file that configures
"nodedir" to point to the output store path.
(libnode)[arguments]: Delete the 'install-npmrc phase.
---
 gnu/packages/node.scm | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index a57a74fb81..0f67fe79c2 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -250,7 +250,21 @@ (define-public node
                 (find-files (string-append prefix "/lib/node_modules")
                             (lambda (file stat)
                               (executable-file? file))
-                            #:stat lstat))))))))
+                            #:stat lstat)))))
+         (add-after 'install 'install-npmrc
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out")))
+               (with-output-to-file
+                   ;; Use the config file "primarily for distribution
+                   ;; maintainers" rather than "{prefix}/etc/npmrc",
+                   ;; especially because node-build-system uses --prefix
+                   ;; to install things to their store paths:
+                   (string-append out "/lib/node_modules/npm/npmrc")
+                 (lambda ()
+                   ;; Tell npm (mostly node-gyp) where to find our
+                   ;; installed headers so it doesn't try to
+                   ;; download them from the internet:
+                   (format #t "nodedir=~a\n" out)))))))))
     (native-inputs
      `(;; Runtime dependencies for binaries used as a bootstrap.
        ("c-ares" ,c-ares)
@@ -818,4 +832,5 @@ (define-public libnode
         `(cons* "--shared" "--without-npm" ,flags))
        ((#:phases phases '%standard-phases)
         `(modify-phases ,phases
+           (delete 'install-npmrc)
            (delete 'patch-nested-shebangs)))))))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 05/43] guix: node-build-system: Refactor patch-dependencies phase.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (3 preceding siblings ...)
  2021-12-08 20:27                         ` [bug#51838] [PATCH v3 04/43] gnu: node: Add an npmrc file to set nodedir Philip McGrath
@ 2021-12-08 20:28                         ` Philip McGrath
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 06/43] guix: node-build-system: Add #:absent-dependencies argument Philip McGrath
                                           ` (38 subsequent siblings)
  43 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:28 UTC (permalink / raw)
  To: 51838

* guix/build/node-build-system.scm (patch-dependencies): Strictly
follow the linearity rules for `assoc-set!` and friends.
Clarify the types of the arguments to and return value from the
internal helper function `resolve-dependencies`.
---
 guix/build/node-build-system.scm | 53 ++++++++++++++++++++++----------
 1 file changed, 36 insertions(+), 17 deletions(-)

diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
index 70a367618e..6fade54670 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -73,26 +73,45 @@ (define* (patch-dependencies #:key inputs #:allow-other-keys)
 
   (define index (index-modules (map cdr inputs)))
 
-  (define (resolve-dependencies package-meta meta-key)
-    (fold (lambda (key+value acc)
-            (match key+value
-              ('@ acc)
-              ((key . value) (acons key (hash-ref index key value) acc))))
-          '()
-          (or (assoc-ref package-meta meta-key) '())))
+  (define (resolve-dependencies meta-alist meta-key)
+    ;; Given:
+    ;;  - The alist from "package.json", with the '@ unwrapped
+    ;;  - A string key, like "dependencies"
+    ;; Returns: an alist (without a wrapping '@) like the entry in
+    ;; meta-alist for meta-key, but with dependencies supplied
+    ;; by Guix packages mapped to the absolute store paths to use.
+    (match (assoc-ref meta-alist meta-key)
+      (#f
+       '())
+      (('@ . orig-deps)
+       (fold (match-lambda*
+               (((key . value) acc)
+                (acons key (hash-ref index key value) acc)))
+             '()
+             orig-deps))))
 
   (with-atomic-file-replacement "package.json"
     (lambda (in out)
-      (let ((package-meta (read-json in)))
-        (assoc-set! package-meta "dependencies"
-                    (append
-                     '(@)
-                     (resolve-dependencies package-meta "dependencies")
-                     (resolve-dependencies package-meta "peerDependencies")))
-        (assoc-set! package-meta "devDependencies"
-                    (append
-                     '(@)
-                     (resolve-dependencies package-meta "devDependencies")))
+      ;; It is unsafe to rely on 'assoc-set!' to update an
+      ;; existing assosciation list variable:
+      ;; see 'info "(guile)Adding or Setting Alist Entries"'.
+      (let* ((package-meta (read-json in))
+             (alist (match package-meta
+                      ((@ . alist) alist)))
+             (alist
+              (assoc-set!
+               alist "dependencies"
+               (append
+                '(@)
+                (resolve-dependencies alist "dependencies")
+                (resolve-dependencies alist "peerDependencies"))))
+             (alist
+              (assoc-set!
+               alist "devDependencies"
+               (append
+                '(@)
+                (resolve-dependencies alist "devDependencies"))))
+             (package-meta (cons '@ alist)))
         (write-json package-meta out))))
   #t)
 
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 06/43] guix: node-build-system: Add #:absent-dependencies argument.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (4 preceding siblings ...)
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 05/43] guix: node-build-system: Refactor patch-dependencies phase Philip McGrath
@ 2021-12-08 20:28                         ` Philip McGrath
  2021-12-12 15:31                           ` Pierre Langlois
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 07/43] gnu: node-semver-bootstrap: Use #:absent-dependencies Philip McGrath
                                           ` (37 subsequent siblings)
  43 siblings, 1 reply; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:28 UTC (permalink / raw)
  To: 51838

* guix/build-system/node.scm (lower, node-build): Add optional
argument #:absent-dependencies with default of ''(). Pass it on
to the build-side code.
* guix/build/node-build-system.scm (patch-dependencies): Respect
the #:absent-dependencies argument, removing specified npm
packages from the "dependencies" or "devDependencies" tables
in "package.json".
---
 guix/build-system/node.scm       | 19 ++++++++++++++++++-
 guix/build/node-build-system.scm |  7 +++++--
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/guix/build-system/node.scm b/guix/build-system/node.scm
index 98f63f87ef..4f437f9c0d 100644
--- a/guix/build-system/node.scm
+++ b/guix/build-system/node.scm
@@ -44,6 +44,7 @@ (define (default-node)
 (define* (lower name
                 #:key source inputs native-inputs outputs system target
                 (node (default-node))
+                (absent-dependencies ''())
                 #:allow-other-keys
                 #:rest arguments)
   "Return a bag for NAME."
@@ -73,6 +74,7 @@ (define* (node-build store name inputs
                      (tests? #t)
                      (phases '(@ (guix build node-build-system)
                                  %standard-phases))
+                     (absent-dependencies ''())
                      (outputs '("out"))
                      (search-paths '())
                      (system (%current-system))
@@ -80,7 +82,21 @@ (define* (node-build store name inputs
                      (imported-modules %node-build-system-modules)
                      (modules '((guix build node-build-system)
                                 (guix build utils))))
-  "Build SOURCE using NODE and INPUTS."
+  "Build SOURCE using NODE and INPUTS.
+
+The builder will remove Node.js packages listed in ABSENT-DEPENCENCIES from
+the 'package.json' file's 'dependencies' and 'devDependencies' tables.  This
+mechanism can be used both avoid dependencies we don't want (e.g. optional
+features that would increase closure size) and to work around dependencies
+that haven't been packaged for Guix yet (e.g. test utilities)."
+  ;; Before #:absent-dependencies existed, this scenario was often handled by
+  ;; deleting the 'configure phase. Using #:absent-dependencies, instead,
+  ;; retains the check that no dependencies are silently missing and other
+  ;; actions performed by 'npm install', such as building native
+  ;; addons. Having an explicit list of absent dependencies in the package
+  ;; definition should also facilitate future maintenence: for example, if we
+  ;; add a package for a test framework, it should be easy to find all the
+  ;; other packages that use it and enable their tests.
   (define builder
     `(begin
        (use-modules ,@modules)
@@ -94,6 +110,7 @@ (define builder
                    #:test-target ,test-target
                    #:tests? ,tests?
                    #:phases ,phases
+                   #:absent-dependencies ,absent-dependencies
                    #:outputs %outputs
                    #:search-paths ',(map search-path-specification->sexp
                                          search-paths)
diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
index 6fade54670..249b3deee6 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -69,7 +69,8 @@ (define (list-modules directory)
               input-paths)
     index))
 
-(define* (patch-dependencies #:key inputs #:allow-other-keys)
+(define* (patch-dependencies #:key inputs absent-dependencies
+                             #:allow-other-keys)
 
   (define index (index-modules (map cdr inputs)))
 
@@ -86,7 +87,9 @@ (define (resolve-dependencies meta-alist meta-key)
       (('@ . orig-deps)
        (fold (match-lambda*
                (((key . value) acc)
-                (acons key (hash-ref index key value) acc)))
+                (if (member key absent-dependencies)
+                    acc
+                    (acons key (hash-ref index key value) acc))))
              '()
              orig-deps))))
 
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 07/43] gnu: node-semver-bootstrap: Use #:absent-dependencies.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (5 preceding siblings ...)
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 06/43] guix: node-build-system: Add #:absent-dependencies argument Philip McGrath
@ 2021-12-08 20:28                         ` Philip McGrath
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 08/43] gnu: node-ms-bootstrap: " Philip McGrath
                                           ` (36 subsequent siblings)
  43 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:28 UTC (permalink / raw)
  To: 51838

gnu/packages/node.scm (node-semver-bootstrap)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node.scm | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 0f67fe79c2..6c958eebec 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -330,9 +330,8 @@ (define-public node-semver-bootstrap
     (arguments
      `(#:node ,node-bootstrap
        #:tests? #f
-       #:phases
-       (modify-phases %standard-phases
-         (delete 'configure))))
+       #:absent-dependencies
+       '("tap")))
     (home-page "https://github.com/npm/node-semver")
     (properties '((hidden? . #t)))
     (synopsis "Parses semantic versions strings")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 08/43] gnu: node-ms-bootstrap: Use #:absent-dependencies.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (6 preceding siblings ...)
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 07/43] gnu: node-semver-bootstrap: Use #:absent-dependencies Philip McGrath
@ 2021-12-08 20:28                         ` Philip McGrath
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 09/43] gnu: node-binary-search-bootstrap: " Philip McGrath
                                           ` (35 subsequent siblings)
  43 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:28 UTC (permalink / raw)
  To: 51838

gnu/packages/node.scm (node-ms-bootstrap)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node.scm | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 6c958eebec..ca4bf1ad23 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -358,9 +358,12 @@ (define-public node-ms-bootstrap
     (arguments
      `(#:node ,node-bootstrap
        #:tests? #f
-       #:phases
-       (modify-phases %standard-phases
-         (delete 'configure))))
+       #:absent-dependencies
+       `("eslint"
+         "expect.js"
+         "husky"
+         "lint-staged"
+         "mocha")))
     (home-page "https://github.com/zeit/ms#readme")
     (properties '((hidden? . #t)))
     (synopsis "Tiny millisecond conversion utility")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 09/43] gnu: node-binary-search-bootstrap: Use #:absent-dependencies.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (7 preceding siblings ...)
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 08/43] gnu: node-ms-bootstrap: " Philip McGrath
@ 2021-12-08 20:28                         ` Philip McGrath
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 10/43] gnu: node-debug-bootstrap: " Philip McGrath
                                           ` (34 subsequent siblings)
  43 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:28 UTC (permalink / raw)
  To: 51838

gnu/packages/node.scm (node-binary-search-bootstrap)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node.scm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index ca4bf1ad23..2cdae34ae1 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -389,9 +389,9 @@ (define-public node-binary-search-bootstrap
     (arguments
      `(#:node ,node-bootstrap
        #:tests? #f
-       #:phases
-       (modify-phases %standard-phases
-         (delete 'configure))))
+       #:absent-dependencies
+       `("chai"
+         "mocha")))
     (home-page "https://github.com/darkskyapp/binary-search#readme")
     (properties '((hidden? . #t)))
     (synopsis "Tiny binary search function with comparators")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 10/43] gnu: node-debug-bootstrap: Use #:absent-dependencies.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (8 preceding siblings ...)
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 09/43] gnu: node-binary-search-bootstrap: " Philip McGrath
@ 2021-12-08 20:28                         ` Philip McGrath
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 11/43] gnu: node-llparse-builder-bootstrap: " Philip McGrath
                                           ` (33 subsequent siblings)
  43 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:28 UTC (permalink / raw)
  To: 51838

gnu/packages/node.scm (node-debug-bootstrap)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node.scm | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 2cdae34ae1..98a51276e7 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -416,9 +416,18 @@ (define-public node-debug-bootstrap
     (arguments
      `(#:node ,node-bootstrap
        #:tests? #f
-       #:phases
-       (modify-phases %standard-phases
-         (delete 'configure))))
+       #:absent-dependencies
+       `("brfs"
+         "browserify"
+         "coveralls"
+         "istanbul"
+         "karma"
+         "karma-browserify"
+         "karma-chrome-launcher"
+         "karma-mocha"
+         "mocha"
+         "mocha-lcov-reporter"
+         "xo")))
     (inputs `(("node-ms" ,node-ms-bootstrap)))
     (home-page "https://github.com/visionmedia/debug#readme")
     (properties '((hidden? . #t)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 11/43] gnu: node-llparse-builder-bootstrap: Use #:absent-dependencies.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (9 preceding siblings ...)
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 10/43] gnu: node-debug-bootstrap: " Philip McGrath
@ 2021-12-08 20:28                         ` Philip McGrath
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 12/43] gnu: node-llparse-frontend-bootstrap: " Philip McGrath
                                           ` (32 subsequent siblings)
  43 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:28 UTC (permalink / raw)
  To: 51838

gnu/packages/node.scm (node-llparse-builder-bootstrap)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
Add a new phase `#:delete-package-lock` to remove the
problematic "package-lock.json".
---
 gnu/packages/node.scm | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 98a51276e7..9d4903a8ca 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -479,9 +479,21 @@ (define-public node-llparse-builder-bootstrap
     (arguments
      `(#:node ,node-bootstrap
        #:tests? #f
+       #:absent-dependencies
+       `("@types/mocha"
+         "@types/node"
+         "mocha"
+         "ts-node"
+         "tslint"
+         "typescript")
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure)
+         (add-before 'configure 'remove-package-lock
+           ;; Having package-lock.json seems to cause npm
+           ;; to look for things on the internet in the configure phase,
+           ;; even if we have them properly installed.
+           (lambda args
+             (delete-file-recursively "package-lock.json")))
          (replace 'build
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((esbuild (string-append (assoc-ref inputs "esbuild")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 12/43] gnu: node-llparse-frontend-bootstrap: Use #:absent-dependencies.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (10 preceding siblings ...)
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 11/43] gnu: node-llparse-builder-bootstrap: " Philip McGrath
@ 2021-12-08 20:28                         ` Philip McGrath
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 13/43] gnu: node-llparse-bootstrap: " Philip McGrath
                                           ` (31 subsequent siblings)
  43 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:28 UTC (permalink / raw)
  To: 51838

gnu/packages/node.scm (node-llparse-frontend-bootstrap)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node.scm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 9d4903a8ca..298b9376a8 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -547,9 +547,16 @@ (define-public node-llparse-frontend-bootstrap
     (arguments
      `(#:node ,node-bootstrap
        #:tests? #f
+       #:absent-dependencies
+       `("@types/debug"
+         "@types/mocha"
+         "@types/node"
+         "mocha"
+         "ts-node"
+         "tslint"
+         "typescript")
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure)
          (replace 'build
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((esbuild (string-append (assoc-ref inputs "esbuild")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 13/43] gnu: node-llparse-bootstrap: Use #:absent-dependencies.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (11 preceding siblings ...)
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 12/43] gnu: node-llparse-frontend-bootstrap: " Philip McGrath
@ 2021-12-08 20:28                         ` Philip McGrath
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 14/43] gnu: node-semver: " Philip McGrath
                                           ` (30 subsequent siblings)
  43 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:28 UTC (permalink / raw)
  To: 51838

gnu/packages/node.scm (node-llparse-bootstrap)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
Add a new phase `#:delete-package-lock` to remove the
problematic "package-lock.json".
---
 gnu/packages/node.scm | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 298b9376a8..6d48816c77 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -609,9 +609,24 @@ (define-public node-llparse-bootstrap
     (arguments
      `(#:node ,node-bootstrap
        #:tests? #f
+       #:absent-dependencies
+       `("@types/debug"
+         "@types/mocha"
+         "@types/node"
+         "esm"
+         "llparse-test-fixture"
+         "mocha"
+         "ts-node"
+         "tslint"
+         "typescript")
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure)
+         (add-before 'configure 'remove-package-lock
+           ;; Having package-lock.json seems to cause npm
+           ;; to look for things on the internet in the configure phase,
+           ;; even if we have them properly installed.
+           (lambda args
+             (delete-file-recursively "package-lock.json")))
          (replace 'build
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((esbuild (string-append (assoc-ref inputs "esbuild")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 14/43] gnu: node-semver: Use #:absent-dependencies.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (12 preceding siblings ...)
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 13/43] gnu: node-llparse-bootstrap: " Philip McGrath
@ 2021-12-08 20:28                         ` Philip McGrath
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 15/43] gnu: node-wrappy: " Philip McGrath
                                           ` (29 subsequent siblings)
  43 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:28 UTC (permalink / raw)
  To: 51838

gnu/packages/node-xyz.scm (node-semver)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node-xyz.scm | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 98c611f227..93a033d33e 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -289,11 +289,10 @@ (define-public node-semver
                 "06biknqb05r9xsmcflm3ygh50pjvdk84x6r79w43kmck4fn3qn5p"))))
     (build-system node-build-system)
     (arguments
-     '(#:tests? #f ; FIXME: Tests depend on node-tap
-       #:phases
-       (modify-phases %standard-phases
-         ;; The only dependency to check for is tap, which we don't have.
-         (delete 'configure))))
+     '(#:absent-dependencies
+       '("tap")
+       ;; FIXME: Tests depend on node-tap
+       #:tests? #f))
     (home-page "https://github.com/npm/node-semver")
     (synopsis "Parses semantic versions strings")
     (description
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 15/43] gnu: node-wrappy: Use #:absent-dependencies.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (13 preceding siblings ...)
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 14/43] gnu: node-semver: " Philip McGrath
@ 2021-12-08 20:28                         ` Philip McGrath
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 16/43] gnu: node-once: " Philip McGrath
                                           ` (28 subsequent siblings)
  43 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:28 UTC (permalink / raw)
  To: 51838

gnu/packages/node-xyz.scm (node-wrappy)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node-xyz.scm | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 93a033d33e..77577cb315 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -316,10 +316,8 @@ (define-public node-wrappy
     (build-system node-build-system)
     (arguments
      '(#:tests? #f ; FIXME: Tests depend on node-tap
-       #:phases
-       (modify-phases %standard-phases
-         ;; The only dependency to check for is tap, which we don't have.
-         (delete 'configure))))
+       #:absent-dependencies
+       '("tap")))
     (home-page "https://github.com/npm/wrappy")
     (synopsis "Callback wrapping utility")
     (description "@code{wrappy} is a utility for Node.js to wrap callbacks.")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 16/43] gnu: node-once: Use #:absent-dependencies.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (14 preceding siblings ...)
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 15/43] gnu: node-wrappy: " Philip McGrath
@ 2021-12-08 20:28                         ` Philip McGrath
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 17/43] gnu: node-irc-colors: " Philip McGrath
                                           ` (27 subsequent siblings)
  43 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:28 UTC (permalink / raw)
  To: 51838

gnu/packages/node-xyz.scm (node-once)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node-xyz.scm | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 77577cb315..eb071320cd 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -338,13 +338,10 @@ (define-public node-once
                 "1z8dcbf28dqdcp4wb0c53wrs90a07nkrax2c9kk26dsk1dhrnxav"))))
     (build-system node-build-system)
     (arguments
-     '(#:tests? #f                      ; FIXME: tests depend on node-tap
-       #:phases
-       (modify-phases %standard-phases
-         ;; The default configure phase fails due to tap being missing, as we do
-         ;; not have tap packaged yet.  It is used only for tests.  This package
-         ;; still works as a dependency of node-glob and node-inflight.
-         (delete 'configure))))
+     '(#:absent-dependencies
+       '("tap")
+       ;; FIXME: Tests depend on node-tap
+       #:tests? #f))
     (inputs
      `(("node-wrappy" ,node-wrappy)))
     (home-page "https://github.com/isaacs/once")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 17/43] gnu: node-irc-colors: Use #:absent-dependencies.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (15 preceding siblings ...)
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 16/43] gnu: node-once: " Philip McGrath
@ 2021-12-08 20:28                         ` Philip McGrath
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 18/43] gnu: node-irc: " Philip McGrath
                                           ` (26 subsequent siblings)
  43 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:28 UTC (permalink / raw)
  To: 51838

gnu/packages/node-xyz.scm (node-irc-colors)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node-xyz.scm | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index eb071320cd..9646c14243 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -367,12 +367,10 @@ (define-public node-irc-colors
                 "0q3y34rbnlc55jcakmdxkicwazyvyph9r6gaf6hi8k7wj2nfwfli"))))
     (build-system node-build-system)
     (arguments
-     '(#:tests? #f                      ; FIXME: tests depend on node-istanbul
-       #:phases
-       (modify-phases %standard-phases
-         ;; The default configure phase fails due to various packages
-         ;; being missing, as we don't have them packaged yet.
-         (delete 'configure))))
+     '(#:absent-dependencies
+       `("istanbul"
+         "vows")
+       #:tests? #f))
     (home-page "https://github.com/fent/irc-colors.js")
     (synopsis "Node.js module providing color and formatting for IRC")
     (description "@code{node-irc-colors} is a Node.js module that
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 18/43] gnu: node-irc: Use #:absent-dependencies.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (16 preceding siblings ...)
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 17/43] gnu: node-irc-colors: " Philip McGrath
@ 2021-12-08 20:28                         ` Philip McGrath
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 19/43] guix: node-build-system: Add implicit libuv input Philip McGrath
                                           ` (25 subsequent siblings)
  43 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:28 UTC (permalink / raw)
  To: 51838

gnu/packages/node-xyz.scm (node-irc)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node-xyz.scm | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 9646c14243..998d0a9a90 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -394,12 +394,12 @@ (define-public node-irc
                 "1ln4qfx20jbwg4cp8lp0vf27m5281z2sz16d15xd6150n26cbi4x"))))
     (build-system node-build-system)
     (arguments
-     '(#:tests? #f                      ; FIXME: tests depend on node-faucet
-       #:phases
-       (modify-phases %standard-phases
-         ;; The default configure phase fails due to various packages
-         ;; being missing, as we don't have them packaged yet.
-         (delete 'configure))))
+     '(#:absent-dependencies
+       `("ansi-color"
+         "faucet"
+         "jscs"
+         "tape")
+       #:tests? #f))
     (inputs
      `(("node-irc-colors" ,node-irc-colors)))
     (home-page "https://github.com/martynsmith/node-irc")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 19/43] guix: node-build-system: Add implicit libuv input.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (17 preceding siblings ...)
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 18/43] gnu: node-irc: " Philip McGrath
@ 2021-12-08 20:28                         ` Philip McGrath
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 20/43] guix: node-build-system: Add delete-lockfiles phase Philip McGrath
                                           ` (24 subsequent siblings)
  43 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:28 UTC (permalink / raw)
  To: 51838

* guix/build-system/node.scm (lower): Add the version of libuv
used as an input to the #:node package as an additional implicit
input, so that packages needing libuv always get the correct version.
---
 guix/build-system/node.scm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/guix/build-system/node.scm b/guix/build-system/node.scm
index 4f437f9c0d..179da65ee8 100644
--- a/guix/build-system/node.scm
+++ b/guix/build-system/node.scm
@@ -1,6 +1,8 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2016 Jelle Licht <jlicht@fsfe.org>
 ;;; Copyright © 2019 Timothy Sample <samplet@ngyro.com>
+;;; Copyright © 2021 Pierre Langlois <pierre.langlois@gmx.com>
+;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -59,10 +61,15 @@ (define private-keywords
                               `(("source" ,source))
                               '())
                         ,@inputs
-
                         ;; Keep the standard inputs of 'gnu-build-system'.
                         ,@(standard-packages)))
          (build-inputs `(("node" ,node)
+                         ;; Many packages with native addons need
+                         ;; libuv headers. The libuv version must
+                         ;; be exactly the same as for the node
+                         ;; package we are adding implicitly,
+                         ;; so we take care of adding libuv, too.
+                         ("libuv" ,@(assoc-ref (package-inputs node) "libuv"))
                          ,@native-inputs))
          (outputs outputs)
          (build node-build)
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 20/43] guix: node-build-system: Add delete-lockfiles phase.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (18 preceding siblings ...)
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 19/43] guix: node-build-system: Add implicit libuv input Philip McGrath
@ 2021-12-08 20:28                         ` Philip McGrath
  2021-12-12 16:09                           ` Pierre Langlois
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 21/43] guix: node-build-system: Add avoid-node-gyp-rebuild phase Philip McGrath
                                           ` (23 subsequent siblings)
  43 siblings, 1 reply; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:28 UTC (permalink / raw)
  To: 51838

* guix/build/node-build-system.scm (delete-lockfiles): New function.
Remove 'package-lock.json', 'yarn.lock', and 'npm-shrinkwrap.json',
if they exist.  Because these files specify dependency both exact
versions and integrity hashes, they only cause problems for Guix.
(%standard-phases): Add 'delete-lockfiles' after 'patch-dependencies'.
---
 gnu/packages/node.scm            | 12 ------------
 guix/build/node-build-system.scm | 12 ++++++++++++
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 6d48816c77..5289e2fe4f 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -488,12 +488,6 @@ (define-public node-llparse-builder-bootstrap
          "typescript")
        #:phases
        (modify-phases %standard-phases
-         (add-before 'configure 'remove-package-lock
-           ;; Having package-lock.json seems to cause npm
-           ;; to look for things on the internet in the configure phase,
-           ;; even if we have them properly installed.
-           (lambda args
-             (delete-file-recursively "package-lock.json")))
          (replace 'build
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((esbuild (string-append (assoc-ref inputs "esbuild")
@@ -621,12 +615,6 @@ (define-public node-llparse-bootstrap
          "typescript")
        #:phases
        (modify-phases %standard-phases
-         (add-before 'configure 'remove-package-lock
-           ;; Having package-lock.json seems to cause npm
-           ;; to look for things on the internet in the configure phase,
-           ;; even if we have them properly installed.
-           (lambda args
-             (delete-file-recursively "package-lock.json")))
          (replace 'build
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((esbuild (string-append (assoc-ref inputs "esbuild")
diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
index 249b3deee6..892104b6d2 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -118,6 +118,17 @@ (define (resolve-dependencies meta-alist meta-key)
         (write-json package-meta out))))
   #t)
 
+(define* (delete-lockfiles #:key inputs #:allow-other-keys)
+  "Delete 'package-lock.json', 'yarn.lock', and 'npm-shrinkwrap.json', if they
+exist."
+  (for-each (lambda (pth)
+              (when (file-exists? pth)
+                (delete-file pth)))
+            '("package-lock.json"
+              "yarn.lock"
+              "npm-shrinkwrap.json"))
+  #t)
+
 (define* (configure #:key outputs inputs #:allow-other-keys)
   (let ((npm (string-append (assoc-ref inputs "node") "/bin/npm")))
     (invoke npm "--offline" "--ignore-scripts" "install")
@@ -168,6 +179,7 @@ (define %standard-phases
   (modify-phases gnu:%standard-phases
     (add-after 'unpack 'set-home set-home)
     (add-before 'configure 'patch-dependencies patch-dependencies)
+    (add-after 'patch-dependencies 'delete-lockfiles delete-lockfiles)
     (replace 'configure configure)
     (replace 'build build)
     (replace 'check check)
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 21/43] guix: node-build-system: Add avoid-node-gyp-rebuild phase.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (19 preceding siblings ...)
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 20/43] guix: node-build-system: Add delete-lockfiles phase Philip McGrath
@ 2021-12-08 20:28                         ` Philip McGrath
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 22/43] gnu: Add node-inherits Philip McGrath
                                           ` (22 subsequent siblings)
  43 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:28 UTC (permalink / raw)
  To: 51838

* guix/build/node-build-system.scm (avoid-node-gyp-rebuild): New
function. Override the default install script for packages with
native addons to prevent it from attempting to write to the store
when such packages are used.
(%standard-phases): Add 'avoid-node-gyp-rebuild' after 'install'.
---
 guix/build/node-build-system.scm | 59 +++++++++++++++++++++++++++++++-
 1 file changed, 58 insertions(+), 1 deletion(-)

diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
index 892104b6d2..f9ca515d58 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -175,6 +175,62 @@ (define* (install #:key outputs inputs #:allow-other-keys)
             "install" "../package.tgz")
     #t))
 
+(define* (avoid-node-gyp-rebuild #:key outputs #:allow-other-keys)
+  "Adjust the installed 'package.json' to remove an 'install' script that
+would try to run 'node-gyp rebuild'."
+  ;; We want to take advantage of `npm install`'s automatic support for
+  ;; building native addons with node-gyp: in particular, it helps us avoid
+  ;; hard-coding the specifics of how npm's internal copy of node-gyp is
+  ;; currently packaged. However, the mechanism by which the automatic support
+  ;; is implemented causes problems for us.
+  ;;
+  ;; If a package contains a 'binding.gyp' file and does not define an
+  ;; 'install' or 'preinstall' script, 'npm install' runs a default install
+  ;; script consisting of 'node-gyp rebuild'. In our 'install' phase, this
+  ;; implicit 'install' script, if it is applicable, is explicitly added to
+  ;; the "package.json" file. However, if another Guix package were to use a
+  ;; Node.js package with such an 'install' script, the dependent package's
+  ;; build process would fail, because 'node-gyp rebuild' would try to write
+  ;; to the store.
+  ;;
+  ;; Here, if the installed "package.json" defines scripts.install as
+  ;; "node-gyp rebuild", we replace it with a no-op. Importantly, deleting the
+  ;; install script definition would not be enough, because the default
+  ;; install script would cause the same problem.
+  ;;
+  ;; 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
+  (let* ((package.json (string-append
+                        (assoc-ref outputs "out")
+                        "/lib/node_modules/"
+                        (match (call-with-input-file "package.json" read-json)
+                          (('@ . alist)
+                           (assoc-ref alist "name")))
+                        "/package.json"))
+         (meta-alist (match (call-with-input-file package.json read-json)
+                       (('@ . alist)
+                        alist)))
+         (scripts-alist (match (assoc-ref meta-alist "scripts")
+                          (('@ . alist)
+                           alist)
+                          (#f
+                           #f))))
+    (when (and scripts-alist
+               (equal? "node-gyp rebuild" (assoc-ref scripts-alist "install")))
+      (call-with-output-file package.json
+        (lambda (out)
+          (write-json
+           (cons '@ (assoc-set!
+                     meta-alist
+                     "scripts"
+                     (cons '@ (assoc-set!
+                               scripts-alist
+                               "install"
+                               "echo Guix: avoiding node-gyp rebuild"))))
+           out))))
+    #t))
+
 (define %standard-phases
   (modify-phases gnu:%standard-phases
     (add-after 'unpack 'set-home set-home)
@@ -184,7 +240,8 @@ (define %standard-phases
     (replace 'build build)
     (replace 'check check)
     (add-before 'install 'repack repack)
-    (replace 'install install)))
+    (replace 'install install)
+    (add-after 'install 'avoid-node-gyp-rebuild avoid-node-gyp-rebuild)))
 
 (define* (node-build #:key inputs (phases %standard-phases)
                      #:allow-other-keys #:rest args)
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 22/43] gnu: Add node-inherits.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (20 preceding siblings ...)
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 21/43] guix: node-build-system: Add avoid-node-gyp-rebuild phase Philip McGrath
@ 2021-12-08 20:28                         ` Philip McGrath
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 23/43] gnu: Add node-safe-buffer Philip McGrath
                                           ` (21 subsequent siblings)
  43 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:28 UTC (permalink / raw)
  To: 51838

* gnu/packages/node-xyz.scm (node-inherits): New variable.
---
 gnu/packages/node-xyz.scm | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 998d0a9a90..9d8bf27852 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2020 Giacomo Leidi <goodoldpaul@autistici.org>
 ;;; Copyright © 2021 Noisytoot <noisytoot@disroot.org>
 ;;; Copyright © 2021 Charles <charles.b.jackson@protonmail.com>
+;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -352,6 +353,35 @@ (define-public node-once
 if desired.")
     (license license:isc)))
 
+(define-public node-inherits
+  (package
+    (name "node-inherits")
+    (version "2.0.4")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/isaacs/inherits")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0cpsr5yqwkxpbbbbl0rwk4mcby6zbx841k2zb4c3gb1579i5wq9p"))))
+    (build-system node-build-system)
+    (arguments
+     '(#:absent-dependencies
+       '("tap")
+       ;; FIXME: Tests depend on node-tap
+       #:tests? #f))
+    (home-page
+     "https://github.com/isaacs/inherits")
+    (synopsis
+     "Browser-friendly inheritance Node.js")
+    (description
+     "Browser-friendly inheritance fully compatible with standard Node.js
+@code{inherits()}.")
+    (license license:isc)))
+
 (define-public node-irc-colors
   (package
     (name "node-irc-colors")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 23/43] gnu: Add node-safe-buffer.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (21 preceding siblings ...)
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 22/43] gnu: Add node-inherits Philip McGrath
@ 2021-12-08 20:28                         ` Philip McGrath
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 24/43] gnu: Add node-string-decoder Philip McGrath
                                           ` (20 subsequent siblings)
  43 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:28 UTC (permalink / raw)
  To: 51838

* gnu/packages/node-xyz.scm (node-safe-buffer): New variable.
---
 gnu/packages/node-xyz.scm | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 9d8bf27852..6dff0ddba5 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -382,6 +382,34 @@ (define-public node-inherits
 @code{inherits()}.")
     (license license:isc)))
 
+(define-public node-safe-buffer
+  (package
+    (name "node-safe-buffer")
+    (version "5.2.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/feross/safe-buffer")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0r26m0nl41h90ihnl2xf0cqs6z9z7jb87dl5j8yqb7887r9jlbpi"))))
+    (build-system node-build-system)
+    (arguments
+     '(#:absent-dependencies
+       '("tape"
+         "standard")
+       #:tests? #f))
+    (home-page
+     "https://github.com/feross/safe-buffer")
+    (synopsis "Safer Node.js Buffer API")
+    (description "A safe drop-in replacement the Node.js @code{Buffer} API
+that works in all versions of Node.js, using the built-in implementation when
+available.")
+    (license license:expat)))
+
 (define-public node-irc-colors
   (package
     (name "node-irc-colors")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 24/43] gnu: Add node-string-decoder.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (22 preceding siblings ...)
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 23/43] gnu: Add node-safe-buffer Philip McGrath
@ 2021-12-08 20:28                         ` Philip McGrath
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 25/43] gnu: Add node-readable-stream Philip McGrath
                                           ` (19 subsequent siblings)
  43 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:28 UTC (permalink / raw)
  To: 51838

* gnu/packages/node-xyz.scm (node-string-decoder): New variable.
---
 gnu/packages/node-xyz.scm | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 6dff0ddba5..c6cce64f7d 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -410,6 +410,40 @@ (define-public node-safe-buffer
 available.")
     (license license:expat)))
 
+(define-public node-string-decoder
+  (package
+    (name "node-string-decoder")
+    (version "1.3.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nodejs/string_decoder")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0xxvyya9fl9rlkqwmxzqzbz4rdr3jgw4vf37hff7cgscxkhg266k"))))
+    (build-system node-build-system)
+    (arguments
+     '(#:absent-dependencies
+       '("tap"
+         "core-util-is"
+         "babel-polyfill")
+       ;; FIXME: Tests depend on node-tap
+       #:tests? #f))
+    (inputs
+     `(("node-safe-buffer" ,node-safe-buffer)
+       ("node-inherits" ,node-inherits)))
+    (home-page
+     "https://github.com/nodejs/string_decoder")
+    (synopsis
+     "Node.js core @code{string_decoder} for userland")
+    (description
+     "This package is a mirror of the @code{string_decoder} implementation in
+Node-core.")
+    (license license:expat)))
+
 (define-public node-irc-colors
   (package
     (name "node-irc-colors")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 25/43] gnu: Add node-readable-stream.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (23 preceding siblings ...)
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 24/43] gnu: Add node-string-decoder Philip McGrath
@ 2021-12-08 20:28                         ` Philip McGrath
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 26/43] gnu: Add node-nan Philip McGrath
                                           ` (18 subsequent siblings)
  43 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:28 UTC (permalink / raw)
  To: 51838

* gnu/packages/node-xyz.scm (node-readable-stream): New variable.
---
 gnu/packages/node-xyz.scm | 54 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index c6cce64f7d..3e06413908 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -444,6 +444,60 @@ (define-public node-string-decoder
 Node-core.")
     (license license:expat)))
 
+(define-public node-readable-stream
+  (package
+    (name "node-readable-stream")
+    (version "3.6.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nodejs/readable-stream")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0ybl4cdgsm9c5jq3xq8s01201jk8w0yakh63hlclsfbcdfqhd9ri"))))
+    (build-system node-build-system)
+    (arguments
+     `(#:absent-dependencies
+       `("@babel/cli"
+         "@babel/core"
+         "@babel/polyfill"
+         "@babel/preset-env"
+         "airtap"
+         "assert"
+         "bl"
+         "deep-strict-equal"
+         "events.once"
+         "glob"
+         "gunzip-maybe"
+         "hyperquest"
+         "lolex"
+         "nyc"
+         "pump"
+         "rimraf"
+         "tap"
+         "tape"
+         "tar-fs"
+         "util-promisify")
+       #:tests? #f))
+    (inputs
+     `(("node-util-deprecate" ,node-util-deprecate)
+       ("node-string-decoder" ,node-string-decoder)
+       ("node-inherits" ,node-inherits)))
+    (home-page
+     "https://github.com/nodejs/readable-stream")
+    (synopsis
+     "Node.js core streams for userland")
+    (description
+     "This package is a mirror of the streams implementations in Node.js.
+
+If you want to guarantee a stable streams base, regardless of what version of
+Node you (or the users of your libraries) are using, use
+@code{readable-stream} only and avoid the @code{stream} module in Node-core.")
+    (license license:expat)))
+
 (define-public node-irc-colors
   (package
     (name "node-irc-colors")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 26/43] gnu: Add node-nan.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (24 preceding siblings ...)
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 25/43] gnu: Add node-readable-stream Philip McGrath
@ 2021-12-08 20:28                         ` Philip McGrath
  2021-12-12 16:17                           ` Pierre Langlois
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 27/43] gnu: Add node-openzwave-shared Philip McGrath
                                           ` (17 subsequent siblings)
  43 siblings, 1 reply; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:28 UTC (permalink / raw)
  To: 51838

* gnu/packages/node-xyz.scm (node-nan): New variable.
---
 gnu/packages/node-xyz.scm | 44 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 3e06413908..ed169c0778 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -553,3 +553,47 @@ (define-public node-irc
     (description "@code{node-irc} is an IRC client library for Node.js.
 It has functions for joining, parting, talking, and many other IRC commands.")
     (license license:gpl3+)))
+
+(define-public node-nan
+  (package
+    (name "node-nan")
+    (version "2.15.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nodejs/nan")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "18xslh9va5ld872scrp5y4251ax9s3c6qh0lnl1200lpzbsxy7yd"))))
+    (build-system node-build-system)
+    (arguments
+     `(#:tests?
+       ;; tests need tap and other dependencies
+       #f
+       #:absent-dependencies
+       '("bindings"
+         "commander"
+         "glob"
+         "request"
+         "node-gyp" ;; would be needed for tests
+         "tap"
+         "xtend")))
+    (inputs
+     `(("readable-stream" ,node-readable-stream)))
+    (home-page "https://github.com/nodejs/nan")
+    (synopsis "Native Abstractions for Node.js")
+    (description "A header file filled with macro and utility goodness for
+making add-on development for Node.js easier across versions 0.8, 0.10, 0.12,
+1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 and 16.
+
+Thanks to the crazy changes in V8 (and some in Node core), keeping native
+addons compiling happily across versions, particularly 0.10 to 0.12 to 4.0, is
+a minor nightmare.  The goal of this project is to store all logic necessary
+to develop native Node.js addons without having to inspect
+@code{NODE_MODULE_VERSION} and get yourself into a macro-tangle.
+
+This project also contains some helper utilities that make addon development a
+bit more pleasant.")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 27/43] gnu: Add node-openzwave-shared.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (25 preceding siblings ...)
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 26/43] gnu: Add node-nan Philip McGrath
@ 2021-12-08 20:28                         ` Philip McGrath
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 28/43] gnu: Add node-addon-api Philip McGrath
                                           ` (16 subsequent siblings)
  43 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:28 UTC (permalink / raw)
  To: 51838

* gnu/packages/zwave.scm (node-openzwave-shared): New variable.
---
 gnu/packages/zwave.scm | 65 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 65 insertions(+)

diff --git a/gnu/packages/zwave.scm b/gnu/packages/zwave.scm
index 2019ec32df..586cd66e1d 100644
--- a/gnu/packages/zwave.scm
+++ b/gnu/packages/zwave.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -21,11 +22,14 @@ (define-module (gnu packages zwave)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix git-download)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system node)
   #:use-module (gnu packages)
   #:use-module (gnu packages base)
+  #:use-module (gnu packages node-xyz)
   #:use-module (gnu packages libusb)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages perl)
+  #:use-module (gnu packages python)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages xml))
 
@@ -88,3 +92,64 @@ (define-public open-zwave
 and respond to devices on a Z-Wave network, without requiring in-depth
 knowledge of the Z-Wave protocol.")
     (license license:lgpl3+)))
+
+(define-public node-openzwave-shared
+  (package
+    (name "node-openzwave-shared")
+    (version "1.7.2")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/OpenZWave/node-openzwave-shared")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "1bqqy12dzqj05j9wsh50dmn84dddmhz0gjzvd3y20z4hpy1v8rsc"))))
+    (inputs
+     `(("open-zwave" ,open-zwave)
+       ("node-nan" ,node-nan)))
+    (native-inputs
+     `(("which" ,which)
+       ("python" ,python)
+       ("pkg-config" ,pkg-config)))
+    (build-system node-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (replace 'build
+           (lambda* (#:key inputs #:allow-other-keys)
+             (define node-dir
+               (assoc-ref inputs "node"))
+             (invoke (string-append node-dir "/bin/npx")
+                     "--call"
+                     (string-append
+                      node-dir
+                      "/lib/node_modules/npm/bin/node-gyp-bin/node-gyp"
+                      " "
+                      "rebuild")))))))
+    (home-page "https://github.com/OpenZWave/node-openzwave-shared")
+    (synopsis "Node.js bindings for OpenZWave")
+    (description
+     "With the @code{node-openzwave-shared} package, you can easily control
+and manage your Z-Wave devices (lights, dimmers, blinds, you name it) from
+within Node.js applications.  This library also supports secure
+devices (e.g. door locks) that require encryption.  All widely used Node.js
+versions are supported with the help of @code{node-nan}.
+
+This library is currently able to:
+@itemize @bullet
+@item
+scan a Z-Wave network and report on connected devices;
+@item
+write values to Z-Wave nodes;
+@item
+monitor the network for changes;
+@item
+heal nodes and/or the network; and
+@item
+perform management tasks: add or remove nodes, replace failed nodes,
+manage their group associations, etc.
+@end itemize")
+    (license license:isc)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 28/43] gnu: Add node-addon-api.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (26 preceding siblings ...)
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 27/43] gnu: Add node-openzwave-shared Philip McGrath
@ 2021-12-08 20:28                         ` Philip McGrath
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 29/43] gnu: Add node-sqlite3 Philip McGrath
                                           ` (15 subsequent siblings)
  43 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:28 UTC (permalink / raw)
  To: 51838

* gnu/packages/node-xyz.scm (node-addon-api): New variable.
---
 gnu/packages/node-xyz.scm | 63 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index ed169c0778..60dbfc163c 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -22,6 +22,9 @@
 
 (define-module (gnu packages node-xyz)
   #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (gnu packages sqlite)
+  #:use-module (gnu packages python)
+  #:use-module (guix gexp)
   #:use-module (guix packages)
   #:use-module (guix git-download)
   #:use-module (guix build-system node))
@@ -597,3 +600,63 @@ (define-public node-nan
 This project also contains some helper utilities that make addon development a
 bit more pleasant.")
     (license license:expat)))
+
+(define-public node-addon-api
+  (package
+    (name "node-addon-api")
+    (version "4.2.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nodejs/node-addon-api")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1bhvfi2m9nxfz418s619914vmidcnrzbjv6l9nid476c3zlpazch"))))
+    (inputs
+     `(("python" ,python)))
+    (build-system node-build-system)
+    (arguments
+     `(#:absent-dependencies
+       `("benchmark"
+         "bindings"
+         "clang-format"
+         "eslint"
+         "eslint-config-semistandard"
+         "eslint-config-standard"
+         "eslint-plugin-import"
+         "eslint-plugin-node"
+         "eslint-plugin-promise"
+         "fs-extra"
+         "path"
+         "pre-commit"
+         "safe-buffer")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'skip-js-tests
+           ;; We can't run the js-based tests,
+           ;; but we can still do the C++ parts
+           (lambda args
+             (substitute* "package.json"
+               (("\"test\": \"node test\"")
+                "\"test\": \"echo stopping after pretest on Guix\"")))))))
+    (home-page "https://github.com/nodejs/node-addon-api")
+    (synopsis "Node.js API (Node-API) header-only C++ wrappers")
+    (description "This module contains header-only C++ wrapper classes which
+simplify the use of the C based Node-API provided by Node.js when using C++.
+It provides a C++ object model and exception handling semantics with low
+overhead.
+
+Node-API is an ABI stable C interface provided by Node.js for building native
+addons.  It is intended to insulate native addons from changes in the
+underlying JavaScript engine and allow modules compiled for one version to run
+on later versions of Node.js without recompilation.  The @code{node-addon-api}
+module, which is not part of Node.js, preserves the benefits of the Node-API
+as it consists only of inline code that depends only on the stable API
+provided by Node-API.
+
+It is important to remember that @emph{other} Node.js interfaces such as
+@code{libuv} (included in a project via @code{#include <uv.h>}) are not
+ABI-stable across Node.js major versions.")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 29/43] gnu: Add node-sqlite3.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (27 preceding siblings ...)
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 28/43] gnu: Add node-addon-api Philip McGrath
@ 2021-12-08 20:28                         ` Philip McGrath
  2021-12-12 15:42                           ` Pierre Langlois
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 30/43] gnu: Add node-file-uri-to-path Philip McGrath
                                           ` (14 subsequent siblings)
  43 siblings, 1 reply; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:28 UTC (permalink / raw)
  To: 51838

* gnu/packages/node-xyz.scm (node-sqlite3): New variable.
---
 gnu/packages/node-xyz.scm | 118 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 115 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 60dbfc163c..b979d0cd53 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -615,7 +615,8 @@ (define-public node-addon-api
        (sha256
         (base32 "1bhvfi2m9nxfz418s619914vmidcnrzbjv6l9nid476c3zlpazch"))))
     (inputs
-     `(("python" ,python)))
+     `(("python" ,python)
+       ("node-safe-buffer" ,node-safe-buffer)))
     (build-system node-build-system)
     (arguments
      `(#:absent-dependencies
@@ -630,8 +631,7 @@ (define-public node-addon-api
          "eslint-plugin-promise"
          "fs-extra"
          "path"
-         "pre-commit"
-         "safe-buffer")
+         "pre-commit")
        #:phases
        (modify-phases %standard-phases
          (add-after 'unpack 'skip-js-tests
@@ -660,3 +660,115 @@ (define-public node-addon-api
 @code{libuv} (included in a project via @code{#include <uv.h>}) are not
 ABI-stable across Node.js major versions.")
     (license license:expat)))
+
+(define-public node-sqlite3
+  (package
+    (name "node-sqlite3")
+    (version "5.0.2")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/mapbox/node-sqlite3")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0sbbzzli282nxyfha10zx0k5m8hdp0sf3ipl59khjb7wm449j86h"))
+       (snippet
+        (with-imported-modules '((guix build utils))
+          #~(begin
+              (use-modules (guix build utils))
+              ;; unbundle sqlite
+              (for-each delete-file-recursively
+                        (find-files "deps"
+                                    (lambda (pth stat)
+                                      (gzip-file? pth)))))))))
+    (inputs
+     `(("node-addon-api" ,node-addon-api)
+       ("python" ,python)
+       ("sqlite" ,sqlite)))
+    (build-system node-build-system)
+    (arguments
+     `(#:tests?
+       #f ; FIXME: tests depend on node-mocha
+       #:modules
+       ((guix build node-build-system)
+        (guix build json)
+        (srfi srfi-1)
+        (ice-9 match)
+        (guix build utils))
+       #:absent-dependencies
+       `(;; Normally, this is "built" using @mapbox/node-pre-gyp,
+         ;; which publishes or downloads pre-built binaries
+         ;; or falls back to building from source.
+         ;; Here, we patch out all of that and just build directly.
+         ;; It would be better to patch a version of @mapbox/node-pre-gyp
+         ;; that always builds from source, as Debian does,
+         ;; but there are a number of dependencies that need
+         ;; to be packaged or removed.
+         "@mapbox/node-pre-gyp"
+         "node-pre-gyp" ;; deprecated name still used in some places
+         "aws-sdk"
+         "@mapbox/cloudfriend"
+         ;; Confusingly, this is only a dependency beceuse of
+         ;; @mapbox/node-pre-gyp: with that removed,
+         ;; npm will use its own copy:
+         "node-gyp"
+         ;; These we'd like, we just don't have them yet:
+         "eslint"
+         "mocha")
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'configure 'npm-config-sqlite
+           ;; We need this step even if we do replace @mapbox/node-pre-gyp
+           ;; because the package expects to build its bundled sqlite
+           (lambda* (#:key inputs #:allow-other-keys)
+             (setenv "npm_config_sqlite" (assoc-ref inputs "sqlite"))))
+         (add-after 'install 'patch-binding-path
+           (lambda* (#:key outputs #:allow-other-keys)
+             (with-directory-excursion
+                 (string-append (assoc-ref outputs "out")
+                                "/lib/node_modules/sqlite3/lib")
+               (match (find-files "binding" "\\.node$")
+                 ((rel-path)
+                  (with-atomic-file-replacement "sqlite3-binding.js"
+                    (lambda (in out)
+                      (format out "var binding = require('./~a');\n" rel-path)
+                      (display "module.exports = exports = binding;\n" out))))))))
+         (add-after 'patch-dependencies 'avoid-node-pre-gyp
+           (lambda args
+             (substitute* ".npmignore"
+               (("lib/binding")
+                "#lib/binding # <- patched for Guix"))
+             (with-atomic-file-replacement "package.json"
+               (lambda (in out)
+                 (let* ((js (read-json in))
+                        (alist (match js
+                                 (('@ . alist) alist)))
+                        (scripts-alist (match (assoc-ref alist "scripts")
+                                         (('@ . alist) alist)))
+                        (scripts-alist
+                         ;; install script would use node-pre-gyp
+                         (assoc-remove! scripts-alist "install"))
+                        (alist
+                         (assoc-set! alist "scripts" (cons '@ scripts-alist)))
+                        (binary-alist (match (assoc-ref alist "binary")
+                                        (('@ . alist) alist)))
+                        (js (cons '@ alist)))
+                   ;; compensate for lack of @mapbox/node-pre-gyp
+                   (setenv "GYP_DEFINES"
+                           (string-append
+                            "module_name="
+                            (assoc-ref binary-alist "module_name")
+                            " "
+                            "module_path="
+                            (assoc-ref binary-alist "module_path")))
+                   (write-json js
+                               out)))))))))
+    (home-page "https://github.com/mapbox/node-sqlite3")
+    (synopsis "Asynchronous, non-blocking SQLite3 bindings for Node.js")
+    (description
+     "The Node.js add-on @code{node-sqlite3} provides a set of a asynchronous,
+non-blocking bindings for SQLite3, written in modern C++ and tested for memory
+leaks.")
+     (license license:bsd-3)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 30/43] gnu: Add node-file-uri-to-path.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (28 preceding siblings ...)
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 29/43] gnu: Add node-sqlite3 Philip McGrath
@ 2021-12-08 20:28                         ` Philip McGrath
  2021-12-12 16:26                           ` Pierre Langlois
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 31/43] gnu: Add node-bindings Philip McGrath
                                           ` (13 subsequent siblings)
  43 siblings, 1 reply; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:28 UTC (permalink / raw)
  To: 51838

* gnu/packages/node-xyz.scm (node-file-uri-to-path): New variable.
---
 gnu/packages/node-xyz.scm | 54 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index b979d0cd53..d23326fa25 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -24,6 +24,7 @@ (define-module (gnu packages node-xyz)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (gnu packages sqlite)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages web)
   #:use-module (guix gexp)
   #:use-module (guix packages)
   #:use-module (guix git-download)
@@ -772,3 +773,56 @@ (define-public node-sqlite3
 non-blocking bindings for SQLite3, written in modern C++ and tested for memory
 leaks.")
      (license license:bsd-3)))
+
+(define-public node-file-uri-to-path
+  (package
+    (name "node-file-uri-to-path")
+    (version "2.0.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/TooTallNate/file-uri-to-path")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "08l779az44czm12xdhgcrnzpqw34s59hbrlfphs7g9y2k26drqav"))))
+    (native-inputs
+     `(("esbuild" ,esbuild)))
+    (build-system node-build-system)
+    (arguments
+     `(#:absent-dependencies
+       `("@types/mocha"
+         "@types/node"
+         "@typescript-eslint/eslint-plugin"
+         "@typescript-eslint/parser"
+         "cpy-cli"
+         "eslint"
+         "eslint-config-airbnb"
+         "eslint-config-prettier"
+         "eslint-import-resolver-typescript"
+         "eslint-plugin-import"
+         "eslint-plugin-jsx-a11y"
+         "eslint-plugin-react"
+         "mocha"
+         "rimraf"
+         "typescript")
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'build
+           (lambda* (#:key inputs native-inputs #:allow-other-keys)
+             (copy-recursively "src" "dist")
+             (invoke (string-append
+                      (assoc-ref (or native-inputs inputs) "esbuild")
+                      "/bin/esbuild")
+                     "dist/index.ts"
+                     "--outfile=dist/src/index.js"
+                     "--format=cjs"
+                     "--sourcemap"
+                     "--platform=node"))))
+       #:tests? #f))
+    (home-page "https://github.com/TooTallNate/file-uri-to-path")
+    (synopsis "Convert a @code{file:} URI to a file path")
+    (description "Accepts a @code{file:} URI and returns a regular file path
+suitable for use with the @code{fs} module functions.")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 31/43] gnu: Add node-bindings.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (29 preceding siblings ...)
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 30/43] gnu: Add node-file-uri-to-path Philip McGrath
@ 2021-12-08 20:28                         ` Philip McGrath
  2021-12-12 15:57                           ` Pierre Langlois
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 32/43] gnu: Add node-segfault-handler Philip McGrath
                                           ` (12 subsequent siblings)
  43 siblings, 1 reply; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:28 UTC (permalink / raw)
  To: 51838

* gnu/packages/node-xyz.scm (node-bindings): New variable.
---
 gnu/packages/node-xyz.scm | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index d23326fa25..196fa55a39 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -826,3 +826,33 @@ (define-public node-file-uri-to-path
     (description "Accepts a @code{file:} URI and returns a regular file path
 suitable for use with the @code{fs} module functions.")
     (license license:expat)))
+
+(define-public node-bindings
+  (package
+    (name "node-bindings")
+    (version "1.5.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/TooTallNate/node-bindings")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "100gp6kpjvd4j1dqnp0sbjr1hqx5mz7r61q9qy527jyhk9mj47wk"))))
+    (inputs
+     `(("node-file-uri-to-path" ,node-file-uri-to-path)))
+    (build-system node-build-system)
+    (arguments
+     ;; there are no tests
+     `(#:tests? #f))
+    (home-page "https://github.com/TooTallNate/node-bindings")
+    (synopsis "Help for loading your native module's @code{.node} file")
+    (description "Throughout the course of Node's native addon history, addons
+have ended up being compiled in a variety of different places, depending on
+which build tool and which version of @code{node} was used.  To make matters
+worse, now the @code{gyp} build tool can produce either a @code{Release} or
+@code{Debug} build, each being built into different locations.  This module
+checks @emph{all} the possible locations that a native addon would be built
+at, and returns the first one that loads successfully.")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 32/43] gnu: Add node-segfault-handler.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (30 preceding siblings ...)
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 31/43] gnu: Add node-bindings Philip McGrath
@ 2021-12-08 20:28                         ` Philip McGrath
  2021-12-12 16:31                           ` Pierre Langlois
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 33/43] gnu: Add node-serialport-binding-abstract Philip McGrath
                                           ` (11 subsequent siblings)
  43 siblings, 1 reply; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:28 UTC (permalink / raw)
  To: 51838

* gnu/packages/node-xyz.scm (node-segfault-handler): New variable.
---
 gnu/packages/node-xyz.scm | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 196fa55a39..27506062ba 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -856,3 +856,38 @@ (define-public node-bindings
 checks @emph{all} the possible locations that a native addon would be built
 at, and returns the first one that loads successfully.")
     (license license:expat)))
+
+(define-public node-segfault-handler
+  (package
+    (name "node-segfault-handler")
+    (version "1.3.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/ddopson/node-segfault-handler")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "07nbw35wvrr18kmh8f388v4k5mpjgyy0260bx0xzjdv795i3xvfv"))))
+    (native-inputs
+     `(("python" ,python)))
+    (inputs
+     `(("node-bindings" ,node-bindings)
+       ("node-nan" ,node-nan)))
+    (build-system node-build-system)
+    (arguments
+     ;; there are no tests
+     `(#:tests? #f))
+    (home-page "https://github.com/ddopson/node-segfault-handler")
+    (synopsis "Catches @code{SIGSEGV} and prints diagnostic information")
+    (description "This package is a tool for debugging Node.js C/C++ native
+code modules, and is safe to use in production environments.  Normally, when a
+bug is triggered in native code, the @code{node} process simply ends with no
+helpful information.  In production, this can manifest as worker processes
+restarting for seemingly no reason.  Running @code{node} in @code{gdb} is
+messy and infeasible for a production environment.  Instead, this module will
+sit unobtrusively doing nothing (zero perf impact) as long as Node.js is
+well-behaved.  If a @code{SIGSEGV} signal is raised, the module will print a
+native stack trace to both STDERR and to a timestamped file.")
+    (license license:bsd-3)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 33/43] gnu: Add node-serialport-binding-abstract.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (31 preceding siblings ...)
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 32/43] gnu: Add node-segfault-handler Philip McGrath
@ 2021-12-08 20:28                         ` Philip McGrath
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 34/43] gnu: Add node-serialport-parser-delimiter Philip McGrath
                                           ` (10 subsequent siblings)
  43 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:28 UTC (permalink / raw)
  To: 51838

* gnu/packages/node-xyz.scm (node-serialport-binding-abstract): New variable.
---
 gnu/packages/node-xyz.scm | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 27506062ba..69182ffcbf 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -891,3 +891,37 @@ (define-public node-segfault-handler
 well-behaved.  If a @code{SIGSEGV} signal is raised, the module will print a
 native stack trace to both STDERR and to a timestamped file.")
     (license license:bsd-3)))
+
+(define-public node-serialport-binding-abstract
+  (package
+    (name "node-serialport-binding-abstract")
+    (version "9.2.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/serialport/node-serialport")
+             (commit "v9.2.7")))
+       (file-name (git-file-name "serialport-monorepo" version))
+       (sha256
+        (base32 "0x7zm59a5ff5yygjyw15xs3r5m3rb8av1yfrh4snn44mrwq87yg8"))))
+    (build-system node-build-system)
+    (arguments
+     `(#:absent-dependencies
+       `("debug")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/binding-abstract"))))
+       #:tests? #f))
+    (home-page "https://serialport.io")
+    (synopsis "Abstract base class for Node SerialPort bindings")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+This package provides the @code{AbstractBinding} class, the base for all Node
+SerialPort bindings.  You wouldn't use this class directly, but instead extend
+it to make a new binding for a different platform or underling technology.")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 34/43] gnu: Add node-serialport-parser-delimiter.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (32 preceding siblings ...)
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 33/43] gnu: Add node-serialport-binding-abstract Philip McGrath
@ 2021-12-08 20:28                         ` Philip McGrath
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 35/43] gnu: Add node-serialport-parser-readling Philip McGrath
                                           ` (9 subsequent siblings)
  43 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:28 UTC (permalink / raw)
  To: 51838

* gnu/packages/node-xyz.scm (node-serialport-parser-delimiter): New
variable.
---
 gnu/packages/node-xyz.scm | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 69182ffcbf..394ddb28a5 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -925,3 +925,24 @@ (define-public node-serialport-binding-abstract
 SerialPort bindings.  You wouldn't use this class directly, but instead extend
 it to make a new binding for a different platform or underling technology.")
     (license license:expat)))
+
+(define-public node-serialport-parser-delimiter
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-delimiter")
+    (version "9.2.4")
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-delimiter"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser to split data on a delimiter")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{Delimiter}, a parser that emits data
+each time a specified byte sequence is received.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 35/43] gnu: Add node-serialport-parser-readling.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (33 preceding siblings ...)
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 34/43] gnu: Add node-serialport-parser-delimiter Philip McGrath
@ 2021-12-08 20:28                         ` Philip McGrath
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 36/43] gnu: Add node-serialport-bindings Philip McGrath
                                           ` (8 subsequent siblings)
  43 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:28 UTC (permalink / raw)
  To: 51838

* gnu/packages/node-xyz.scm (node-serialport-parser-readline): New
variable.
---
 gnu/packages/node-xyz.scm | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 394ddb28a5..495fc6f854 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -946,3 +946,27 @@ (define-public node-serialport-parser-delimiter
 Parsers are used to take raw binary data and transform them into usable
 messages.  This package provides @code{Delimiter}, a parser that emits data
 each time a specified byte sequence is received.")))
+
+(define-public node-serialport-parser-readline
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-readline")
+    (version "9.2.4")
+    (inputs
+     `(("node-serialport-parser-delimiter"
+        ,node-serialport-parser-delimiter)))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-readline"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser to split data on newlines")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{Readline}, a parser that emits data
+after a (configurable) newline delimiter is received.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 36/43] gnu: Add node-serialport-bindings.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (34 preceding siblings ...)
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 35/43] gnu: Add node-serialport-parser-readling Philip McGrath
@ 2021-12-08 20:28                         ` Philip McGrath
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 37/43] gnu: Add node-serialport-parser-regex Philip McGrath
                                           ` (7 subsequent siblings)
  43 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:28 UTC (permalink / raw)
  To: 51838

* gnu/packages/node-xyz.scm (node-serialport-bindings): New variable.
---
 gnu/packages/node-xyz.scm | 56 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 495fc6f854..a60ec33506 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -970,3 +970,59 @@ (define-public node-serialport-parser-readline
 Parsers are used to take raw binary data and transform them into usable
 messages.  This package provides @code{Readline}, a parser that emits data
 after a (configurable) newline delimiter is received.")))
+
+(define-public node-serialport-bindings
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-bindings")
+    (version "9.2.7")
+    (native-inputs
+     `(("python" ,python)))
+    (inputs
+     `(("node-nan" ,node-nan)
+       ("node-bindings" ,node-bindings)
+       ("node-serialport-binding-abstract" ,node-serialport-binding-abstract)
+       ("node-serialport-parser-readline" ,node-serialport-parser-readline)))
+    (arguments
+     `(#:absent-dependencies
+       `("debug"
+         "prebuild-install"
+         ;; devDependencies
+         "@serialport/binding-mock"
+         "node-abi")
+       #:modules
+       ((guix build node-build-system)
+        (guix build json)
+        (srfi srfi-1)
+        (ice-9 match)
+        (guix build utils))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/bindings")))
+         (add-after 'chdir 'avoid-prebuild-install
+           (lambda args
+             (with-atomic-file-replacement "package.json"
+               (lambda (in out)
+                 (match (read-json in)
+                   (('@ . meta-alist)
+                    (match (assoc-ref meta-alist "scripts")
+                      (('@ . scripts-alist)
+                       (write-json
+                        (cons '@ (assoc-set!
+                                  meta-alist
+                                  "scripts"
+                                  (cons '@ (assoc-remove! scripts-alist
+                                                          "install"))))
+                        out))))))))))
+       #:tests? #f))
+    (synopsis "Abstract base class for Node SerialPort bindings")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+This package provides the @code{Binding} class, which uses a native addon to
+talk to the underlying system.  You never have to use @code{Binding} objects
+directly.  There is also a @code{MockBinding} available (but not yet packaged
+for Guix) to assist with testing.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 37/43] gnu: Add node-serialport-parser-regex.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (35 preceding siblings ...)
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 36/43] gnu: Add node-serialport-bindings Philip McGrath
@ 2021-12-08 20:28                         ` Philip McGrath
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 38/43] gnu: Add node-serialport-parser-ready Philip McGrath
                                           ` (6 subsequent siblings)
  43 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:28 UTC (permalink / raw)
  To: 51838

* gnu/packages/node-xyz.scm (node-serialport-parser-regex): New variable.
---
 gnu/packages/node-xyz.scm | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index a60ec33506..409dfaf38c 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1026,3 +1026,24 @@ (define-public node-serialport-bindings
 talk to the underlying system.  You never have to use @code{Binding} objects
 directly.  There is also a @code{MockBinding} available (but not yet packaged
 for Guix) to assist with testing.")))
+
+(define-public node-serialport-parser-regex
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-regex")
+    (version "9.2.4")
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-regex"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser to split data on a regular expression")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{Regex}, a parser that uses a regular
+expression to split the incoming text.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 38/43] gnu: Add node-serialport-parser-ready.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (36 preceding siblings ...)
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 37/43] gnu: Add node-serialport-parser-regex Philip McGrath
@ 2021-12-08 20:28                         ` Philip McGrath
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 39/43] gnu: Add node-serialport-parser-inter-byte-timeout Philip McGrath
                                           ` (5 subsequent siblings)
  43 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:28 UTC (permalink / raw)
  To: 51838

* gnu/packages/node-xyz.scm (node-serialport-parser-ready): New variable.
---
 gnu/packages/node-xyz.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 409dfaf38c..d78d4610f4 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1047,3 +1047,25 @@ (define-public node-serialport-parser-regex
 Parsers are used to take raw binary data and transform them into usable
 messages.  This package provides @code{Regex}, a parser that uses a regular
 expression to split the incoming text.")))
+
+(define-public node-serialport-parser-ready
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-ready")
+    (version "9.2.4")
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-ready"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser to wait for specified byte sequence")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{Ready}, a parser that waits for a
+specified sequence of ``ready'' bytes before emitting a ready event and
+emitting data events.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 39/43] gnu: Add node-serialport-parser-inter-byte-timeout.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (37 preceding siblings ...)
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 38/43] gnu: Add node-serialport-parser-ready Philip McGrath
@ 2021-12-08 20:28                         ` Philip McGrath
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 40/43] gnu: Add node-serialport-parser-cctalk Philip McGrath
                                           ` (4 subsequent siblings)
  43 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:28 UTC (permalink / raw)
  To: 51838

* gnu/packages/node-xyz.scm
(node-serialport-parser-inter-byte-timeout): New variable.
---
 gnu/packages/node-xyz.scm | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index d78d4610f4..8715765003 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1069,3 +1069,24 @@ (define-public node-serialport-parser-ready
 messages.  This package provides @code{Ready}, a parser that waits for a
 specified sequence of ``ready'' bytes before emitting a ready event and
 emitting data events.")))
+
+(define-public node-serialport-parser-inter-byte-timeout
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-inter-byte-timeout")
+    (version "9.2.4")
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-inter-byte-timeout"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser to detect pauses in data")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{InterByteTimeout}, a parser that emits
+data if there is a pause between packets for the specified amount of time.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 40/43] gnu: Add node-serialport-parser-cctalk.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (38 preceding siblings ...)
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 39/43] gnu: Add node-serialport-parser-inter-byte-timeout Philip McGrath
@ 2021-12-08 20:28                         ` Philip McGrath
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 41/43] gnu: Add node-serialport-parser-byte-length Philip McGrath
                                           ` (3 subsequent siblings)
  43 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:28 UTC (permalink / raw)
  To: 51838

* gnu/packages/node-xyz.scm (node-serialport-parser-cctalk): New variable.
---
 gnu/packages/node-xyz.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 8715765003..7f59b0f987 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1090,3 +1090,25 @@ (define-public node-serialport-parser-inter-byte-timeout
 Parsers are used to take raw binary data and transform them into usable
 messages.  This package provides @code{InterByteTimeout}, a parser that emits
 data if there is a pause between packets for the specified amount of time.")))
+
+(define-public node-serialport-parser-cctalk
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-cctalk")
+    (version "9.2.4")
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-cctalk"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser for the ccTalk protocol")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{CCTalk}, which emits packets for the
+ccTalk protocol (an open standard for currency detectors) as they are
+received.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 41/43] gnu: Add node-serialport-parser-byte-length.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (39 preceding siblings ...)
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 40/43] gnu: Add node-serialport-parser-cctalk Philip McGrath
@ 2021-12-08 20:28                         ` Philip McGrath
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 42/43] gnu: Add node-serialport-stream Philip McGrath
                                           ` (2 subsequent siblings)
  43 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:28 UTC (permalink / raw)
  To: 51838

* gnu/packages/node-xyz.scm (node-serialport-parser-byte-length): New
variable.
---
 gnu/packages/node-xyz.scm | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 7f59b0f987..3722f90e3b 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1112,3 +1112,24 @@ (define-public node-serialport-parser-cctalk
 messages.  This package provides @code{CCTalk}, which emits packets for the
 ccTalk protocol (an open standard for currency detectors) as they are
 received.")))
+
+(define-public node-serialport-parser-byte-length
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-byte-length")
+    (version "9.2.4")
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-byte-length"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser for fixed-length buffers")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{ByteLength}, a parser that emits data
+as a buffer every time a specified number of bytes are received.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 42/43] gnu: Add node-serialport-stream.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (40 preceding siblings ...)
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 41/43] gnu: Add node-serialport-parser-byte-length Philip McGrath
@ 2021-12-08 20:28                         ` Philip McGrath
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 43/43] gnu: Add node-serialport Philip McGrath
  2021-12-12 16:01                         ` [bug#51838] [PATCH v3 00/43] guix: node-build-system: Support compiling add-ons with node-gyp Pierre Langlois
  43 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:28 UTC (permalink / raw)
  To: 51838

* gnu/packages/node-xyz.scm (node-serialport-stream): New variable.
---
 gnu/packages/node-xyz.scm | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 3722f90e3b..904c0be89d 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1133,3 +1133,29 @@ (define-public node-serialport-parser-byte-length
 Parsers are used to take raw binary data and transform them into usable
 messages.  This package provides @code{ByteLength}, a parser that emits data
 as a buffer every time a specified number of bytes are received.")))
+
+(define-public node-serialport-stream
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-stream")
+    (version "9.2.4")
+    (arguments
+     `(#:absent-dependencies
+       `("debug"
+         ;; devDependencies
+         "@serialport/binding-mock")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/stream"))))
+       #:tests? #f))
+    (synopsis "Node.js stream interface for Node SerialPort")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+This package provides an interface for using Node SerialPort bindings via the
+Node.js Stream API.  The stream is a duplex stream, allowing for reading and
+writing.  It has additional methods for managing the SerialPort
+connection.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 43/43] gnu: Add node-serialport.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (41 preceding siblings ...)
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 42/43] gnu: Add node-serialport-stream Philip McGrath
@ 2021-12-08 20:28                         ` Philip McGrath
  2021-12-12 16:01                         ` [bug#51838] [PATCH v3 00/43] guix: node-build-system: Support compiling add-ons with node-gyp Pierre Langlois
  43 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-08 20:28 UTC (permalink / raw)
  To: 51838

* gnu/packages/node-xyz.scm (node-serialport): New variable.
---
 gnu/packages/node-xyz.scm | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 904c0be89d..03bc250132 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1159,3 +1159,36 @@ (define-public node-serialport-stream
 Node.js Stream API.  The stream is a duplex stream, allowing for reading and
 writing.  It has additional methods for managing the SerialPort
 connection.")))
+
+(define-public node-serialport
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport")
+    (version "9.2.7")
+    (inputs
+     `(("node-serialport-bindings" ,node-serialport-bindings)
+       ("node-serialport-parser-delimiter" ,node-serialport-parser-delimiter)
+       ("node-serialport-parser-readline" ,node-serialport-parser-readline)
+       ("node-serialport-parser-regex" ,node-serialport-parser-regex)
+       ("node-serialport-parser-ready" ,node-serialport-parser-ready)
+       ("node-serialport-parser-inter-byte-timeout"
+        ,node-serialport-parser-inter-byte-timeout)
+       ("node-serialport-parser-cctalk" ,node-serialport-parser-cctalk)
+       ("node-serialport-parser-byte-length"
+        ,node-serialport-parser-byte-length)
+       ("node-serialport-stream" ,node-serialport-stream)))
+    (arguments
+     `(#:absent-dependencies
+       `("@serialport/binding-mock"
+         "debug")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/serialport"))))
+       #:tests? #f))
+    (synopsis "Node.js package to access serial ports")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  This package is the recommended entry point for most
+projects.  It combines a high-level Node.js stream interface with a useful
+default set of parsers and bindings.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 04/43] gnu: node: Add an npmrc file to set nodedir.
  2021-12-08 20:27                         ` [bug#51838] [PATCH v3 04/43] gnu: node: Add an npmrc file to set nodedir Philip McGrath
@ 2021-12-12 15:19                           ` Pierre Langlois
  2021-12-12 20:19                             ` Philip McGrath
  0 siblings, 1 reply; 458+ messages in thread
From: Pierre Langlois @ 2021-12-12 15:19 UTC (permalink / raw)
  To: Philip McGrath; +Cc: 51838

[-- Attachment #1: Type: text/plain, Size: 2529 bytes --]


Philip McGrath <philip@philipmcgrath.com> writes:

> * gnu/packages/node.scm (node, node-lts)[arguments]: Add a phase
> 'install-npmrc to create a "built-in" npmrc file that configures
> "nodedir" to point to the output store path.
> (libnode)[arguments]: Delete the 'install-npmrc phase.
> ---
>  gnu/packages/node.scm | 17 ++++++++++++++++-
>  1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
> index a57a74fb81..0f67fe79c2 100644
> --- a/gnu/packages/node.scm
> +++ b/gnu/packages/node.scm
> @@ -250,7 +250,21 @@ (define-public node
>                  (find-files (string-append prefix "/lib/node_modules")
>                              (lambda (file stat)
>                                (executable-file? file))
> -                            #:stat lstat))))))))
> +                            #:stat lstat)))))
> +         (add-after 'install 'install-npmrc
> +           (lambda* (#:key outputs #:allow-other-keys)
> +             (let* ((out (assoc-ref outputs "out")))
> +               (with-output-to-file
> +                   ;; Use the config file "primarily for distribution
> +                   ;; maintainers" rather than "{prefix}/etc/npmrc",
> +                   ;; especially because node-build-system uses --prefix
> +                   ;; to install things to their store paths:
> +                   (string-append out "/lib/node_modules/npm/npmrc")
> +                 (lambda ()
> +                   ;; Tell npm (mostly node-gyp) where to find our
> +                   ;; installed headers so it doesn't try to
> +                   ;; download them from the internet:
> +                   (format #t "nodedir=~a\n" out)))))))))

When I run `node-gyp configure' in my tree-sitter packages, it's not
able to find the node dir and tries to download headers. So I need to
set `npm_config_nodedir' manually, like so:

--8<---------------cut here---------------start------------->8---
(add-after 'configure 'configure-gyp
  (lambda* (#:key inputs #:allow-other-keys)
    (let ((node (assoc-ref inputs "node")))
      (setenv "npm_config_nodedir" node)
      (invoke
        (string-append
          node
          "/lib/node_modules/npm/bin/node-gyp-bin/node-gyp")
        "configure"))))
--8<---------------cut here---------------end--------------->8---

I'm wondering if the npmrc approach here is working properly? I see in
another patch you've used the `npx' command to run `node-gyp rebuild',
should I be using that?

Thanks,
Pierre

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 519 bytes --]

^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 06/43] guix: node-build-system: Add #:absent-dependencies argument.
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 06/43] guix: node-build-system: Add #:absent-dependencies argument Philip McGrath
@ 2021-12-12 15:31                           ` Pierre Langlois
  2021-12-12 20:22                             ` Philip McGrath
  0 siblings, 1 reply; 458+ messages in thread
From: Pierre Langlois @ 2021-12-12 15:31 UTC (permalink / raw)
  To: Philip McGrath; +Cc: 51838

[-- Attachment #1: Type: text/plain, Size: 875 bytes --]


Philip McGrath <philip@philipmcgrath.com> writes:

> * guix/build-system/node.scm (lower, node-build): Add optional
> argument #:absent-dependencies with default of ''(). Pass it on
> to the build-side code.
> * guix/build/node-build-system.scm (patch-dependencies): Respect
> the #:absent-dependencies argument, removing specified npm
> packages from the "dependencies" or "devDependencies" tables
> in "package.json".

Nice, I like this new option, I've needed this functionnality before as
well. For instance I've seen dependencies like "prebuild-install" [0]
for which the whole purepose is to download binaries instead of building
them... in Guix we always want to remove those dependencies.

I'd suggest to add documentation for this new option in the manual, but
that could be done as a follow-up.

[0]: https://www.npmjs.com/package/prebuild-install

Thanks,
Pierre

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 519 bytes --]

^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 29/43] gnu: Add node-sqlite3.
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 29/43] gnu: Add node-sqlite3 Philip McGrath
@ 2021-12-12 15:42                           ` Pierre Langlois
  2021-12-12 21:18                             ` Philip McGrath
  0 siblings, 1 reply; 458+ messages in thread
From: Pierre Langlois @ 2021-12-12 15:42 UTC (permalink / raw)
  To: Philip McGrath; +Cc: 51838


Philip McGrath <philip@philipmcgrath.com> writes:

> * gnu/packages/node-xyz.scm (node-sqlite3): New variable.
> ---
>  gnu/packages/node-xyz.scm | 118 +++++++++++++++++++++++++++++++++++++-
>  1 file changed, 115 insertions(+), 3 deletions(-)
>
> diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
> index 60dbfc163c..b979d0cd53 100644
> --- a/gnu/packages/node-xyz.scm
> +++ b/gnu/packages/node-xyz.scm
> @@ -615,7 +615,8 @@ (define-public node-addon-api
>         (sha256
>          (base32 "1bhvfi2m9nxfz418s619914vmidcnrzbjv6l9nid476c3zlpazch"))))
>      (inputs
> -     `(("python" ,python)))
> +     `(("python" ,python)
> +       ("node-safe-buffer" ,node-safe-buffer)))
>      (build-system node-build-system)
>      (arguments
>       `(#:absent-dependencies
> @@ -630,8 +631,7 @@ (define-public node-addon-api
>           "eslint-plugin-promise"
>           "fs-extra"
>           "path"
> -         "pre-commit"
> -         "safe-buffer")
> +         "pre-commit")
>         #:phases
>         (modify-phases %standard-phases
>           (add-after 'unpack 'skip-js-tests

nit: Did you mean to include these changes in this patch? It seems they
should be part of the node-addon-api patch.

> @@ -660,3 +660,115 @@ (define-public node-addon-api
>  @code{libuv} (included in a project via @code{#include <uv.h>}) are not
>  ABI-stable across Node.js major versions.")
>      (license license:expat)))
> +
> +(define-public node-sqlite3
> +  (package
> +    (name "node-sqlite3")
> +    (version "5.0.2")
> +    (source
> +     (origin
> +       (method git-fetch)
> +       (uri (git-reference
> +             (url "https://github.com/mapbox/node-sqlite3")
> +             (commit (string-append "v" version))))
> +       (file-name (git-file-name name version))
> +       (sha256
> +        (base32 "0sbbzzli282nxyfha10zx0k5m8hdp0sf3ipl59khjb7wm449j86h"))
> +       (snippet
> +        (with-imported-modules '((guix build utils))
> +          #~(begin
> +              (use-modules (guix build utils))
> +              ;; unbundle sqlite
> +              (for-each delete-file-recursively
> +                        (find-files "deps"
> +                                    (lambda (pth stat)
> +                                      (gzip-file? pth)))))))))
> +    (inputs
> +     `(("node-addon-api" ,node-addon-api)
> +       ("python" ,python)
> +       ("sqlite" ,sqlite)))
> +    (build-system node-build-system)
> +    (arguments
> +     `(#:tests?
> +       #f ; FIXME: tests depend on node-mocha
> +       #:modules
> +       ((guix build node-build-system)
> +        (guix build json)
> +        (srfi srfi-1)
> +        (ice-9 match)
> +        (guix build utils))
> +       #:absent-dependencies
> +       `(;; Normally, this is "built" using @mapbox/node-pre-gyp,
> +         ;; which publishes or downloads pre-built binaries
> +         ;; or falls back to building from source.
> +         ;; Here, we patch out all of that and just build directly.
> +         ;; It would be better to patch a version of @mapbox/node-pre-gyp
> +         ;; that always builds from source, as Debian does,
> +         ;; but there are a number of dependencies that need
> +         ;; to be packaged or removed.
> +         "@mapbox/node-pre-gyp"
> +         "node-pre-gyp" ;; deprecated name still used in some places
> +         "aws-sdk"
> +         "@mapbox/cloudfriend"
> +         ;; Confusingly, this is only a dependency beceuse of

typo: beceuse -> because

> +         ;; @mapbox/node-pre-gyp: with that removed,
> +         ;; npm will use its own copy:
> +         "node-gyp"
> +         ;; These we'd like, we just don't have them yet:
> +         "eslint"
> +         "mocha")
> +       #:phases
> +       (modify-phases %standard-phases
> +         (add-before 'configure 'npm-config-sqlite
> +           ;; We need this step even if we do replace @mapbox/node-pre-gyp
> +           ;; because the package expects to build its bundled sqlite
> +           (lambda* (#:key inputs #:allow-other-keys)
> +             (setenv "npm_config_sqlite" (assoc-ref inputs "sqlite"))))
> +         (add-after 'install 'patch-binding-path
> +           (lambda* (#:key outputs #:allow-other-keys)
> +             (with-directory-excursion
> +                 (string-append (assoc-ref outputs "out")
> +                                "/lib/node_modules/sqlite3/lib")
> +               (match (find-files "binding" "\\.node$")
> +                 ((rel-path)
> +                  (with-atomic-file-replacement "sqlite3-binding.js"
> +                    (lambda (in out)
> +                      (format out "var binding = require('./~a');\n" rel-path)
> +                      (display "module.exports = exports = binding;\n" out))))))))
> +         (add-after 'patch-dependencies 'avoid-node-pre-gyp
> +           (lambda args
> +             (substitute* ".npmignore"
> +               (("lib/binding")
> +                "#lib/binding # <- patched for Guix"))

Would this substitute* be more suited to live in the 'patch-binding-path
phase?

> +             (with-atomic-file-replacement "package.json"
> +               (lambda (in out)
> +                 (let* ((js (read-json in))
> +                        (alist (match js
> +                                 (('@ . alist) alist)))
> +                        (scripts-alist (match (assoc-ref alist "scripts")
> +                                         (('@ . alist) alist)))
> +                        (scripts-alist
> +                         ;; install script would use node-pre-gyp
> +                         (assoc-remove! scripts-alist "install"))
> +                        (alist
> +                         (assoc-set! alist "scripts" (cons '@ scripts-alist)))
> +                        (binary-alist (match (assoc-ref alist "binary")
> +                                        (('@ . alist) alist)))
> +                        (js (cons '@ alist)))
> +                   ;; compensate for lack of @mapbox/node-pre-gyp
> +                   (setenv "GYP_DEFINES"
> +                           (string-append
> +                            "module_name="
> +                            (assoc-ref binary-alist "module_name")
> +                            " "
> +                            "module_path="
> +                            (assoc-ref binary-alist "module_path")))
> +                   (write-json js
> +                               out)))))))))

I was having a bit of a hard time understand this phase, let me know if
I have this right. We have this JSON input:

--8<---------------cut here---------------start------------->8---
"binary": {
  "module_name": "node_sqlite3",
  "module_path": "./lib/binding/napi-v{napi_build_version}-{platform}-{arch}",
  "host": "https://mapbox-node-binary.s3.amazonaws.com",
  "remote_path": "./{name}/v{version}/{toolset}/",
  "package_name": "napi-v{napi_build_version}-{platform}-{arch}.tar.gz",
  "napi_versions": [
    3
  ]
},

"scripts": {
  "install": "node-pre-gyp install --fallback-to-build",
  "pretest": "node test/support/createdb.js",
  "test": "mocha -R spec --timeout 480000",
  "pack": "node-pre-gyp package"
},
--8<---------------cut here---------------end--------------->8---

And we:

  - Read the "binary" entry to find the module_name and module_path to
    give to node-gyp, so we can use our own GYP instead of a bundled one.

  - Delete the "scripts.install" phase, it's not using the correct GYP.

Maybe a couple of comments would be helpful here :-).

> +    (home-page "https://github.com/mapbox/node-sqlite3")
> +    (synopsis "Asynchronous, non-blocking SQLite3 bindings for Node.js")
> +    (description
> +     "The Node.js add-on @code{node-sqlite3} provides a set of a asynchronous,
> +non-blocking bindings for SQLite3, written in modern C++ and tested for memory
> +leaks.")
> +     (license license:bsd-3)))

Otherwise this looks good to me!

Thanks,
Pierre




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 31/43] gnu: Add node-bindings.
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 31/43] gnu: Add node-bindings Philip McGrath
@ 2021-12-12 15:57                           ` Pierre Langlois
  2021-12-12 21:20                             ` Philip McGrath
  0 siblings, 1 reply; 458+ messages in thread
From: Pierre Langlois @ 2021-12-12 15:57 UTC (permalink / raw)
  To: Philip McGrath; +Cc: 51838


Philip McGrath <philip@philipmcgrath.com> writes:

> * gnu/packages/node-xyz.scm (node-bindings): New variable.
> ---
>  gnu/packages/node-xyz.scm | 30 ++++++++++++++++++++++++++++++
>  1 file changed, 30 insertions(+)
>
> diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
> index d23326fa25..196fa55a39 100644
> --- a/gnu/packages/node-xyz.scm
> +++ b/gnu/packages/node-xyz.scm
> @@ -826,3 +826,33 @@ (define-public node-file-uri-to-path
>      (description "Accepts a @code{file:} URI and returns a regular file path
>  suitable for use with the @code{fs} module functions.")
>      (license license:expat)))
> +
> +(define-public node-bindings
> +  (package
> +    (name "node-bindings")
> +    (version "1.5.0")
> +    (source
> +     (origin
> +       (method git-fetch)
> +       (uri (git-reference
> +             (url "https://github.com/TooTallNate/node-bindings")
> +             (commit version)))
> +       (file-name (git-file-name name version))
> +       (sha256
> +        (base32 "100gp6kpjvd4j1dqnp0sbjr1hqx5mz7r61q9qy527jyhk9mj47wk"))))
> +    (inputs
> +     `(("node-file-uri-to-path" ,node-file-uri-to-path)))
> +    (build-system node-build-system)
> +    (arguments
> +     ;; there are no tests
> +     `(#:tests? #f))
> +    (home-page "https://github.com/TooTallNate/node-bindings")
> +    (synopsis "Help for loading your native module's @code{.node} file")
> +    (description "Throughout the course of Node's native addon history, addons
> +have ended up being compiled in a variety of different places, depending on
> +which build tool and which version of @code{node} was used.  To make matters
> +worse, now the @code{gyp} build tool can produce either a @code{Release} or
> +@code{Debug} build, each being built into different locations.  This module
> +checks @emph{all} the possible locations that a native addon would be built
> +at, and returns the first one that loads successfully.")

I see the upstream description is prefaced with:

--8<---------------cut here---------------start------------->8---
This is a helper module for authors of Node.js native addon modules. It
is basically the "swiss army knife" of require()ing your native module's
.node file.
--8<---------------cut here---------------end--------------->8---

I'd suggest to just use this as the description, I'm not sure we need to
mention node's addon build system history here.

Otherwise LGTM!

Thanks,
Pierre




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 00/43] guix: node-build-system: Support compiling add-ons with node-gyp.
  2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
                                           ` (42 preceding siblings ...)
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 43/43] gnu: Add node-serialport Philip McGrath
@ 2021-12-12 16:01                         ` Pierre Langlois
  2021-12-12 16:36                           ` Pierre Langlois
  43 siblings, 1 reply; 458+ messages in thread
From: Pierre Langlois @ 2021-12-12 16:01 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht,
	Liliana Marie Prikler

[-- Attachment #1: Type: text/plain, Size: 1546 bytes --]

Hi Philip,

Philip McGrath <philip@philipmcgrath.com> writes:

> Hi!
>
> Here is a v3 of this patch series, hopefully incorporating all of the
> suggestions. In particular, as Timothy suggested
> in <https://issues.guix.gnu.org/51838#59>, I've tried to make sure the earlier
> patches, at least through #:absent-dependencies, are able to be applied even
> if there is more discussion needed on the later patches.
>
> As I mentioned in <https://issues.guix.gnu.org/51838#64>, while experimenting
> with v2 of this series, I discovered an issue with the install script
> automatically generated by npm. Patch 21 ``guix: node-build-system: Add
> avoid-node-gyp-rebuild phase.'' fixed the issue: I explain the details in
> comments there.
>
> This series also adds two additional leaf packages, `node-segfault-handler'
> and `node-serialport', that confirm these patches can support additional
> styles of native addons. In particular, because the native addon for
> `node-serialport' is actually in one of the intermediate packages,
> `node-serialport-bindings', it serves as a test case for the new
> `avoid-node-gyp-rebuild' phase.
>
> I've also put these patches up
> at <https://gitlab.com/philip1/guix-patches/-/tree/guix-issue-51838-v3>,
> if anyone finds that useful.

Thanks for working on this! I've tested the series and rebased my own
work on top locally, it's working for me so feel free to add:

Tested-by: Pierre Langlois <pierre.langlois@gmx.com>

The series looks good to me overall, I'll add comments in each patch.

Thanks,
Pierre

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 519 bytes --]

^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 20/43] guix: node-build-system: Add delete-lockfiles phase.
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 20/43] guix: node-build-system: Add delete-lockfiles phase Philip McGrath
@ 2021-12-12 16:09                           ` Pierre Langlois
  2021-12-12 21:26                             ` Philip McGrath
  0 siblings, 1 reply; 458+ messages in thread
From: Pierre Langlois @ 2021-12-12 16:09 UTC (permalink / raw)
  To: Philip McGrath; +Cc: 51838

[-- Attachment #1: Type: text/plain, Size: 3611 bytes --]


Philip McGrath <philip@philipmcgrath.com> writes:

> * guix/build/node-build-system.scm (delete-lockfiles): New function.
> Remove 'package-lock.json', 'yarn.lock', and 'npm-shrinkwrap.json',
> if they exist.  Because these files specify dependency both exact
> versions and integrity hashes, they only cause problems for Guix.
> (%standard-phases): Add 'delete-lockfiles' after 'patch-dependencies'.
> ---
>  gnu/packages/node.scm            | 12 ------------
>  guix/build/node-build-system.scm | 12 ++++++++++++
>  2 files changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
> index 6d48816c77..5289e2fe4f 100644
> --- a/gnu/packages/node.scm
> +++ b/gnu/packages/node.scm
> @@ -488,12 +488,6 @@ (define-public node-llparse-builder-bootstrap
>           "typescript")
>         #:phases
>         (modify-phases %standard-phases
> -         (add-before 'configure 'remove-package-lock
> -           ;; Having package-lock.json seems to cause npm
> -           ;; to look for things on the internet in the configure phase,
> -           ;; even if we have them properly installed.
> -           (lambda args
> -             (delete-file-recursively "package-lock.json")))
>           (replace 'build
>             (lambda* (#:key inputs #:allow-other-keys)
>               (let ((esbuild (string-append (assoc-ref inputs "esbuild")
> @@ -621,12 +615,6 @@ (define-public node-llparse-bootstrap
>           "typescript")
>         #:phases
>         (modify-phases %standard-phases
> -         (add-before 'configure 'remove-package-lock
> -           ;; Having package-lock.json seems to cause npm
> -           ;; to look for things on the internet in the configure phase,
> -           ;; even if we have them properly installed.
> -           (lambda args
> -             (delete-file-recursively "package-lock.json")))

These changes were added in this series right? I'd suggest to re-order
commits to have the build-system changes first so that they don't need
to be added at all.

>           (replace 'build
>             (lambda* (#:key inputs #:allow-other-keys)
>               (let ((esbuild (string-append (assoc-ref inputs "esbuild")
> diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
> index 249b3deee6..892104b6d2 100644
> --- a/guix/build/node-build-system.scm
> +++ b/guix/build/node-build-system.scm
> @@ -118,6 +118,17 @@ (define (resolve-dependencies meta-alist meta-key)
>          (write-json package-meta out))))
>    #t)
>  
> +(define* (delete-lockfiles #:key inputs #:allow-other-keys)
> +  "Delete 'package-lock.json', 'yarn.lock', and 'npm-shrinkwrap.json', if they
> +exist."
> +  (for-each (lambda (pth)
> +              (when (file-exists? pth)
> +                (delete-file pth)))
> +            '("package-lock.json"
> +              "yarn.lock"
> +              "npm-shrinkwrap.json"))
> +  #t)
> +
>  (define* (configure #:key outputs inputs #:allow-other-keys)
>    (let ((npm (string-append (assoc-ref inputs "node") "/bin/npm")))
>      (invoke npm "--offline" "--ignore-scripts" "install")
> @@ -168,6 +179,7 @@ (define %standard-phases
>    (modify-phases gnu:%standard-phases
>      (add-after 'unpack 'set-home set-home)
>      (add-before 'configure 'patch-dependencies patch-dependencies)
> +    (add-after 'patch-dependencies 'delete-lockfiles delete-lockfiles)
>      (replace 'configure configure)
>      (replace 'build build)
>      (replace 'check check)

Otherwise LGTM!

Thanks,
Pierre

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 519 bytes --]

^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 26/43] gnu: Add node-nan.
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 26/43] gnu: Add node-nan Philip McGrath
@ 2021-12-12 16:17                           ` Pierre Langlois
  2021-12-12 21:33                             ` Philip McGrath
  0 siblings, 1 reply; 458+ messages in thread
From: Pierre Langlois @ 2021-12-12 16:17 UTC (permalink / raw)
  To: Philip McGrath; +Cc: 51838

[-- Attachment #1: Type: text/plain, Size: 3077 bytes --]


Philip McGrath <philip@philipmcgrath.com> writes:

> * gnu/packages/node-xyz.scm (node-nan): New variable.
> ---
>  gnu/packages/node-xyz.scm | 44 +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 44 insertions(+)
>
> diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
> index 3e06413908..ed169c0778 100644
> --- a/gnu/packages/node-xyz.scm
> +++ b/gnu/packages/node-xyz.scm
> @@ -553,3 +553,47 @@ (define-public node-irc
>      (description "@code{node-irc} is an IRC client library for Node.js.
>  It has functions for joining, parting, talking, and many other IRC commands.")
>      (license license:gpl3+)))
> +
> +(define-public node-nan
> +  (package
> +    (name "node-nan")
> +    (version "2.15.0")
> +    (source
> +     (origin
> +       (method git-fetch)
> +       (uri (git-reference
> +             (url "https://github.com/nodejs/nan")
> +             (commit (string-append "v" version))))
> +       (file-name (git-file-name name version))
> +       (sha256
> +        (base32 "18xslh9va5ld872scrp5y4251ax9s3c6qh0lnl1200lpzbsxy7yd"))))
> +    (build-system node-build-system)
> +    (arguments
> +     `(#:tests?
> +       ;; tests need tap and other dependencies
> +       #f

Formatting nit, you can write this all in one line:

    #:tests? #f  ;; Tests need tap an other dependencies.

> +       #:absent-dependencies
> +       '("bindings"
> +         "commander"
> +         "glob"
> +         "request"
> +         "node-gyp" ;; would be needed for tests
> +         "tap"
> +         "xtend")))
> +    (inputs
> +     `(("readable-stream" ,node-readable-stream)))
> +    (home-page "https://github.com/nodejs/nan")
> +    (synopsis "Native Abstractions for Node.js")
> +    (description "A header file filled with macro and utility goodness for
> +making add-on development for Node.js easier across versions 0.8, 0.10, 0.12,
> +1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 and 16.

Given our packages only work with the node what Guix uses, you could
remove the version numbers from the description. Mostly because we
probalby won't think to update this description when future node
releases appear.

> +
> +Thanks to the crazy changes in V8 (and some in Node core), keeping native
> +addons compiling happily across versions, particularly 0.10 to 0.12 to 4.0, is
> +a minor nightmare.

I'd remove this sentence, it doesn't make much sense in Guix given we
don't support older versions.

> +The goal of this project is to store all logic necessary
> +to develop native Node.js addons without having to inspect
> +@code{NODE_MODULE_VERSION} and get yourself into a macro-tangle.
> +
> +This project also contains some helper utilities that make addon development a
> +bit more pleasant.")
> +    (license license:expat)))

Otherwise LGTM! I hope my comments make sense, I agree in general it's
good to keep our description the same as upstream. But I think it's OK
to reserve ourselves the right to tweak them a little bit, after all we
provide a "curated" set of packages, not a direct mirror IMO :-).

Thanks,
Pierre


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 519 bytes --]

^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 30/43] gnu: Add node-file-uri-to-path.
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 30/43] gnu: Add node-file-uri-to-path Philip McGrath
@ 2021-12-12 16:26                           ` Pierre Langlois
  2021-12-12 21:34                             ` Philip McGrath
  0 siblings, 1 reply; 458+ messages in thread
From: Pierre Langlois @ 2021-12-12 16:26 UTC (permalink / raw)
  To: Philip McGrath; +Cc: 51838

[-- Attachment #1: Type: text/plain, Size: 3312 bytes --]


Philip McGrath <philip@philipmcgrath.com> writes:

> * gnu/packages/node-xyz.scm (node-file-uri-to-path): New variable.
> ---
>  gnu/packages/node-xyz.scm | 54 +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 54 insertions(+)
>
> diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
> index b979d0cd53..d23326fa25 100644
> --- a/gnu/packages/node-xyz.scm
> +++ b/gnu/packages/node-xyz.scm
> @@ -24,6 +24,7 @@ (define-module (gnu packages node-xyz)
>    #:use-module ((guix licenses) #:prefix license:)
>    #:use-module (gnu packages sqlite)
>    #:use-module (gnu packages python)
> +  #:use-module (gnu packages web)
>    #:use-module (guix gexp)
>    #:use-module (guix packages)
>    #:use-module (guix git-download)
> @@ -772,3 +773,56 @@ (define-public node-sqlite3
>  non-blocking bindings for SQLite3, written in modern C++ and tested for memory
>  leaks.")
>       (license license:bsd-3)))
> +
> +(define-public node-file-uri-to-path
> +  (package
> +    (name "node-file-uri-to-path")
> +    (version "2.0.0")
> +    (source
> +     (origin
> +       (method git-fetch)
> +       (uri (git-reference
> +             (url "https://github.com/TooTallNate/file-uri-to-path")
> +             (commit version)))
> +       (file-name (git-file-name name version))
> +       (sha256
> +        (base32 "08l779az44czm12xdhgcrnzpqw34s59hbrlfphs7g9y2k26drqav"))))
> +    (native-inputs
> +     `(("esbuild" ,esbuild)))
> +    (build-system node-build-system)
> +    (arguments
> +     `(#:absent-dependencies
> +       `("@types/mocha"
> +         "@types/node"
> +         "@typescript-eslint/eslint-plugin"
> +         "@typescript-eslint/parser"
> +         "cpy-cli"
> +         "eslint"
> +         "eslint-config-airbnb"
> +         "eslint-config-prettier"
> +         "eslint-import-resolver-typescript"
> +         "eslint-plugin-import"
> +         "eslint-plugin-jsx-a11y"
> +         "eslint-plugin-react"
> +         "mocha"
> +         "rimraf"
> +         "typescript")
> +       #:phases
> +       (modify-phases %standard-phases
> +         (replace 'build
> +           (lambda* (#:key inputs native-inputs #:allow-other-keys)
> +             (copy-recursively "src" "dist")
> +             (invoke (string-append
> +                      (assoc-ref (or native-inputs inputs) "esbuild")
> +                      "/bin/esbuild")
> +                     "dist/index.ts"
> +                     "--outfile=dist/src/index.js"
> +                     "--format=cjs"
> +                     "--sourcemap"
> +                     "--platform=node"))))
> +       #:tests? #f))
> +    (home-page "https://github.com/TooTallNate/file-uri-to-path")
> +    (synopsis "Convert a @code{file:} URI to a file path")
> +    (description "Accepts a @code{file:} URI and returns a regular file path
> +suitable for use with the @code{fs} module functions.")

nit: We generally write description as full sentences, I'd suggest:

--8<---------------cut here---------------start------------->8---
This package provides a method to convert a @code{file:} URI to a file
path.  It accepts a @code{file:} URI and returns a regular file path
suitable for use with the @code{fs} module functions.
--8<---------------cut here---------------end--------------->8---

Otherwise LGTM!

Thanks,
Pierre

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 519 bytes --]

^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 32/43] gnu: Add node-segfault-handler.
  2021-12-08 20:28                         ` [bug#51838] [PATCH v3 32/43] gnu: Add node-segfault-handler Philip McGrath
@ 2021-12-12 16:31                           ` Pierre Langlois
  2021-12-12 21:38                             ` Philip McGrath
  0 siblings, 1 reply; 458+ messages in thread
From: Pierre Langlois @ 2021-12-12 16:31 UTC (permalink / raw)
  To: Philip McGrath; +Cc: 51838

[-- Attachment #1: Type: text/plain, Size: 2582 bytes --]


Philip McGrath <philip@philipmcgrath.com> writes:

> * gnu/packages/node-xyz.scm (node-segfault-handler): New variable.
> ---
>  gnu/packages/node-xyz.scm | 35 +++++++++++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
>
> diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
> index 196fa55a39..27506062ba 100644
> --- a/gnu/packages/node-xyz.scm
> +++ b/gnu/packages/node-xyz.scm
> @@ -856,3 +856,38 @@ (define-public node-bindings
>  checks @emph{all} the possible locations that a native addon would be built
>  at, and returns the first one that loads successfully.")
>      (license license:expat)))
> +
> +(define-public node-segfault-handler
> +  (package
> +    (name "node-segfault-handler")
> +    (version "1.3.0")
> +    (source
> +     (origin
> +       (method git-fetch)
> +       (uri (git-reference
> +             (url "https://github.com/ddopson/node-segfault-handler")
> +             (commit (string-append "v" version))))
> +       (file-name (git-file-name name version))
> +       (sha256
> +        (base32 "07nbw35wvrr18kmh8f388v4k5mpjgyy0260bx0xzjdv795i3xvfv"))))
> +    (native-inputs
> +     `(("python" ,python)))
> +    (inputs
> +     `(("node-bindings" ,node-bindings)
> +       ("node-nan" ,node-nan)))
> +    (build-system node-build-system)
> +    (arguments
> +     ;; there are no tests
> +     `(#:tests? #f))
> +    (home-page "https://github.com/ddopson/node-segfault-handler")
> +    (synopsis "Catches @code{SIGSEGV} and prints diagnostic information")
> +    (description "This package is a tool for debugging Node.js C/C++ native
> +code modules, and is safe to use in production environments.  Normally, when a
> +bug is triggered in native code, the @code{node} process simply ends with no
> +helpful information.  In production, this can manifest as worker processes
> +restarting for seemingly no reason.  Running @code{node} in @code{gdb} is
> +messy and infeasible for a production environment.  Instead, this module will
> +sit unobtrusively doing nothing (zero perf impact) as long as Node.js is
> +well-behaved.  If a @code{SIGSEGV} signal is raised, the module will print a
> +native stack trace to both STDERR and to a timestamped file.")

I'd suggest for the description to be a little more succint, maybe just:

--8<---------------cut here---------------start------------->8---
This package is a tool for debugging Node.js C/C++ native code modules
and getting stack traces when things go wrong.
--8<---------------cut here---------------end--------------->8---

Otherwise LGTM!

Thanks,
Pierre

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 519 bytes --]

^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 00/43] guix: node-build-system: Support compiling add-ons with node-gyp.
  2021-12-12 16:01                         ` [bug#51838] [PATCH v3 00/43] guix: node-build-system: Support compiling add-ons with node-gyp Pierre Langlois
@ 2021-12-12 16:36                           ` Pierre Langlois
  2021-12-12 21:45                             ` Philip McGrath
  0 siblings, 1 reply; 458+ messages in thread
From: Pierre Langlois @ 2021-12-12 16:36 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht,
	Liliana Marie Prikler

[-- Attachment #1: Type: text/plain, Size: 1931 bytes --]


Pierre Langlois <pierre.langlois@gmx.com> writes:

> [[PGP Signed Part:Undecided]]
> Hi Philip,
>
> Philip McGrath <philip@philipmcgrath.com> writes:
>
>> Hi!
>>
>> Here is a v3 of this patch series, hopefully incorporating all of the
>> suggestions. In particular, as Timothy suggested
>> in <https://issues.guix.gnu.org/51838#59>, I've tried to make sure the earlier
>> patches, at least through #:absent-dependencies, are able to be applied even
>> if there is more discussion needed on the later patches.
>>
>> As I mentioned in <https://issues.guix.gnu.org/51838#64>, while experimenting
>> with v2 of this series, I discovered an issue with the install script
>> automatically generated by npm. Patch 21 ``guix: node-build-system: Add
>> avoid-node-gyp-rebuild phase.'' fixed the issue: I explain the details in
>> comments there.
>>
>> This series also adds two additional leaf packages, `node-segfault-handler'
>> and `node-serialport', that confirm these patches can support additional
>> styles of native addons. In particular, because the native addon for
>> `node-serialport' is actually in one of the intermediate packages,
>> `node-serialport-bindings', it serves as a test case for the new
>> `avoid-node-gyp-rebuild' phase.
>>
>> I've also put these patches up
>> at <https://gitlab.com/philip1/guix-patches/-/tree/guix-issue-51838-v3>,
>> if anyone finds that useful.
>
> Thanks for working on this! I've tested the series and rebased my own
> work on top locally, it's working for me so feel free to add:
>
> Tested-by: Pierre Langlois <pierre.langlois@gmx.com>
>
> The series looks good to me overall, I'll add comments in each patch.

OK, I'm done with my round of comments :-)

I'm not a maintainer but I do have commit access, so I can volonteer to
push this on your behalf if maintainers are happy with the series.
Hopefully with some of my suggestions incorporated if you agree with
them.

Thanks,
Pierre


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 519 bytes --]

^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 04/43] gnu: node: Add an npmrc file to set nodedir.
  2021-12-12 15:19                           ` Pierre Langlois
@ 2021-12-12 20:19                             ` Philip McGrath
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
  0 siblings, 1 reply; 458+ messages in thread
From: Philip McGrath @ 2021-12-12 20:19 UTC (permalink / raw)
  To: Pierre Langlois; +Cc: 51838

Hi!

On 12/12/21 10:19, Pierre Langlois wrote:
> When I run `node-gyp configure' in my tree-sitter packages, it's not
> able to find the node dir and tries to download headers. So I need to
> set `npm_config_nodedir' manually, like so:

> I'm wondering if the npmrc approach here is working properly? I see in
> another patch you've used the `npx' command to run `node-gyp rebuild',
> should I be using that?

The npmrc configuration will only work of node-gyp is run through npm 
(or npx): https://github.com/nodejs/node-gyp#npm-configuration

In general, my current understanding is that you shouldn't have to run 
`node-gyp configure` explicitly. First, `node-gyp rebuild` includes a 
`node-gyp configure` step, but, more broadly, Guix's configure and build 
phases should usually do any needed addon building automatically. Aside 
from packages that deleted the configue phase, the main exception I've 
found is packages that try to use some strategy for downloading 
pre-built binaries: in some cases I've patched them enough to make 
automatic compilation work, but maybe sometimes just doing things 
manually is less work. If you do need to run `node-gyp` explicitly, the 
`npx` approach is the best I've found.

-Philip




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 06/43] guix: node-build-system: Add #:absent-dependencies argument.
  2021-12-12 15:31                           ` Pierre Langlois
@ 2021-12-12 20:22                             ` Philip McGrath
  0 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-12 20:22 UTC (permalink / raw)
  To: Pierre Langlois; +Cc: 51838

On 12/12/21 10:31, Pierre Langlois wrote:
> 
> Philip McGrath <philip@philipmcgrath.com> writes:
> 
>> * guix/build-system/node.scm (lower, node-build): Add optional
>> argument #:absent-dependencies with default of ''(). Pass it on
>> to the build-side code.
>> * guix/build/node-build-system.scm (patch-dependencies): Respect
>> the #:absent-dependencies argument, removing specified npm
>> packages from the "dependencies" or "devDependencies" tables
>> in "package.json".
> 
> Nice, I like this new option, I've needed this functionnality before as
> well. For instance I've seen dependencies like "prebuild-install" [0]
> for which the whole purepose is to download binaries instead of building
> them... in Guix we always want to remove those dependencies.
> 
> I'd suggest to add documentation for this new option in the manual, but
> that could be done as a follow-up.

I agree documentation would be good: I don't think there's any for 
node-build-system at all, yet. I haven't written texinfo before, but I 
may give it a try as a follow-up.

-Philip




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 29/43] gnu: Add node-sqlite3.
  2021-12-12 15:42                           ` Pierre Langlois
@ 2021-12-12 21:18                             ` Philip McGrath
  0 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-12 21:18 UTC (permalink / raw)
  To: Pierre Langlois; +Cc: 51838

On 12/12/21 10:42, Pierre Langlois wrote:
> 
> Philip McGrath <philip@philipmcgrath.com> writes:
> 
>> * gnu/packages/node-xyz.scm (node-sqlite3): New variable.
>> ---
>>   gnu/packages/node-xyz.scm | 118 +++++++++++++++++++++++++++++++++++++-
>>   1 file changed, 115 insertions(+), 3 deletions(-)
>>
>> diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
>> index 60dbfc163c..b979d0cd53 100644
>> --- a/gnu/packages/node-xyz.scm
>> +++ b/gnu/packages/node-xyz.scm
>> @@ -615,7 +615,8 @@ (define-public node-addon-api
>>          (sha256
>>           (base32 "1bhvfi2m9nxfz418s619914vmidcnrzbjv6l9nid476c3zlpazch"))))
>>       (inputs
>> -     `(("python" ,python)))
>> +     `(("python" ,python)
>> +       ("node-safe-buffer" ,node-safe-buffer)))
>>       (build-system node-build-system)
>>       (arguments
>>        `(#:absent-dependencies
>> @@ -630,8 +631,7 @@ (define-public node-addon-api
>>            "eslint-plugin-promise"
>>            "fs-extra"
>>            "path"
>> -         "pre-commit"
>> -         "safe-buffer")
>> +         "pre-commit")
>>          #:phases
>>          (modify-phases %standard-phases
>>            (add-after 'unpack 'skip-js-tests
> 
> nit: Did you mean to include these changes in this patch? It seems they
> should be part of the node-addon-api patch.

Thanks! I've rebased, reorganized, and squashed this series a number of 
times: these must have ended up in the wrong place.

>> +         "aws-sdk"
>> +         "@mapbox/cloudfriend"
>> +         ;; Confusingly, this is only a dependency beceuse of
> 
> typo: beceuse -> because

Thanks, will fix!

>> +         (add-after 'patch-dependencies 'avoid-node-pre-gyp
>> +           (lambda args
>> +             (substitute* ".npmignore"
>> +               (("lib/binding")
>> +                "#lib/binding # <- patched for Guix"))
> 
> Would this substitute* be more suited to live in the 'patch-binding-path
> phase?

No, at least not as currently written.

The upstream .npmignore file excludes the compiled addon from `npm pack` 
and `npm install`, so patching it after Guix's install phase would be 
too late. (Except that, unfortunately, Guix doesn't seem to be 
respecting instructions about which files to include or not in built 
packages ...)

The 'patch-binding-path phase, on the other hand, replaces code that 
dynamically finds the addon to load at runtime via the 
`@mapbox/node-pre-gyp` package (which we don't have) with one that 
simply uses the path we built directly. Because that path depends (or 
should---see below) on the expansion of the `module_path` configuration, 
including parameters like `napi_build_version`, the most reliable 
approach seems to be patching this after Guix's configure phase, so we 
can just find what path we actually did build, rather than having to 
accurately predict what we're going to build.

Instead of all of this, Debian packages a patched version of 
`@mapbox/node-pre-gyp` that always builds from source. This has some 
appeal and might mean less patching overall. I started down that road in 
<https://gitlab.com/philip1/guix-patches/-/tree/wip-node-npm-gyp-hist-4-unicode-bootstrap>, 
but I found `@mapbox/node-pre-gyp` really did need its `npm-log` 
dependency: we have `npm-log` as a dependency of `npm`, but, when I 
tried to package it properly, I found (if I'm remembering the details 
correctly) that bootstrapping `@unicode/14.0.0` from 
https://github.com/node-unicode/node-unicode-data seemed to involve a 
dependency cycle. That seemed like a headache for another time.

>> +             (with-atomic-file-replacement "package.json"
>> +               (lambda (in out)
>> +                 (let* ((js (read-json in))
>> +                        (alist (match js
>> +                                 (('@ . alist) alist)))
>> +                        (scripts-alist (match (assoc-ref alist "scripts")
>> +                                         (('@ . alist) alist)))
>> +                        (scripts-alist
>> +                         ;; install script would use node-pre-gyp
>> +                         (assoc-remove! scripts-alist "install"))
>> +                        (alist
>> +                         (assoc-set! alist "scripts" (cons '@ scripts-alist)))
>> +                        (binary-alist (match (assoc-ref alist "binary")
>> +                                        (('@ . alist) alist)))
>> +                        (js (cons '@ alist)))
>> +                   ;; compensate for lack of @mapbox/node-pre-gyp
>> +                   (setenv "GYP_DEFINES"
>> +                           (string-append
>> +                            "module_name="
>> +                            (assoc-ref binary-alist "module_name")
>> +                            " "
>> +                            "module_path="
>> +                            (assoc-ref binary-alist "module_path")))
>> +                   (write-json js
>> +                               out)))))))))
> 
> I was having a bit of a hard time understand this phase, let me know if
> I have this right. We have this JSON input:
> 
> --8<---------------cut here---------------start------------->8---
> "binary": {
>    "module_name": "node_sqlite3",
>    "module_path": "./lib/binding/napi-v{napi_build_version}-{platform}-{arch}",
>    "host": "https://mapbox-node-binary.s3.amazonaws.com",
>    "remote_path": "./{name}/v{version}/{toolset}/",
>    "package_name": "napi-v{napi_build_version}-{platform}-{arch}.tar.gz",
>    "napi_versions": [
>      3
>    ]
> },
> 
> "scripts": {
>    "install": "node-pre-gyp install --fallback-to-build",
>    "pretest": "node test/support/createdb.js",
>    "test": "mocha -R spec --timeout 480000",
>    "pack": "node-pre-gyp package"
> },
> --8<---------------cut here---------------end--------------->8---
> 
> And we:
> 
>    - Read the "binary" entry to find the module_name and module_path to
>      give to node-gyp, so we can use our own GYP instead of a bundled one.
> 
>    - Delete the "scripts.install" phase, it's not using the correct GYP.
> 
> Maybe a couple of comments would be helpful here :-).

Yes, I'll add comments :)

What you said is mostly right, but, to clarify, the upstream 
scripts.install is using node-PRE-gyp, which tries to download pre-built 
binaries from S3-compatible storage. Since we don't have a patched 
version like Debian, we definitely want to avoid that.

When node-pre-gyp does decide to build from source, it arranges to 
supply module_name and module_path based on the package.json 
definitions, so the binding.gyp doesn't define them. Thus, we also have 
to pass them to node-gyp, and the GYP_DEFINES environment variable turns 
out to be the easiest way to make sure they get passed on from npm to 
node-gyp to gyp.

What we do isn't quite consistent with node-pre-gyp because we don't 
currently perform substitution on the module_path, so there ends up 
being a directory literally named 
"napi-v{napi_build_version}-{platform}-{arch}". But that could be 
improved later.

-Philip




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 31/43] gnu: Add node-bindings.
  2021-12-12 15:57                           ` Pierre Langlois
@ 2021-12-12 21:20                             ` Philip McGrath
  0 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-12 21:20 UTC (permalink / raw)
  To: Pierre Langlois; +Cc: 51838

On 12/12/21 10:57, Pierre Langlois wrote:
>> +    (home-page "https://github.com/TooTallNate/node-bindings")
>> +    (synopsis "Help for loading your native module's @code{.node} file")
>> +    (description "Throughout the course of Node's native addon history, addons
>> +have ended up being compiled in a variety of different places, depending on
>> +which build tool and which version of @code{node} was used.  To make matters
>> +worse, now the @code{gyp} build tool can produce either a @code{Release} or
>> +@code{Debug} build, each being built into different locations.  This module
>> +checks @emph{all} the possible locations that a native addon would be built
>> +at, and returns the first one that loads successfully.")
> 
> I see the upstream description is prefaced with:
> 
> --8<---------------cut here---------------start------------->8---
> This is a helper module for authors of Node.js native addon modules. It
> is basically the "swiss army knife" of require()ing your native module's
> .node file.
> --8<---------------cut here---------------end--------------->8---
> 
> I'd suggest to just use this as the description, I'm not sure we need to
> mention node's addon build system history here.

Yes, I like that better.

-Philip




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 20/43] guix: node-build-system: Add delete-lockfiles phase.
  2021-12-12 16:09                           ` Pierre Langlois
@ 2021-12-12 21:26                             ` Philip McGrath
  0 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-12 21:26 UTC (permalink / raw)
  To: Pierre Langlois; +Cc: 51838

On 12/12/21 11:09, Pierre Langlois wrote:
> 
> Philip McGrath <philip@philipmcgrath.com> writes:
> 
>> * guix/build/node-build-system.scm (delete-lockfiles): New function.
>> Remove 'package-lock.json', 'yarn.lock', and 'npm-shrinkwrap.json',
>> if they exist.  Because these files specify dependency both exact
>> versions and integrity hashes, they only cause problems for Guix.
>> (%standard-phases): Add 'delete-lockfiles' after 'patch-dependencies'.
>> ---
>>   gnu/packages/node.scm            | 12 ------------
>>   guix/build/node-build-system.scm | 12 ++++++++++++
>>   2 files changed, 12 insertions(+), 12 deletions(-)
>>
>> diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
>> index 6d48816c77..5289e2fe4f 100644
>> --- a/gnu/packages/node.scm
>> +++ b/gnu/packages/node.scm
>> @@ -488,12 +488,6 @@ (define-public node-llparse-builder-bootstrap
>>            "typescript")
>>          #:phases
>>          (modify-phases %standard-phases
>> -         (add-before 'configure 'remove-package-lock
>> -           ;; Having package-lock.json seems to cause npm
>> -           ;; to look for things on the internet in the configure phase,
>> -           ;; even if we have them properly installed.
>> -           (lambda args
>> -             (delete-file-recursively "package-lock.json")))
>>            (replace 'build
>>              (lambda* (#:key inputs #:allow-other-keys)
>>                (let ((esbuild (string-append (assoc-ref inputs "esbuild")
>> @@ -621,12 +615,6 @@ (define-public node-llparse-bootstrap
>>            "typescript")
>>          #:phases
>>          (modify-phases %standard-phases
>> -         (add-before 'configure 'remove-package-lock
>> -           ;; Having package-lock.json seems to cause npm
>> -           ;; to look for things on the internet in the configure phase,
>> -           ;; even if we have them properly installed.
>> -           (lambda args
>> -             (delete-file-recursively "package-lock.json")))
> 
> These changes were added in this series right? I'd suggest to re-order
> commits to have the build-system changes first so that they don't need
> to be added at all.

Right! I'll do that.

-Philip




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 26/43] gnu: Add node-nan.
  2021-12-12 16:17                           ` Pierre Langlois
@ 2021-12-12 21:33                             ` Philip McGrath
  0 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-12 21:33 UTC (permalink / raw)
  To: Pierre Langlois; +Cc: 51838

On 12/12/21 11:17, Pierre Langlois wrote:
> 
> Philip McGrath <philip@philipmcgrath.com> writes:
> 
>> * gnu/packages/node-xyz.scm (node-nan): New variable.
>> ---
>>   gnu/packages/node-xyz.scm | 44 +++++++++++++++++++++++++++++++++++++++
>>   1 file changed, 44 insertions(+)
>>
>> diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
>> index 3e06413908..ed169c0778 100644
>> --- a/gnu/packages/node-xyz.scm
>> +++ b/gnu/packages/node-xyz.scm
>> @@ -553,3 +553,47 @@ (define-public node-irc
>>       (description "@code{node-irc} is an IRC client library for Node.js.
>>   It has functions for joining, parting, talking, and many other IRC commands.")
>>       (license license:gpl3+)))
>> +
>> +(define-public node-nan
>> +  (package
>> +    (name "node-nan")
>> +    (version "2.15.0")
>> +    (source
>> +     (origin
>> +       (method git-fetch)
>> +       (uri (git-reference
>> +             (url "https://github.com/nodejs/nan")
>> +             (commit (string-append "v" version))))
>> +       (file-name (git-file-name name version))
>> +       (sha256
>> +        (base32 "18xslh9va5ld872scrp5y4251ax9s3c6qh0lnl1200lpzbsxy7yd"))))
>> +    (build-system node-build-system)
>> +    (arguments
>> +     `(#:tests?
>> +       ;; tests need tap and other dependencies
>> +       #f
> 
> Formatting nit, you can write this all in one line:
> 
>      #:tests? #f  ;; Tests need tap an other dependencies.

Yes, I'll do that. It causes problems for automatic indentation if it's 
the first line, but I can put it after #:absent-dependencies, as I 
started doing elsewhere.

> 
>> +       #:absent-dependencies
>> +       '("bindings"
>> +         "commander"
>> +         "glob"
>> +         "request"
>> +         "node-gyp" ;; would be needed for tests
>> +         "tap"
>> +         "xtend")))
>> +    (inputs
>> +     `(("readable-stream" ,node-readable-stream)))
>> +    (home-page "https://github.com/nodejs/nan")
>> +    (synopsis "Native Abstractions for Node.js")
>> +    (description "A header file filled with macro and utility goodness for
>> +making add-on development for Node.js easier across versions 0.8, 0.10, 0.12,
>> +1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 and 16.
> 
> Given our packages only work with the node what Guix uses, you could
> remove the version numbers from the description. Mostly because we
> probalby won't think to update this description when future node
> releases appear.
> 
>> +
>> +Thanks to the crazy changes in V8 (and some in Node core), keeping native
>> +addons compiling happily across versions, particularly 0.10 to 0.12 to 4.0, is
>> +a minor nightmare.
> 
> I'd remove this sentence, it doesn't make much sense in Guix given we
> don't support older versions.

Both of these seem like good changes to me. (Personally, I think a lot 
of complexity in JavaScript land comes from trying to support obsolete 
versions of things.)

-Philip




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 30/43] gnu: Add node-file-uri-to-path.
  2021-12-12 16:26                           ` Pierre Langlois
@ 2021-12-12 21:34                             ` Philip McGrath
  0 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-12 21:34 UTC (permalink / raw)
  To: Pierre Langlois; +Cc: 51838

On 12/12/21 11:26, Pierre Langlois wrote:
> 
> Philip McGrath <philip@philipmcgrath.com> writes:
> 
>> * gnu/packages/node-xyz.scm (node-file-uri-to-path): New variable.
>> ---
>>   gnu/packages/node-xyz.scm | 54 +++++++++++++++++++++++++++++++++++++++
>>   1 file changed, 54 insertions(+)
>>
>> diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
>> index b979d0cd53..d23326fa25 100644
>> --- a/gnu/packages/node-xyz.scm
>> +++ b/gnu/packages/node-xyz.scm
>> @@ -24,6 +24,7 @@ (define-module (gnu packages node-xyz)
>>     #:use-module ((guix licenses) #:prefix license:)
>>     #:use-module (gnu packages sqlite)
>>     #:use-module (gnu packages python)
>> +  #:use-module (gnu packages web)
>>     #:use-module (guix gexp)
>>     #:use-module (guix packages)
>>     #:use-module (guix git-download)
>> @@ -772,3 +773,56 @@ (define-public node-sqlite3
>>   non-blocking bindings for SQLite3, written in modern C++ and tested for memory
>>   leaks.")
>>        (license license:bsd-3)))
>> +
>> +(define-public node-file-uri-to-path
>> +  (package
>> +    (name "node-file-uri-to-path")
>> +    (version "2.0.0")
>> +    (source
>> +     (origin
>> +       (method git-fetch)
>> +       (uri (git-reference
>> +             (url "https://github.com/TooTallNate/file-uri-to-path")
>> +             (commit version)))
>> +       (file-name (git-file-name name version))
>> +       (sha256
>> +        (base32 "08l779az44czm12xdhgcrnzpqw34s59hbrlfphs7g9y2k26drqav"))))
>> +    (native-inputs
>> +     `(("esbuild" ,esbuild)))
>> +    (build-system node-build-system)
>> +    (arguments
>> +     `(#:absent-dependencies
>> +       `("@types/mocha"
>> +         "@types/node"
>> +         "@typescript-eslint/eslint-plugin"
>> +         "@typescript-eslint/parser"
>> +         "cpy-cli"
>> +         "eslint"
>> +         "eslint-config-airbnb"
>> +         "eslint-config-prettier"
>> +         "eslint-import-resolver-typescript"
>> +         "eslint-plugin-import"
>> +         "eslint-plugin-jsx-a11y"
>> +         "eslint-plugin-react"
>> +         "mocha"
>> +         "rimraf"
>> +         "typescript")
>> +       #:phases
>> +       (modify-phases %standard-phases
>> +         (replace 'build
>> +           (lambda* (#:key inputs native-inputs #:allow-other-keys)
>> +             (copy-recursively "src" "dist")
>> +             (invoke (string-append
>> +                      (assoc-ref (or native-inputs inputs) "esbuild")
>> +                      "/bin/esbuild")
>> +                     "dist/index.ts"
>> +                     "--outfile=dist/src/index.js"
>> +                     "--format=cjs"
>> +                     "--sourcemap"
>> +                     "--platform=node"))))
>> +       #:tests? #f))
>> +    (home-page "https://github.com/TooTallNate/file-uri-to-path")
>> +    (synopsis "Convert a @code{file:} URI to a file path")
>> +    (description "Accepts a @code{file:} URI and returns a regular file path
>> +suitable for use with the @code{fs} module functions.")
> 
> nit: We generally write description as full sentences, I'd suggest:
> 
> --8<---------------cut here---------------start------------->8---
> This package provides a method to convert a @code{file:} URI to a file
> path.  It accepts a @code{file:} URI and returns a regular file path
> suitable for use with the @code{fs} module functions.
> --8<---------------cut here---------------end--------------->8---

Yes, I'll do something like that.

-Philip




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 32/43] gnu: Add node-segfault-handler.
  2021-12-12 16:31                           ` Pierre Langlois
@ 2021-12-12 21:38                             ` Philip McGrath
  0 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-12 21:38 UTC (permalink / raw)
  To: Pierre Langlois; +Cc: 51838

On 12/12/21 11:31, Pierre Langlois wrote:
> 
> Philip McGrath <philip@philipmcgrath.com> writes:
> 
>> * gnu/packages/node-xyz.scm (node-segfault-handler): New variable.
>> ---
>>   gnu/packages/node-xyz.scm | 35 +++++++++++++++++++++++++++++++++++
>>   1 file changed, 35 insertions(+)
>>
>> diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
>> index 196fa55a39..27506062ba 100644
>> --- a/gnu/packages/node-xyz.scm
>> +++ b/gnu/packages/node-xyz.scm
>> @@ -856,3 +856,38 @@ (define-public node-bindings
>>   checks @emph{all} the possible locations that a native addon would be built
>>   at, and returns the first one that loads successfully.")
>>       (license license:expat)))
>> +
>> +(define-public node-segfault-handler
>> +  (package
>> +    (name "node-segfault-handler")
>> +    (version "1.3.0")
>> +    (source
>> +     (origin
>> +       (method git-fetch)
>> +       (uri (git-reference
>> +             (url "https://github.com/ddopson/node-segfault-handler")
>> +             (commit (string-append "v" version))))
>> +       (file-name (git-file-name name version))
>> +       (sha256
>> +        (base32 "07nbw35wvrr18kmh8f388v4k5mpjgyy0260bx0xzjdv795i3xvfv"))))
>> +    (native-inputs
>> +     `(("python" ,python)))
>> +    (inputs
>> +     `(("node-bindings" ,node-bindings)
>> +       ("node-nan" ,node-nan)))
>> +    (build-system node-build-system)
>> +    (arguments
>> +     ;; there are no tests
>> +     `(#:tests? #f))
>> +    (home-page "https://github.com/ddopson/node-segfault-handler")
>> +    (synopsis "Catches @code{SIGSEGV} and prints diagnostic information")
>> +    (description "This package is a tool for debugging Node.js C/C++ native
>> +code modules, and is safe to use in production environments.  Normally, when a
>> +bug is triggered in native code, the @code{node} process simply ends with no
>> +helpful information.  In production, this can manifest as worker processes
>> +restarting for seemingly no reason.  Running @code{node} in @code{gdb} is
>> +messy and infeasible for a production environment.  Instead, this module will
>> +sit unobtrusively doing nothing (zero perf impact) as long as Node.js is
>> +well-behaved.  If a @code{SIGSEGV} signal is raised, the module will print a
>> +native stack trace to both STDERR and to a timestamped file.")
> 
> I'd suggest for the description to be a little more succint, maybe just:
> 
> --8<---------------cut here---------------start------------->8---
> This package is a tool for debugging Node.js C/C++ native code modules
> and getting stack traces when things go wrong.
> --8<---------------cut here---------------end--------------->8---

Yes, this is a bit long. I think I'll keep the last sentence, too, 
though, so something like:

--8<---------------cut here---------------start------------->8---
This package is a tool for debugging Node.js C/C++ native code modules
and getting stack traces when things go wrong.
If a @code{SIGSEGV} signal is raised, the module will print a
native stack trace to both STDERR and to a timestamped file.
--8<---------------cut here---------------end--------------->8---

(And maybe I should be using texinfo markup for STDERR, too.)

-Philip




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v3 00/43] guix: node-build-system: Support compiling add-ons with node-gyp.
  2021-12-12 16:36                           ` Pierre Langlois
@ 2021-12-12 21:45                             ` Philip McGrath
  0 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-12 21:45 UTC (permalink / raw)
  To: Pierre Langlois; +Cc: 51838, Timothy Sample, Jelle Licht, Liliana Marie Prikler

Hi!

On 12/12/21 11:36, Pierre Langlois wrote:
> 
> Pierre Langlois <pierre.langlois@gmx.com> writes:
>> Thanks for working on this! I've tested the series and rebased my own
>> work on top locally, it's working for me so feel free to add:
>>
>> Tested-by: Pierre Langlois <pierre.langlois@gmx.com>
>>
>> The series looks good to me overall, I'll add comments in each patch.
> 
> OK, I'm done with my round of comments :-)
> 
> I'm not a maintainer but I do have commit access, so I can volonteer to
> push this on your behalf if maintainers are happy with the series.
> Hopefully with some of my suggestions incorporated if you agree with
> them.

Thanks for the review! I'll send a v4 incorporating your comments, 
probably later today or tomorrow, and hopefully that will be ready to 
merge. It will also include node-debug, because I discovered that the 
lack of it causes some problems for the node-serialport packages, and it 
turned out not to be too difficult to add.

-Philip




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp.
  2021-12-12 20:19                             ` Philip McGrath
@ 2021-12-13  6:00                               ` Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 01/45] gnu: node: Avoid duplicating build phases Philip McGrath
                                                   ` (45 more replies)
  0 siblings, 46 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:00 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

Hi!

Here is v4 of the patch series: I've also put it up
at <https://gitlab.com/philip1/guix-patches/-/tags/guix-issue-51838-v4>.

  -Philip

Philip McGrath (45):
  gnu: node: Avoid duplicating build phases.
  gnu: node: Update to 10.24.1 for bootstrapping.
  gnu: node: Patch shebangs in node_modules.
  gnu: node: Add an npmrc file to set nodedir.
  guix: node-build-system: Add delete-lockfiles phase.
  guix: node-build-system: Refactor patch-dependencies phase.
  guix: node-build-system: Add #:absent-dependencies argument.
  gnu: node-semver-bootstrap: Use #:absent-dependencies.
  gnu: node-ms-bootstrap: Use #:absent-dependencies.
  gnu: node-binary-search-bootstrap: Use #:absent-dependencies.
  gnu: node-debug-bootstrap: Use #:absent-dependencies.
  gnu: node-llparse-builder-bootstrap: Use #:absent-dependencies.
  gnu: node-llparse-frontend-bootstrap: Use #:absent-dependencies.
  gnu: node-llparse-bootstrap: Use #:absent-dependencies.
  gnu: node-semver: Use #:absent-dependencies.
  gnu: node-wrappy: Use #:absent-dependencies.
  gnu: node-once: Use #:absent-dependencies.
  gnu: node-irc-colors: Use #:absent-dependencies.
  gnu: node-irc: Use #:absent-dependencies.
  guix: node-build-system: Add implicit libuv input.
  guix: node-build-system: Add avoid-node-gyp-rebuild phase.
  gnu: Add node-inherits.
  gnu: Add node-safe-buffer.
  gnu: Add node-string-decoder.
  gnu: Add node-readable-stream.
  gnu: Add node-nan.
  gnu: Add node-openzwave-shared.
  gnu: Add node-addon-api.
  gnu: Add node-sqlite3.
  gnu: Add node-file-uri-to-path.
  gnu: Add node-bindings.
  gnu: Add node-segfault-handler.
  gnu: Add node-ms.
  gnu: Add node-debug.
  gnu: Add node-serialport-binding-abstract.
  gnu: Add node-serialport-parser-delimiter.
  gnu: Add node-serialport-parser-readling.
  gnu: Add node-serialport-bindings.
  gnu: Add node-serialport-parser-regex.
  gnu: Add node-serialport-parser-ready.
  gnu: Add node-serialport-parser-inter-byte-timeout.
  gnu: Add node-serialport-parser-cctalk.
  gnu: Add node-serialport-parser-byte-length.
  gnu: Add node-serialport-stream.
  gnu: Add node-serialport.

 gnu/packages/node-xyz.scm        | 932 ++++++++++++++++++++++++++++++-
 gnu/packages/node.scm            | 222 ++++----
 gnu/packages/zwave.scm           |  69 +++
 guix/build-system/node.scm       |  28 +-
 guix/build/node-build-system.scm | 129 ++++-
 5 files changed, 1225 insertions(+), 155 deletions(-)

-- 
2.32.0





^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 01/45] gnu: node: Avoid duplicating build phases.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
@ 2021-12-13  6:00                                 ` Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 02/45] gnu: node: Update to 10.24.1 for bootstrapping Philip McGrath
                                                   ` (44 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:00 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node.scm (node)[arguments]: Split 'patch-files phase
into 'patch-hardcoded-program-references and
'delete-problematic-tests. Adapt 'patch-hardcoded-program-references
and 'configure to work unmodified on node-lts, but don't try to
share 'delete-problematic-tests, because those details seem to change
too much between node versions.
(node, node-lts)[inputs]: Use bash-minimal rather than bash.
(node-lts)[arguments]: Inherit 'patch-hardcoded-program-references,
and 'configure phases from the bootstrap node.
Remove the 'patch-files phase, keeping its remaining
non-inherited work in a new 'replace-llhttp-sources phase.
---
 gnu/packages/node.scm | 105 +++++++++++++-----------------------------
 1 file changed, 32 insertions(+), 73 deletions(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index dccf871d2c..7ebbbc3060 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -9,6 +9,7 @@
 ;;; Copyright © 2020, 2021 Pierre Langlois <pierre.langlois@gmx.com>
 ;;; Copyright © 2020 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
+;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -105,14 +106,22 @@ (define-public node
        #:test-target "test-ci-js"
        #:phases
        (modify-phases %standard-phases
-         (add-before 'configure 'patch-files
+         (add-before 'configure 'patch-hardcoded-program-references
            (lambda* (#:key inputs #:allow-other-keys)
+
              ;; Fix hardcoded /bin/sh references.
-             (substitute* '("lib/child_process.js"
-                            "lib/internal/v8_prof_polyfill.js"
-                            "test/parallel/test-child-process-spawnsync-shell.js"
-                            "test/parallel/test-stdio-closed.js"
-                            "test/sequential/test-child-process-emfile.js")
+             (substitute*
+                 (let ((common
+                        '("lib/child_process.js"
+                          "lib/internal/v8_prof_polyfill.js"
+                          "test/parallel/test-child-process-spawnsync-shell.js"
+                          "test/parallel/test-stdio-closed.js"
+                          "test/sequential/test-child-process-emfile.js"))
+                       ;; not in bootstap node:
+                       (sigxfsz "test/parallel/test-fs-write-sigxfsz.js"))
+                   (if (file-exists? sigxfsz)
+                       (cons sigxfsz common)
+                       common))
                (("'/bin/sh'")
                 (string-append "'" (assoc-ref inputs "bash") "/bin/sh'")))
 
@@ -122,7 +131,10 @@ (define-public node
                             "test/parallel/test-child-process-exec-env.js")
                (("'/usr/bin/env'")
                 (string-append "'" (assoc-ref inputs "coreutils")
-                               "/bin/env'")))
+                               "/bin/env'")))))
+         (add-after 'patch-hardcoded-program-references
+             'delete-problematic-tests
+           (lambda* (#:key inputs #:allow-other-keys)
 
              ;; FIXME: These tests fail in the build container, but they don't
              ;; seem to be indicative of real problems in practice.
@@ -217,9 +229,13 @@ (define-public node
                (setenv "CXX" ,(cxx-for-target))
                (setenv "PKG_CONFIG" ,(pkg-config-for-target))
                (apply invoke
-                      (string-append (assoc-ref (or native-inputs inputs)
-                                                "python")
-                                     "/bin/python")
+                      (let ((python
+                             (string-append (assoc-ref (or native-inputs inputs)
+                                                       "python")
+                                            "/bin/python")))
+                        (if (file-exists? python)
+                            python
+                            (string-append python "3")))
                       "configure" flags))))
          (add-after 'patch-shebangs 'patch-npm-shebang
            (lambda* (#:key outputs #:allow-other-keys)
@@ -256,7 +272,7 @@ (define-public node
             (variable "NODE_PATH")
             (files '("lib/node_modules")))))
     (inputs
-     `(("bash" ,bash)
+     `(("bash" ,bash-minimal)
        ("coreutils" ,coreutils)
        ("c-ares" ,c-ares)
        ("http-parser" ,http-parser)
@@ -712,66 +728,8 @@ (define-public node-lts
                                    libuv "/lib:"
                                    zlib "/lib"
                                    "'],"))))))
-           (replace 'configure
-             ;; Node's configure script is actually a python script, so we can't
-             ;; run it with bash.
-             (lambda* (#:key outputs (configure-flags '()) native-inputs inputs
-                       #:allow-other-keys)
-               (let* ((prefix (assoc-ref outputs "out"))
-                      (xflags ,(if (%current-target-system)
-                                   `'("--cross-compiling"
-                                     ,(string-append
-                                       "--dest-cpu="
-                                       (match (%current-target-system)
-                                         ((? (cut string-prefix? "arm" <>))
-                                          "arm")
-                                         ((? (cut string-prefix? "aarch64" <>))
-                                          "arm64")
-                                         ((? (cut string-prefix? "i686" <>))
-                                          "ia32")
-                                         ((? (cut string-prefix? "x86_64" <>))
-                                          "x64")
-                                         ((? (cut string-prefix? "powerpc64" <>))
-                                          "ppc64")
-                                         (_ "unsupported"))))
-                                   ''()))
-                      (flags (cons
-                               (string-append "--prefix=" prefix)
-                               (append xflags configure-flags))))
-                 (format #t "build directory: ~s~%" (getcwd))
-                 (format #t "configure flags: ~s~%" flags)
-                 ;; Node's configure script expects the CC environment variable to
-                 ;; be set.
-                 (setenv "CC_host" "gcc")
-                 (setenv "CXX_host" "g++")
-                 (setenv "CC" ,(cc-for-target))
-                 (setenv "CXX" ,(cxx-for-target))
-                 (setenv "PKG_CONFIG" ,(pkg-config-for-target))
-                 (apply invoke
-                        (string-append (assoc-ref (or native-inputs inputs)
-                                                  "python")
-                                       "/bin/python3")
-                        "configure" flags))))
-           (replace 'patch-files
+           (replace 'delete-problematic-tests
              (lambda* (#:key inputs #:allow-other-keys)
-               ;; Fix hardcoded /bin/sh references.
-               (substitute* '("lib/child_process.js"
-                              "lib/internal/v8_prof_polyfill.js"
-                              "test/parallel/test-child-process-spawnsync-shell.js"
-                              "test/parallel/test-fs-write-sigxfsz.js"
-                              "test/parallel/test-stdio-closed.js"
-                              "test/sequential/test-child-process-emfile.js")
-                 (("'/bin/sh'")
-                  (string-append "'" (assoc-ref inputs "bash") "/bin/sh'")))
-
-               ;; Fix hardcoded /usr/bin/env references.
-               (substitute* '("test/parallel/test-child-process-default-options.js"
-                              "test/parallel/test-child-process-env.js"
-                              "test/parallel/test-child-process-exec-env.js")
-                 (("'/usr/bin/env'")
-                  (string-append "'" (assoc-ref inputs "coreutils")
-                                 "/bin/env'")))
-
                ;; FIXME: These tests fail in the build container, but they don't
                ;; seem to be indicative of real problems in practice.
                (for-each delete-file
@@ -810,8 +768,9 @@ (define-public node-lts
                ;; TODO: Regenerate certs instead.
                (for-each delete-file
                          '("test/parallel/test-tls-passphrase.js"
-                           "test/parallel/test-tls-server-verify.js"))
-
+                           "test/parallel/test-tls-server-verify.js"))))
+           (add-after 'delete-problematic-tests 'replace-llhttp-sources
+             (lambda* (#:key inputs #:allow-other-keys)
                ;; Replace pre-generated llhttp sources
                (let ((llhttp (assoc-ref inputs "llhttp")))
                  (copy-file (string-append llhttp "/src/llhttp.c")
@@ -838,7 +797,7 @@ (define-public node-lts
        ("python" ,python)
        ("util-linux" ,util-linux)))
     (inputs
-     `(("bash" ,bash)
+     `(("bash" ,bash-minimal)
        ("coreutils" ,coreutils)
        ("c-ares" ,c-ares-for-node)
        ("icu4c" ,icu4c-67)
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 02/45] gnu: node: Update to 10.24.1 for bootstrapping.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 01/45] gnu: node: Avoid duplicating build phases Philip McGrath
@ 2021-12-13  6:00                                 ` Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 03/45] gnu: node: Patch shebangs in node_modules Philip McGrath
                                                   ` (43 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:00 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node.scm (node): Update to 10.24.1.
---
 gnu/packages/node.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 7ebbbc3060..71b66774a6 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -57,14 +57,14 @@ (define-module (gnu packages node)
 (define-public node
   (package
     (name "node")
-    (version "10.24.0")
+    (version "10.24.1")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://nodejs.org/dist/v" version
                                   "/node-v" version ".tar.xz"))
               (sha256
                (base32
-                "1k1srdis23782hnd1ymgczs78x9gqhv77v0am7yb54gqcspp70hm"))
+                "032801kg24j04xmf09m0vxzlcz86sv21s24lv9l4cfv08k1c4byp"))
               (modules '((guix build utils)))
               (snippet
                `(begin
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 03/45] gnu: node: Patch shebangs in node_modules.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 01/45] gnu: node: Avoid duplicating build phases Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 02/45] gnu: node: Update to 10.24.1 for bootstrapping Philip McGrath
@ 2021-12-13  6:00                                 ` Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 04/45] gnu: node: Add an npmrc file to set nodedir Philip McGrath
                                                   ` (42 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:00 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node.scm (node)[arguments]: Replace 'patch-npm-shebang
and 'patch-node-shebang with a new 'patch-nested-shebangs that also
handles node-gyp and other shebangs under "/lib/node_modules".
[inputs]: Add Python for node-gyp as "python-for-target".
(node-lts)[inputs]: Likewise.
(libnode)[arguments]: Adjust to delete 'patch-nested-shebangs rather
than 'patch-npm-shebang and 'patch-node-shebang.
---
 gnu/packages/node.scm | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 71b66774a6..a57a74fb81 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -237,21 +237,20 @@ (define-public node
                             python
                             (string-append python "3")))
                       "configure" flags))))
-         (add-after 'patch-shebangs 'patch-npm-shebang
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let* ((bindir (string-append (assoc-ref outputs "out")
-                                           "/bin"))
-                    (npm    (string-append bindir "/npm"))
-                    (target (readlink npm)))
-               (with-directory-excursion bindir
-                 (patch-shebang target (list bindir))))))
-         (add-after 'install 'patch-node-shebang
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let* ((bindir (string-append (assoc-ref outputs "out")
-                                           "/bin"))
-                    (npx    (readlink (string-append bindir "/npx"))))
-               (with-directory-excursion bindir
-                 (patch-shebang npx (list bindir)))))))))
+         (add-after 'patch-shebangs 'patch-nested-shebangs
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((prefix (assoc-ref outputs "out"))
+                    (path (map (lambda (dir)
+                                 (string-append dir "/bin"))
+                               (list prefix
+                                     (assoc-ref inputs "python-for-target")))))
+               (for-each
+                (lambda (file)
+                  (patch-shebang file path))
+                (find-files (string-append prefix "/lib/node_modules")
+                            (lambda (file stat)
+                              (executable-file? file))
+                            #:stat lstat))))))))
     (native-inputs
      `(;; Runtime dependencies for binaries used as a bootstrap.
        ("c-ares" ,c-ares)
@@ -274,6 +273,7 @@ (define-public node
     (inputs
      `(("bash" ,bash-minimal)
        ("coreutils" ,coreutils)
+       ("python-for-target" ,python-wrapper) ;; for node-gyp (supports python3)
        ("c-ares" ,c-ares)
        ("http-parser" ,http-parser)
        ("icu4c" ,icu4c)
@@ -799,6 +799,7 @@ (define-public node-lts
     (inputs
      `(("bash" ,bash-minimal)
        ("coreutils" ,coreutils)
+       ("python-for-target" ,python-wrapper) ;; for node-gyp (supports python3)
        ("c-ares" ,c-ares-for-node)
        ("icu4c" ,icu4c-67)
        ("libuv" ,libuv-for-node)
@@ -817,5 +818,4 @@ (define-public libnode
         `(cons* "--shared" "--without-npm" ,flags))
        ((#:phases phases '%standard-phases)
         `(modify-phases ,phases
-           (delete 'patch-npm-shebang)
-           (delete 'patch-node-shebang)))))))
+           (delete 'patch-nested-shebangs)))))))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 04/45] gnu: node: Add an npmrc file to set nodedir.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (2 preceding siblings ...)
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 03/45] gnu: node: Patch shebangs in node_modules Philip McGrath
@ 2021-12-13  6:00                                 ` Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 05/45] guix: node-build-system: Add delete-lockfiles phase Philip McGrath
                                                   ` (41 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:00 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node.scm (node, node-lts)[arguments]: Add a phase
'install-npmrc to create a "built-in" npmrc file that configures
"nodedir" to point to the output store path.
(libnode)[arguments]: Delete the 'install-npmrc phase.
---
 gnu/packages/node.scm | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index a57a74fb81..346cbd488d 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -250,7 +250,24 @@ (define-public node
                 (find-files (string-append prefix "/lib/node_modules")
                             (lambda (file stat)
                               (executable-file? file))
-                            #:stat lstat))))))))
+                            #:stat lstat)))))
+         (add-after 'install 'install-npmrc
+           ;; Note: programs like node-gyp only receive these values if
+           ;; they are started via `npm` or `npx`.
+           ;; See: https://github.com/nodejs/node-gyp#npm-configuration
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out")))
+               (with-output-to-file
+                   ;; Use the config file "primarily for distribution
+                   ;; maintainers" rather than "{prefix}/etc/npmrc",
+                   ;; especially because node-build-system uses --prefix
+                   ;; to install things to their store paths:
+                   (string-append out "/lib/node_modules/npm/npmrc")
+                 (lambda ()
+                   ;; Tell npm (mostly node-gyp) where to find our
+                   ;; installed headers so it doesn't try to
+                   ;; download them from the internet:
+                   (format #t "nodedir=~a\n" out)))))))))
     (native-inputs
      `(;; Runtime dependencies for binaries used as a bootstrap.
        ("c-ares" ,c-ares)
@@ -818,4 +835,5 @@ (define-public libnode
         `(cons* "--shared" "--without-npm" ,flags))
        ((#:phases phases '%standard-phases)
         `(modify-phases ,phases
+           (delete 'install-npmrc)
            (delete 'patch-nested-shebangs)))))))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 05/45] guix: node-build-system: Add delete-lockfiles phase.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (3 preceding siblings ...)
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 04/45] gnu: node: Add an npmrc file to set nodedir Philip McGrath
@ 2021-12-13  6:00                                 ` Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 06/45] guix: node-build-system: Refactor patch-dependencies phase Philip McGrath
                                                   ` (40 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:00 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* guix/build/node-build-system.scm (delete-lockfiles): New function.
Remove 'package-lock.json', 'yarn.lock', and 'npm-shrinkwrap.json',
if they exist.  Because these files specify  both exact dependency
versions and integrity hashes, they only cause problems for Guix.
(%standard-phases): Add 'delete-lockfiles' after 'patch-dependencies'.
---
 guix/build/node-build-system.scm | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
index 70a367618e..dcaa719f40 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -96,6 +96,17 @@ (define (resolve-dependencies package-meta meta-key)
         (write-json package-meta out))))
   #t)
 
+(define* (delete-lockfiles #:key inputs #:allow-other-keys)
+  "Delete 'package-lock.json', 'yarn.lock', and 'npm-shrinkwrap.json', if they
+exist."
+  (for-each (lambda (pth)
+              (when (file-exists? pth)
+                (delete-file pth)))
+            '("package-lock.json"
+              "yarn.lock"
+              "npm-shrinkwrap.json"))
+  #t)
+
 (define* (configure #:key outputs inputs #:allow-other-keys)
   (let ((npm (string-append (assoc-ref inputs "node") "/bin/npm")))
     (invoke npm "--offline" "--ignore-scripts" "install")
@@ -146,6 +157,7 @@ (define %standard-phases
   (modify-phases gnu:%standard-phases
     (add-after 'unpack 'set-home set-home)
     (add-before 'configure 'patch-dependencies patch-dependencies)
+    (add-after 'patch-dependencies 'delete-lockfiles delete-lockfiles)
     (replace 'configure configure)
     (replace 'build build)
     (replace 'check check)
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 06/45] guix: node-build-system: Refactor patch-dependencies phase.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (4 preceding siblings ...)
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 05/45] guix: node-build-system: Add delete-lockfiles phase Philip McGrath
@ 2021-12-13  6:00                                 ` Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 07/45] guix: node-build-system: Add #:absent-dependencies argument Philip McGrath
                                                   ` (39 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:00 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* guix/build/node-build-system.scm (patch-dependencies): Strictly
follow the linearity rules for `assoc-set!` and friends.
Clarify the types of the arguments to and return value from the
internal helper function `resolve-dependencies`.
---
 guix/build/node-build-system.scm | 53 ++++++++++++++++++++++----------
 1 file changed, 36 insertions(+), 17 deletions(-)

diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
index dcaa719f40..b74e593838 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -73,26 +73,45 @@ (define* (patch-dependencies #:key inputs #:allow-other-keys)
 
   (define index (index-modules (map cdr inputs)))
 
-  (define (resolve-dependencies package-meta meta-key)
-    (fold (lambda (key+value acc)
-            (match key+value
-              ('@ acc)
-              ((key . value) (acons key (hash-ref index key value) acc))))
-          '()
-          (or (assoc-ref package-meta meta-key) '())))
+  (define (resolve-dependencies meta-alist meta-key)
+    ;; Given:
+    ;;  - The alist from "package.json", with the '@ unwrapped
+    ;;  - A string key, like "dependencies"
+    ;; Returns: an alist (without a wrapping '@) like the entry in
+    ;; meta-alist for meta-key, but with dependencies supplied
+    ;; by Guix packages mapped to the absolute store paths to use.
+    (match (assoc-ref meta-alist meta-key)
+      (#f
+       '())
+      (('@ . orig-deps)
+       (fold (match-lambda*
+               (((key . value) acc)
+                (acons key (hash-ref index key value) acc)))
+             '()
+             orig-deps))))
 
   (with-atomic-file-replacement "package.json"
     (lambda (in out)
-      (let ((package-meta (read-json in)))
-        (assoc-set! package-meta "dependencies"
-                    (append
-                     '(@)
-                     (resolve-dependencies package-meta "dependencies")
-                     (resolve-dependencies package-meta "peerDependencies")))
-        (assoc-set! package-meta "devDependencies"
-                    (append
-                     '(@)
-                     (resolve-dependencies package-meta "devDependencies")))
+      ;; It is unsafe to rely on 'assoc-set!' to update an
+      ;; existing assosciation list variable:
+      ;; see 'info "(guile)Adding or Setting Alist Entries"'.
+      (let* ((package-meta (read-json in))
+             (alist (match package-meta
+                      ((@ . alist) alist)))
+             (alist
+              (assoc-set!
+               alist "dependencies"
+               (append
+                '(@)
+                (resolve-dependencies alist "dependencies")
+                (resolve-dependencies alist "peerDependencies"))))
+             (alist
+              (assoc-set!
+               alist "devDependencies"
+               (append
+                '(@)
+                (resolve-dependencies alist "devDependencies"))))
+             (package-meta (cons '@ alist)))
         (write-json package-meta out))))
   #t)
 
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 07/45] guix: node-build-system: Add #:absent-dependencies argument.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (5 preceding siblings ...)
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 06/45] guix: node-build-system: Refactor patch-dependencies phase Philip McGrath
@ 2021-12-13  6:00                                 ` Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 08/45] gnu: node-semver-bootstrap: Use #:absent-dependencies Philip McGrath
                                                   ` (38 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:00 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* guix/build-system/node.scm (lower, node-build): Add optional
argument #:absent-dependencies with default of ''(). Pass it on
to the build-side code.
* guix/build/node-build-system.scm (patch-dependencies): Respect
the #:absent-dependencies argument, removing specified npm
packages from the "dependencies" or "devDependencies" tables
in "package.json".
---
 guix/build-system/node.scm       | 19 ++++++++++++++++++-
 guix/build/node-build-system.scm |  7 +++++--
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/guix/build-system/node.scm b/guix/build-system/node.scm
index 98f63f87ef..4f437f9c0d 100644
--- a/guix/build-system/node.scm
+++ b/guix/build-system/node.scm
@@ -44,6 +44,7 @@ (define (default-node)
 (define* (lower name
                 #:key source inputs native-inputs outputs system target
                 (node (default-node))
+                (absent-dependencies ''())
                 #:allow-other-keys
                 #:rest arguments)
   "Return a bag for NAME."
@@ -73,6 +74,7 @@ (define* (node-build store name inputs
                      (tests? #t)
                      (phases '(@ (guix build node-build-system)
                                  %standard-phases))
+                     (absent-dependencies ''())
                      (outputs '("out"))
                      (search-paths '())
                      (system (%current-system))
@@ -80,7 +82,21 @@ (define* (node-build store name inputs
                      (imported-modules %node-build-system-modules)
                      (modules '((guix build node-build-system)
                                 (guix build utils))))
-  "Build SOURCE using NODE and INPUTS."
+  "Build SOURCE using NODE and INPUTS.
+
+The builder will remove Node.js packages listed in ABSENT-DEPENCENCIES from
+the 'package.json' file's 'dependencies' and 'devDependencies' tables.  This
+mechanism can be used both avoid dependencies we don't want (e.g. optional
+features that would increase closure size) and to work around dependencies
+that haven't been packaged for Guix yet (e.g. test utilities)."
+  ;; Before #:absent-dependencies existed, this scenario was often handled by
+  ;; deleting the 'configure phase. Using #:absent-dependencies, instead,
+  ;; retains the check that no dependencies are silently missing and other
+  ;; actions performed by 'npm install', such as building native
+  ;; addons. Having an explicit list of absent dependencies in the package
+  ;; definition should also facilitate future maintenence: for example, if we
+  ;; add a package for a test framework, it should be easy to find all the
+  ;; other packages that use it and enable their tests.
   (define builder
     `(begin
        (use-modules ,@modules)
@@ -94,6 +110,7 @@ (define builder
                    #:test-target ,test-target
                    #:tests? ,tests?
                    #:phases ,phases
+                   #:absent-dependencies ,absent-dependencies
                    #:outputs %outputs
                    #:search-paths ',(map search-path-specification->sexp
                                          search-paths)
diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
index b74e593838..892104b6d2 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -69,7 +69,8 @@ (define (list-modules directory)
               input-paths)
     index))
 
-(define* (patch-dependencies #:key inputs #:allow-other-keys)
+(define* (patch-dependencies #:key inputs absent-dependencies
+                             #:allow-other-keys)
 
   (define index (index-modules (map cdr inputs)))
 
@@ -86,7 +87,9 @@ (define (resolve-dependencies meta-alist meta-key)
       (('@ . orig-deps)
        (fold (match-lambda*
                (((key . value) acc)
-                (acons key (hash-ref index key value) acc)))
+                (if (member key absent-dependencies)
+                    acc
+                    (acons key (hash-ref index key value) acc))))
              '()
              orig-deps))))
 
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 08/45] gnu: node-semver-bootstrap: Use #:absent-dependencies.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (6 preceding siblings ...)
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 07/45] guix: node-build-system: Add #:absent-dependencies argument Philip McGrath
@ 2021-12-13  6:00                                 ` Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 09/45] gnu: node-ms-bootstrap: " Philip McGrath
                                                   ` (37 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:00 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node.scm (node-semver-bootstrap)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node.scm | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 346cbd488d..0c33c6906e 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -333,9 +333,8 @@ (define-public node-semver-bootstrap
     (arguments
      `(#:node ,node-bootstrap
        #:tests? #f
-       #:phases
-       (modify-phases %standard-phases
-         (delete 'configure))))
+       #:absent-dependencies
+       '("tap")))
     (home-page "https://github.com/npm/node-semver")
     (properties '((hidden? . #t)))
     (synopsis "Parses semantic versions strings")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 09/45] gnu: node-ms-bootstrap: Use #:absent-dependencies.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (7 preceding siblings ...)
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 08/45] gnu: node-semver-bootstrap: Use #:absent-dependencies Philip McGrath
@ 2021-12-13  6:00                                 ` Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 10/45] gnu: node-binary-search-bootstrap: " Philip McGrath
                                                   ` (36 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:00 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node.scm (node-ms-bootstrap)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node.scm | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 0c33c6906e..f2dfa1476b 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -361,9 +361,12 @@ (define-public node-ms-bootstrap
     (arguments
      `(#:node ,node-bootstrap
        #:tests? #f
-       #:phases
-       (modify-phases %standard-phases
-         (delete 'configure))))
+       #:absent-dependencies
+       `("eslint"
+         "expect.js"
+         "husky"
+         "lint-staged"
+         "mocha")))
     (home-page "https://github.com/zeit/ms#readme")
     (properties '((hidden? . #t)))
     (synopsis "Tiny millisecond conversion utility")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 10/45] gnu: node-binary-search-bootstrap: Use #:absent-dependencies.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (8 preceding siblings ...)
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 09/45] gnu: node-ms-bootstrap: " Philip McGrath
@ 2021-12-13  6:00                                 ` Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 11/45] gnu: node-debug-bootstrap: " Philip McGrath
                                                   ` (35 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:00 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node.scm (node-binary-search-bootstrap)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node.scm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index f2dfa1476b..b9f6e181b6 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -392,9 +392,9 @@ (define-public node-binary-search-bootstrap
     (arguments
      `(#:node ,node-bootstrap
        #:tests? #f
-       #:phases
-       (modify-phases %standard-phases
-         (delete 'configure))))
+       #:absent-dependencies
+       `("chai"
+         "mocha")))
     (home-page "https://github.com/darkskyapp/binary-search#readme")
     (properties '((hidden? . #t)))
     (synopsis "Tiny binary search function with comparators")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 11/45] gnu: node-debug-bootstrap: Use #:absent-dependencies.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (9 preceding siblings ...)
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 10/45] gnu: node-binary-search-bootstrap: " Philip McGrath
@ 2021-12-13  6:00                                 ` Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 12/45] gnu: node-llparse-builder-bootstrap: " Philip McGrath
                                                   ` (34 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:00 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node.scm (node-debug-bootstrap)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node.scm | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index b9f6e181b6..b605442f64 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -419,9 +419,18 @@ (define-public node-debug-bootstrap
     (arguments
      `(#:node ,node-bootstrap
        #:tests? #f
-       #:phases
-       (modify-phases %standard-phases
-         (delete 'configure))))
+       #:absent-dependencies
+       `("brfs"
+         "browserify"
+         "coveralls"
+         "istanbul"
+         "karma"
+         "karma-browserify"
+         "karma-chrome-launcher"
+         "karma-mocha"
+         "mocha"
+         "mocha-lcov-reporter"
+         "xo")))
     (inputs `(("node-ms" ,node-ms-bootstrap)))
     (home-page "https://github.com/visionmedia/debug#readme")
     (properties '((hidden? . #t)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 12/45] gnu: node-llparse-builder-bootstrap: Use #:absent-dependencies.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (10 preceding siblings ...)
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 11/45] gnu: node-debug-bootstrap: " Philip McGrath
@ 2021-12-13  6:00                                 ` Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 13/45] gnu: node-llparse-frontend-bootstrap: " Philip McGrath
                                                   ` (33 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:00 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node.scm (node-llparse-builder-bootstrap)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node.scm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index b605442f64..2dddea8239 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -482,9 +482,15 @@ (define-public node-llparse-builder-bootstrap
     (arguments
      `(#:node ,node-bootstrap
        #:tests? #f
+       #:absent-dependencies
+       `("@types/mocha"
+         "@types/node"
+         "mocha"
+         "ts-node"
+         "tslint"
+         "typescript")
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure)
          (replace 'build
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((esbuild (string-append (assoc-ref inputs "esbuild")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 13/45] gnu: node-llparse-frontend-bootstrap: Use #:absent-dependencies.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (11 preceding siblings ...)
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 12/45] gnu: node-llparse-builder-bootstrap: " Philip McGrath
@ 2021-12-13  6:00                                 ` Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 14/45] gnu: node-llparse-bootstrap: " Philip McGrath
                                                   ` (32 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:00 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node.scm (node-llparse-frontend-bootstrap)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node.scm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 2dddea8239..c429495955 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -544,9 +544,16 @@ (define-public node-llparse-frontend-bootstrap
     (arguments
      `(#:node ,node-bootstrap
        #:tests? #f
+       #:absent-dependencies
+       `("@types/debug"
+         "@types/mocha"
+         "@types/node"
+         "mocha"
+         "ts-node"
+         "tslint"
+         "typescript")
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure)
          (replace 'build
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((esbuild (string-append (assoc-ref inputs "esbuild")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 14/45] gnu: node-llparse-bootstrap: Use #:absent-dependencies.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (12 preceding siblings ...)
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 13/45] gnu: node-llparse-frontend-bootstrap: " Philip McGrath
@ 2021-12-13  6:00                                 ` Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 15/45] gnu: node-semver: " Philip McGrath
                                                   ` (31 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:00 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node.scm (node-llparse-bootstrap)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node.scm | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index c429495955..2baa382cd9 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -606,9 +606,18 @@ (define-public node-llparse-bootstrap
     (arguments
      `(#:node ,node-bootstrap
        #:tests? #f
+       #:absent-dependencies
+       `("@types/debug"
+         "@types/mocha"
+         "@types/node"
+         "esm"
+         "llparse-test-fixture"
+         "mocha"
+         "ts-node"
+         "tslint"
+         "typescript")
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure)
          (replace 'build
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((esbuild (string-append (assoc-ref inputs "esbuild")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 15/45] gnu: node-semver: Use #:absent-dependencies.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (13 preceding siblings ...)
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 14/45] gnu: node-llparse-bootstrap: " Philip McGrath
@ 2021-12-13  6:00                                 ` Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 16/45] gnu: node-wrappy: " Philip McGrath
                                                   ` (30 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:00 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node-xyz.scm (node-semver)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node-xyz.scm | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 98c611f227..93a033d33e 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -289,11 +289,10 @@ (define-public node-semver
                 "06biknqb05r9xsmcflm3ygh50pjvdk84x6r79w43kmck4fn3qn5p"))))
     (build-system node-build-system)
     (arguments
-     '(#:tests? #f ; FIXME: Tests depend on node-tap
-       #:phases
-       (modify-phases %standard-phases
-         ;; The only dependency to check for is tap, which we don't have.
-         (delete 'configure))))
+     '(#:absent-dependencies
+       '("tap")
+       ;; FIXME: Tests depend on node-tap
+       #:tests? #f))
     (home-page "https://github.com/npm/node-semver")
     (synopsis "Parses semantic versions strings")
     (description
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 16/45] gnu: node-wrappy: Use #:absent-dependencies.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (14 preceding siblings ...)
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 15/45] gnu: node-semver: " Philip McGrath
@ 2021-12-13  6:00                                 ` Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 17/45] gnu: node-once: " Philip McGrath
                                                   ` (29 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:00 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node-xyz.scm (node-wrappy)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node-xyz.scm | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 93a033d33e..77577cb315 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -316,10 +316,8 @@ (define-public node-wrappy
     (build-system node-build-system)
     (arguments
      '(#:tests? #f ; FIXME: Tests depend on node-tap
-       #:phases
-       (modify-phases %standard-phases
-         ;; The only dependency to check for is tap, which we don't have.
-         (delete 'configure))))
+       #:absent-dependencies
+       '("tap")))
     (home-page "https://github.com/npm/wrappy")
     (synopsis "Callback wrapping utility")
     (description "@code{wrappy} is a utility for Node.js to wrap callbacks.")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 17/45] gnu: node-once: Use #:absent-dependencies.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (15 preceding siblings ...)
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 16/45] gnu: node-wrappy: " Philip McGrath
@ 2021-12-13  6:00                                 ` Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 18/45] gnu: node-irc-colors: " Philip McGrath
                                                   ` (28 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:00 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node-xyz.scm (node-once)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node-xyz.scm | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 77577cb315..eb071320cd 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -338,13 +338,10 @@ (define-public node-once
                 "1z8dcbf28dqdcp4wb0c53wrs90a07nkrax2c9kk26dsk1dhrnxav"))))
     (build-system node-build-system)
     (arguments
-     '(#:tests? #f                      ; FIXME: tests depend on node-tap
-       #:phases
-       (modify-phases %standard-phases
-         ;; The default configure phase fails due to tap being missing, as we do
-         ;; not have tap packaged yet.  It is used only for tests.  This package
-         ;; still works as a dependency of node-glob and node-inflight.
-         (delete 'configure))))
+     '(#:absent-dependencies
+       '("tap")
+       ;; FIXME: Tests depend on node-tap
+       #:tests? #f))
     (inputs
      `(("node-wrappy" ,node-wrappy)))
     (home-page "https://github.com/isaacs/once")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 18/45] gnu: node-irc-colors: Use #:absent-dependencies.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (16 preceding siblings ...)
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 17/45] gnu: node-once: " Philip McGrath
@ 2021-12-13  6:00                                 ` Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 19/45] gnu: node-irc: " Philip McGrath
                                                   ` (27 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:00 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node-xyz.scm (node-irc-colors)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node-xyz.scm | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index eb071320cd..9646c14243 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -367,12 +367,10 @@ (define-public node-irc-colors
                 "0q3y34rbnlc55jcakmdxkicwazyvyph9r6gaf6hi8k7wj2nfwfli"))))
     (build-system node-build-system)
     (arguments
-     '(#:tests? #f                      ; FIXME: tests depend on node-istanbul
-       #:phases
-       (modify-phases %standard-phases
-         ;; The default configure phase fails due to various packages
-         ;; being missing, as we don't have them packaged yet.
-         (delete 'configure))))
+     '(#:absent-dependencies
+       `("istanbul"
+         "vows")
+       #:tests? #f))
     (home-page "https://github.com/fent/irc-colors.js")
     (synopsis "Node.js module providing color and formatting for IRC")
     (description "@code{node-irc-colors} is a Node.js module that
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 19/45] gnu: node-irc: Use #:absent-dependencies.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (17 preceding siblings ...)
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 18/45] gnu: node-irc-colors: " Philip McGrath
@ 2021-12-13  6:00                                 ` Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 20/45] guix: node-build-system: Add implicit libuv input Philip McGrath
                                                   ` (26 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:00 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node-xyz.scm (node-irc)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node-xyz.scm | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 9646c14243..998d0a9a90 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -394,12 +394,12 @@ (define-public node-irc
                 "1ln4qfx20jbwg4cp8lp0vf27m5281z2sz16d15xd6150n26cbi4x"))))
     (build-system node-build-system)
     (arguments
-     '(#:tests? #f                      ; FIXME: tests depend on node-faucet
-       #:phases
-       (modify-phases %standard-phases
-         ;; The default configure phase fails due to various packages
-         ;; being missing, as we don't have them packaged yet.
-         (delete 'configure))))
+     '(#:absent-dependencies
+       `("ansi-color"
+         "faucet"
+         "jscs"
+         "tape")
+       #:tests? #f))
     (inputs
      `(("node-irc-colors" ,node-irc-colors)))
     (home-page "https://github.com/martynsmith/node-irc")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 20/45] guix: node-build-system: Add implicit libuv input.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (18 preceding siblings ...)
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 19/45] gnu: node-irc: " Philip McGrath
@ 2021-12-13  6:00                                 ` Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 21/45] guix: node-build-system: Add avoid-node-gyp-rebuild phase Philip McGrath
                                                   ` (25 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:00 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* guix/build-system/node.scm (lower): Add the version of libuv
used as an input to the #:node package as an additional implicit
input, so that packages needing libuv always get the correct version.
---
 guix/build-system/node.scm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/guix/build-system/node.scm b/guix/build-system/node.scm
index 4f437f9c0d..179da65ee8 100644
--- a/guix/build-system/node.scm
+++ b/guix/build-system/node.scm
@@ -1,6 +1,8 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2016 Jelle Licht <jlicht@fsfe.org>
 ;;; Copyright © 2019 Timothy Sample <samplet@ngyro.com>
+;;; Copyright © 2021 Pierre Langlois <pierre.langlois@gmx.com>
+;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -59,10 +61,15 @@ (define private-keywords
                               `(("source" ,source))
                               '())
                         ,@inputs
-
                         ;; Keep the standard inputs of 'gnu-build-system'.
                         ,@(standard-packages)))
          (build-inputs `(("node" ,node)
+                         ;; Many packages with native addons need
+                         ;; libuv headers. The libuv version must
+                         ;; be exactly the same as for the node
+                         ;; package we are adding implicitly,
+                         ;; so we take care of adding libuv, too.
+                         ("libuv" ,@(assoc-ref (package-inputs node) "libuv"))
                          ,@native-inputs))
          (outputs outputs)
          (build node-build)
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 21/45] guix: node-build-system: Add avoid-node-gyp-rebuild phase.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (19 preceding siblings ...)
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 20/45] guix: node-build-system: Add implicit libuv input Philip McGrath
@ 2021-12-13  6:00                                 ` Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 22/45] gnu: Add node-inherits Philip McGrath
                                                   ` (24 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:00 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* guix/build/node-build-system.scm (avoid-node-gyp-rebuild): New
function. Override the default install script for packages with
native addons to prevent it from attempting to write to the store
when such packages are used.
(%standard-phases): Add 'avoid-node-gyp-rebuild' after 'install'.
---
 guix/build/node-build-system.scm | 59 +++++++++++++++++++++++++++++++-
 1 file changed, 58 insertions(+), 1 deletion(-)

diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
index 892104b6d2..f9ca515d58 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -175,6 +175,62 @@ (define* (install #:key outputs inputs #:allow-other-keys)
             "install" "../package.tgz")
     #t))
 
+(define* (avoid-node-gyp-rebuild #:key outputs #:allow-other-keys)
+  "Adjust the installed 'package.json' to remove an 'install' script that
+would try to run 'node-gyp rebuild'."
+  ;; We want to take advantage of `npm install`'s automatic support for
+  ;; building native addons with node-gyp: in particular, it helps us avoid
+  ;; hard-coding the specifics of how npm's internal copy of node-gyp is
+  ;; currently packaged. However, the mechanism by which the automatic support
+  ;; is implemented causes problems for us.
+  ;;
+  ;; If a package contains a 'binding.gyp' file and does not define an
+  ;; 'install' or 'preinstall' script, 'npm install' runs a default install
+  ;; script consisting of 'node-gyp rebuild'. In our 'install' phase, this
+  ;; implicit 'install' script, if it is applicable, is explicitly added to
+  ;; the "package.json" file. However, if another Guix package were to use a
+  ;; Node.js package with such an 'install' script, the dependent package's
+  ;; build process would fail, because 'node-gyp rebuild' would try to write
+  ;; to the store.
+  ;;
+  ;; Here, if the installed "package.json" defines scripts.install as
+  ;; "node-gyp rebuild", we replace it with a no-op. Importantly, deleting the
+  ;; install script definition would not be enough, because the default
+  ;; install script would cause the same problem.
+  ;;
+  ;; 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
+  (let* ((package.json (string-append
+                        (assoc-ref outputs "out")
+                        "/lib/node_modules/"
+                        (match (call-with-input-file "package.json" read-json)
+                          (('@ . alist)
+                           (assoc-ref alist "name")))
+                        "/package.json"))
+         (meta-alist (match (call-with-input-file package.json read-json)
+                       (('@ . alist)
+                        alist)))
+         (scripts-alist (match (assoc-ref meta-alist "scripts")
+                          (('@ . alist)
+                           alist)
+                          (#f
+                           #f))))
+    (when (and scripts-alist
+               (equal? "node-gyp rebuild" (assoc-ref scripts-alist "install")))
+      (call-with-output-file package.json
+        (lambda (out)
+          (write-json
+           (cons '@ (assoc-set!
+                     meta-alist
+                     "scripts"
+                     (cons '@ (assoc-set!
+                               scripts-alist
+                               "install"
+                               "echo Guix: avoiding node-gyp rebuild"))))
+           out))))
+    #t))
+
 (define %standard-phases
   (modify-phases gnu:%standard-phases
     (add-after 'unpack 'set-home set-home)
@@ -184,7 +240,8 @@ (define %standard-phases
     (replace 'build build)
     (replace 'check check)
     (add-before 'install 'repack repack)
-    (replace 'install install)))
+    (replace 'install install)
+    (add-after 'install 'avoid-node-gyp-rebuild avoid-node-gyp-rebuild)))
 
 (define* (node-build #:key inputs (phases %standard-phases)
                      #:allow-other-keys #:rest args)
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 22/45] gnu: Add node-inherits.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (20 preceding siblings ...)
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 21/45] guix: node-build-system: Add avoid-node-gyp-rebuild phase Philip McGrath
@ 2021-12-13  6:00                                 ` Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 23/45] gnu: Add node-safe-buffer Philip McGrath
                                                   ` (23 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:00 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-inherits): New variable.
---
 gnu/packages/node-xyz.scm | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 998d0a9a90..9d8bf27852 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2020 Giacomo Leidi <goodoldpaul@autistici.org>
 ;;; Copyright © 2021 Noisytoot <noisytoot@disroot.org>
 ;;; Copyright © 2021 Charles <charles.b.jackson@protonmail.com>
+;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -352,6 +353,35 @@ (define-public node-once
 if desired.")
     (license license:isc)))
 
+(define-public node-inherits
+  (package
+    (name "node-inherits")
+    (version "2.0.4")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/isaacs/inherits")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0cpsr5yqwkxpbbbbl0rwk4mcby6zbx841k2zb4c3gb1579i5wq9p"))))
+    (build-system node-build-system)
+    (arguments
+     '(#:absent-dependencies
+       '("tap")
+       ;; FIXME: Tests depend on node-tap
+       #:tests? #f))
+    (home-page
+     "https://github.com/isaacs/inherits")
+    (synopsis
+     "Browser-friendly inheritance Node.js")
+    (description
+     "Browser-friendly inheritance fully compatible with standard Node.js
+@code{inherits()}.")
+    (license license:isc)))
+
 (define-public node-irc-colors
   (package
     (name "node-irc-colors")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 23/45] gnu: Add node-safe-buffer.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (21 preceding siblings ...)
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 22/45] gnu: Add node-inherits Philip McGrath
@ 2021-12-13  6:00                                 ` Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 24/45] gnu: Add node-string-decoder Philip McGrath
                                                   ` (22 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:00 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-safe-buffer): New variable.
---
 gnu/packages/node-xyz.scm | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 9d8bf27852..6dff0ddba5 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -382,6 +382,34 @@ (define-public node-inherits
 @code{inherits()}.")
     (license license:isc)))
 
+(define-public node-safe-buffer
+  (package
+    (name "node-safe-buffer")
+    (version "5.2.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/feross/safe-buffer")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0r26m0nl41h90ihnl2xf0cqs6z9z7jb87dl5j8yqb7887r9jlbpi"))))
+    (build-system node-build-system)
+    (arguments
+     '(#:absent-dependencies
+       '("tape"
+         "standard")
+       #:tests? #f))
+    (home-page
+     "https://github.com/feross/safe-buffer")
+    (synopsis "Safer Node.js Buffer API")
+    (description "A safe drop-in replacement the Node.js @code{Buffer} API
+that works in all versions of Node.js, using the built-in implementation when
+available.")
+    (license license:expat)))
+
 (define-public node-irc-colors
   (package
     (name "node-irc-colors")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 24/45] gnu: Add node-string-decoder.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (22 preceding siblings ...)
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 23/45] gnu: Add node-safe-buffer Philip McGrath
@ 2021-12-13  6:00                                 ` Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 25/45] gnu: Add node-readable-stream Philip McGrath
                                                   ` (21 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:00 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-string-decoder): New variable.
---
 gnu/packages/node-xyz.scm | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 6dff0ddba5..c6cce64f7d 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -410,6 +410,40 @@ (define-public node-safe-buffer
 available.")
     (license license:expat)))
 
+(define-public node-string-decoder
+  (package
+    (name "node-string-decoder")
+    (version "1.3.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nodejs/string_decoder")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0xxvyya9fl9rlkqwmxzqzbz4rdr3jgw4vf37hff7cgscxkhg266k"))))
+    (build-system node-build-system)
+    (arguments
+     '(#:absent-dependencies
+       '("tap"
+         "core-util-is"
+         "babel-polyfill")
+       ;; FIXME: Tests depend on node-tap
+       #:tests? #f))
+    (inputs
+     `(("node-safe-buffer" ,node-safe-buffer)
+       ("node-inherits" ,node-inherits)))
+    (home-page
+     "https://github.com/nodejs/string_decoder")
+    (synopsis
+     "Node.js core @code{string_decoder} for userland")
+    (description
+     "This package is a mirror of the @code{string_decoder} implementation in
+Node-core.")
+    (license license:expat)))
+
 (define-public node-irc-colors
   (package
     (name "node-irc-colors")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 25/45] gnu: Add node-readable-stream.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (23 preceding siblings ...)
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 24/45] gnu: Add node-string-decoder Philip McGrath
@ 2021-12-13  6:00                                 ` Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 26/45] gnu: Add node-nan Philip McGrath
                                                   ` (20 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:00 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-readable-stream): New variable.
---
 gnu/packages/node-xyz.scm | 54 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index c6cce64f7d..3e06413908 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -444,6 +444,60 @@ (define-public node-string-decoder
 Node-core.")
     (license license:expat)))
 
+(define-public node-readable-stream
+  (package
+    (name "node-readable-stream")
+    (version "3.6.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nodejs/readable-stream")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0ybl4cdgsm9c5jq3xq8s01201jk8w0yakh63hlclsfbcdfqhd9ri"))))
+    (build-system node-build-system)
+    (arguments
+     `(#:absent-dependencies
+       `("@babel/cli"
+         "@babel/core"
+         "@babel/polyfill"
+         "@babel/preset-env"
+         "airtap"
+         "assert"
+         "bl"
+         "deep-strict-equal"
+         "events.once"
+         "glob"
+         "gunzip-maybe"
+         "hyperquest"
+         "lolex"
+         "nyc"
+         "pump"
+         "rimraf"
+         "tap"
+         "tape"
+         "tar-fs"
+         "util-promisify")
+       #:tests? #f))
+    (inputs
+     `(("node-util-deprecate" ,node-util-deprecate)
+       ("node-string-decoder" ,node-string-decoder)
+       ("node-inherits" ,node-inherits)))
+    (home-page
+     "https://github.com/nodejs/readable-stream")
+    (synopsis
+     "Node.js core streams for userland")
+    (description
+     "This package is a mirror of the streams implementations in Node.js.
+
+If you want to guarantee a stable streams base, regardless of what version of
+Node you (or the users of your libraries) are using, use
+@code{readable-stream} only and avoid the @code{stream} module in Node-core.")
+    (license license:expat)))
+
 (define-public node-irc-colors
   (package
     (name "node-irc-colors")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 26/45] gnu: Add node-nan.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (24 preceding siblings ...)
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 25/45] gnu: Add node-readable-stream Philip McGrath
@ 2021-12-13  6:00                                 ` Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 27/45] gnu: Add node-openzwave-shared Philip McGrath
                                                   ` (19 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:00 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-nan): New variable.
---
 gnu/packages/node-xyz.scm | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 3e06413908..43cf9fe660 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -553,3 +553,42 @@ (define-public node-irc
     (description "@code{node-irc} is an IRC client library for Node.js.
 It has functions for joining, parting, talking, and many other IRC commands.")
     (license license:gpl3+)))
+
+(define-public node-nan
+  (package
+    (name "node-nan")
+    (version "2.15.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nodejs/nan")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "18xslh9va5ld872scrp5y4251ax9s3c6qh0lnl1200lpzbsxy7yd"))))
+    (build-system node-build-system)
+    (arguments
+     `(#:absent-dependencies
+       '("bindings"
+         "commander"
+         "glob"
+         "request"
+         "node-gyp" ;; would be needed for tests
+         "tap"
+         "xtend")
+       ;; tests need tap and other dependencies
+       #:tests? #f))
+    (inputs
+     `(("readable-stream" ,node-readable-stream)))
+    (home-page "https://github.com/nodejs/nan")
+    (synopsis "Native Abstractions for Node.js")
+    (description "Native Abstractions for Node.js (``NaN'') provides a header
+file filled with macro and utility goodness for making add-on development for
+Node.js easier across versions. The goal of this project is to store all logic
+necessary to develop native Node.js addons without having to inspect
+@code{NODE_MODULE_VERSION} and get yourself into a macro-tangle.
+
+This project also contains some helper utilities that make addon development a
+bit more pleasant.")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 27/45] gnu: Add node-openzwave-shared.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (25 preceding siblings ...)
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 26/45] gnu: Add node-nan Philip McGrath
@ 2021-12-13  6:00                                 ` Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 28/45] gnu: Add node-addon-api Philip McGrath
                                                   ` (18 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:00 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/zwave.scm (node-openzwave-shared): New variable.
---
 gnu/packages/zwave.scm | 69 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 69 insertions(+)

diff --git a/gnu/packages/zwave.scm b/gnu/packages/zwave.scm
index 2019ec32df..feecf51e9c 100644
--- a/gnu/packages/zwave.scm
+++ b/gnu/packages/zwave.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -21,11 +22,14 @@ (define-module (gnu packages zwave)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix git-download)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system node)
   #:use-module (gnu packages)
   #:use-module (gnu packages base)
+  #:use-module (gnu packages node-xyz)
   #:use-module (gnu packages libusb)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages perl)
+  #:use-module (gnu packages python)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages xml))
 
@@ -88,3 +92,68 @@ (define-public open-zwave
 and respond to devices on a Z-Wave network, without requiring in-depth
 knowledge of the Z-Wave protocol.")
     (license license:lgpl3+)))
+
+(define-public node-openzwave-shared
+  (package
+    (name "node-openzwave-shared")
+    (version "1.7.2")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/OpenZWave/node-openzwave-shared")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "1bqqy12dzqj05j9wsh50dmn84dddmhz0gjzvd3y20z4hpy1v8rsc"))))
+    (inputs
+     `(("open-zwave" ,open-zwave)
+       ("node-nan" ,node-nan)))
+    (native-inputs
+     `(("which" ,which)
+       ("python" ,python)
+       ("pkg-config" ,pkg-config)))
+    (build-system node-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (replace 'build
+           ;; For some reason, `npm install` doesn't build
+           ;; the addon automatically, so we do it explicitly here.
+           ;; We go through `npx` so the npmrc file sets the
+           ;; configuration up properly.
+           (lambda* (#:key inputs #:allow-other-keys)
+             (define node-dir
+               (assoc-ref inputs "node"))
+             (invoke (string-append node-dir "/bin/npx")
+                     "--call"
+                     (string-append
+                      node-dir
+                      "/lib/node_modules/npm/bin/node-gyp-bin/node-gyp"
+                      " "
+                      "rebuild")))))))
+    (home-page "https://github.com/OpenZWave/node-openzwave-shared")
+    (synopsis "Node.js bindings for OpenZWave")
+    (description
+     "With the @code{node-openzwave-shared} package, you can easily control
+and manage your Z-Wave devices (lights, dimmers, blinds, you name it) from
+within Node.js applications.  This library also supports secure
+devices (e.g. door locks) that require encryption.  All widely used Node.js
+versions are supported with the help of @code{node-nan}.
+
+This library is currently able to:
+@itemize @bullet
+@item
+scan a Z-Wave network and report on connected devices;
+@item
+write values to Z-Wave nodes;
+@item
+monitor the network for changes;
+@item
+heal nodes and/or the network; and
+@item
+perform management tasks: add or remove nodes, replace failed nodes,
+manage their group associations, etc.
+@end itemize")
+    (license license:isc)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 28/45] gnu: Add node-addon-api.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (26 preceding siblings ...)
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 27/45] gnu: Add node-openzwave-shared Philip McGrath
@ 2021-12-13  6:00                                 ` Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 29/45] gnu: Add node-sqlite3 Philip McGrath
                                                   ` (17 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:00 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-addon-api): New variable.
---
 gnu/packages/node-xyz.scm | 63 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 43cf9fe660..c7bc660134 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -22,6 +22,9 @@
 
 (define-module (gnu packages node-xyz)
   #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (gnu packages sqlite)
+  #:use-module (gnu packages python)
+  #:use-module (guix gexp)
   #:use-module (guix packages)
   #:use-module (guix git-download)
   #:use-module (guix build-system node))
@@ -592,3 +595,63 @@ (define-public node-nan
 This project also contains some helper utilities that make addon development a
 bit more pleasant.")
     (license license:expat)))
+
+(define-public node-addon-api
+  (package
+    (name "node-addon-api")
+    (version "4.2.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nodejs/node-addon-api")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1bhvfi2m9nxfz418s619914vmidcnrzbjv6l9nid476c3zlpazch"))))
+    (inputs
+     `(("python" ,python)
+       ("node-safe-buffer" ,node-safe-buffer)))
+    (build-system node-build-system)
+    (arguments
+     `(#:absent-dependencies
+       `("benchmark"
+         "bindings"
+         "clang-format"
+         "eslint"
+         "eslint-config-semistandard"
+         "eslint-config-standard"
+         "eslint-plugin-import"
+         "eslint-plugin-node"
+         "eslint-plugin-promise"
+         "fs-extra"
+         "path"
+         "pre-commit")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'skip-js-tests
+           ;; We can't run the js-based tests,
+           ;; but we can still do the C++ parts
+           (lambda args
+             (substitute* "package.json"
+               (("\"test\": \"node test\"")
+                "\"test\": \"echo stopping after pretest on Guix\"")))))))
+    (home-page "https://github.com/nodejs/node-addon-api")
+    (synopsis "Node.js API (Node-API) header-only C++ wrappers")
+    (description "This module contains header-only C++ wrapper classes which
+simplify the use of the C based Node-API provided by Node.js when using C++.
+It provides a C++ object model and exception handling semantics with low
+overhead.
+
+Node-API is an ABI stable C interface provided by Node.js for building native
+addons.  It is intended to insulate native addons from changes in the
+underlying JavaScript engine and allow modules compiled for one version to run
+on later versions of Node.js without recompilation.  The @code{node-addon-api}
+module, which is not part of Node.js, preserves the benefits of the Node-API
+as it consists only of inline code that depends only on the stable API
+provided by Node-API.
+
+It is important to remember that @emph{other} Node.js interfaces such as
+@code{libuv} (included in a project via @code{#include <uv.h>}) are not
+ABI-stable across Node.js major versions.")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 29/45] gnu: Add node-sqlite3.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (27 preceding siblings ...)
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 28/45] gnu: Add node-addon-api Philip McGrath
@ 2021-12-13  6:00                                 ` Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 30/45] gnu: Add node-file-uri-to-path Philip McGrath
                                                   ` (16 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:00 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-sqlite3): New variable.
---
 gnu/packages/node-xyz.scm | 132 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 132 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index c7bc660134..d1bb236186 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -655,3 +655,135 @@ (define-public node-addon-api
 @code{libuv} (included in a project via @code{#include <uv.h>}) are not
 ABI-stable across Node.js major versions.")
     (license license:expat)))
+
+(define-public node-sqlite3
+  (package
+    (name "node-sqlite3")
+    (version "5.0.2")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/mapbox/node-sqlite3")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0sbbzzli282nxyfha10zx0k5m8hdp0sf3ipl59khjb7wm449j86h"))
+       (snippet
+        (with-imported-modules '((guix build utils))
+          #~(begin
+              (use-modules (guix build utils))
+              ;; unbundle sqlite
+              (for-each delete-file-recursively
+                        (find-files "deps"
+                                    (lambda (pth stat)
+                                      (gzip-file? pth)))))))))
+    (inputs
+     `(("node-addon-api" ,node-addon-api)
+       ("python" ,python)
+       ("sqlite" ,sqlite)))
+    (build-system node-build-system)
+    (arguments
+     `(#:tests?
+       #f ; FIXME: tests depend on node-mocha
+       #:modules
+       ((guix build node-build-system)
+        (guix build json)
+        (srfi srfi-1)
+        (ice-9 match)
+        (guix build utils))
+       #:absent-dependencies
+       `(;; Normally, this is "built" using @mapbox/node-pre-gyp,
+         ;; which publishes or downloads pre-built binaries
+         ;; or falls back to building from source.
+         ;; Here, we patch out all of that and just build directly.
+         ;; It would be better to patch a version of @mapbox/node-pre-gyp
+         ;; that always builds from source, as Debian does,
+         ;; but there are a number of dependencies that need
+         ;; to be packaged or removed.
+         "@mapbox/node-pre-gyp"
+         "node-pre-gyp" ;; deprecated name still used in some places
+         "aws-sdk"
+         "@mapbox/cloudfriend"
+         ;; Confusingly, this is only a dependency because of
+         ;; @mapbox/node-pre-gyp: with that removed,
+         ;; npm will use its own copy:
+         "node-gyp"
+         ;; These we'd like, we just don't have them yet:
+         "eslint"
+         "mocha")
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'configure 'npm-config-sqlite
+           ;; We need this step even if we do replace @mapbox/node-pre-gyp
+           ;; because the package expects to build its bundled sqlite
+           (lambda* (#:key inputs #:allow-other-keys)
+             (setenv "npm_config_sqlite" (assoc-ref inputs "sqlite"))))
+         (add-after 'install 'patch-binding-path
+           ;; We replace a file that dynamic searches for the addon using
+           ;; node-pre-gyp (which we don't have) with a version that
+           ;; simply uses the path to the addon we built directly.
+           ;; The exact path is supposed to depend on things like the
+           ;; architecture and napi_build_version, so, to avoid having
+           ;; hard-code the details accurately, we do this after the addon
+           ;; has been built so we can just find where it ended up.
+           (lambda* (#:key outputs #:allow-other-keys)
+             (with-directory-excursion
+                 (string-append (assoc-ref outputs "out")
+                                "/lib/node_modules/sqlite3/lib")
+               (match (find-files "binding" "\\.node$")
+                 ((rel-path)
+                  (with-atomic-file-replacement "sqlite3-binding.js"
+                    (lambda (in out)
+                      (format out "var binding = require('./~a');\n" rel-path)
+                      (display "module.exports = exports = binding;\n" out))))))))
+         (add-after 'patch-dependencies 'avoid-node-pre-gyp
+           (lambda args
+             ;; We need to patch .npmignore before the 'repack phase
+             ;; so that the built addon is installed with in the package.
+             ;; (Upstream assumes node-pre-gyp will download a pre-built
+             ;; version when this package is installed.)
+             (substitute* ".npmignore"
+               (("lib/binding")
+                "#lib/binding # <- patched for Guix"))
+             ;; We need to remove the install script from "package.json",
+             ;; as it would try to use node-pre-gyp and would block the
+             ;; automatic building performed by `npm install`.
+             (with-atomic-file-replacement "package.json"
+               (lambda (in out)
+                 (let* ((js (read-json in))
+                        (alist (match js
+                                 (('@ . alist) alist)))
+                        (scripts-alist (match (assoc-ref alist "scripts")
+                                         (('@ . alist) alist)))
+                        (scripts-alist
+                         ;; install script would use node-pre-gyp
+                         (assoc-remove! scripts-alist "install"))
+                        (alist
+                         (assoc-set! alist "scripts" (cons '@ scripts-alist)))
+                        (binary-alist (match (assoc-ref alist "binary")
+                                        (('@ . alist) alist)))
+                        (js (cons '@ alist)))
+                   ;; When it builds from source, node-pre-gyp supplies
+                   ;; module_name and module_path based on the entries under
+                   ;; "binary" from "package.json", so this package's
+                   ;; "binding.gyp" doesn't define them. Thus, we also need
+                   ;; to supply them. The GYP_DEFINES environment variable
+                   ;; turns out to be the easiest way to make sure they are
+                   ;; propagated from npm to node-gyp to gyp.
+                   (setenv "GYP_DEFINES"
+                           (string-append
+                            "module_name="
+                            (assoc-ref binary-alist "module_name")
+                            " "
+                            "module_path="
+                            (assoc-ref binary-alist "module_path")))
+                   (write-json js
+                               out)))))))))
+    (home-page "https://github.com/mapbox/node-sqlite3")
+    (synopsis "Asynchronous, non-blocking SQLite3 bindings for Node.js")
+    (description
+     "The Node.js add-on @code{node-sqlite3} provides a set of a asynchronous,
+non-blocking bindings for SQLite3, written in modern C++ and tested for memory
+leaks.")
+     (license license:bsd-3)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 30/45] gnu: Add node-file-uri-to-path.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (28 preceding siblings ...)
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 29/45] gnu: Add node-sqlite3 Philip McGrath
@ 2021-12-13  6:00                                 ` Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 31/45] gnu: Add node-bindings Philip McGrath
                                                   ` (15 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:00 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-file-uri-to-path): New variable.
---
 gnu/packages/node-xyz.scm | 55 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index d1bb236186..bdfe71a1f3 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -24,6 +24,7 @@ (define-module (gnu packages node-xyz)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (gnu packages sqlite)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages web)
   #:use-module (guix gexp)
   #:use-module (guix packages)
   #:use-module (guix git-download)
@@ -787,3 +788,57 @@ (define-public node-sqlite3
 non-blocking bindings for SQLite3, written in modern C++ and tested for memory
 leaks.")
      (license license:bsd-3)))
+
+(define-public node-file-uri-to-path
+  (package
+    (name "node-file-uri-to-path")
+    (version "2.0.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/TooTallNate/file-uri-to-path")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "08l779az44czm12xdhgcrnzpqw34s59hbrlfphs7g9y2k26drqav"))))
+    (native-inputs
+     `(("esbuild" ,esbuild)))
+    (build-system node-build-system)
+    (arguments
+     `(#:absent-dependencies
+       `("@types/mocha"
+         "@types/node"
+         "@typescript-eslint/eslint-plugin"
+         "@typescript-eslint/parser"
+         "cpy-cli"
+         "eslint"
+         "eslint-config-airbnb"
+         "eslint-config-prettier"
+         "eslint-import-resolver-typescript"
+         "eslint-plugin-import"
+         "eslint-plugin-jsx-a11y"
+         "eslint-plugin-react"
+         "mocha"
+         "rimraf"
+         "typescript")
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'build
+           (lambda* (#:key inputs native-inputs #:allow-other-keys)
+             (copy-recursively "src" "dist")
+             (invoke (string-append
+                      (assoc-ref (or native-inputs inputs) "esbuild")
+                      "/bin/esbuild")
+                     "dist/index.ts"
+                     "--outfile=dist/src/index.js"
+                     "--format=cjs"
+                     "--sourcemap"
+                     "--platform=node"))))
+       #:tests? #f))
+    (home-page "https://github.com/TooTallNate/file-uri-to-path")
+    (synopsis "Convert a @code{file:} URI to a file path")
+    (description "This package provides a function to convert a @code{file:}
+URI to a file path.  It accepts a @code{file:} URI and returns a file path
+suitable for use with the @code{fs} module functions.")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 31/45] gnu: Add node-bindings.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (29 preceding siblings ...)
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 30/45] gnu: Add node-file-uri-to-path Philip McGrath
@ 2021-12-13  6:00                                 ` Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 32/45] gnu: Add node-segfault-handler Philip McGrath
                                                   ` (14 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:00 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-bindings): New variable.
---
 gnu/packages/node-xyz.scm | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index bdfe71a1f3..021bc81403 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -842,3 +842,29 @@ (define-public node-file-uri-to-path
 URI to a file path.  It accepts a @code{file:} URI and returns a file path
 suitable for use with the @code{fs} module functions.")
     (license license:expat)))
+
+(define-public node-bindings
+  (package
+    (name "node-bindings")
+    (version "1.5.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/TooTallNate/node-bindings")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "100gp6kpjvd4j1dqnp0sbjr1hqx5mz7r61q9qy527jyhk9mj47wk"))))
+    (inputs
+     `(("node-file-uri-to-path" ,node-file-uri-to-path)))
+    (build-system node-build-system)
+    (arguments
+     ;; there are no tests
+     `(#:tests? #f))
+    (home-page "https://github.com/TooTallNate/node-bindings")
+    (synopsis "Help for loading your native module's @code{.node} file")
+    (description "This is a helper module for authors of Node.js native addon
+modules.  It is basically the ``swiss army knife'' of @code{require()}ing your
+native module's @code{.node} file.")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 32/45] gnu: Add node-segfault-handler.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (30 preceding siblings ...)
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 31/45] gnu: Add node-bindings Philip McGrath
@ 2021-12-13  6:00                                 ` Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 33/45] gnu: Add node-ms Philip McGrath
                                                   ` (13 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:00 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-segfault-handler): New variable.
---
 gnu/packages/node-xyz.scm | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 021bc81403..b63cd46fdd 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -868,3 +868,33 @@ (define-public node-bindings
 modules.  It is basically the ``swiss army knife'' of @code{require()}ing your
 native module's @code{.node} file.")
     (license license:expat)))
+
+(define-public node-segfault-handler
+  (package
+    (name "node-segfault-handler")
+    (version "1.3.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/ddopson/node-segfault-handler")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "07nbw35wvrr18kmh8f388v4k5mpjgyy0260bx0xzjdv795i3xvfv"))))
+    (native-inputs
+     `(("python" ,python)))
+    (inputs
+     `(("node-bindings" ,node-bindings)
+       ("node-nan" ,node-nan)))
+    (build-system node-build-system)
+    (arguments
+     ;; there are no tests
+     `(#:tests? #f))
+    (home-page "https://github.com/ddopson/node-segfault-handler")
+    (synopsis "Catches @code{SIGSEGV} and prints diagnostic information")
+    (description "This package is a tool for debugging Node.js C/C++ native
+code modules and getting stack traces when things go wrong.  If a
+@code{SIGSEGV} signal is raised, the module will print a native stack trace to
+both @code{STDERR} and to a timestamped file.")
+    (license license:bsd-3)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 33/45] gnu: Add node-ms.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (31 preceding siblings ...)
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 32/45] gnu: Add node-segfault-handler Philip McGrath
@ 2021-12-13  6:00                                 ` Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 34/45] gnu: Add node-debug Philip McGrath
                                                   ` (12 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:00 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-ms): New variable.
---
 gnu/packages/node-xyz.scm | 43 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index b63cd46fdd..82ac537133 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -898,3 +898,46 @@ (define-public node-segfault-handler
 @code{SIGSEGV} signal is raised, the module will print a native stack trace to
 both @code{STDERR} and to a timestamped file.")
     (license license:bsd-3)))
+
+(define-public node-ms
+  (package
+    (name "node-ms")
+    (version "2.1.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/vercel/ms")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1l74kmmwffmzdz38lli0v5mdb9p9jmsjxpb48ncknqw2n74cgf08"))))
+    (build-system node-build-system)
+    (arguments
+     `(#:absent-dependencies
+       `("eslint"
+         "expect.js"
+         "husky"
+         "lint-staged"
+         "mocha"
+         "prettier")
+       #:tests? #f))
+    (home-page "https://github.com/vercel/ms")
+    (synopsis "Tiny millisecond conversion utility")
+    (description "Use this package to easily convert various time formats to
+milliseconds.
+
+Features:
+@itemize @bullet
+@item
+Works both in Node.js and in the browser.
+@item
+If a number is supplied to @code{ms}, a string with a unit is returned.
+@item
+If a string that contains the number is supplied, it returns it as a
+number (e.g. it returns @code{100} for @code{'100'}).
+@item
+If you pass a string with a number and a valid unit, the number of
+equivalent milliseconds is returned.
+@end itemize")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 34/45] gnu: Add node-debug.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (32 preceding siblings ...)
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 33/45] gnu: Add node-ms Philip McGrath
@ 2021-12-13  6:00                                 ` Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 35/45] gnu: Add node-serialport-binding-abstract Philip McGrath
                                                   ` (11 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:00 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-debug): New variable.
---
 gnu/packages/node-xyz.scm | 42 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 82ac537133..782c66e160 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -941,3 +941,45 @@ (define-public node-ms
 equivalent milliseconds is returned.
 @end itemize")
     (license license:expat)))
+
+(define-public node-debug
+  (package
+    (name "node-debug")
+    (version "4.3.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/debug-js/debug")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0ji0dmdl2xkgxqxvd6xjy7k3mmknmhvqjgc40vyly9ka1mpf20vb"))))
+    (inputs
+     `(("node-ms" ,node-ms)))
+    (build-system node-build-system)
+    (arguments
+     `(#:absent-dependencies
+       `("brfs"
+         "browserify"
+         "coveralls"
+         "istanbul"
+         "karma"
+         "karma-browserify"
+         "karma-chrome-launcher"
+         "karma-mocha"
+         "mocha"
+         "mocha-lcov-reporter"
+         "xo"
+         "supports-color")
+       #:tests? #f))
+    (home-page "https://github.com/debug-js/debug")
+    (synopsis "Lightweight debugging utility for Node.js and the browser")
+    (description "A tiny JavaScript debugging utility modelled after Node.js
+core's debugging technique.  orks in Node.js and web browsers.
+
+The @code{debug} module exposes a function; simply pass this function the name
+of your module, and it will return a decorated version of @code{console.error}
+for you to pass debug statements to.  This will allow you to toggle the debug
+output for different parts of your module as well as the module as a whole.")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 35/45] gnu: Add node-serialport-binding-abstract.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (33 preceding siblings ...)
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 34/45] gnu: Add node-debug Philip McGrath
@ 2021-12-13  6:00                                 ` Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 36/45] gnu: Add node-serialport-parser-delimiter Philip McGrath
                                                   ` (10 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:00 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport-binding-abstract): New variable.
---
 gnu/packages/node-xyz.scm | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 782c66e160..d821790ecb 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -983,3 +983,37 @@ (define-public node-debug
 for you to pass debug statements to.  This will allow you to toggle the debug
 output for different parts of your module as well as the module as a whole.")
     (license license:expat)))
+
+(define-public node-serialport-binding-abstract
+  (package
+    (name "node-serialport-binding-abstract")
+    (version "9.2.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/serialport/node-serialport")
+             (commit "v9.2.7")))
+       (file-name (git-file-name "serialport-monorepo" version))
+       (sha256
+        (base32 "0x7zm59a5ff5yygjyw15xs3r5m3rb8av1yfrh4snn44mrwq87yg8"))))
+    (inputs
+     `(("node-debug" ,node-debug)))
+    (build-system node-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/binding-abstract"))))
+       #:tests? #f))
+    (home-page "https://serialport.io")
+    (synopsis "Abstract base class for Node SerialPort bindings")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+This package provides the @code{AbstractBinding} class, the base for all Node
+SerialPort bindings.  You wouldn't use this class directly, but instead extend
+it to make a new binding for a different platform or underling technology.")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 36/45] gnu: Add node-serialport-parser-delimiter.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (34 preceding siblings ...)
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 35/45] gnu: Add node-serialport-binding-abstract Philip McGrath
@ 2021-12-13  6:00                                 ` Philip McGrath
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 37/45] gnu: Add node-serialport-parser-readling Philip McGrath
                                                   ` (9 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:00 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport-parser-delimiter): New
variable.
---
 gnu/packages/node-xyz.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index d821790ecb..4e69fd146f 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1017,3 +1017,25 @@ (define-public node-serialport-binding-abstract
 SerialPort bindings.  You wouldn't use this class directly, but instead extend
 it to make a new binding for a different platform or underling technology.")
     (license license:expat)))
+
+(define-public node-serialport-parser-delimiter
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-delimiter")
+    (version "9.2.4")
+    (inputs `())
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-delimiter"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser to split data on a delimiter")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{Delimiter}, a parser that emits data
+each time a specified byte sequence is received.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 37/45] gnu: Add node-serialport-parser-readling.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (35 preceding siblings ...)
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 36/45] gnu: Add node-serialport-parser-delimiter Philip McGrath
@ 2021-12-13  6:00                                 ` Philip McGrath
  2021-12-13  6:01                                 ` [bug#51838] [PATCH v4 38/45] gnu: Add node-serialport-bindings Philip McGrath
                                                   ` (8 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:00 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport-parser-readline): New
variable.
---
 gnu/packages/node-xyz.scm | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 4e69fd146f..873e0f9a39 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1039,3 +1039,27 @@ (define-public node-serialport-parser-delimiter
 Parsers are used to take raw binary data and transform them into usable
 messages.  This package provides @code{Delimiter}, a parser that emits data
 each time a specified byte sequence is received.")))
+
+(define-public node-serialport-parser-readline
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-readline")
+    (version "9.2.4")
+    (inputs
+     `(("node-serialport-parser-delimiter"
+        ,node-serialport-parser-delimiter)))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-readline"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser to split data on newlines")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{Readline}, a parser that emits data
+after a (configurable) newline delimiter is received.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 38/45] gnu: Add node-serialport-bindings.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (36 preceding siblings ...)
  2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 37/45] gnu: Add node-serialport-parser-readling Philip McGrath
@ 2021-12-13  6:01                                 ` Philip McGrath
  2021-12-13  6:01                                 ` [bug#51838] [PATCH v4 39/45] gnu: Add node-serialport-parser-regex Philip McGrath
                                                   ` (7 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:01 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport-bindings): New variable.
---
 gnu/packages/node-xyz.scm | 56 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 873e0f9a39..9ee33c7402 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1063,3 +1063,59 @@ (define-public node-serialport-parser-readline
 Parsers are used to take raw binary data and transform them into usable
 messages.  This package provides @code{Readline}, a parser that emits data
 after a (configurable) newline delimiter is received.")))
+
+(define-public node-serialport-bindings
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-bindings")
+    (version "9.2.7")
+    (native-inputs
+     `(("python" ,python)))
+    (inputs
+     `(("node-nan" ,node-nan)
+       ("node-bindings" ,node-bindings)
+       ("node-serialport-binding-abstract" ,node-serialport-binding-abstract)
+       ("node-serialport-parser-readline" ,node-serialport-parser-readline)
+       ("node-debug" ,node-debug)))
+    (arguments
+     `(#:absent-dependencies
+       `("prebuild-install"
+         ;; devDependencies
+         "@serialport/binding-mock"
+         "node-abi")
+       #:modules
+       ((guix build node-build-system)
+        (guix build json)
+        (srfi srfi-1)
+        (ice-9 match)
+        (guix build utils))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/bindings")))
+         (add-after 'chdir 'avoid-prebuild-install
+           (lambda args
+             (with-atomic-file-replacement "package.json"
+               (lambda (in out)
+                 (match (read-json in)
+                   (('@ . meta-alist)
+                    (match (assoc-ref meta-alist "scripts")
+                      (('@ . scripts-alist)
+                       (write-json
+                        (cons '@ (assoc-set!
+                                  meta-alist
+                                  "scripts"
+                                  (cons '@ (assoc-remove! scripts-alist
+                                                          "install"))))
+                        out))))))))))
+       #:tests? #f))
+    (synopsis "Abstract base class for Node SerialPort bindings")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+This package provides the @code{Binding} class, which uses a native addon to
+talk to the underlying system.  You never have to use @code{Binding} objects
+directly.  There is also a @code{MockBinding} available (but not yet packaged
+for Guix) to assist with testing.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 39/45] gnu: Add node-serialport-parser-regex.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (37 preceding siblings ...)
  2021-12-13  6:01                                 ` [bug#51838] [PATCH v4 38/45] gnu: Add node-serialport-bindings Philip McGrath
@ 2021-12-13  6:01                                 ` Philip McGrath
  2021-12-13  6:01                                 ` [bug#51838] [PATCH v4 40/45] gnu: Add node-serialport-parser-ready Philip McGrath
                                                   ` (6 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:01 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport-parser-regex): New variable.
---
 gnu/packages/node-xyz.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 9ee33c7402..f8c6cce95c 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1119,3 +1119,25 @@ (define-public node-serialport-bindings
 talk to the underlying system.  You never have to use @code{Binding} objects
 directly.  There is also a @code{MockBinding} available (but not yet packaged
 for Guix) to assist with testing.")))
+
+(define-public node-serialport-parser-regex
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-regex")
+    (version "9.2.4")
+    (inputs `())
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-regex"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser to split data on a regular expression")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{Regex}, a parser that uses a regular
+expression to split the incoming text.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 40/45] gnu: Add node-serialport-parser-ready.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (38 preceding siblings ...)
  2021-12-13  6:01                                 ` [bug#51838] [PATCH v4 39/45] gnu: Add node-serialport-parser-regex Philip McGrath
@ 2021-12-13  6:01                                 ` Philip McGrath
  2021-12-13  6:01                                 ` [bug#51838] [PATCH v4 41/45] gnu: Add node-serialport-parser-inter-byte-timeout Philip McGrath
                                                   ` (5 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:01 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport-parser-ready): New variable.
---
 gnu/packages/node-xyz.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index f8c6cce95c..8cc4efeed8 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1141,3 +1141,26 @@ (define-public node-serialport-parser-regex
 Parsers are used to take raw binary data and transform them into usable
 messages.  This package provides @code{Regex}, a parser that uses a regular
 expression to split the incoming text.")))
+
+(define-public node-serialport-parser-ready
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-ready")
+    (version "9.2.4")
+    (inputs `())
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-ready"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser to wait for specified byte sequence")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{Ready}, a parser that waits for a
+specified sequence of ``ready'' bytes before emitting a ready event and
+emitting data events.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 41/45] gnu: Add node-serialport-parser-inter-byte-timeout.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (39 preceding siblings ...)
  2021-12-13  6:01                                 ` [bug#51838] [PATCH v4 40/45] gnu: Add node-serialport-parser-ready Philip McGrath
@ 2021-12-13  6:01                                 ` Philip McGrath
  2021-12-13  6:01                                 ` [bug#51838] [PATCH v4 42/45] gnu: Add node-serialport-parser-cctalk Philip McGrath
                                                   ` (4 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:01 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm
(node-serialport-parser-inter-byte-timeout): New variable.
---
 gnu/packages/node-xyz.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 8cc4efeed8..3df6c37584 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1164,3 +1164,25 @@ (define-public node-serialport-parser-ready
 messages.  This package provides @code{Ready}, a parser that waits for a
 specified sequence of ``ready'' bytes before emitting a ready event and
 emitting data events.")))
+
+(define-public node-serialport-parser-inter-byte-timeout
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-inter-byte-timeout")
+    (version "9.2.4")
+    (inputs `())
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-inter-byte-timeout"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser to detect pauses in data")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{InterByteTimeout}, a parser that emits
+data if there is a pause between packets for the specified amount of time.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 42/45] gnu: Add node-serialport-parser-cctalk.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (40 preceding siblings ...)
  2021-12-13  6:01                                 ` [bug#51838] [PATCH v4 41/45] gnu: Add node-serialport-parser-inter-byte-timeout Philip McGrath
@ 2021-12-13  6:01                                 ` Philip McGrath
  2021-12-13  6:01                                 ` [bug#51838] [PATCH v4 43/45] gnu: Add node-serialport-parser-byte-length Philip McGrath
                                                   ` (3 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:01 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport-parser-cctalk): New variable.
---
 gnu/packages/node-xyz.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 3df6c37584..00d5cb7665 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1186,3 +1186,26 @@ (define-public node-serialport-parser-inter-byte-timeout
 Parsers are used to take raw binary data and transform them into usable
 messages.  This package provides @code{InterByteTimeout}, a parser that emits
 data if there is a pause between packets for the specified amount of time.")))
+
+(define-public node-serialport-parser-cctalk
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-cctalk")
+    (version "9.2.4")
+    (inputs `())
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-cctalk"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser for the ccTalk protocol")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{CCTalk}, which emits packets for the
+ccTalk protocol (an open standard for currency detectors) as they are
+received.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 43/45] gnu: Add node-serialport-parser-byte-length.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (41 preceding siblings ...)
  2021-12-13  6:01                                 ` [bug#51838] [PATCH v4 42/45] gnu: Add node-serialport-parser-cctalk Philip McGrath
@ 2021-12-13  6:01                                 ` Philip McGrath
  2021-12-13  6:01                                 ` [bug#51838] [PATCH v4 44/45] gnu: Add node-serialport-stream Philip McGrath
                                                   ` (2 subsequent siblings)
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:01 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport-parser-byte-length): New
variable.
---
 gnu/packages/node-xyz.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 00d5cb7665..3a4d155b02 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1209,3 +1209,25 @@ (define-public node-serialport-parser-cctalk
 messages.  This package provides @code{CCTalk}, which emits packets for the
 ccTalk protocol (an open standard for currency detectors) as they are
 received.")))
+
+(define-public node-serialport-parser-byte-length
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-byte-length")
+    (version "9.2.4")
+    (inputs `())
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-byte-length"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser for fixed-length buffers")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{ByteLength}, a parser that emits data
+as a buffer every time a specified number of bytes are received.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 44/45] gnu: Add node-serialport-stream.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (42 preceding siblings ...)
  2021-12-13  6:01                                 ` [bug#51838] [PATCH v4 43/45] gnu: Add node-serialport-parser-byte-length Philip McGrath
@ 2021-12-13  6:01                                 ` Philip McGrath
  2021-12-13  6:01                                 ` [bug#51838] [PATCH v4 45/45] gnu: Add node-serialport Philip McGrath
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:01 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport-stream): New variable.
---
 gnu/packages/node-xyz.scm | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 3a4d155b02..271082ce5b 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1231,3 +1231,30 @@ (define-public node-serialport-parser-byte-length
 Parsers are used to take raw binary data and transform them into usable
 messages.  This package provides @code{ByteLength}, a parser that emits data
 as a buffer every time a specified number of bytes are received.")))
+
+(define-public node-serialport-stream
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-stream")
+    (version "9.2.4")
+    (inputs
+     `(("node-debug" ,node-debug)))
+    (arguments
+     `(#:absent-dependencies
+       `(;; devDependencies
+         "@serialport/binding-mock")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/stream"))))
+       #:tests? #f))
+    (synopsis "Node.js stream interface for Node SerialPort")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+This package provides an interface for using Node SerialPort bindings via the
+Node.js Stream API.  The stream is a duplex stream, allowing for reading and
+writing.  It has additional methods for managing the SerialPort
+connection.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v4 45/45] gnu: Add node-serialport.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (43 preceding siblings ...)
  2021-12-13  6:01                                 ` [bug#51838] [PATCH v4 44/45] gnu: Add node-serialport-stream Philip McGrath
@ 2021-12-13  6:01                                 ` Philip McGrath
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
  45 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-13  6:01 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport): New variable.
---
 gnu/packages/node-xyz.scm | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 271082ce5b..92e16f2dc6 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1258,3 +1258,36 @@ (define-public node-serialport-stream
 Node.js Stream API.  The stream is a duplex stream, allowing for reading and
 writing.  It has additional methods for managing the SerialPort
 connection.")))
+
+(define-public node-serialport
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport")
+    (version "9.2.7")
+    (inputs
+     `(("node-serialport-bindings" ,node-serialport-bindings)
+       ("node-serialport-parser-delimiter" ,node-serialport-parser-delimiter)
+       ("node-serialport-parser-readline" ,node-serialport-parser-readline)
+       ("node-serialport-parser-regex" ,node-serialport-parser-regex)
+       ("node-serialport-parser-ready" ,node-serialport-parser-ready)
+       ("node-serialport-parser-inter-byte-timeout"
+        ,node-serialport-parser-inter-byte-timeout)
+       ("node-serialport-parser-cctalk" ,node-serialport-parser-cctalk)
+       ("node-serialport-parser-byte-length"
+        ,node-serialport-parser-byte-length)
+       ("node-serialport-stream" ,node-serialport-stream)
+       ("node-debug" ,node-debug)))
+    (arguments
+     `(#:absent-dependencies
+       `("@serialport/binding-mock")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/serialport"))))
+       #:tests? #f))
+    (synopsis "Node.js package to access serial ports")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  This package is the recommended entry point for most
+projects.  It combines a high-level Node.js stream interface with a useful
+default set of parsers and bindings.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp.
  2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                   ` (44 preceding siblings ...)
  2021-12-13  6:01                                 ` [bug#51838] [PATCH v4 45/45] gnu: Add node-serialport Philip McGrath
@ 2021-12-17  2:02                                 ` Philip McGrath
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 01/45] gnu: node: Avoid duplicating build phases Philip McGrath
                                                     ` (44 more replies)
  45 siblings, 45 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:02 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

Since core-updates-frozen was merged, I've rebased on the latest master and
adjusted these packages to use "new-style" inputs. So, here is v5 (also at
at <https://gitlab.com/philip1/guix-patches/-/tags/guix-issue-51838-v5>).

  -Philip

Philip McGrath (45):
  gnu: node: Avoid duplicating build phases.
  gnu: node: Update to 10.24.1 for bootstrapping.
  gnu: node: Patch shebangs in node_modules.
  gnu: node: Add an npmrc file to set nodedir.
  guix: node-build-system: Add delete-lockfiles phase.
  guix: node-build-system: Refactor patch-dependencies phase.
  guix: node-build-system: Add #:absent-dependencies argument.
  gnu: node-semver-bootstrap: Use #:absent-dependencies.
  gnu: node-ms-bootstrap: Use #:absent-dependencies.
  gnu: node-binary-search-bootstrap: Use #:absent-dependencies.
  gnu: node-debug-bootstrap: Use #:absent-dependencies.
  gnu: node-llparse-builder-bootstrap: Use #:absent-dependencies.
  gnu: node-llparse-frontend-bootstrap: Use #:absent-dependencies.
  gnu: node-llparse-bootstrap: Use #:absent-dependencies.
  gnu: node-semver: Use #:absent-dependencies.
  gnu: node-wrappy: Use #:absent-dependencies.
  gnu: node-once: Use #:absent-dependencies.
  gnu: node-irc-colors: Use #:absent-dependencies.
  gnu: node-irc: Use #:absent-dependencies.
  guix: node-build-system: Add implicit libuv input.
  guix: node-build-system: Add avoid-node-gyp-rebuild phase.
  gnu: Add node-inherits.
  gnu: Add node-safe-buffer.
  gnu: Add node-string-decoder.
  gnu: Add node-readable-stream.
  gnu: Add node-nan.
  gnu: Add node-openzwave-shared.
  gnu: Add node-addon-api.
  gnu: Add node-sqlite3.
  gnu: Add node-file-uri-to-path.
  gnu: Add node-bindings.
  gnu: Add node-segfault-handler.
  gnu: Add node-ms.
  gnu: Add node-debug.
  gnu: Add node-serialport-binding-abstract.
  gnu: Add node-serialport-parser-delimiter.
  gnu: Add node-serialport-parser-readline.
  gnu: Add node-serialport-bindings.
  gnu: Add node-serialport-parser-regex.
  gnu: Add node-serialport-parser-ready.
  gnu: Add node-serialport-parser-inter-byte-timeout.
  gnu: Add node-serialport-parser-cctalk.
  gnu: Add node-serialport-parser-byte-length.
  gnu: Add node-serialport-stream.
  gnu: Add node-serialport.

 gnu/packages/node-xyz.scm        | 919 ++++++++++++++++++++++++++++++-
 gnu/packages/node.scm            | 232 ++++----
 gnu/packages/zwave.scm           |  66 +++
 guix/build-system/node.scm       |  28 +-
 guix/build/node-build-system.scm | 129 ++++-
 5 files changed, 1220 insertions(+), 154 deletions(-)

-- 
2.32.0





^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 01/45] gnu: node: Avoid duplicating build phases.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
@ 2021-12-17  2:02                                   ` Philip McGrath
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 02/45] gnu: node: Update to 10.24.1 for bootstrapping Philip McGrath
                                                     ` (43 subsequent siblings)
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:02 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node.scm (node)[arguments]: Split 'patch-files phase
into 'patch-hardcoded-program-references and
'delete-problematic-tests. Adapt 'patch-hardcoded-program-references
and 'configure to work unmodified on node-lts, but don't try to
share 'delete-problematic-tests, because those details seem to change
too much between node versions.
(node, node-lts)[inputs]: Use bash-minimal rather than bash.
(node-lts)[arguments]: Inherit 'patch-hardcoded-program-references,
and 'configure phases from the bootstrap node.
Remove the 'patch-files phase, keeping its remaining
non-inherited work in a new 'replace-llhttp-sources phase.
---
 gnu/packages/node.scm | 107 ++++++++++++++----------------------------
 1 file changed, 35 insertions(+), 72 deletions(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 6b543acf6f..1635df5b1a 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -10,6 +10,7 @@
 ;;; Copyright © 2020 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
 ;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
+;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -106,14 +107,22 @@ (define-public node
        #:test-target "test-ci-js"
        #:phases
        (modify-phases %standard-phases
-         (add-before 'configure 'patch-files
+         (add-before 'configure 'patch-hardcoded-program-references
            (lambda* (#:key inputs #:allow-other-keys)
+
              ;; Fix hardcoded /bin/sh references.
-             (substitute* '("lib/child_process.js"
-                            "lib/internal/v8_prof_polyfill.js"
-                            "test/parallel/test-child-process-spawnsync-shell.js"
-                            "test/parallel/test-stdio-closed.js"
-                            "test/sequential/test-child-process-emfile.js")
+             (substitute*
+                 (let ((common
+                        '("lib/child_process.js"
+                          "lib/internal/v8_prof_polyfill.js"
+                          "test/parallel/test-child-process-spawnsync-shell.js"
+                          "test/parallel/test-stdio-closed.js"
+                          "test/sequential/test-child-process-emfile.js"))
+                       ;; not in bootstap node:
+                       (sigxfsz "test/parallel/test-fs-write-sigxfsz.js"))
+                   (if (file-exists? sigxfsz)
+                       (cons sigxfsz common)
+                       common))
                (("'/bin/sh'")
                 (string-append "'" (assoc-ref inputs "bash") "/bin/sh'")))
 
@@ -123,7 +132,10 @@ (define-public node
                             "test/parallel/test-child-process-exec-env.js")
                (("'/usr/bin/env'")
                 (string-append "'" (assoc-ref inputs "coreutils")
-                               "/bin/env'")))
+                               "/bin/env'")))))
+         (add-after 'patch-hardcoded-program-references
+             'delete-problematic-tests
+           (lambda* (#:key inputs #:allow-other-keys)
 
              ;; FIXME: These tests fail in the build container, but they don't
              ;; seem to be indicative of real problems in practice.
@@ -218,9 +230,16 @@ (define-public node
                (setenv "CXX" ,(cxx-for-target))
                (setenv "PKG_CONFIG" ,(pkg-config-for-target))
                (apply invoke
-                      (search-input-file (or native-inputs inputs)
-                                         "/bin/python")
-                      "configure" flags))))
+                      (let ((inpts (or native-inputs inputs)))
+                        (with-exception-handler
+                            (lambda (e)
+                              (if (search-error? e)
+                                  (search-input-file inpts "/bin/python3")
+                                  (raise-exception e)))
+                          (lambda ()
+                            (search-input-file inpts "/bin/python"))))
+                      "configure"
+                      flags))))
          (add-after 'patch-shebangs 'patch-npm-shebang
            (lambda* (#:key outputs #:allow-other-keys)
              (let* ((bindir (string-append (assoc-ref outputs "out")
@@ -256,7 +275,7 @@ (define-public node
             (variable "NODE_PATH")
             (files '("lib/node_modules")))))
     (inputs
-     (list bash
+     (list bash-minimal
            coreutils
            c-ares
            http-parser
@@ -705,65 +724,8 @@ (define-public node-lts
                                    libuv "/lib:"
                                    zlib "/lib"
                                    "'],"))))))
-           (replace 'configure
-             ;; Node's configure script is actually a python script, so we can't
-             ;; run it with bash.
-             (lambda* (#:key outputs (configure-flags '()) native-inputs inputs
-                       #:allow-other-keys)
-               (let* ((prefix (assoc-ref outputs "out"))
-                      (xflags ,(if (%current-target-system)
-                                   `'("--cross-compiling"
-                                     ,(string-append
-                                       "--dest-cpu="
-                                       (match (%current-target-system)
-                                         ((? (cut string-prefix? "arm" <>))
-                                          "arm")
-                                         ((? (cut string-prefix? "aarch64" <>))
-                                          "arm64")
-                                         ((? (cut string-prefix? "i686" <>))
-                                          "ia32")
-                                         ((? (cut string-prefix? "x86_64" <>))
-                                          "x64")
-                                         ((? (cut string-prefix? "powerpc64" <>))
-                                          "ppc64")
-                                         (_ "unsupported"))))
-                                   ''()))
-                      (flags (cons
-                               (string-append "--prefix=" prefix)
-                               (append xflags configure-flags))))
-                 (format #t "build directory: ~s~%" (getcwd))
-                 (format #t "configure flags: ~s~%" flags)
-                 ;; Node's configure script expects the CC environment variable to
-                 ;; be set.
-                 (setenv "CC_host" "gcc")
-                 (setenv "CXX_host" "g++")
-                 (setenv "CC" ,(cc-for-target))
-                 (setenv "CXX" ,(cxx-for-target))
-                 (setenv "PKG_CONFIG" ,(pkg-config-for-target))
-                 (apply invoke
-                        (search-input-file (or native-inputs inputs)
-                                           "/bin/python3")
-                        "configure" flags))))
-           (replace 'patch-files
+           (replace 'delete-problematic-tests
              (lambda* (#:key inputs #:allow-other-keys)
-               ;; Fix hardcoded /bin/sh references.
-               (substitute* '("lib/child_process.js"
-                              "lib/internal/v8_prof_polyfill.js"
-                              "test/parallel/test-child-process-spawnsync-shell.js"
-                              "test/parallel/test-fs-write-sigxfsz.js"
-                              "test/parallel/test-stdio-closed.js"
-                              "test/sequential/test-child-process-emfile.js")
-                 (("'/bin/sh'")
-                  (string-append "'" (assoc-ref inputs "bash") "/bin/sh'")))
-
-               ;; Fix hardcoded /usr/bin/env references.
-               (substitute* '("test/parallel/test-child-process-default-options.js"
-                              "test/parallel/test-child-process-env.js"
-                              "test/parallel/test-child-process-exec-env.js")
-                 (("'/usr/bin/env'")
-                  (string-append "'" (assoc-ref inputs "coreutils")
-                                 "/bin/env'")))
-
                ;; FIXME: These tests fail in the build container, but they don't
                ;; seem to be indicative of real problems in practice.
                (for-each delete-file
@@ -802,8 +764,9 @@ (define-public node-lts
                ;; TODO: Regenerate certs instead.
                (for-each delete-file
                          '("test/parallel/test-tls-passphrase.js"
-                           "test/parallel/test-tls-server-verify.js"))
-
+                           "test/parallel/test-tls-server-verify.js"))))
+           (add-after 'delete-problematic-tests 'replace-llhttp-sources
+             (lambda* (#:key inputs #:allow-other-keys)
                ;; Replace pre-generated llhttp sources
                (let ((llhttp (assoc-ref inputs "llhttp")))
                  (copy-file (string-append llhttp "/src/llhttp.c")
@@ -830,7 +793,7 @@ (define-public node-lts
            python
            util-linux))
     (inputs
-     (list bash
+     (list bash-minimal
            coreutils
            c-ares-for-node
            icu4c-67
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 02/45] gnu: node: Update to 10.24.1 for bootstrapping.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 01/45] gnu: node: Avoid duplicating build phases Philip McGrath
@ 2021-12-17  2:02                                   ` Philip McGrath
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 03/45] gnu: node: Patch shebangs in node_modules Philip McGrath
                                                     ` (42 subsequent siblings)
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:02 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node.scm (node): Update to 10.24.1.
---
 gnu/packages/node.scm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 1635df5b1a..d433118213 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -58,14 +58,14 @@ (define-module (gnu packages node)
 (define-public node
   (package
     (name "node")
-    (version "10.24.0")
+    (version "10.24.1")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://nodejs.org/dist/v" version
                                   "/node-v" version ".tar.xz"))
               (sha256
                (base32
-                "1k1srdis23782hnd1ymgczs78x9gqhv77v0am7yb54gqcspp70hm"))
+                "032801kg24j04xmf09m0vxzlcz86sv21s24lv9l4cfv08k1c4byp"))
               (modules '((guix build utils)))
               (snippet
                `(begin
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 03/45] gnu: node: Patch shebangs in node_modules.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 01/45] gnu: node: Avoid duplicating build phases Philip McGrath
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 02/45] gnu: node: Update to 10.24.1 for bootstrapping Philip McGrath
@ 2021-12-17  2:02                                   ` Philip McGrath
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 04/45] gnu: node: Add an npmrc file to set nodedir Philip McGrath
                                                     ` (41 subsequent siblings)
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:02 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node.scm (node)[arguments]: Replace 'patch-npm-shebang
and 'patch-node-shebang with a new 'patch-nested-shebangs that also
handles node-gyp and other shebangs under "/lib/node_modules".
[inputs]: Add Python for node-gyp as "python-for-target".
(node-lts)[inputs]: Likewise.
(libnode)[arguments]: Adjust to delete 'patch-nested-shebangs rather
than 'patch-npm-shebang and 'patch-node-shebang.
---
 gnu/packages/node.scm | 42 +++++++++++++++++++++++++-----------------
 1 file changed, 25 insertions(+), 17 deletions(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index d433118213..3bd98c715e 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -105,6 +105,11 @@ (define-public node
        ;; Run only the CI tests.  The default test target requires additional
        ;; add-ons from NPM that are not distributed with the source.
        #:test-target "test-ci-js"
+       #:modules
+       ((guix build gnu-build-system)
+        (guix build utils)
+        (srfi srfi-1)
+        (ice-9 match))
        #:phases
        (modify-phases %standard-phases
          (add-before 'configure 'patch-hardcoded-program-references
@@ -240,21 +245,23 @@ (define-public node
                             (search-input-file inpts "/bin/python"))))
                       "configure"
                       flags))))
-         (add-after 'patch-shebangs 'patch-npm-shebang
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let* ((bindir (string-append (assoc-ref outputs "out")
-                                           "/bin"))
-                    (npm    (string-append bindir "/npm"))
-                    (target (readlink npm)))
-               (with-directory-excursion bindir
-                 (patch-shebang target (list bindir))))))
-         (add-after 'install 'patch-node-shebang
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let* ((bindir (string-append (assoc-ref outputs "out")
-                                           "/bin"))
-                    (npx    (readlink (string-append bindir "/npx"))))
-               (with-directory-excursion bindir
-                 (patch-shebang npx (list bindir)))))))))
+         (add-after 'patch-shebangs 'patch-nested-shebangs
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             ;; Based on the implementation of patch-shebangs
+             ;; from (guix build gnu-build-system).
+             (let ((path (append-map (match-lambda
+                                       ((_ . dir)
+                                        (list (string-append dir "/bin")
+                                              (string-append dir "/sbin")
+                                              (string-append dir "/libexec"))))
+                                     (append outputs inputs))))
+               (for-each
+                (lambda (file)
+                  (patch-shebang file path))
+                (find-files (search-input-directory outputs "lib/node_modules")
+                            (lambda (file stat)
+                              (executable-file? file))
+                            #:stat lstat))))))))
     (native-inputs
      `(;; Runtime dependencies for binaries used as a bootstrap.
        ("c-ares" ,c-ares)
@@ -283,6 +290,7 @@ (define-public node
            libuv
            `(,nghttp2 "lib")
            openssl
+           python-wrapper ;; for node-gyp (supports python3)
            zlib))
     (synopsis "Evented I/O for V8 JavaScript")
     (description "Node.js is a platform built on Chrome's JavaScript runtime
@@ -802,6 +810,7 @@ (define-public node-lts
            brotli
            `(,nghttp2 "lib")
            openssl
+           python-wrapper ;; for node-gyp (supports python3)
            zlib))))
 
 (define-public libnode
@@ -813,5 +822,4 @@ (define-public libnode
         `(cons* "--shared" "--without-npm" ,flags))
        ((#:phases phases '%standard-phases)
         `(modify-phases ,phases
-           (delete 'patch-npm-shebang)
-           (delete 'patch-node-shebang)))))))
+           (delete 'patch-nested-shebangs)))))))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 04/45] gnu: node: Add an npmrc file to set nodedir.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (2 preceding siblings ...)
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 03/45] gnu: node: Patch shebangs in node_modules Philip McGrath
@ 2021-12-17  2:02                                   ` Philip McGrath
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 05/45] guix: node-build-system: Add delete-lockfiles phase Philip McGrath
                                                     ` (40 subsequent siblings)
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:02 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node.scm (node, node-lts)[arguments]: Add a phase
'install-npmrc to create a "built-in" npmrc file that configures
"nodedir" to point to the output store path.
(libnode)[arguments]: Delete the 'install-npmrc phase.
---
 gnu/packages/node.scm | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 3bd98c715e..51a393caab 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -261,7 +261,24 @@ (define-public node
                 (find-files (search-input-directory outputs "lib/node_modules")
                             (lambda (file stat)
                               (executable-file? file))
-                            #:stat lstat))))))))
+                            #:stat lstat)))))
+         (add-after 'install 'install-npmrc
+           ;; Note: programs like node-gyp only receive these values if
+           ;; they are started via `npm` or `npx`.
+           ;; See: https://github.com/nodejs/node-gyp#npm-configuration
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out")))
+               (with-output-to-file
+                   ;; Use the config file "primarily for distribution
+                   ;; maintainers" rather than "{prefix}/etc/npmrc",
+                   ;; especially because node-build-system uses --prefix
+                   ;; to install things to their store paths:
+                   (string-append out "/lib/node_modules/npm/npmrc")
+                 (lambda ()
+                   ;; Tell npm (mostly node-gyp) where to find our
+                   ;; installed headers so it doesn't try to
+                   ;; download them from the internet:
+                   (format #t "nodedir=~a\n" out)))))))))
     (native-inputs
      `(;; Runtime dependencies for binaries used as a bootstrap.
        ("c-ares" ,c-ares)
@@ -822,4 +839,5 @@ (define-public libnode
         `(cons* "--shared" "--without-npm" ,flags))
        ((#:phases phases '%standard-phases)
         `(modify-phases ,phases
+           (delete 'install-npmrc)
            (delete 'patch-nested-shebangs)))))))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 05/45] guix: node-build-system: Add delete-lockfiles phase.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (3 preceding siblings ...)
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 04/45] gnu: node: Add an npmrc file to set nodedir Philip McGrath
@ 2021-12-17  2:02                                   ` Philip McGrath
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 06/45] guix: node-build-system: Refactor patch-dependencies phase Philip McGrath
                                                     ` (39 subsequent siblings)
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:02 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* guix/build/node-build-system.scm (delete-lockfiles): New function.
Remove 'package-lock.json', 'yarn.lock', and 'npm-shrinkwrap.json',
if they exist.  Because these files specify  both exact dependency
versions and integrity hashes, they only cause problems for Guix.
(%standard-phases): Add 'delete-lockfiles' after 'patch-dependencies'.
---
 guix/build/node-build-system.scm | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
index 70a367618e..dcaa719f40 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -96,6 +96,17 @@ (define (resolve-dependencies package-meta meta-key)
         (write-json package-meta out))))
   #t)
 
+(define* (delete-lockfiles #:key inputs #:allow-other-keys)
+  "Delete 'package-lock.json', 'yarn.lock', and 'npm-shrinkwrap.json', if they
+exist."
+  (for-each (lambda (pth)
+              (when (file-exists? pth)
+                (delete-file pth)))
+            '("package-lock.json"
+              "yarn.lock"
+              "npm-shrinkwrap.json"))
+  #t)
+
 (define* (configure #:key outputs inputs #:allow-other-keys)
   (let ((npm (string-append (assoc-ref inputs "node") "/bin/npm")))
     (invoke npm "--offline" "--ignore-scripts" "install")
@@ -146,6 +157,7 @@ (define %standard-phases
   (modify-phases gnu:%standard-phases
     (add-after 'unpack 'set-home set-home)
     (add-before 'configure 'patch-dependencies patch-dependencies)
+    (add-after 'patch-dependencies 'delete-lockfiles delete-lockfiles)
     (replace 'configure configure)
     (replace 'build build)
     (replace 'check check)
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 06/45] guix: node-build-system: Refactor patch-dependencies phase.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (4 preceding siblings ...)
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 05/45] guix: node-build-system: Add delete-lockfiles phase Philip McGrath
@ 2021-12-17  2:02                                   ` Philip McGrath
  2021-12-17  4:29                                     ` Liliana Marie Prikler
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 07/45] guix: node-build-system: Add #:absent-dependencies argument Philip McGrath
                                                     ` (38 subsequent siblings)
  44 siblings, 1 reply; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:02 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* guix/build/node-build-system.scm (patch-dependencies): Strictly
follow the linearity rules for `assoc-set!` and friends.
Clarify the types of the arguments to and return value from the
internal helper function `resolve-dependencies`.
---
 guix/build/node-build-system.scm | 53 ++++++++++++++++++++++----------
 1 file changed, 36 insertions(+), 17 deletions(-)

diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
index dcaa719f40..b74e593838 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -73,26 +73,45 @@ (define* (patch-dependencies #:key inputs #:allow-other-keys)
 
   (define index (index-modules (map cdr inputs)))
 
-  (define (resolve-dependencies package-meta meta-key)
-    (fold (lambda (key+value acc)
-            (match key+value
-              ('@ acc)
-              ((key . value) (acons key (hash-ref index key value) acc))))
-          '()
-          (or (assoc-ref package-meta meta-key) '())))
+  (define (resolve-dependencies meta-alist meta-key)
+    ;; Given:
+    ;;  - The alist from "package.json", with the '@ unwrapped
+    ;;  - A string key, like "dependencies"
+    ;; Returns: an alist (without a wrapping '@) like the entry in
+    ;; meta-alist for meta-key, but with dependencies supplied
+    ;; by Guix packages mapped to the absolute store paths to use.
+    (match (assoc-ref meta-alist meta-key)
+      (#f
+       '())
+      (('@ . orig-deps)
+       (fold (match-lambda*
+               (((key . value) acc)
+                (acons key (hash-ref index key value) acc)))
+             '()
+             orig-deps))))
 
   (with-atomic-file-replacement "package.json"
     (lambda (in out)
-      (let ((package-meta (read-json in)))
-        (assoc-set! package-meta "dependencies"
-                    (append
-                     '(@)
-                     (resolve-dependencies package-meta "dependencies")
-                     (resolve-dependencies package-meta "peerDependencies")))
-        (assoc-set! package-meta "devDependencies"
-                    (append
-                     '(@)
-                     (resolve-dependencies package-meta "devDependencies")))
+      ;; It is unsafe to rely on 'assoc-set!' to update an
+      ;; existing assosciation list variable:
+      ;; see 'info "(guile)Adding or Setting Alist Entries"'.
+      (let* ((package-meta (read-json in))
+             (alist (match package-meta
+                      ((@ . alist) alist)))
+             (alist
+              (assoc-set!
+               alist "dependencies"
+               (append
+                '(@)
+                (resolve-dependencies alist "dependencies")
+                (resolve-dependencies alist "peerDependencies"))))
+             (alist
+              (assoc-set!
+               alist "devDependencies"
+               (append
+                '(@)
+                (resolve-dependencies alist "devDependencies"))))
+             (package-meta (cons '@ alist)))
         (write-json package-meta out))))
   #t)
 
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 07/45] guix: node-build-system: Add #:absent-dependencies argument.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (5 preceding siblings ...)
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 06/45] guix: node-build-system: Refactor patch-dependencies phase Philip McGrath
@ 2021-12-17  2:02                                   ` Philip McGrath
  2021-12-17  4:43                                     ` Liliana Marie Prikler
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 08/45] gnu: node-semver-bootstrap: Use #:absent-dependencies Philip McGrath
                                                     ` (37 subsequent siblings)
  44 siblings, 1 reply; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:02 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* guix/build-system/node.scm (lower, node-build): Add optional
argument #:absent-dependencies with default of ''(). Pass it on
to the build-side code.
* guix/build/node-build-system.scm (patch-dependencies): Respect
the #:absent-dependencies argument, removing specified npm
packages from the "dependencies" or "devDependencies" tables
in "package.json".
---
 guix/build-system/node.scm       | 19 ++++++++++++++++++-
 guix/build/node-build-system.scm |  7 +++++--
 2 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/guix/build-system/node.scm b/guix/build-system/node.scm
index 735f8dd06e..330d10dca5 100644
--- a/guix/build-system/node.scm
+++ b/guix/build-system/node.scm
@@ -47,6 +47,7 @@ (define (default-node)
 (define* (lower name
                 #:key source inputs native-inputs outputs system target
                 (node (default-node))
+                (absent-dependencies ''())
                 #:allow-other-keys
                 #:rest arguments)
   "Return a bag for NAME."
@@ -77,6 +78,7 @@ (define* (node-build name inputs
                      (test-target "test")
                      (tests? #t)
                      (phases '%standard-phases)
+                     (absent-dependencies ''())
                      (outputs '("out"))
                      (search-paths '())
                      (system (%current-system))
@@ -84,7 +86,21 @@ (define* (node-build name inputs
                      (imported-modules %node-build-system-modules)
                      (modules '((guix build node-build-system)
                                 (guix build utils))))
-  "Build SOURCE using NODE and INPUTS."
+  "Build SOURCE using NODE and INPUTS.
+
+The builder will remove Node.js packages listed in ABSENT-DEPENCENCIES from
+the 'package.json' file's 'dependencies' and 'devDependencies' tables.  This
+mechanism can be used both avoid dependencies we don't want (e.g. optional
+features that would increase closure size) and to work around dependencies
+that haven't been packaged for Guix yet (e.g. test utilities)."
+  ;; Before #:absent-dependencies existed, this scenario was often handled by
+  ;; deleting the 'configure phase. Using #:absent-dependencies, instead,
+  ;; retains the check that no dependencies are silently missing and other
+  ;; actions performed by 'npm install', such as building native
+  ;; addons. Having an explicit list of absent dependencies in the package
+  ;; definition should also facilitate future maintenence: for example, if we
+  ;; add a package for a test framework, it should be easy to find all the
+  ;; other packages that use it and enable their tests.
   (define builder
     (with-imported-modules imported-modules
       #~(begin
@@ -96,6 +112,7 @@ (define builder
                       #:test-target #$test-target
                       #:tests? #$tests?
                       #:phases #$phases
+                      #:absent-dependencies #$absent-dependencies
                       #:outputs #$(outputs->gexp outputs)
                       #:search-paths '#$(sexp->gexp
                                          (map search-path-specification->sexp
diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
index b74e593838..892104b6d2 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -69,7 +69,8 @@ (define (list-modules directory)
               input-paths)
     index))
 
-(define* (patch-dependencies #:key inputs #:allow-other-keys)
+(define* (patch-dependencies #:key inputs absent-dependencies
+                             #:allow-other-keys)
 
   (define index (index-modules (map cdr inputs)))
 
@@ -86,7 +87,9 @@ (define (resolve-dependencies meta-alist meta-key)
       (('@ . orig-deps)
        (fold (match-lambda*
                (((key . value) acc)
-                (acons key (hash-ref index key value) acc)))
+                (if (member key absent-dependencies)
+                    acc
+                    (acons key (hash-ref index key value) acc))))
              '()
              orig-deps))))
 
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 08/45] gnu: node-semver-bootstrap: Use #:absent-dependencies.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (6 preceding siblings ...)
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 07/45] guix: node-build-system: Add #:absent-dependencies argument Philip McGrath
@ 2021-12-17  2:02                                   ` Philip McGrath
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 09/45] gnu: node-ms-bootstrap: " Philip McGrath
                                                     ` (36 subsequent siblings)
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:02 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node.scm (node-semver-bootstrap)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node.scm | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 51a393caab..95f5f28b3d 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -344,9 +344,8 @@ (define-public node-semver-bootstrap
     (arguments
      `(#:node ,node-bootstrap
        #:tests? #f
-       #:phases
-       (modify-phases %standard-phases
-         (delete 'configure))))
+       #:absent-dependencies
+       '("tap")))
     (home-page "https://github.com/npm/node-semver")
     (properties '((hidden? . #t)))
     (synopsis "Parses semantic versions strings")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 09/45] gnu: node-ms-bootstrap: Use #:absent-dependencies.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (7 preceding siblings ...)
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 08/45] gnu: node-semver-bootstrap: Use #:absent-dependencies Philip McGrath
@ 2021-12-17  2:02                                   ` Philip McGrath
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 10/45] gnu: node-binary-search-bootstrap: " Philip McGrath
                                                     ` (35 subsequent siblings)
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:02 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node.scm (node-ms-bootstrap)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node.scm | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 95f5f28b3d..bec3f4620a 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -372,9 +372,12 @@ (define-public node-ms-bootstrap
     (arguments
      `(#:node ,node-bootstrap
        #:tests? #f
-       #:phases
-       (modify-phases %standard-phases
-         (delete 'configure))))
+       #:absent-dependencies
+       `("eslint"
+         "expect.js"
+         "husky"
+         "lint-staged"
+         "mocha")))
     (home-page "https://github.com/zeit/ms#readme")
     (properties '((hidden? . #t)))
     (synopsis "Tiny millisecond conversion utility")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 10/45] gnu: node-binary-search-bootstrap: Use #:absent-dependencies.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (8 preceding siblings ...)
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 09/45] gnu: node-ms-bootstrap: " Philip McGrath
@ 2021-12-17  2:02                                   ` Philip McGrath
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 11/45] gnu: node-debug-bootstrap: " Philip McGrath
                                                     ` (34 subsequent siblings)
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:02 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node.scm (node-binary-search-bootstrap)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node.scm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index bec3f4620a..0a66b032bb 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -403,9 +403,9 @@ (define-public node-binary-search-bootstrap
     (arguments
      `(#:node ,node-bootstrap
        #:tests? #f
-       #:phases
-       (modify-phases %standard-phases
-         (delete 'configure))))
+       #:absent-dependencies
+       `("chai"
+         "mocha")))
     (home-page "https://github.com/darkskyapp/binary-search#readme")
     (properties '((hidden? . #t)))
     (synopsis "Tiny binary search function with comparators")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 11/45] gnu: node-debug-bootstrap: Use #:absent-dependencies.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (9 preceding siblings ...)
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 10/45] gnu: node-binary-search-bootstrap: " Philip McGrath
@ 2021-12-17  2:02                                   ` Philip McGrath
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 12/45] gnu: node-llparse-builder-bootstrap: " Philip McGrath
                                                     ` (33 subsequent siblings)
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:02 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node.scm (node-debug-bootstrap)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node.scm | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 0a66b032bb..985a2fdb20 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -430,9 +430,18 @@ (define-public node-debug-bootstrap
     (arguments
      `(#:node ,node-bootstrap
        #:tests? #f
-       #:phases
-       (modify-phases %standard-phases
-         (delete 'configure))))
+       #:absent-dependencies
+       `("brfs"
+         "browserify"
+         "coveralls"
+         "istanbul"
+         "karma"
+         "karma-browserify"
+         "karma-chrome-launcher"
+         "karma-mocha"
+         "mocha"
+         "mocha-lcov-reporter"
+         "xo")))
     (inputs (list node-ms-bootstrap))
     (home-page "https://github.com/visionmedia/debug#readme")
     (properties '((hidden? . #t)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 12/45] gnu: node-llparse-builder-bootstrap: Use #:absent-dependencies.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (10 preceding siblings ...)
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 11/45] gnu: node-debug-bootstrap: " Philip McGrath
@ 2021-12-17  2:02                                   ` Philip McGrath
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 13/45] gnu: node-llparse-frontend-bootstrap: " Philip McGrath
                                                     ` (32 subsequent siblings)
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:02 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node.scm (node-llparse-builder-bootstrap)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node.scm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 985a2fdb20..31df15ffc3 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -493,9 +493,15 @@ (define-public node-llparse-builder-bootstrap
     (arguments
      `(#:node ,node-bootstrap
        #:tests? #f
+       #:absent-dependencies
+       `("@types/mocha"
+         "@types/node"
+         "mocha"
+         "ts-node"
+         "tslint"
+         "typescript")
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure)
          (replace 'build
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((esbuild (search-input-file inputs "/bin/esbuild")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 13/45] gnu: node-llparse-frontend-bootstrap: Use #:absent-dependencies.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (11 preceding siblings ...)
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 12/45] gnu: node-llparse-builder-bootstrap: " Philip McGrath
@ 2021-12-17  2:02                                   ` Philip McGrath
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 14/45] gnu: node-llparse-bootstrap: " Philip McGrath
                                                     ` (31 subsequent siblings)
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:02 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node.scm (node-llparse-frontend-bootstrap)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node.scm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 31df15ffc3..4d3db6a8ea 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -553,9 +553,16 @@ (define-public node-llparse-frontend-bootstrap
     (arguments
      `(#:node ,node-bootstrap
        #:tests? #f
+       #:absent-dependencies
+       `("@types/debug"
+         "@types/mocha"
+         "@types/node"
+         "mocha"
+         "ts-node"
+         "tslint"
+         "typescript")
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure)
          (replace 'build
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((esbuild (search-input-file inputs "/bin/esbuild")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 14/45] gnu: node-llparse-bootstrap: Use #:absent-dependencies.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (12 preceding siblings ...)
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 13/45] gnu: node-llparse-frontend-bootstrap: " Philip McGrath
@ 2021-12-17  2:02                                   ` Philip McGrath
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 15/45] gnu: node-semver: " Philip McGrath
                                                     ` (30 subsequent siblings)
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:02 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node.scm (node-llparse-bootstrap)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node.scm | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 4d3db6a8ea..f952119a9f 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -613,9 +613,18 @@ (define-public node-llparse-bootstrap
     (arguments
      `(#:node ,node-bootstrap
        #:tests? #f
+       #:absent-dependencies
+       `("@types/debug"
+         "@types/mocha"
+         "@types/node"
+         "esm"
+         "llparse-test-fixture"
+         "mocha"
+         "ts-node"
+         "tslint"
+         "typescript")
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure)
          (replace 'build
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((esbuild (search-input-file inputs "/bin/esbuild")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 15/45] gnu: node-semver: Use #:absent-dependencies.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (13 preceding siblings ...)
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 14/45] gnu: node-llparse-bootstrap: " Philip McGrath
@ 2021-12-17  2:02                                   ` Philip McGrath
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 16/45] gnu: node-wrappy: " Philip McGrath
                                                     ` (29 subsequent siblings)
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:02 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node-xyz.scm (node-semver)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node-xyz.scm | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 9a0be96852..bd72eea807 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -288,11 +288,10 @@ (define-public node-semver
                 "06biknqb05r9xsmcflm3ygh50pjvdk84x6r79w43kmck4fn3qn5p"))))
     (build-system node-build-system)
     (arguments
-     '(#:tests? #f ; FIXME: Tests depend on node-tap
-       #:phases
-       (modify-phases %standard-phases
-         ;; The only dependency to check for is tap, which we don't have.
-         (delete 'configure))))
+     '(#:absent-dependencies
+       '("tap")
+       ;; FIXME: Tests depend on node-tap
+       #:tests? #f))
     (home-page "https://github.com/npm/node-semver")
     (synopsis "Parses semantic versions strings")
     (description
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 16/45] gnu: node-wrappy: Use #:absent-dependencies.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (14 preceding siblings ...)
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 15/45] gnu: node-semver: " Philip McGrath
@ 2021-12-17  2:02                                   ` Philip McGrath
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 17/45] gnu: node-once: " Philip McGrath
                                                     ` (28 subsequent siblings)
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:02 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node-xyz.scm (node-wrappy)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node-xyz.scm | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index bd72eea807..ceef48887e 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -315,10 +315,8 @@ (define-public node-wrappy
     (build-system node-build-system)
     (arguments
      '(#:tests? #f ; FIXME: Tests depend on node-tap
-       #:phases
-       (modify-phases %standard-phases
-         ;; The only dependency to check for is tap, which we don't have.
-         (delete 'configure))))
+       #:absent-dependencies
+       '("tap")))
     (home-page "https://github.com/npm/wrappy")
     (synopsis "Callback wrapping utility")
     (description "@code{wrappy} is a utility for Node.js to wrap callbacks.")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 17/45] gnu: node-once: Use #:absent-dependencies.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (15 preceding siblings ...)
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 16/45] gnu: node-wrappy: " Philip McGrath
@ 2021-12-17  2:02                                   ` Philip McGrath
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 18/45] gnu: node-irc-colors: " Philip McGrath
                                                     ` (27 subsequent siblings)
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:02 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node-xyz.scm (node-once)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node-xyz.scm | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index ceef48887e..9e602fd0e8 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -337,13 +337,10 @@ (define-public node-once
                 "1z8dcbf28dqdcp4wb0c53wrs90a07nkrax2c9kk26dsk1dhrnxav"))))
     (build-system node-build-system)
     (arguments
-     '(#:tests? #f                      ; FIXME: tests depend on node-tap
-       #:phases
-       (modify-phases %standard-phases
-         ;; The default configure phase fails due to tap being missing, as we do
-         ;; not have tap packaged yet.  It is used only for tests.  This package
-         ;; still works as a dependency of node-glob and node-inflight.
-         (delete 'configure))))
+     '(#:absent-dependencies
+       '("tap")
+       ;; FIXME: Tests depend on node-tap
+       #:tests? #f))
     (inputs
      (list node-wrappy))
     (home-page "https://github.com/isaacs/once")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 18/45] gnu: node-irc-colors: Use #:absent-dependencies.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (16 preceding siblings ...)
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 17/45] gnu: node-once: " Philip McGrath
@ 2021-12-17  2:02                                   ` Philip McGrath
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 19/45] gnu: node-irc: " Philip McGrath
                                                     ` (26 subsequent siblings)
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:02 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node-xyz.scm (node-irc-colors)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node-xyz.scm | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 9e602fd0e8..6c3811528a 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -366,12 +366,10 @@ (define-public node-irc-colors
                 "0q3y34rbnlc55jcakmdxkicwazyvyph9r6gaf6hi8k7wj2nfwfli"))))
     (build-system node-build-system)
     (arguments
-     '(#:tests? #f                      ; FIXME: tests depend on node-istanbul
-       #:phases
-       (modify-phases %standard-phases
-         ;; The default configure phase fails due to various packages
-         ;; being missing, as we don't have them packaged yet.
-         (delete 'configure))))
+     '(#:absent-dependencies
+       `("istanbul"
+         "vows")
+       #:tests? #f))
     (home-page "https://github.com/fent/irc-colors.js")
     (synopsis "Node.js module providing color and formatting for IRC")
     (description "@code{node-irc-colors} is a Node.js module that
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 19/45] gnu: node-irc: Use #:absent-dependencies.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (17 preceding siblings ...)
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 18/45] gnu: node-irc-colors: " Philip McGrath
@ 2021-12-17  2:02                                   ` Philip McGrath
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 20/45] guix: node-build-system: Add implicit libuv input Philip McGrath
                                                     ` (25 subsequent siblings)
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:02 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node-xyz.scm (node-irc)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node-xyz.scm | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 6c3811528a..93bd067311 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -393,12 +393,12 @@ (define-public node-irc
                 "1ln4qfx20jbwg4cp8lp0vf27m5281z2sz16d15xd6150n26cbi4x"))))
     (build-system node-build-system)
     (arguments
-     '(#:tests? #f                      ; FIXME: tests depend on node-faucet
-       #:phases
-       (modify-phases %standard-phases
-         ;; The default configure phase fails due to various packages
-         ;; being missing, as we don't have them packaged yet.
-         (delete 'configure))))
+     '(#:absent-dependencies
+       `("ansi-color"
+         "faucet"
+         "jscs"
+         "tape")
+       #:tests? #f))
     (inputs
      (list node-irc-colors))
     (home-page "https://github.com/martynsmith/node-irc")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 20/45] guix: node-build-system: Add implicit libuv input.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (18 preceding siblings ...)
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 19/45] gnu: node-irc: " Philip McGrath
@ 2021-12-17  2:03                                   ` Philip McGrath
  2021-12-17  5:08                                     ` Liliana Marie Prikler
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 21/45] guix: node-build-system: Add avoid-node-gyp-rebuild phase Philip McGrath
                                                     ` (24 subsequent siblings)
  44 siblings, 1 reply; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:03 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* guix/build-system/node.scm (lower): Add the version of libuv
used as an input to the #:node package as an additional implicit
input, so that packages needing libuv always get the correct version.
---
 guix/build-system/node.scm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/guix/build-system/node.scm b/guix/build-system/node.scm
index 330d10dca5..47af4bb9e2 100644
--- a/guix/build-system/node.scm
+++ b/guix/build-system/node.scm
@@ -2,6 +2,8 @@
 ;;; Copyright © 2016 Jelle Licht <jlicht@fsfe.org>
 ;;; Copyright © 2019 Timothy Sample <samplet@ngyro.com>
 ;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2021 Pierre Langlois <pierre.langlois@gmx.com>
+;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -62,10 +64,15 @@ (define private-keywords
                               `(("source" ,source))
                               '())
                         ,@inputs
-
                         ;; Keep the standard inputs of 'gnu-build-system'.
                         ,@(standard-packages)))
          (build-inputs `(("node" ,node)
+                         ;; Many packages with native addons need
+                         ;; libuv headers. The libuv version must
+                         ;; be exactly the same as for the node
+                         ;; package we are adding implicitly,
+                         ;; so we take care of adding libuv, too.
+                         ("libuv" ,@(assoc-ref (package-inputs node) "libuv"))
                          ,@native-inputs))
          (outputs outputs)
          (build node-build)
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 21/45] guix: node-build-system: Add avoid-node-gyp-rebuild phase.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (19 preceding siblings ...)
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 20/45] guix: node-build-system: Add implicit libuv input Philip McGrath
@ 2021-12-17  2:03                                   ` Philip McGrath
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 22/45] gnu: Add node-inherits Philip McGrath
                                                     ` (23 subsequent siblings)
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:03 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* guix/build/node-build-system.scm (avoid-node-gyp-rebuild): New
function. Override the default install script for packages with
native addons to prevent it from attempting to write to the store
when such packages are used.
(%standard-phases): Add 'avoid-node-gyp-rebuild' after 'install'.
---
 guix/build/node-build-system.scm | 59 +++++++++++++++++++++++++++++++-
 1 file changed, 58 insertions(+), 1 deletion(-)

diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
index 892104b6d2..f9ca515d58 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -175,6 +175,62 @@ (define* (install #:key outputs inputs #:allow-other-keys)
             "install" "../package.tgz")
     #t))
 
+(define* (avoid-node-gyp-rebuild #:key outputs #:allow-other-keys)
+  "Adjust the installed 'package.json' to remove an 'install' script that
+would try to run 'node-gyp rebuild'."
+  ;; We want to take advantage of `npm install`'s automatic support for
+  ;; building native addons with node-gyp: in particular, it helps us avoid
+  ;; hard-coding the specifics of how npm's internal copy of node-gyp is
+  ;; currently packaged. However, the mechanism by which the automatic support
+  ;; is implemented causes problems for us.
+  ;;
+  ;; If a package contains a 'binding.gyp' file and does not define an
+  ;; 'install' or 'preinstall' script, 'npm install' runs a default install
+  ;; script consisting of 'node-gyp rebuild'. In our 'install' phase, this
+  ;; implicit 'install' script, if it is applicable, is explicitly added to
+  ;; the "package.json" file. However, if another Guix package were to use a
+  ;; Node.js package with such an 'install' script, the dependent package's
+  ;; build process would fail, because 'node-gyp rebuild' would try to write
+  ;; to the store.
+  ;;
+  ;; Here, if the installed "package.json" defines scripts.install as
+  ;; "node-gyp rebuild", we replace it with a no-op. Importantly, deleting the
+  ;; install script definition would not be enough, because the default
+  ;; install script would cause the same problem.
+  ;;
+  ;; 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
+  (let* ((package.json (string-append
+                        (assoc-ref outputs "out")
+                        "/lib/node_modules/"
+                        (match (call-with-input-file "package.json" read-json)
+                          (('@ . alist)
+                           (assoc-ref alist "name")))
+                        "/package.json"))
+         (meta-alist (match (call-with-input-file package.json read-json)
+                       (('@ . alist)
+                        alist)))
+         (scripts-alist (match (assoc-ref meta-alist "scripts")
+                          (('@ . alist)
+                           alist)
+                          (#f
+                           #f))))
+    (when (and scripts-alist
+               (equal? "node-gyp rebuild" (assoc-ref scripts-alist "install")))
+      (call-with-output-file package.json
+        (lambda (out)
+          (write-json
+           (cons '@ (assoc-set!
+                     meta-alist
+                     "scripts"
+                     (cons '@ (assoc-set!
+                               scripts-alist
+                               "install"
+                               "echo Guix: avoiding node-gyp rebuild"))))
+           out))))
+    #t))
+
 (define %standard-phases
   (modify-phases gnu:%standard-phases
     (add-after 'unpack 'set-home set-home)
@@ -184,7 +240,8 @@ (define %standard-phases
     (replace 'build build)
     (replace 'check check)
     (add-before 'install 'repack repack)
-    (replace 'install install)))
+    (replace 'install install)
+    (add-after 'install 'avoid-node-gyp-rebuild avoid-node-gyp-rebuild)))
 
 (define* (node-build #:key inputs (phases %standard-phases)
                      #:allow-other-keys #:rest args)
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 22/45] gnu: Add node-inherits.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (20 preceding siblings ...)
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 21/45] guix: node-build-system: Add avoid-node-gyp-rebuild phase Philip McGrath
@ 2021-12-17  2:03                                   ` Philip McGrath
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 23/45] gnu: Add node-safe-buffer Philip McGrath
                                                     ` (22 subsequent siblings)
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:03 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-inherits): New variable.
---
 gnu/packages/node-xyz.scm | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 93bd067311..ce098e6e8c 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2020 Giacomo Leidi <goodoldpaul@autistici.org>
 ;;; Copyright © 2021 Noisytoot <noisytoot@disroot.org>
 ;;; Copyright © 2021 Charles <charles.b.jackson@protonmail.com>
+;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -351,6 +352,35 @@ (define-public node-once
 if desired.")
     (license license:isc)))
 
+(define-public node-inherits
+  (package
+    (name "node-inherits")
+    (version "2.0.4")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/isaacs/inherits")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0cpsr5yqwkxpbbbbl0rwk4mcby6zbx841k2zb4c3gb1579i5wq9p"))))
+    (build-system node-build-system)
+    (arguments
+     '(#:absent-dependencies
+       '("tap")
+       ;; FIXME: Tests depend on node-tap
+       #:tests? #f))
+    (home-page
+     "https://github.com/isaacs/inherits")
+    (synopsis
+     "Browser-friendly inheritance Node.js")
+    (description
+     "Browser-friendly inheritance fully compatible with standard Node.js
+@code{inherits()}.")
+    (license license:isc)))
+
 (define-public node-irc-colors
   (package
     (name "node-irc-colors")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 23/45] gnu: Add node-safe-buffer.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (21 preceding siblings ...)
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 22/45] gnu: Add node-inherits Philip McGrath
@ 2021-12-17  2:03                                   ` Philip McGrath
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 24/45] gnu: Add node-string-decoder Philip McGrath
                                                     ` (21 subsequent siblings)
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:03 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-safe-buffer): New variable.
---
 gnu/packages/node-xyz.scm | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index ce098e6e8c..410dfd6a62 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -381,6 +381,34 @@ (define-public node-inherits
 @code{inherits()}.")
     (license license:isc)))
 
+(define-public node-safe-buffer
+  (package
+    (name "node-safe-buffer")
+    (version "5.2.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/feross/safe-buffer")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0r26m0nl41h90ihnl2xf0cqs6z9z7jb87dl5j8yqb7887r9jlbpi"))))
+    (build-system node-build-system)
+    (arguments
+     '(#:absent-dependencies
+       '("tape"
+         "standard")
+       #:tests? #f))
+    (home-page
+     "https://github.com/feross/safe-buffer")
+    (synopsis "Safer Node.js Buffer API")
+    (description "A safe drop-in replacement the Node.js @code{Buffer} API
+that works in all versions of Node.js, using the built-in implementation when
+available.")
+    (license license:expat)))
+
 (define-public node-irc-colors
   (package
     (name "node-irc-colors")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 24/45] gnu: Add node-string-decoder.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (22 preceding siblings ...)
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 23/45] gnu: Add node-safe-buffer Philip McGrath
@ 2021-12-17  2:03                                   ` Philip McGrath
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 25/45] gnu: Add node-readable-stream Philip McGrath
                                                     ` (20 subsequent siblings)
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:03 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-string-decoder): New variable.
---
 gnu/packages/node-xyz.scm | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 410dfd6a62..5dbe2cf244 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -409,6 +409,39 @@ (define-public node-safe-buffer
 available.")
     (license license:expat)))
 
+(define-public node-string-decoder
+  (package
+    (name "node-string-decoder")
+    (version "1.3.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nodejs/string_decoder")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0xxvyya9fl9rlkqwmxzqzbz4rdr3jgw4vf37hff7cgscxkhg266k"))))
+    (build-system node-build-system)
+    (arguments
+     '(#:absent-dependencies
+       '("tap"
+         "core-util-is"
+         "babel-polyfill")
+       ;; FIXME: Tests depend on node-tap
+       #:tests? #f))
+    (inputs
+     (list node-safe-buffer node-inherits))
+    (home-page
+     "https://github.com/nodejs/string_decoder")
+    (synopsis
+     "Node.js core @code{string_decoder} for userland")
+    (description
+     "This package is a mirror of the @code{string_decoder} implementation in
+Node-core.")
+    (license license:expat)))
+
 (define-public node-irc-colors
   (package
     (name "node-irc-colors")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 25/45] gnu: Add node-readable-stream.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (23 preceding siblings ...)
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 24/45] gnu: Add node-string-decoder Philip McGrath
@ 2021-12-17  2:03                                   ` Philip McGrath
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 26/45] gnu: Add node-nan Philip McGrath
                                                     ` (19 subsequent siblings)
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:03 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-readable-stream): New variable.
---
 gnu/packages/node-xyz.scm | 52 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 5dbe2cf244..87694c7d00 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -442,6 +442,58 @@ (define-public node-string-decoder
 Node-core.")
     (license license:expat)))
 
+(define-public node-readable-stream
+  (package
+    (name "node-readable-stream")
+    (version "3.6.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nodejs/readable-stream")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0ybl4cdgsm9c5jq3xq8s01201jk8w0yakh63hlclsfbcdfqhd9ri"))))
+    (build-system node-build-system)
+    (arguments
+     `(#:absent-dependencies
+       `("@babel/cli"
+         "@babel/core"
+         "@babel/polyfill"
+         "@babel/preset-env"
+         "airtap"
+         "assert"
+         "bl"
+         "deep-strict-equal"
+         "events.once"
+         "glob"
+         "gunzip-maybe"
+         "hyperquest"
+         "lolex"
+         "nyc"
+         "pump"
+         "rimraf"
+         "tap"
+         "tape"
+         "tar-fs"
+         "util-promisify")
+       #:tests? #f))
+    (inputs
+     (list node-util-deprecate node-string-decoder node-inherits))
+    (home-page
+     "https://github.com/nodejs/readable-stream")
+    (synopsis
+     "Node.js core streams for userland")
+    (description
+     "This package is a mirror of the streams implementations in Node.js.
+
+If you want to guarantee a stable streams base, regardless of what version of
+Node you (or the users of your libraries) are using, use
+@code{readable-stream} only and avoid the @code{stream} module in Node-core.")
+    (license license:expat)))
+
 (define-public node-irc-colors
   (package
     (name "node-irc-colors")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 26/45] gnu: Add node-nan.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (24 preceding siblings ...)
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 25/45] gnu: Add node-readable-stream Philip McGrath
@ 2021-12-17  2:03                                   ` Philip McGrath
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 27/45] gnu: Add node-openzwave-shared Philip McGrath
                                                     ` (18 subsequent siblings)
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:03 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-nan): New variable.
---
 gnu/packages/node-xyz.scm | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 87694c7d00..d8ce7248f8 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -549,3 +549,42 @@ (define-public node-irc
     (description "@code{node-irc} is an IRC client library for Node.js.
 It has functions for joining, parting, talking, and many other IRC commands.")
     (license license:gpl3+)))
+
+(define-public node-nan
+  (package
+    (name "node-nan")
+    (version "2.15.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nodejs/nan")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "18xslh9va5ld872scrp5y4251ax9s3c6qh0lnl1200lpzbsxy7yd"))))
+    (build-system node-build-system)
+    (arguments
+     `(#:absent-dependencies
+       '("bindings"
+         "commander"
+         "glob"
+         "request"
+         "node-gyp" ;; would be needed for tests
+         "tap"
+         "xtend")
+       ;; tests need tap and other dependencies
+       #:tests? #f))
+    (inputs
+     (list node-readable-stream))
+    (home-page "https://github.com/nodejs/nan")
+    (synopsis "Native Abstractions for Node.js")
+    (description "Native Abstractions for Node.js (``NaN'') provides a header
+file filled with macro and utility goodness for making add-on development for
+Node.js easier across versions.  The goal of this project is to store all logic
+necessary to develop native Node.js addons without having to inspect
+@code{NODE_MODULE_VERSION} and get yourself into a macro-tangle.
+
+This project also contains some helper utilities that make addon development a
+bit more pleasant.")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 27/45] gnu: Add node-openzwave-shared.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (25 preceding siblings ...)
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 26/45] gnu: Add node-nan Philip McGrath
@ 2021-12-17  2:03                                   ` Philip McGrath
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 28/45] gnu: Add node-addon-api Philip McGrath
                                                     ` (17 subsequent siblings)
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:03 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/zwave.scm (node-openzwave-shared): New variable.
---
 gnu/packages/zwave.scm | 66 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)

diff --git a/gnu/packages/zwave.scm b/gnu/packages/zwave.scm
index 4d8286e334..e247c8488e 100644
--- a/gnu/packages/zwave.scm
+++ b/gnu/packages/zwave.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -21,11 +22,14 @@ (define-module (gnu packages zwave)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix git-download)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system node)
   #:use-module (gnu packages)
   #:use-module (gnu packages base)
+  #:use-module (gnu packages node-xyz)
   #:use-module (gnu packages libusb)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages perl)
+  #:use-module (gnu packages python)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages xml))
 
@@ -85,3 +89,65 @@ (define-public open-zwave
 and respond to devices on a Z-Wave network, without requiring in-depth
 knowledge of the Z-Wave protocol.")
     (license license:lgpl3+)))
+
+(define-public node-openzwave-shared
+  (package
+    (name "node-openzwave-shared")
+    (version "1.7.2")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/OpenZWave/node-openzwave-shared")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "1bqqy12dzqj05j9wsh50dmn84dddmhz0gjzvd3y20z4hpy1v8rsc"))))
+    (inputs
+     (list open-zwave node-nan))
+    (native-inputs
+     (list which python pkg-config))
+    (build-system node-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (replace 'build
+           ;; For some reason, `npm install` doesn't build
+           ;; the addon automatically, so we do it explicitly here.
+           ;; We go through `npx` so the npmrc file sets the
+           ;; configuration up properly.
+           (lambda* (#:key inputs #:allow-other-keys)
+             (define node-dir
+               (assoc-ref inputs "node"))
+             (invoke (string-append node-dir "/bin/npx")
+                     "--call"
+                     (string-append
+                      node-dir
+                      "/lib/node_modules/npm/bin/node-gyp-bin/node-gyp"
+                      " "
+                      "rebuild")))))))
+    (home-page "https://github.com/OpenZWave/node-openzwave-shared")
+    (synopsis "Node.js bindings for OpenZWave")
+    (description
+     "With the @code{node-openzwave-shared} package, you can easily control
+and manage your Z-Wave devices (lights, dimmers, blinds, you name it) from
+within Node.js applications.  This library also supports secure
+devices (e.g. door locks) that require encryption.  All widely used Node.js
+versions are supported with the help of @code{node-nan}.
+
+This library is currently able to:
+@itemize @bullet
+@item
+scan a Z-Wave network and report on connected devices;
+@item
+write values to Z-Wave nodes;
+@item
+monitor the network for changes;
+@item
+heal nodes and/or the network; and
+@item
+perform management tasks: add or remove nodes, replace failed nodes,
+manage their group associations, etc.
+@end itemize")
+    (license license:isc)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 28/45] gnu: Add node-addon-api.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (26 preceding siblings ...)
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 27/45] gnu: Add node-openzwave-shared Philip McGrath
@ 2021-12-17  2:03                                   ` Philip McGrath
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 29/45] gnu: Add node-sqlite3 Philip McGrath
                                                     ` (16 subsequent siblings)
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:03 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-addon-api): New variable.
---
 gnu/packages/node-xyz.scm | 62 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index d8ce7248f8..beebac7a40 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -22,6 +22,9 @@
 
 (define-module (gnu packages node-xyz)
   #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (gnu packages sqlite)
+  #:use-module (gnu packages python)
+  #:use-module (guix gexp)
   #:use-module (guix packages)
   #:use-module (guix git-download)
   #:use-module (guix build-system node))
@@ -588,3 +591,62 @@ (define-public node-nan
 This project also contains some helper utilities that make addon development a
 bit more pleasant.")
     (license license:expat)))
+
+(define-public node-addon-api
+  (package
+    (name "node-addon-api")
+    (version "4.2.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nodejs/node-addon-api")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1bhvfi2m9nxfz418s619914vmidcnrzbjv6l9nid476c3zlpazch"))))
+    (inputs
+     (list python node-safe-buffer))
+    (build-system node-build-system)
+    (arguments
+     `(#:absent-dependencies
+       `("benchmark"
+         "bindings"
+         "clang-format"
+         "eslint"
+         "eslint-config-semistandard"
+         "eslint-config-standard"
+         "eslint-plugin-import"
+         "eslint-plugin-node"
+         "eslint-plugin-promise"
+         "fs-extra"
+         "path"
+         "pre-commit")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'skip-js-tests
+           ;; We can't run the js-based tests,
+           ;; but we can still do the C++ parts
+           (lambda args
+             (substitute* "package.json"
+               (("\"test\": \"node test\"")
+                "\"test\": \"echo stopping after pretest on Guix\"")))))))
+    (home-page "https://github.com/nodejs/node-addon-api")
+    (synopsis "Node.js API (Node-API) header-only C++ wrappers")
+    (description "This module contains header-only C++ wrapper classes which
+simplify the use of the C based Node-API provided by Node.js when using C++.
+It provides a C++ object model and exception handling semantics with low
+overhead.
+
+Node-API is an ABI stable C interface provided by Node.js for building native
+addons.  It is intended to insulate native addons from changes in the
+underlying JavaScript engine and allow modules compiled for one version to run
+on later versions of Node.js without recompilation.  The @code{node-addon-api}
+module, which is not part of Node.js, preserves the benefits of the Node-API
+as it consists only of inline code that depends only on the stable API
+provided by Node-API.
+
+It is important to remember that @emph{other} Node.js interfaces such as
+@code{libuv} (included in a project via @code{#include <uv.h>}) are not
+ABI-stable across Node.js major versions.")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 29/45] gnu: Add node-sqlite3.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (27 preceding siblings ...)
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 28/45] gnu: Add node-addon-api Philip McGrath
@ 2021-12-17  2:03                                   ` Philip McGrath
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 30/45] gnu: Add node-file-uri-to-path Philip McGrath
                                                     ` (15 subsequent siblings)
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:03 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-sqlite3): New variable.
---
 gnu/packages/node-xyz.scm | 130 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 130 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index beebac7a40..f5297c869b 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -650,3 +650,133 @@ (define-public node-addon-api
 @code{libuv} (included in a project via @code{#include <uv.h>}) are not
 ABI-stable across Node.js major versions.")
     (license license:expat)))
+
+(define-public node-sqlite3
+  (package
+    (name "node-sqlite3")
+    (version "5.0.2")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/mapbox/node-sqlite3")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0sbbzzli282nxyfha10zx0k5m8hdp0sf3ipl59khjb7wm449j86h"))
+       (snippet
+        (with-imported-modules '((guix build utils))
+          #~(begin
+              (use-modules (guix build utils))
+              ;; unbundle sqlite
+              (for-each delete-file-recursively
+                        (find-files "deps"
+                                    (lambda (pth stat)
+                                      (gzip-file? pth)))))))))
+    (inputs
+     (list node-addon-api python sqlite))
+    (build-system node-build-system)
+    (arguments
+     `(#:tests?
+       #f ; FIXME: tests depend on node-mocha
+       #:modules
+       ((guix build node-build-system)
+        (guix build json)
+        (srfi srfi-1)
+        (ice-9 match)
+        (guix build utils))
+       #:absent-dependencies
+       `(;; Normally, this is "built" using @mapbox/node-pre-gyp,
+         ;; which publishes or downloads pre-built binaries
+         ;; or falls back to building from source.
+         ;; Here, we patch out all of that and just build directly.
+         ;; It would be better to patch a version of @mapbox/node-pre-gyp
+         ;; that always builds from source, as Debian does,
+         ;; but there are a number of dependencies that need
+         ;; to be packaged or removed.
+         "@mapbox/node-pre-gyp"
+         "node-pre-gyp" ;; deprecated name still used in some places
+         "aws-sdk"
+         "@mapbox/cloudfriend"
+         ;; Confusingly, this is only a dependency because of
+         ;; @mapbox/node-pre-gyp: with that removed,
+         ;; npm will use its own copy:
+         "node-gyp"
+         ;; These we'd like, we just don't have them yet:
+         "eslint"
+         "mocha")
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'configure 'npm-config-sqlite
+           ;; We need this step even if we do replace @mapbox/node-pre-gyp
+           ;; because the package expects to build its bundled sqlite
+           (lambda* (#:key inputs #:allow-other-keys)
+             (setenv "npm_config_sqlite" (assoc-ref inputs "sqlite"))))
+         (add-after 'install 'patch-binding-path
+           ;; We replace a file that dynamic searches for the addon using
+           ;; node-pre-gyp (which we don't have) with a version that
+           ;; simply uses the path to the addon we built directly.
+           ;; The exact path is supposed to depend on things like the
+           ;; architecture and napi_build_version, so, to avoid having
+           ;; hard-code the details accurately, we do this after the addon
+           ;; has been built so we can just find where it ended up.
+           (lambda* (#:key outputs #:allow-other-keys)
+             (with-directory-excursion
+                 (string-append (assoc-ref outputs "out")
+                                "/lib/node_modules/sqlite3/lib")
+               (match (find-files "binding" "\\.node$")
+                 ((rel-path)
+                  (with-atomic-file-replacement "sqlite3-binding.js"
+                    (lambda (in out)
+                      (format out "var binding = require('./~a');\n" rel-path)
+                      (display "module.exports = exports = binding;\n" out))))))))
+         (add-after 'patch-dependencies 'avoid-node-pre-gyp
+           (lambda args
+             ;; We need to patch .npmignore before the 'repack phase
+             ;; so that the built addon is installed with in the package.
+             ;; (Upstream assumes node-pre-gyp will download a pre-built
+             ;; version when this package is installed.)
+             (substitute* ".npmignore"
+               (("lib/binding")
+                "#lib/binding # <- patched for Guix"))
+             ;; We need to remove the install script from "package.json",
+             ;; as it would try to use node-pre-gyp and would block the
+             ;; automatic building performed by `npm install`.
+             (with-atomic-file-replacement "package.json"
+               (lambda (in out)
+                 (let* ((js (read-json in))
+                        (alist (match js
+                                 (('@ . alist) alist)))
+                        (scripts-alist (match (assoc-ref alist "scripts")
+                                         (('@ . alist) alist)))
+                        (scripts-alist
+                         ;; install script would use node-pre-gyp
+                         (assoc-remove! scripts-alist "install"))
+                        (alist
+                         (assoc-set! alist "scripts" (cons '@ scripts-alist)))
+                        (binary-alist (match (assoc-ref alist "binary")
+                                        (('@ . alist) alist)))
+                        (js (cons '@ alist)))
+                   ;; When it builds from source, node-pre-gyp supplies
+                   ;; module_name and module_path based on the entries under
+                   ;; "binary" from "package.json", so this package's
+                   ;; "binding.gyp" doesn't define them. Thus, we also need
+                   ;; to supply them. The GYP_DEFINES environment variable
+                   ;; turns out to be the easiest way to make sure they are
+                   ;; propagated from npm to node-gyp to gyp.
+                   (setenv "GYP_DEFINES"
+                           (string-append
+                            "module_name="
+                            (assoc-ref binary-alist "module_name")
+                            " "
+                            "module_path="
+                            (assoc-ref binary-alist "module_path")))
+                   (write-json js
+                               out)))))))))
+    (home-page "https://github.com/mapbox/node-sqlite3")
+    (synopsis "Asynchronous, non-blocking SQLite3 bindings for Node.js")
+    (description
+     "The Node.js add-on @code{node-sqlite3} provides a set of a asynchronous,
+non-blocking bindings for SQLite3, written in modern C++ and tested for memory
+leaks.")
+     (license license:bsd-3)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 30/45] gnu: Add node-file-uri-to-path.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (28 preceding siblings ...)
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 29/45] gnu: Add node-sqlite3 Philip McGrath
@ 2021-12-17  2:03                                   ` Philip McGrath
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 31/45] gnu: Add node-bindings Philip McGrath
                                                     ` (14 subsequent siblings)
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:03 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-file-uri-to-path): New variable.
---
 gnu/packages/node-xyz.scm | 55 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index f5297c869b..c9afe8ccd2 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -24,6 +24,7 @@ (define-module (gnu packages node-xyz)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (gnu packages sqlite)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages web)
   #:use-module (guix gexp)
   #:use-module (guix packages)
   #:use-module (guix git-download)
@@ -780,3 +781,57 @@ (define-public node-sqlite3
 non-blocking bindings for SQLite3, written in modern C++ and tested for memory
 leaks.")
      (license license:bsd-3)))
+
+(define-public node-file-uri-to-path
+  (package
+    (name "node-file-uri-to-path")
+    (version "2.0.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/TooTallNate/file-uri-to-path")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "08l779az44czm12xdhgcrnzpqw34s59hbrlfphs7g9y2k26drqav"))))
+    (native-inputs
+     (list esbuild))
+    (build-system node-build-system)
+    (arguments
+     `(#:absent-dependencies
+       `("@types/mocha"
+         "@types/node"
+         "@typescript-eslint/eslint-plugin"
+         "@typescript-eslint/parser"
+         "cpy-cli"
+         "eslint"
+         "eslint-config-airbnb"
+         "eslint-config-prettier"
+         "eslint-import-resolver-typescript"
+         "eslint-plugin-import"
+         "eslint-plugin-jsx-a11y"
+         "eslint-plugin-react"
+         "mocha"
+         "rimraf"
+         "typescript")
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'build
+           (lambda* (#:key inputs native-inputs #:allow-other-keys)
+             (copy-recursively "src" "dist")
+             (invoke (string-append
+                      (assoc-ref (or native-inputs inputs) "esbuild")
+                      "/bin/esbuild")
+                     "dist/index.ts"
+                     "--outfile=dist/src/index.js"
+                     "--format=cjs"
+                     "--sourcemap"
+                     "--platform=node"))))
+       #:tests? #f))
+    (home-page "https://github.com/TooTallNate/file-uri-to-path")
+    (synopsis "Convert a @code{file:} URI to a file path")
+    (description "This package provides a function to convert a @code{file:}
+URI to a file path.  It accepts a @code{file:} URI and returns a file path
+suitable for use with the @code{fs} module functions.")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 31/45] gnu: Add node-bindings.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (29 preceding siblings ...)
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 30/45] gnu: Add node-file-uri-to-path Philip McGrath
@ 2021-12-17  2:03                                   ` Philip McGrath
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 32/45] gnu: Add node-segfault-handler Philip McGrath
                                                     ` (13 subsequent siblings)
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:03 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-bindings): New variable.
---
 gnu/packages/node-xyz.scm | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index c9afe8ccd2..913bb7d149 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -835,3 +835,29 @@ (define-public node-file-uri-to-path
 URI to a file path.  It accepts a @code{file:} URI and returns a file path
 suitable for use with the @code{fs} module functions.")
     (license license:expat)))
+
+(define-public node-bindings
+  (package
+    (name "node-bindings")
+    (version "1.5.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/TooTallNate/node-bindings")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "100gp6kpjvd4j1dqnp0sbjr1hqx5mz7r61q9qy527jyhk9mj47wk"))))
+    (inputs
+     (list node-file-uri-to-path))
+    (build-system node-build-system)
+    (arguments
+     ;; there are no tests
+     `(#:tests? #f))
+    (home-page "https://github.com/TooTallNate/node-bindings")
+    (synopsis "Help for loading your native module's @code{.node} file")
+    (description "This is a helper module for authors of Node.js native addon
+modules.  It is basically the ``swiss army knife'' of @code{require()}ing your
+native module's @code{.node} file.")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 32/45] gnu: Add node-segfault-handler.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (30 preceding siblings ...)
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 31/45] gnu: Add node-bindings Philip McGrath
@ 2021-12-17  2:03                                   ` Philip McGrath
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 33/45] gnu: Add node-ms Philip McGrath
                                                     ` (12 subsequent siblings)
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:03 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-segfault-handler): New variable.
---
 gnu/packages/node-xyz.scm | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 913bb7d149..30a0174063 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -861,3 +861,32 @@ (define-public node-bindings
 modules.  It is basically the ``swiss army knife'' of @code{require()}ing your
 native module's @code{.node} file.")
     (license license:expat)))
+
+(define-public node-segfault-handler
+  (package
+    (name "node-segfault-handler")
+    (version "1.3.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/ddopson/node-segfault-handler")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "07nbw35wvrr18kmh8f388v4k5mpjgyy0260bx0xzjdv795i3xvfv"))))
+    (native-inputs
+     (list python))
+    (inputs
+     (list node-bindings node-nan))
+    (build-system node-build-system)
+    (arguments
+     ;; there are no tests
+     `(#:tests? #f))
+    (home-page "https://github.com/ddopson/node-segfault-handler")
+    (synopsis "Catches @code{SIGSEGV} and prints diagnostic information")
+    (description "This package is a tool for debugging Node.js C/C++ native
+code modules and getting stack traces when things go wrong.  If a
+@code{SIGSEGV} signal is raised, the module will print a native stack trace to
+both @code{STDERR} and to a timestamped file.")
+    (license license:bsd-3)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 33/45] gnu: Add node-ms.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (31 preceding siblings ...)
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 32/45] gnu: Add node-segfault-handler Philip McGrath
@ 2021-12-17  2:03                                   ` Philip McGrath
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 34/45] gnu: Add node-debug Philip McGrath
                                                     ` (11 subsequent siblings)
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:03 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-ms): New variable.
---
 gnu/packages/node-xyz.scm | 43 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 30a0174063..3103124bed 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -890,3 +890,46 @@ (define-public node-segfault-handler
 @code{SIGSEGV} signal is raised, the module will print a native stack trace to
 both @code{STDERR} and to a timestamped file.")
     (license license:bsd-3)))
+
+(define-public node-ms
+  (package
+    (name "node-ms")
+    (version "2.1.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/vercel/ms")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1l74kmmwffmzdz38lli0v5mdb9p9jmsjxpb48ncknqw2n74cgf08"))))
+    (build-system node-build-system)
+    (arguments
+     `(#:absent-dependencies
+       `("eslint"
+         "expect.js"
+         "husky"
+         "lint-staged"
+         "mocha"
+         "prettier")
+       #:tests? #f))
+    (home-page "https://github.com/vercel/ms")
+    (synopsis "Tiny millisecond conversion utility")
+    (description "Use this package to easily convert various time formats to
+milliseconds.
+
+Features:
+@itemize @bullet
+@item
+Works both in Node.js and in the browser.
+@item
+If a number is supplied to @code{ms}, a string with a unit is returned.
+@item
+If a string that contains the number is supplied, it returns it as a
+number (e.g. it returns @code{100} for @code{'100'}).
+@item
+If you pass a string with a number and a valid unit, the number of
+equivalent milliseconds is returned.
+@end itemize")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 34/45] gnu: Add node-debug.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (32 preceding siblings ...)
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 33/45] gnu: Add node-ms Philip McGrath
@ 2021-12-17  2:03                                   ` Philip McGrath
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 35/45] gnu: Add node-serialport-binding-abstract Philip McGrath
                                                     ` (10 subsequent siblings)
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:03 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-debug): New variable.
---
 gnu/packages/node-xyz.scm | 42 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 3103124bed..8de98fe046 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -933,3 +933,45 @@ (define-public node-ms
 equivalent milliseconds is returned.
 @end itemize")
     (license license:expat)))
+
+(define-public node-debug
+  (package
+    (name "node-debug")
+    (version "4.3.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/debug-js/debug")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0ji0dmdl2xkgxqxvd6xjy7k3mmknmhvqjgc40vyly9ka1mpf20vb"))))
+    (inputs
+     (list node-ms))
+    (build-system node-build-system)
+    (arguments
+     `(#:absent-dependencies
+       `("brfs"
+         "browserify"
+         "coveralls"
+         "istanbul"
+         "karma"
+         "karma-browserify"
+         "karma-chrome-launcher"
+         "karma-mocha"
+         "mocha"
+         "mocha-lcov-reporter"
+         "xo"
+         "supports-color")
+       #:tests? #f))
+    (home-page "https://github.com/debug-js/debug")
+    (synopsis "Lightweight debugging utility for Node.js and the browser")
+    (description "A tiny JavaScript debugging utility modelled after Node.js
+core's debugging technique.  orks in Node.js and web browsers.
+
+The @code{debug} module exposes a function; simply pass this function the name
+of your module, and it will return a decorated version of @code{console.error}
+for you to pass debug statements to.  This will allow you to toggle the debug
+output for different parts of your module as well as the module as a whole.")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 35/45] gnu: Add node-serialport-binding-abstract.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (33 preceding siblings ...)
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 34/45] gnu: Add node-debug Philip McGrath
@ 2021-12-17  2:03                                   ` Philip McGrath
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 36/45] gnu: Add node-serialport-parser-delimiter Philip McGrath
                                                     ` (9 subsequent siblings)
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:03 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport-binding-abstract): New variable.
---
 gnu/packages/node-xyz.scm | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 8de98fe046..ef833678d1 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -975,3 +975,37 @@ (define-public node-debug
 for you to pass debug statements to.  This will allow you to toggle the debug
 output for different parts of your module as well as the module as a whole.")
     (license license:expat)))
+
+(define-public node-serialport-binding-abstract
+  (package
+    (name "node-serialport-binding-abstract")
+    (version "9.2.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/serialport/node-serialport")
+             (commit "v9.2.7")))
+       (file-name (git-file-name "serialport-monorepo" version))
+       (sha256
+        (base32 "0x7zm59a5ff5yygjyw15xs3r5m3rb8av1yfrh4snn44mrwq87yg8"))))
+    (inputs
+     (list node-debug))
+    (build-system node-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/binding-abstract"))))
+       #:tests? #f))
+    (home-page "https://serialport.io")
+    (synopsis "Abstract base class for Node SerialPort bindings")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+This package provides the @code{AbstractBinding} class, the base for all Node
+SerialPort bindings.  You wouldn't use this class directly, but instead extend
+it to make a new binding for a different platform or underling technology.")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 36/45] gnu: Add node-serialport-parser-delimiter.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (34 preceding siblings ...)
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 35/45] gnu: Add node-serialport-binding-abstract Philip McGrath
@ 2021-12-17  2:03                                   ` Philip McGrath
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 37/45] gnu: Add node-serialport-parser-readline Philip McGrath
                                                     ` (8 subsequent siblings)
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:03 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport-parser-delimiter): New
variable.
---
 gnu/packages/node-xyz.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index ef833678d1..abe0e9b291 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1009,3 +1009,25 @@ (define-public node-serialport-binding-abstract
 SerialPort bindings.  You wouldn't use this class directly, but instead extend
 it to make a new binding for a different platform or underling technology.")
     (license license:expat)))
+
+(define-public node-serialport-parser-delimiter
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-delimiter")
+    (version "9.2.4")
+    (inputs `())
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-delimiter"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser to split data on a delimiter")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{Delimiter}, a parser that emits data
+each time a specified byte sequence is received.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 37/45] gnu: Add node-serialport-parser-readline.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (35 preceding siblings ...)
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 36/45] gnu: Add node-serialport-parser-delimiter Philip McGrath
@ 2021-12-17  2:03                                   ` Philip McGrath
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 38/45] gnu: Add node-serialport-bindings Philip McGrath
                                                     ` (7 subsequent siblings)
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:03 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport-parser-readline): New
variable.
---
 gnu/packages/node-xyz.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index abe0e9b291..d117df1e81 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1031,3 +1031,26 @@ (define-public node-serialport-parser-delimiter
 Parsers are used to take raw binary data and transform them into usable
 messages.  This package provides @code{Delimiter}, a parser that emits data
 each time a specified byte sequence is received.")))
+
+(define-public node-serialport-parser-readline
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-readline")
+    (version "9.2.4")
+    (inputs
+     (list node-serialport-parser-delimiter))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-readline"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser to split data on newlines")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{Readline}, a parser that emits data
+after a (configurable) newline delimiter is received.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 38/45] gnu: Add node-serialport-bindings.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (36 preceding siblings ...)
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 37/45] gnu: Add node-serialport-parser-readline Philip McGrath
@ 2021-12-17  2:03                                   ` Philip McGrath
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 39/45] gnu: Add node-serialport-parser-regex Philip McGrath
                                                     ` (6 subsequent siblings)
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:03 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport-bindings): New variable.
---
 gnu/packages/node-xyz.scm | 53 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index d117df1e81..e56bccb895 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1054,3 +1054,56 @@ (define-public node-serialport-parser-readline
 Parsers are used to take raw binary data and transform them into usable
 messages.  This package provides @code{Readline}, a parser that emits data
 after a (configurable) newline delimiter is received.")))
+
+(define-public node-serialport-bindings
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-bindings")
+    (version "9.2.7")
+    (native-inputs
+     (list python))
+    (inputs
+     (list node-nan node-bindings node-serialport-binding-abstract
+           node-serialport-parser-readline node-debug))
+    (arguments
+     `(#:absent-dependencies
+       `("prebuild-install"
+         ;; devDependencies
+         "@serialport/binding-mock"
+         "node-abi")
+       #:modules
+       ((guix build node-build-system)
+        (guix build json)
+        (srfi srfi-1)
+        (ice-9 match)
+        (guix build utils))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/bindings")))
+         (add-after 'chdir 'avoid-prebuild-install
+           (lambda args
+             (with-atomic-file-replacement "package.json"
+               (lambda (in out)
+                 (match (read-json in)
+                   (('@ . meta-alist)
+                    (match (assoc-ref meta-alist "scripts")
+                      (('@ . scripts-alist)
+                       (write-json
+                        (cons '@ (assoc-set!
+                                  meta-alist
+                                  "scripts"
+                                  (cons '@ (assoc-remove! scripts-alist
+                                                          "install"))))
+                        out))))))))))
+       #:tests? #f))
+    (synopsis "Abstract base class for Node SerialPort bindings")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+This package provides the @code{Binding} class, which uses a native addon to
+talk to the underlying system.  You never have to use @code{Binding} objects
+directly.  There is also a @code{MockBinding} available (but not yet packaged
+for Guix) to assist with testing.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 39/45] gnu: Add node-serialport-parser-regex.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (37 preceding siblings ...)
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 38/45] gnu: Add node-serialport-bindings Philip McGrath
@ 2021-12-17  2:03                                   ` Philip McGrath
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 40/45] gnu: Add node-serialport-parser-ready Philip McGrath
                                                     ` (5 subsequent siblings)
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:03 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport-parser-regex): New variable.
---
 gnu/packages/node-xyz.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index e56bccb895..be96a00a37 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1107,3 +1107,25 @@ (define-public node-serialport-bindings
 talk to the underlying system.  You never have to use @code{Binding} objects
 directly.  There is also a @code{MockBinding} available (but not yet packaged
 for Guix) to assist with testing.")))
+
+(define-public node-serialport-parser-regex
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-regex")
+    (version "9.2.4")
+    (inputs `())
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-regex"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser to split data on a regular expression")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{Regex}, a parser that uses a regular
+expression to split the incoming text.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 40/45] gnu: Add node-serialport-parser-ready.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (38 preceding siblings ...)
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 39/45] gnu: Add node-serialport-parser-regex Philip McGrath
@ 2021-12-17  2:03                                   ` Philip McGrath
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 41/45] gnu: Add node-serialport-parser-inter-byte-timeout Philip McGrath
                                                     ` (4 subsequent siblings)
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:03 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport-parser-ready): New variable.
---
 gnu/packages/node-xyz.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index be96a00a37..412bb0a3bb 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1129,3 +1129,26 @@ (define-public node-serialport-parser-regex
 Parsers are used to take raw binary data and transform them into usable
 messages.  This package provides @code{Regex}, a parser that uses a regular
 expression to split the incoming text.")))
+
+(define-public node-serialport-parser-ready
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-ready")
+    (version "9.2.4")
+    (inputs `())
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-ready"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser to wait for specified byte sequence")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{Ready}, a parser that waits for a
+specified sequence of ``ready'' bytes before emitting a ready event and
+emitting data events.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 41/45] gnu: Add node-serialport-parser-inter-byte-timeout.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (39 preceding siblings ...)
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 40/45] gnu: Add node-serialport-parser-ready Philip McGrath
@ 2021-12-17  2:03                                   ` Philip McGrath
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 42/45] gnu: Add node-serialport-parser-cctalk Philip McGrath
                                                     ` (3 subsequent siblings)
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:03 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm
(node-serialport-parser-inter-byte-timeout): New variable.
---
 gnu/packages/node-xyz.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 412bb0a3bb..405bb92327 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1152,3 +1152,25 @@ (define-public node-serialport-parser-ready
 messages.  This package provides @code{Ready}, a parser that waits for a
 specified sequence of ``ready'' bytes before emitting a ready event and
 emitting data events.")))
+
+(define-public node-serialport-parser-inter-byte-timeout
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-inter-byte-timeout")
+    (version "9.2.4")
+    (inputs `())
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-inter-byte-timeout"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser to detect pauses in data")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{InterByteTimeout}, a parser that emits
+data if there is a pause between packets for the specified amount of time.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 42/45] gnu: Add node-serialport-parser-cctalk.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (40 preceding siblings ...)
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 41/45] gnu: Add node-serialport-parser-inter-byte-timeout Philip McGrath
@ 2021-12-17  2:03                                   ` Philip McGrath
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 43/45] gnu: Add node-serialport-parser-byte-length Philip McGrath
                                                     ` (2 subsequent siblings)
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:03 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport-parser-cctalk): New variable.
---
 gnu/packages/node-xyz.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 405bb92327..4dd17aa20f 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1174,3 +1174,26 @@ (define-public node-serialport-parser-inter-byte-timeout
 Parsers are used to take raw binary data and transform them into usable
 messages.  This package provides @code{InterByteTimeout}, a parser that emits
 data if there is a pause between packets for the specified amount of time.")))
+
+(define-public node-serialport-parser-cctalk
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-cctalk")
+    (version "9.2.4")
+    (inputs `())
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-cctalk"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser for the ccTalk protocol")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{CCTalk}, which emits packets for the
+ccTalk protocol (an open standard for currency detectors) as they are
+received.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 43/45] gnu: Add node-serialport-parser-byte-length.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (41 preceding siblings ...)
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 42/45] gnu: Add node-serialport-parser-cctalk Philip McGrath
@ 2021-12-17  2:03                                   ` Philip McGrath
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 44/45] gnu: Add node-serialport-stream Philip McGrath
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 45/45] gnu: Add node-serialport Philip McGrath
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:03 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport-parser-byte-length): New
variable.
---
 gnu/packages/node-xyz.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 4dd17aa20f..b2c2d62220 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1197,3 +1197,25 @@ (define-public node-serialport-parser-cctalk
 messages.  This package provides @code{CCTalk}, which emits packets for the
 ccTalk protocol (an open standard for currency detectors) as they are
 received.")))
+
+(define-public node-serialport-parser-byte-length
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-byte-length")
+    (version "9.2.4")
+    (inputs `())
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-byte-length"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser for fixed-length buffers")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{ByteLength}, a parser that emits data
+as a buffer every time a specified number of bytes are received.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 44/45] gnu: Add node-serialport-stream.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (42 preceding siblings ...)
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 43/45] gnu: Add node-serialport-parser-byte-length Philip McGrath
@ 2021-12-17  2:03                                   ` Philip McGrath
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 45/45] gnu: Add node-serialport Philip McGrath
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:03 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport-stream): New variable.
---
 gnu/packages/node-xyz.scm | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index b2c2d62220..083f43e33f 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1219,3 +1219,30 @@ (define-public node-serialport-parser-byte-length
 Parsers are used to take raw binary data and transform them into usable
 messages.  This package provides @code{ByteLength}, a parser that emits data
 as a buffer every time a specified number of bytes are received.")))
+
+(define-public node-serialport-stream
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-stream")
+    (version "9.2.4")
+    (inputs
+     (list node-debug))
+    (arguments
+     `(#:absent-dependencies
+       `(;; devDependencies
+         "@serialport/binding-mock")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/stream"))))
+       #:tests? #f))
+    (synopsis "Node.js stream interface for Node SerialPort")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+This package provides an interface for using Node SerialPort bindings via the
+Node.js Stream API.  The stream is a duplex stream, allowing for reading and
+writing.  It has additional methods for managing the SerialPort
+connection.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 45/45] gnu: Add node-serialport.
  2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                     ` (43 preceding siblings ...)
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 44/45] gnu: Add node-serialport-stream Philip McGrath
@ 2021-12-17  2:03                                   ` Philip McGrath
  44 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-17  2:03 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport): New variable.
---
 gnu/packages/node-xyz.scm | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 083f43e33f..52dec0423b 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1246,3 +1246,34 @@ (define-public node-serialport-stream
 Node.js Stream API.  The stream is a duplex stream, allowing for reading and
 writing.  It has additional methods for managing the SerialPort
 connection.")))
+
+(define-public node-serialport
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport")
+    (version "9.2.7")
+    (inputs
+     (list node-serialport-bindings
+           node-serialport-parser-delimiter
+           node-serialport-parser-readline
+           node-serialport-parser-regex
+           node-serialport-parser-ready
+           node-serialport-parser-inter-byte-timeout
+           node-serialport-parser-cctalk
+           node-serialport-parser-byte-length
+           node-serialport-stream
+           node-debug))
+    (arguments
+     `(#:absent-dependencies
+       `("@serialport/binding-mock")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/serialport"))))
+       #:tests? #f))
+    (synopsis "Node.js package to access serial ports")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  This package is the recommended entry point for most
+projects.  It combines a high-level Node.js stream interface with a useful
+default set of parsers and bindings.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 06/45] guix: node-build-system: Refactor patch-dependencies phase.
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 06/45] guix: node-build-system: Refactor patch-dependencies phase Philip McGrath
@ 2021-12-17  4:29                                     ` Liliana Marie Prikler
  2021-12-18 17:03                                       ` Philip McGrath
  0 siblings, 1 reply; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-17  4:29 UTC (permalink / raw)
  To: Philip McGrath, 51838; +Cc: Timothy Sample, Pierre Langlois, Jelle Licht

Hi,

Am Donnerstag, dem 16.12.2021 um 21:02 -0500 schrieb Philip McGrath:
> * guix/build/node-build-system.scm (patch-dependencies): Strictly
> follow the linearity rules for `assoc-set!` and friends.
> Clarify the types of the arguments to and return value from the
> internal helper function `resolve-dependencies`.
> [...]
> -  (define (resolve-dependencies package-meta meta-key)
> -    (fold (lambda (key+value acc)
> -            (match key+value
> -              ('@ acc)
> -              ((key . value) (acons key (hash-ref index key value)
> acc))))
> -          '()
> -          (or (assoc-ref package-meta meta-key) '())))
> +  (define (resolve-dependencies meta-alist meta-key)
> +    ;; Given:
> +    ;;  - The alist from "package.json", with the '@ unwrapped
> +    ;;  - A string key, like "dependencies"
> +    ;; Returns: an alist (without a wrapping '@) like the entry in
> +    ;; meta-alist for meta-key, but with dependencies supplied
> +    ;; by Guix packages mapped to the absolute store paths to use.
> +    (match (assoc-ref meta-alist meta-key)
> +      (#f
> +       '())
> +      (('@ . orig-deps)
> +       (fold (match-lambda*
> +               (((key . value) acc)
> +                (acons key (hash-ref index key value) acc)))
> +             '()
> +             orig-deps))))
>  
>    (with-atomic-file-replacement "package.json"
>      (lambda (in out)
> -      (let ((package-meta (read-json in)))
> -        (assoc-set! package-meta "dependencies"
> -                    (append
> -                     '(@)
> -                     (resolve-dependencies package-meta
> "dependencies")
> -                     (resolve-dependencies package-meta
> "peerDependencies")))
> -        (assoc-set! package-meta "devDependencies"
> -                    (append
> -                     '(@)
> -                     (resolve-dependencies package-meta
> "devDependencies")))
> +      ;; It is unsafe to rely on 'assoc-set!' to update an
> +      ;; existing assosciation list variable:
> +      ;; see 'info "(guile)Adding or Setting Alist Entries"'.
> +      (let* ((package-meta (read-json in))
> +             (alist (match package-meta
> +                      ((@ . alist) alist)))
> +             (alist
> +              (assoc-set!
> +               alist "dependencies"
> +               (append
> +                '(@)
> +                (resolve-dependencies alist "dependencies")
> +                (resolve-dependencies alist "peerDependencies"))))
> +             (alist
> +              (assoc-set!
> +               alist "devDependencies"
> +               (append
> +                '(@)
> +                (resolve-dependencies alist "devDependencies"))))
> +             (package-meta (cons '@ alist)))
>          (write-json package-meta out))))
>    #t)
The Guix codebase is generally not the place to play around with
destructive semantics.  If you can avoid assoc-set!, I think you ought
to, especially if it helps making a two-step process into a single-step
one.  Anything I'm missing here?




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 07/45] guix: node-build-system: Add #:absent-dependencies argument.
  2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 07/45] guix: node-build-system: Add #:absent-dependencies argument Philip McGrath
@ 2021-12-17  4:43                                     ` Liliana Marie Prikler
  2021-12-17 15:46                                       ` Timothy Sample
  0 siblings, 1 reply; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-17  4:43 UTC (permalink / raw)
  To: Philip McGrath, 51838; +Cc: Timothy Sample, Pierre Langlois, Jelle Licht

Hi,

Am Donnerstag, dem 16.12.2021 um 21:02 -0500 schrieb Philip McGrath:
> * guix/build-system/node.scm (lower, node-build): Add optional
> argument #:absent-dependencies with default of ''(). Pass it on
> to the build-side code.
> * guix/build/node-build-system.scm (patch-dependencies): Respect
> the #:absent-dependencies argument, removing specified npm
> packages from the "dependencies" or "devDependencies" tables
> in "package.json".
> [...]
> +                (absent-dependencies ''())
> [...]
> +                     (absent-dependencies ''())
> [...]
> -(define* (patch-dependencies #:key inputs #:allow-other-keys)
> +(define* (patch-dependencies #:key inputs absent-dependencies
> +                             #:allow-other-keys)
>  
>    (define index (index-modules (map cdr inputs)))
>  
> @@ -86,7 +87,9 @@ (define (resolve-dependencies meta-alist meta-key)
>        (('@ . orig-deps)
>         (fold (match-lambda*
>                 (((key . value) acc)
> -                (acons key (hash-ref index key value) acc)))
> +                (if (member key absent-dependencies)
> +                    acc
> +                    (acons key (hash-ref index key value) acc))))
>               '()
>               orig-deps))))
I might be sounding like a broken record here, but again for the sake
of being able to add or remove inputs on the user side without
duplicated efforts, I'd use something else in lieu of absent-
dependencies.  For the time being, I think a switch between "fail" and
"warn about missing dependencies" ought to be enough.  In the future,
we might want to make it so that packages can specify which
dependencies they absolutely require and which they don't (or if
possible infer that from dependencies).  WDYT? 





^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 20/45] guix: node-build-system: Add implicit libuv input.
  2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 20/45] guix: node-build-system: Add implicit libuv input Philip McGrath
@ 2021-12-17  5:08                                     ` Liliana Marie Prikler
  2021-12-18 16:16                                       ` Philip McGrath
  2021-12-18 17:07                                       ` Philip McGrath
  0 siblings, 2 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-17  5:08 UTC (permalink / raw)
  To: Philip McGrath, 51838; +Cc: Timothy Sample, Pierre Langlois, Jelle Licht

Am Donnerstag, dem 16.12.2021 um 21:03 -0500 schrieb Philip McGrath:
> * guix/build-system/node.scm (lower): Add the version of libuv
> used as an input to the #:node package as an additional implicit
> input, so that packages needing libuv always get the correct version.
> ---
>  guix/build-system/node.scm | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/guix/build-system/node.scm b/guix/build-system/node.scm
> index 330d10dca5..47af4bb9e2 100644
> --- a/guix/build-system/node.scm
> +++ b/guix/build-system/node.scm
> @@ -2,6 +2,8 @@
>  ;;; Copyright © 2016 Jelle Licht <jlicht@fsfe.org>
>  ;;; Copyright © 2019 Timothy Sample <samplet@ngyro.com>
>  ;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
> +;;; Copyright © 2021 Pierre Langlois <pierre.langlois@gmx.com>
> +;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -62,10 +64,15 @@ (define private-keywords
>                                `(("source" ,source))
>                                '())
>                          ,@inputs
> -
>                          ;; Keep the standard inputs of 'gnu-build-
> system'.
>                          ,@(standard-packages)))
>           (build-inputs `(("node" ,node)
> +                         ;; Many packages with native addons need
> +                         ;; libuv headers. The libuv version must
> +                         ;; be exactly the same as for the node
> +                         ;; package we are adding implicitly,
> +                         ;; so we take care of adding libuv, too.
> +                         ("libuv" ,@(assoc-ref (package-inputs node)
> "libuv"))
>                           ,@native-inputs))
>           (outputs outputs)
>           (build node-build)
Do this and #21 have to be separated so far from the rest?  If not, I'd
do build system first, then new packages.  Otherwise fair enough.




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 07/45] guix: node-build-system: Add #:absent-dependencies argument.
  2021-12-17  4:43                                     ` Liliana Marie Prikler
@ 2021-12-17 15:46                                       ` Timothy Sample
  2021-12-17 19:40                                         ` Liliana Marie Prikler
  0 siblings, 1 reply; 458+ messages in thread
From: Timothy Sample @ 2021-12-17 15:46 UTC (permalink / raw)
  To: Liliana Marie Prikler; +Cc: 51838, Pierre Langlois, Jelle Licht, Philip McGrath

Hi Liliana,

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

> I might be sounding like a broken record here, but again for the sake
> of being able to add or remove inputs on the user side without
> duplicated efforts, I'd use something else in lieu of absent-
> dependencies.  For the time being, I think a switch between "fail" and
> "warn about missing dependencies" ought to be enough.  In the future,
> we might want to make it so that packages can specify which
> dependencies they absolutely require and which they don't (or if
> possible infer that from dependencies).  WDYT?

The way I see it is that we are basically copying the
“--disable-X”/“--without-Y” features of a GNU configure script.  With
the GNU build system, if one of our packages specifies “--without-zlib”
for whatever reason, and you as a user want to modify the package to use
zlib, you would have to

  1. remove the “--without-zlib” configure flag; and
  2. add the zlib package to the package’s inputs.

That’s a “duplicated effort”, right?

Similarly, for a Node package (with a pretend Node zlib package), you
would have to

  1. remove “zlib” from absent dependencies; and
  2. add the “node-zlib” package to the package’s inputs.

That seems okay to me, but I’m worried I’ve missed what you’re trying to
communicate.


-- Tim




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 07/45] guix: node-build-system: Add #:absent-dependencies argument.
  2021-12-17 15:46                                       ` Timothy Sample
@ 2021-12-17 19:40                                         ` Liliana Marie Prikler
  2021-12-18  2:48                                           ` Timothy Sample
  0 siblings, 1 reply; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-17 19:40 UTC (permalink / raw)
  To: Timothy Sample; +Cc: 51838, Pierre Langlois, Jelle Licht, Philip McGrath

Hi Timothy,

Am Freitag, dem 17.12.2021 um 10:46 -0500 schrieb Timothy Sample:
> Hi Liliana,
> 
> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
> 
> > I might be sounding like a broken record here, but again for the
> > sake of being able to add or remove inputs on the user side without
> > duplicated efforts, I'd use something else in lieu of absent-
> > dependencies.  For the time being, I think a switch between "fail"
> > and "warn about missing dependencies" ought to be enough.  In the
> > future, we might want to make it so that packages can specify which
> > dependencies they absolutely require and which they don't (or if
> > possible infer that from dependencies).  WDYT?
> 
> The way I see it is that we are basically copying the
> “--disable-X”/“--without-Y” features of a GNU configure script.  With
> the GNU build system, if one of our packages specifies “--without-
> zlib”
> for whatever reason, and you as a user want to modify the package to
> use zlib, you would have to
> 
>   1. remove the “--without-zlib” configure flag; and
>   2. add the zlib package to the package’s inputs.
> 
> That’s a “duplicated effort”, right?
> 
> Similarly, for a Node package (with a pretend Node zlib package), you
> would have to
> 
>   1. remove “zlib” from absent dependencies; and
>   2. add the “node-zlib” package to the package’s inputs.
> 
> That seems okay to me, but I’m worried I’ve missed what you’re trying
> to communicate.
For the GNU build system (and likewise meson-build-system), the default
behaviour if you haven't specified anything as per upstream conventions
is typically to error if the package is required and omit it if it's
not.  The default behaviour of node-build-system (and likewise cargo
and most other build systems that come with the advertisement of "we
know package managers better than people who actually produce useful
package managers) is "Oh my god, you don't have an exact copy of the
machine that built this stuff locally, I am going to barf huge walls of
noise at you".  Therefore, we can't meaningfully compare those build
systems in terms of strategies.

On a slightly related note, I recently had the pleasure of working on a
patch for a package that fails python-build-systems new sanity-check
phase.  If we really want some static verification for node-build-
system, I think we should take that as an approach rather than hard-
coding (absent) dependencies literally everywhere.  Although in writing
that I must concede that Python is still too sane to be a Web standard.

I'm sorry I can't explain my reasoning in a nicer manner.  Your point
would be totally valid if node-build-system did act like the GNU build
system or meson in that dependency resolution is DWIM by default, but
sadly we can't have nice things with "modern" programming languages and
their build systems.

TL;DR: "--without-zlib" is usually implied in packages based on the GNU
build system unless zlib really is a hard requirement of the package. 
The same can't be said for node-anything.

Cheers 




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 07/45] guix: node-build-system: Add #:absent-dependencies argument.
  2021-12-17 19:40                                         ` Liliana Marie Prikler
@ 2021-12-18  2:48                                           ` Timothy Sample
  2021-12-18  8:30                                             ` Liliana Marie Prikler
  0 siblings, 1 reply; 458+ messages in thread
From: Timothy Sample @ 2021-12-18  2:48 UTC (permalink / raw)
  To: Liliana Marie Prikler; +Cc: 51838, Pierre Langlois, Jelle Licht, Philip McGrath

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

> For the GNU build system (and likewise meson-build-system), the default
> behaviour if you haven't specified anything as per upstream conventions
> is typically to error if the package is required and omit it if it's
> not.  The default behaviour of node-build-system (and likewise cargo
> and most other build systems that come with the advertisement of "we
> know package managers better than people who actually produce useful
> package managers) is "Oh my god, you don't have an exact copy of the
> machine that built this stuff locally, I am going to barf huge walls of
> noise at you".  Therefore, we can't meaningfully compare those build
> systems in terms of strategies.

NPM packages tend to wildly over-specify their dependencies.  We already
remove dependency version checking, and before this change, many of our
packages skipped any kind of dependency checking by skipping the
configure phase altogether.  To me, the ‘#:absent-dependencies’ approach
tries to work around the dependency over-specification by listing
exactly those things that are only there to elicit a useless “Oh my god
[...], I’m going to barf huge walls of noise” message.  The rest of the
dependencies are those that the Guix package author deemed required (or
at least important).  Basically, ‘#:absent-dependencies’ helps us
translate between the NPM culture of over-specification (which is really
a culture of prioritizing package author over package user) and the GNU
culture of “DWIM” dependencies.

> If we really want some static verification for node-build-system, I
> think we should take that as an approach rather than hard-coding
> (absent) dependencies literally everywhere.

We need some way to know what to statically verify.  We can’t magically
know what’s important and what isn’t.  The two options in this thread
are ‘#:absent-dependencies’, and only checking what’s already in the
package’s inputs.  What worries me about the second approach is that it
offers no help when updating a package.  With ‘#:absent-dependencies’,
if the developer adds a new dependency that really is required, we will
get a build-time failure letting us know.  Whoever is updating the
package can fix it before even committing anything.  If we just check
the inputs, that’s not the case, and we might end up with Philip’s
“mysterious runtime error, potentially many steps down a dependency
chain.”  Hopefully tests would catch it, but I like the extra assurance.

Another benefit is that it would help us gain knowledge as to which NPM
packages are often used but not actually required (e.g., NPM publishing
tools).  With this knowledge, we could write a clever NPM importer that
ignored obviously inessential dependencies.

I guess I’m starting to sound like a broken record now – this is
basically what we covered before!  :)  Maybe we’re in need of a fresh
perspective.  (If anyone is reading along and has thoughts, feel free to
chime in!)


-- Tim




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 07/45] guix: node-build-system: Add #:absent-dependencies argument.
  2021-12-18  2:48                                           ` Timothy Sample
@ 2021-12-18  8:30                                             ` Liliana Marie Prikler
  2021-12-18 18:31                                               ` Philip McGrath
  0 siblings, 1 reply; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-18  8:30 UTC (permalink / raw)
  To: Timothy Sample; +Cc: 51838, Pierre Langlois, Jelle Licht, Philip McGrath

Hi,

Am Freitag, dem 17.12.2021 um 21:48 -0500 schrieb Timothy Sample:
> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
> 
> > For the GNU build system (and likewise meson-build-system), the
> > default behaviour if you haven't specified anything as per upstream
> > conventions is typically to error if the package is required and
> > omit it if it's not.  The default behaviour of node-build-system
> > (and likewise cargo and most other build systems that come with the
> > advertisement of "we know package managers better than people who
> > actually produce usefulpackage managers) is "Oh my god, you don't
> > have an exact copy of the machine that built this stuff locally, I
> > am going to barf huge walls of noise at you".  Therefore, we can't
> > meaningfully compare those build systems in terms of strategies.
> 
> NPM packages tend to wildly over-specify their dependencies.  We
> already remove dependency version checking, and before this change,
> many of our packages skipped any kind of dependency checking by
> skipping the configure phase altogether.  To me, the ‘#:absent-
> dependencies’ approach tries to work around the dependency over-
> specification by listing exactly those things that are only there to
> elicit a useless “Oh my god [...], I’m going to barf huge walls of
> noise” message.  The rest of the dependencies are those that the Guix
> package author deemed required (or at least important).  Basically,
> ‘#:absent-dependencies’ helps us translate between the NPM culture of
> over-specification (which is really a culture of prioritizing package
> author over package user) and the GNU culture of “DWIM” dependencies.
Except that it's not.  The current workaround is "I know this thing's
going to barf at me, so I prepare an umbrella and hope it has no
holes".

> > If we really want some static verification for node-build-system, I
> > think we should take that as an approach rather than hard-coding
> > (absent) dependencies literally everywhere.
> 
> We need some way to know what to statically verify.  We can’t
> magically know what’s important and what isn’t.  The two options in
> this thread are ‘#:absent-dependencies’, and only checking what’s
> already in the package’s inputs.  What worries me about the second
> approach is that it offers no help when updating a package.  With
> ‘#:absent-dependencies’, if the developer adds a new dependency that
> really is required, we will get a build-time failure letting us
> know.  Whoever is updating the package can fix it before even
> committing anything.  If we just check the inputs, that’s not the
> case, and we might end up with Philip’s “mysterious runtime error,
> potentially many steps down a dependency chain.”  Hopefully tests
> would catch it, but I like the extra assurance.
That's why I didn't want to default to "do nothing", but to *warn*
about missing dependencies in configure.  Then whoever bumps the
package will at least know which warnings are produced if they do so
and they can cross-check by manually building past versions.  Including
#:absent-dependencies is no safe-guard against a failure here anyway. 
A dependency that was optional in V1 might become required in V2. 

> Another benefit is that it would help us gain knowledge as to which
> NPM packages are often used but not actually required (e.g., NPM
> publishing tools).  With this knowledge, we could write a clever NPM
> importer that ignored obviously inessential dependencies.
> 
> I guess I’m starting to sound like a broken record now – this is
> basically what we covered before!  :)  Maybe we’re in need of a fresh
> perspective.  (If anyone is reading along and has thoughts, feel free
> to chime in!)
I think the NPM convention is to put everything you need "at build
time, but not at runtime" into dev-dependencies, no?  In any case, one
approach I could offer is to sanity-check by searching for require()
statements and trying them in a controlled node environment.  This
could look something like

eval("try { var dep = require('" + dependency + "'); true }
catch (e) { false; }")

Once we know where require statements are made and whether they
succeed, we can start estimating the impact of a missing dependency. 
For this, it'd be nice to have a full function call graph, in which a
node is coloured dirty if it has a failing require statement, lies
within a module that has one or calls into a dirty node.  However, as a
primitive approximation we can also count the node modules with failing
requires against those that don't.  We set an arbitrary threshold of
allowed failures, e.g. 0.42, and then check that whatever value we
obtain from the above is lower than that.

While that would be nice and all, I think the overall issue with the
current node implementation in Guix is that 'configure' and 'sanity-
check' are the same phase, so you have to disable both or none.  I
think we could easily do with a configure phase that does nothing, not
even warn about a missing dependency, and a sanity-check phase that
requires every dependency mentioned in package.json to be met. 
Packagers would then outright delete sanity-check as they do for python
and as they did for configure (but not have configure fail due to it!)
or deliberately rewrite the package.json for the sanity check and
dropping absent dependencies, i.e. what you do minus the keyword.  If
later needed for the purposes of an importer, we would then still have
that database and could at some point introduce the key #:insane-
requirements.  WDYT? 




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 20/45] guix: node-build-system: Add implicit libuv input.
  2021-12-17  5:08                                     ` Liliana Marie Prikler
@ 2021-12-18 16:16                                       ` Philip McGrath
  2021-12-18 17:01                                         ` Liliana Marie Prikler
  2021-12-18 17:07                                       ` Philip McGrath
  1 sibling, 1 reply; 458+ messages in thread
From: Philip McGrath @ 2021-12-18 16:16 UTC (permalink / raw)
  To: Liliana Marie Prikler, 51838; +Cc: Timothy Sample, Pierre Langlois, Jelle Licht

Hi,

On 12/17/21 00:08, Liliana Marie Prikler wrote:
> Am Donnerstag, dem 16.12.2021 um 21:03 -0500 schrieb Philip McGrath:
>> * guix/build-system/node.scm (lower): Add the version of libuv
>> used as an input to the #:node package as an additional implicit
>> input, so that packages needing libuv always get the correct version.
>> ---
>>   guix/build-system/node.scm | 9 ++++++++-
>>   1 file changed, 8 insertions(+), 1 deletion(-)
>>
> Do this and #21 have to be separated so far from the rest?  If not, I'd
> do build system first, then new packages.  Otherwise fair enough.

I tried to follow Tim's suggestion in 
<https://issues.guix.gnu.org/51838#59> to put the changes related to 
#:absent-dependencies before the changes to support native addons, so 
that the earlier changes could potentially be applied even if there was 
more discussion needed for the later ones (if #:absent-dependencies were 
less controversial.

But note that the patches before this one aren't adding new packages; 
they are changing existing packages to use #:absent-dependencies rather 
than deleting the configure phase. So the series is ordered overall as:

  1. Changes to the `node` package itself
  2. Build system changes for #:absent-dependencies
     (including the delete-lockfiles phase, because un-deleting the
     configure phase exposes those problems)
  3. Packages changes to use #:absent-dependencies
  4. Build system changes to support native addons
  5. New packages to exercise the support for native addons

-Philip




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 20/45] guix: node-build-system: Add implicit libuv input.
  2021-12-18 16:16                                       ` Philip McGrath
@ 2021-12-18 17:01                                         ` Liliana Marie Prikler
  2021-12-19 20:34                                           ` Jelle Licht
  0 siblings, 1 reply; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-18 17:01 UTC (permalink / raw)
  To: Philip McGrath, 51838; +Cc: Timothy Sample, Pierre Langlois, Jelle Licht

Hi,

Am Samstag, dem 18.12.2021 um 11:16 -0500 schrieb Philip McGrath:
> > 
> > Do this and #21 have to be separated so far from the rest?  If not,
> > I'd do build system first, then new packages.  Otherwise fair
> > enough.
> 
> I tried to follow Tim's suggestion in 
> <https://issues.guix.gnu.org/51838#59> to put the changes related to 
> #:absent-dependencies before the changes to support native addons, so
> that the earlier changes could potentially be applied even if there
> was more discussion needed for the later ones (if #:absent-
> dependencies were less controversial.
Fair enough, that does make sense.  However, I do think that "add
package X" is not too big of a review burden, so I personally think the
fact we're deleting 'configure everywhere is holding back the change to
support native addons rather than the other way around.

> But note that the patches before this one aren't adding new packages;
> they are changing existing packages to use #:absent-dependencies
> rather than deleting the configure phase. So the series is ordered
> overall as:
> 
>   1. Changes to the `node` package itself
>   2. Build system changes for #:absent-dependencies
>      (including the delete-lockfiles phase, because un-deleting the
>      configure phase exposes those problems)
>   3. Packages changes to use #:absent-dependencies
>   4. Build system changes to support native addons
>   5. New packages to exercise the support for native addons
There is an unspoken bit here in #5 in that those packages still need
to get rid of unwanted dependencies, which makes this set still
unsplittable in a sense.

If everyone else here agrees, I think we could at least upstream the
changes to node itself while we still discuss 2-5.  Timothy, Pierre,
Jelle, WDYT?




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 06/45] guix: node-build-system: Refactor patch-dependencies phase.
  2021-12-17  4:29                                     ` Liliana Marie Prikler
@ 2021-12-18 17:03                                       ` Philip McGrath
  2021-12-18 17:52                                         ` Liliana Marie Prikler
  0 siblings, 1 reply; 458+ messages in thread
From: Philip McGrath @ 2021-12-18 17:03 UTC (permalink / raw)
  To: Liliana Marie Prikler, 51838; +Cc: Timothy Sample, Pierre Langlois, Jelle Licht

Hi,

On 12/16/21 23:29, Liliana Marie Prikler wrote:
> Hi,
> 
> Am Donnerstag, dem 16.12.2021 um 21:02 -0500 schrieb Philip McGrath:
>> * guix/build/node-build-system.scm (patch-dependencies): Strictly
>> follow the linearity rules for `assoc-set!` and friends.
>> Clarify the types of the arguments to and return value from the
>> internal helper function `resolve-dependencies`.
>> [...]
>> -  (define (resolve-dependencies package-meta meta-key)
>> -    (fold (lambda (key+value acc)
>> -            (match key+value
>> -              ('@ acc)
>> -              ((key . value) (acons key (hash-ref index key value)
>> acc))))
>> -          '()
>> -          (or (assoc-ref package-meta meta-key) '())))
>> +  (define (resolve-dependencies meta-alist meta-key)
>> +    ;; Given:
>> +    ;;  - The alist from "package.json", with the '@ unwrapped
>> +    ;;  - A string key, like "dependencies"
>> +    ;; Returns: an alist (without a wrapping '@) like the entry in
>> +    ;; meta-alist for meta-key, but with dependencies supplied
>> +    ;; by Guix packages mapped to the absolute store paths to use.
>> +    (match (assoc-ref meta-alist meta-key)
>> +      (#f
>> +       '())
>> +      (('@ . orig-deps)
>> +       (fold (match-lambda*
>> +               (((key . value) acc)
>> +                (acons key (hash-ref index key value) acc)))
>> +             '()
>> +             orig-deps))))
>>   
>>     (with-atomic-file-replacement "package.json"
>>       (lambda (in out)
>> -      (let ((package-meta (read-json in)))
>> -        (assoc-set! package-meta "dependencies"
>> -                    (append
>> -                     '(@)
>> -                     (resolve-dependencies package-meta
>> "dependencies")
>> -                     (resolve-dependencies package-meta
>> "peerDependencies")))
>> -        (assoc-set! package-meta "devDependencies"
>> -                    (append
>> -                     '(@)
>> -                     (resolve-dependencies package-meta
>> "devDependencies")))
>> +      ;; It is unsafe to rely on 'assoc-set!' to update an
>> +      ;; existing assosciation list variable:
>> +      ;; see 'info "(guile)Adding or Setting Alist Entries"'.
>> +      (let* ((package-meta (read-json in))
>> +             (alist (match package-meta
>> +                      ((@ . alist) alist)))
>> +             (alist
>> +              (assoc-set!
>> +               alist "dependencies"
>> +               (append
>> +                '(@)
>> +                (resolve-dependencies alist "dependencies")
>> +                (resolve-dependencies alist "peerDependencies"))))
>> +             (alist
>> +              (assoc-set!
>> +               alist "devDependencies"
>> +               (append
>> +                '(@)
>> +                (resolve-dependencies alist "devDependencies"))))
>> +             (package-meta (cons '@ alist)))
>>           (write-json package-meta out))))
>>     #t)
> The Guix codebase is generally not the place to play around with
> destructive semantics.  If you can avoid assoc-set!, I think you ought
> to, especially if it helps making a two-step process into a single-step
> one.  Anything I'm missing here?

I agree that assoc-set! is best avoided. (I am a Racketeer: we don't 
mutate pairs.) However, this code was already using assoc-set!: the 
change in this patch is merely to use it correctly.

AFAIK neither `info "(guile)Association Lists"` nor SRFI-1 (`info 
"(guile)SRFI-1 Association Lists"`) provide a non-destructive assoc-set 
operation. Note in particular that acons and alist-cons do not work, 
since they don't remove existing entries for the same key: they would 
result in duplicate keys being written to the JSON object. (In theory, 
this has undefined semantics; in practice, I believe Node.js would use 
the wrong entry.)

Of course, I know how to write a little library of purely functional 
association list operations---but that seems vastly out of scope for 
this patch series (which has already grown quite large). Furthermore, if 
we were going to make such changes, I think it might be better to change 
the representation of JSON objects to use a real immutable dictionary 
type, probably VHash (though it looks like those would still need 
missing functions, at which point a wrapper type that validated keys and 
maintained a consistent hash-proc might be even better). Alternatively 
we could use guile-json, which at least avoids the need for improper 
alists to disambiguate objects from arrays, but we would have to address 
the issues in Guix commit a4bb18921099b2ec8c1699e08a73ca0fa78d0486.

All of that reinforces my sense that we should not try to change this here.

-Philip




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 20/45] guix: node-build-system: Add implicit libuv input.
  2021-12-17  5:08                                     ` Liliana Marie Prikler
  2021-12-18 16:16                                       ` Philip McGrath
@ 2021-12-18 17:07                                       ` Philip McGrath
  2021-12-19 20:41                                         ` Jelle Licht
  1 sibling, 1 reply; 458+ messages in thread
From: Philip McGrath @ 2021-12-18 17:07 UTC (permalink / raw)
  To: Liliana Marie Prikler, 51838; +Cc: Timothy Sample, Pierre Langlois, Jelle Licht

Hi again,

On 12/17/21 00:08, Liliana Marie Prikler wrote:
> Am Donnerstag, dem 16.12.2021 um 21:03 -0500 schrieb Philip McGrath:
>> * guix/build-system/node.scm (lower): Add the version of libuv
>> used as an input to the #:node package as an additional implicit
>> input, so that packages needing libuv always get the correct version.
>> ---
>>   guix/build-system/node.scm | 9 ++++++++-
>>   1 file changed, 8 insertions(+), 1 deletion(-)
>>

Tangentially, for the record, I'd considered as an alternative approach 
making libuv a propagated input of node. That might be worth considering 
one day, when we unbundle npm, but for now I think libuv is only needed 
in a small minority of cases.

-Philip




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 06/45] guix: node-build-system: Refactor patch-dependencies phase.
  2021-12-18 17:03                                       ` Philip McGrath
@ 2021-12-18 17:52                                         ` Liliana Marie Prikler
  2021-12-18 18:59                                           ` Timothy Sample
  2021-12-20 18:03                                           ` Philip McGrath
  0 siblings, 2 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-18 17:52 UTC (permalink / raw)
  To: Philip McGrath, 51838; +Cc: Timothy Sample, Pierre Langlois, Jelle Licht

Hi,

Am Samstag, dem 18.12.2021 um 12:03 -0500 schrieb Philip McGrath:
> [...]
> 
> > The Guix codebase is generally not the place to play around with
> > destructive semantics.  If you can avoid assoc-set!, I think you
> > ought to, especially if it helps making a two-step process into a
> > single-step one.  Anything I'm missing here?
> 
> I agree that assoc-set! is best avoided. (I am a Racketeer: we don't 
> mutate pairs.) However, this code was already using assoc-set!: the 
> change in this patch is merely to use it correctly.
> 
> AFAIK neither `info "(guile)Association Lists"` nor SRFI-1 (`info 
> "(guile)SRFI-1 Association Lists"`) provide a non-destructive assoc-
> set operation. Note in particular that acons and alist-cons do not
> work, since they don't remove existing entries for the same key: they
> would result in duplicate keys being written to the JSON object. (In
> theory this has undefined semantics; in practice, I believe Node.js
> would use the wrong entry.)
> 
> Of course, I know how to write a little library of purely functional 
> association list operations---but that seems vastly out of scope for 
> this patch series (which has already grown quite large). Furthermore,
> if we were going to make such changes, I think it might be better to
> change the representation of JSON objects to use a real immutable
> dictionary type, probably VHash (though it looks like those would
> still need missing functions, at which point a wrapper type that
> validated keys and maintained a consistent hash-proc might be even
> better). Alternatively we could use guile-json, which at least avoids
> the need for improper alists to disambiguate objects from arrays, but
> we would have to address the issues in Guix commit
> a4bb18921099b2ec8c1699e08a73ca0fa78d0486.
> 
> All of that reinforces my sense that we should not try to change this
> here.
I think you misread me here.  One thing that's bugging me is that you
(just like whoever wrote this before) strip the @ only to reintroduce
it.  I think it'd be better if (resolve-dependencies) simply took a
list and the let-block deconstructed the json.

As for the package-meta -> package-meta conversion, imo that could
perfectly be done with match or SXML transformation.  WDYT?




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 07/45] guix: node-build-system: Add #:absent-dependencies argument.
  2021-12-18  8:30                                             ` Liliana Marie Prikler
@ 2021-12-18 18:31                                               ` Philip McGrath
  2021-12-18 20:49                                                 ` Liliana Marie Prikler
  0 siblings, 1 reply; 458+ messages in thread
From: Philip McGrath @ 2021-12-18 18:31 UTC (permalink / raw)
  To: Liliana Marie Prikler, Timothy Sample; +Cc: 51838, Pierre Langlois, Jelle Licht

Hi,

On 12/18/21 03:30, Liliana Marie Prikler wrote:
> Hi,
> 
> Am Freitag, dem 17.12.2021 um 21:48 -0500 schrieb Timothy Sample:
>> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
>>
>>> For the GNU build system (and likewise meson-build-system), the
>>> default behaviour if you haven't specified anything as per upstream
>>> conventions is typically to error if the package is required and
>>> omit it if it's not.  The default behaviour of node-build-system
>>> (and likewise cargo and most other build systems that come with the
>>> advertisement of "we know package managers better than people who
>>> actually produce usefulpackage managers) is "Oh my god, you don't
>>> have an exact copy of the machine that built this stuff locally, I
>>> am going to barf huge walls of noise at you".  Therefore, we can't
>>> meaningfully compare those build systems in terms of strategies.
>>
>> NPM packages tend to wildly over-specify their dependencies.  We
>> already remove dependency version checking, and before this change,
>> many of our packages skipped any kind of dependency checking by
>> skipping the configure phase altogether.  To me, the ‘#:absent-
>> dependencies’ approach tries to work around the dependency over-
>> specification by listing exactly those things that are only there to
>> elicit a useless “Oh my god [...], I’m going to barf huge walls of
>> noise” message.  The rest of the dependencies are those that the Guix
>> package author deemed required (or at least important).  Basically,
>> ‘#:absent-dependencies’ helps us translate between the NPM culture of
>> over-specification (which is really a culture of prioritizing package
>> author over package user) and the GNU culture of “DWIM” dependencies.
> Except that it's not.  The current workaround is "I know this thing's
> going to barf at me, so I prepare an umbrella and hope it has no
> holes".
> 
>>> If we really want some static verification for node-build-system, I
>>> think we should take that as an approach rather than hard-coding
>>> (absent) dependencies literally everywhere.
>>
>> We need some way to know what to statically verify.  We can’t
>> magically know what’s important and what isn’t.  The two options in
>> this thread are ‘#:absent-dependencies’, and only checking what’s
>> already in the package’s inputs.  What worries me about the second
>> approach is that it offers no help when updating a package.  With
>> ‘#:absent-dependencies’, if the developer adds a new dependency that
>> really is required, we will get a build-time failure letting us
>> know.  Whoever is updating the package can fix it before even
>> committing anything.  If we just check the inputs, that’s not the
>> case, and we might end up with Philip’s “mysterious runtime error,
>> potentially many steps down a dependency chain.”  Hopefully tests
>> would catch it, but I like the extra assurance.
> That's why I didn't want to default to "do nothing", but to *warn*
> about missing dependencies in configure.  Then whoever bumps the
> package will at least know which warnings are produced if they do so
> and they can cross-check by manually building past versions.  Including
> #:absent-dependencies is no safe-guard against a failure here anyway.
> A dependency that was optional in V1 might become required in V2.

I also feel like I'm missing something, though maybe I just disagree.

To try to be concrete, here's a real example. Between v3 and v4 of this 
patch series, I discovered that leaving out node-debug could actually 
cause runtime problems for some of the node-serialport packages. (It 
turns out it's really a logging library, which wasn't what I'd thought 
at first.) After I added the node-debug, I could easily search 
node-xyz.scm for the packages that listed it among their 
#:absent-dependencies and add it to them as an input.

It seems like this would be much less convenient if node-build-system 
were to silently delete such dependencies and simply print a warning. I 
guess I would have to search through the build logs for all Node.js 
packages, right?

More generally, I think truly "optional dependencies" (in the Node.js 
sense, to the extent I understand it) and dependencies we actively don't 
want (e.g. because node-sqlite3 shouldn't transitively depend on 
node-aws-sdk) are relatively rare cases.

The most common cases seem to be dependencies we really would like to 
have, such as test frameworks or Typescript, but haven't packaged yet, 
and thus need to work around. Many packages that have 
#:absent-dependencies for such reasons also need to use `#:tests? #f` or 
to replace the build phase with some kind of manual alternative.

I guess I don't understand what case the warn-and-drop approach is 
optimizing for. For both the case when dependencies aren't packaged for 
Guix yet and the case when Guix packagers have actively decided to skip 
some upstream dependencies, I think #:absent-dependencies is more 
useful. Having to look for that information in warnings in the build log 
seems much less ergonomic.

>> Another benefit is that it would help us gain knowledge as to which
>> NPM packages are often used but not actually required (e.g., NPM
>> publishing tools).  With this knowledge, we could write a clever NPM
>> importer that ignored obviously inessential dependencies.

I agree with this, too: likewise, we could see packages that are often 
wanted but aren't in Guix and prioritize adding them! Part of the 
benefit of #:absent-dependencies, IMO, is as a form of communication 
with humans.

>> I guess I’m starting to sound like a broken record now – this is
>> basically what we covered before!  :)  Maybe we’re in need of a fresh
>> perspective.  (If anyone is reading along and has thoughts, feel free
>> to chime in!)
> I think the NPM convention is to put everything you need "at build
> time, but not at runtime" into dev-dependencies, no?  In any case, one
> approach I could offer is to sanity-check by searching for require()
> statements and trying them in a controlled node environment.  This
> could look something like
> 
> eval("try { var dep = require('" + dependency + "'); true }
> catch (e) { false; }")
> 
> Once we know where require statements are made and whether they
> succeed, we can start estimating the impact of a missing dependency.
> For this, it'd be nice to have a full function call graph, in which a
> node is coloured dirty if it has a failing require statement, lies
> within a module that has one or calls into a dirty node.  However, as a
> primitive approximation we can also count the node modules with failing
> requires against those that don't.  We set an arbitrary threshold of
> allowed failures, e.g. 0.42, and then check that whatever value we
> obtain from the above is lower than that.

This could be interesting, and I think some of the JavaScript blunders 
we don't have packaged for Guix yet try to do something like this, but 
such analysis is not tractable in the general case, especially with 
CommonJS `require`, which is just a function and can be given arbitrary 
arguments computed at runtime. (And some packages really use it that way!)

Also, currently node-build-system doesn't seem to be removing those 
files which `npm pack` is supposed to exclude, which would probably be a 
prerequisite for addressing this.

> While that would be nice and all, I think the overall issue with the
> current node implementation in Guix is that 'configure' and 'sanity-
> check' are the same phase, so you have to disable both or none.  I
> think we could easily do with a configure phase that does nothing, not
> even warn about a missing dependency, and a sanity-check phase that
> requires every dependency mentioned in package.json to be met.
> Packagers would then outright delete sanity-check as they do for python
> and as they did for configure (but not have configure fail due to it!)
> or deliberately rewrite the package.json for the sanity check and
> dropping absent dependencies, i.e. what you do minus the keyword.  If
> later needed for the purposes of an importer, we would then still have
> that database and could at some point introduce the key #:insane-
> requirements.  WDYT?

I don't understand the benefit of this, and I'm also confused about the 
proposed implementation specifics. Why even have "a configure phase that 
does nothing"? What phase would run `npm install`? Presumably, we would 
have to delete all missing dependencies before that.

I think there is room for improvement in node-build-system. One thing 
I've been thinking about is some articles I've seen (but not fully 
thought through yet) from the developers of PNPM, an alternative package 
manager for Node.js, which seems to have some similarities to Guix in 
symlinking things to a "store".[1][2][3] (It could be especially 
interesting for bootstrapping npm! And the approach to "monorepos" also 
seems relevant.) I also think an importer is very important, even if 
it's an imperfect one: `guix import npm-binary` was indispensable in 
developing these patches. I have some ideas about improving it, in 
particular that we should assume the newer "^" semantics for 
dependencies everywhere (i.e. that major versions and only major 
versions have incompatible changes: a common case recently seems to be 
moving from CommonJS modules to ES6 modules).

As I understand it, node-build-system is undocumented, with no 
guarantees of compatibility. If #:absent-dependencies is at least an 
improvement over the status quo---which I think it is, since the new 
packages wouldn't build with the status quo---could we apply this and 
replace it later if someone implements a better strategy? I don't think 
I can implement control-flow analysis for JavaScript within the scope of 
this patch series.

-Philip

[1]: https://pnpm.io/blog/2020/05/27/flat-node-modules-is-not-the-only-way
[2]: https://pnpm.io/symlinked-node-modules-structure
[3]: https://pnpm.io/how-peers-are-resolved






^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 06/45] guix: node-build-system: Refactor patch-dependencies phase.
  2021-12-18 17:52                                         ` Liliana Marie Prikler
@ 2021-12-18 18:59                                           ` Timothy Sample
  2021-12-20 18:03                                           ` Philip McGrath
  1 sibling, 0 replies; 458+ messages in thread
From: Timothy Sample @ 2021-12-18 18:59 UTC (permalink / raw)
  To: Liliana Marie Prikler; +Cc: 51838, Pierre Langlois, Jelle Licht, Philip McGrath

Hi Liliana,

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

> Am Samstag, dem 18.12.2021 um 12:03 -0500 schrieb Philip McGrath:
>
>> All of that reinforces my sense that we should not try to change this
>> here.
>
> I think you misread me here.  One thing that's bugging me is that you
> (just like whoever wrote this before) strip the @ only to reintroduce
> it.  I think it'd be better if (resolve-dependencies) simply took a
> list and the let-block deconstructed the json.
>
> As for the package-meta -> package-meta conversion, imo that could
> perfectly be done with match or SXML transformation.  WDYT?

I think that, as a patch, this is a clear improvement over the existing
code.  Is it perfect yet?  Maybe not.  Further improvements can always
be made.  The NPM package set is small enough that build system changes
can be committed directly to master.  Each of the three of us has spent
more time writing about it than it would take to reimplement it!  :)

To me, it would be unwise to hold back this series because one of the
patches replaces ugly and broken mutations with merely ugly mutations.


-- Tim




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 07/45] guix: node-build-system: Add #:absent-dependencies argument.
  2021-12-18 18:31                                               ` Philip McGrath
@ 2021-12-18 20:49                                                 ` Liliana Marie Prikler
  2021-12-18 22:55                                                   ` Philip McGrath
  0 siblings, 1 reply; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-18 20:49 UTC (permalink / raw)
  To: Philip McGrath, Timothy Sample; +Cc: 51838, Pierre Langlois, Jelle Licht

Hi,

Am Samstag, dem 18.12.2021 um 13:31 -0500 schrieb Philip McGrath:
> I also feel like I'm missing something, though maybe I just disagree.
> 
> To try to be concrete, here's a real example. Between v3 and v4 of
> this patch series, I discovered that leaving out node-debug could
> actually cause runtime problems for some of the node-serialport
> packages. (It turns out it's really a logging library, which wasn't
> what I'd thought at first.) After I added the node-debug, I could
> easily search node-xyz.scm for the packages that listed it among
> their #:absent-dependencies and add it to them as an input.
Wouldn't we get a huge stack trace of doom with the failed require in
that case if it was truly non-negotiable, though?

> It seems like this would be much less convenient if node-build-system
> were to silently delete such dependencies and simply print a warning.
> I guess I would have to search through the build logs for all Node.js
> packages, right?
Since node packages do have the tendency to pull in the entire
internet, you might not be too far off with that statement, but again
if you have a particular issue in a single package due to an omitted
dependency, the offending package ought to be close to the most recent
call on the stack.

An alternative to searching through the build logs would also be to
build all the sources and grepping their package.jsons ;)

> More generally, I think truly "optional dependencies" (in the Node.js
> sense, to the extent I understand it) and dependencies we actively
> don't want (e.g. because node-sqlite3 shouldn't transitively depend
> on node-aws-sdk) are relatively rare cases.
> 
> The most common cases seem to be dependencies we really would like to
> have, such as test frameworks or Typescript, but haven't packaged
> yet, and thus need to work around. Many packages that have 
> #:absent-dependencies for such reasons also need to use `#:tests? #f`
> or to replace the build phase with some kind of manual alternative.
> 
> I guess I don't understand what case the warn-and-drop approach is 
> optimizing for. For both the case when dependencies aren't packaged
> for Guix yet and the case when Guix packagers have actively decided
> to skip some upstream dependencies, I think #:absent-dependencies is
> more useful. Having to look for that information in warnings in the
> build log seems much less ergonomic.
That's why my original suggestion was to have a switch between "strict"
meaning we fail as before and "warn" meaning "we know we have unmet
dependencies".  The "warn" case would be annotated similar to #:tests?
#f and the strict case default.  So you could still communicate
important missing packages like typescript et al., but people who hack
on their own channels with lower standards can wing it without having
to delete configure.

> > > Another benefit is that it would help us gain knowledge as to
> > > which NPM packages are often used but not actually required
> > > (e.g., NPM publishing tools).  With this knowledge, we could
> > > write a clever NPM importer that ignored obviously inessential
> > > dependencies.
> 
> I agree with this, too: likewise, we could see packages that are
> often wanted but aren't in Guix and prioritize adding them! Part of
> the benefit of #:absent-dependencies, IMO, is as a form of
> communication with humans.
We do have a wishlist...

> > > I guess I’m starting to sound like a broken record now – this is
> > > basically what we covered before!  :)  Maybe we’re in need of a
> > > fresh perspective.  (If anyone is reading along and has thoughts,
> > > feel free to chime in!)
> > I think the NPM convention is to put everything you need "at build
> > time, but not at runtime" into dev-dependencies, no?  In any case,
> > one approach I could offer is to sanity-check by searching for
> > require() statements and trying them in a controlled node
> > environment.  Thiscould look something like
> > 
> > eval("try { var dep = require('" + dependency + "'); true }
> > catch (e) { false; }")
> > 
> > Once we know where require statements are made and whether they
> > succeed, we can start estimating the impact of a missing
> > dependency.
> > For this, it'd be nice to have a full function call graph, in which
> > a node is coloured dirty if it has a failing require statement,
> > lies within a module that has one or calls into a dirty node. 
> > However, as a primitive approximation we can also count the node
> > modules with failing requires against those that don't.  We set an
> > arbitrary threshold of allowed failures, e.g. 0.42, and then check
> > that whatever value we obtain from the above is lower than that.
> 
> This could be interesting, and I think some of the JavaScript
> blunders we don't have packaged for Guix yet try to do something like
> this, but such analysis is not tractable in the general case,
> especially with CommonJS `require`, which is just a function and can
> be given arbitrary arguments computed at runtime. (And some packages
> really use it that way!)
Of course I forgot about computed goto...

> Also, currently node-build-system doesn't seem to be removing those 
> files which `npm pack` is supposed to exclude, which would probably
> be a  prerequisite for addressing this.
For the record, which files would that be?  Could we do emacs-build-
system style #:include and #:exclude lists?

> > While that would be nice and all, I think the overall issue with
> > the current node implementation in Guix is that 'configure' and
> > 'sanity-check' are the same phase, so you have to disable both or
> > none.  I think we could easily do with a configure phase that does
> > nothing, not even warn about a missing dependency, and a sanity-
> > check phase that requires every dependency mentioned in
> > package.json to be met. Packagers would then outright delete
> > sanity-check as they do for python and as they did for configure
> > (but not have configure fail due to it!)
> > or deliberately rewrite the package.json for the sanity check and
> > dropping absent dependencies, i.e. what you do minus the keyword. 
> > If later needed for the purposes of an importer, we would then
> > still have that database and could at some point introduce the key
> > #:insane-requirements.  WDYT?
> 
> I don't understand the benefit of this, and I'm also confused about
> the proposed implementation specifics. Why even have "a configure
> phase that does nothing"? What phase would run `npm install`?
> Presumably, we would have to delete all missing dependencies before
> that.
I meant "does nothing" in the sense of "does nothing with missing
dependencies", i.e. does not even warn.  It would of course still run
npm whatever.

On that note, I did typo there, so it would be patch-dependencies.  So
patch-dependencies would be implemented using and=> or and-let* to
decide whether to patch an entry or not.

Another implementation of the sanity check phase would be to read the
package json once more as we already do for patch-dependencies, but
this time only to check that we have an input that provides it.  The
benefit of doing that would the same as the strict/warn switch from
before, but without adding a new keyword at all.  The downside would be
that it still invites (delete 'sanity-check) without the comments we'd
tend to write around #:tests? #f.

> I think there is room for improvement in node-build-system. One thing
> I've been thinking about is some articles I've seen (but not fully 
> thought through yet) from the developers of PNPM, an alternative
> package manager for Node.js, which seems to have some similarities to
> Guix in symlinking things to a "store".[1][2][3] (It could be
> especially interesting for bootstrapping npm! And the approach to
> "monorepos" also seems relevant.) I also think an importer is very
> important, even if it's an imperfect one: `guix import npm-binary`
> was indispensable in developing these patches. I have some ideas
> about improving it, in particular that we should assume the newer "^"
> semantics for dependencies everywhere (i.e. that major versions and
> only major versions have incompatible changes: a common case recently
> seems to be moving from CommonJS modules to ES6 modules).
> 
> As I understand it, node-build-system is undocumented, with no 
> guarantees of compatibility. If #:absent-dependencies is at least an 
> improvement over the status quo---which I think it is, since the new 
> packages wouldn't build with the status quo---could we apply this and
> replace it later if someone implements a better strategy? I don't
> think I can implement control-flow analysis for JavaScript within the
> scope of this patch series.
It's sadly not that easy.  See XKCD 1172.

Given the reality of XKCD 1172, I do think that implementing a sanity-
check phase that checks for existence of all packages is the sanest
option here, together with safeguarding against missing dependencies in
patch-dependencies.  Does that sound reasonable to everyone else here?

Cheers





^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 07/45] guix: node-build-system: Add #:absent-dependencies argument.
  2021-12-18 20:49                                                 ` Liliana Marie Prikler
@ 2021-12-18 22:55                                                   ` Philip McGrath
  2021-12-19  1:02                                                     ` Liliana Marie Prikler
  0 siblings, 1 reply; 458+ messages in thread
From: Philip McGrath @ 2021-12-18 22:55 UTC (permalink / raw)
  To: Liliana Marie Prikler, Timothy Sample; +Cc: 51838, Pierre Langlois, Jelle Licht

Hi,

On 12/18/21 15:49, Liliana Marie Prikler wrote:
> Hi,
> 
> Am Samstag, dem 18.12.2021 um 13:31 -0500 schrieb Philip McGrath:
>> I also feel like I'm missing something, though maybe I just disagree.
>>
>> To try to be concrete, here's a real example. Between v3 and v4 of
>> this patch series, I discovered that leaving out node-debug could
>> actually cause runtime problems for some of the node-serialport
>> packages. (It turns out it's really a logging library, which wasn't
>> what I'd thought at first.) After I added the node-debug, I could
>> easily search node-xyz.scm for the packages that listed it among
>> their #:absent-dependencies and add it to them as an input.
> Wouldn't we get a huge stack trace of doom with the failed require in
> that case if it was truly non-negotiable, though?
> 
>> It seems like this would be much less convenient if node-build-system
>> were to silently delete such dependencies and simply print a warning.
>> I guess I would have to search through the build logs for all Node.js
>> packages, right?
> Since node packages do have the tendency to pull in the entire
> internet, you might not be too far off with that statement, but again
> if you have a particular issue in a single package due to an omitted
> dependency, the offending package ought to be close to the most recent
> call on the stack.

I think this is part of where our expectations are diverging, because I 
think the failure mode for CommonJS require (ES6 import may be at least 
somewhat better) is much less clean than this seems to suggest.

Returning to my concrete example, my motivation for this has been trying 
to set up a Guix System service to run the Webthings Gateway (formerly 
Mozilla IoT).[1] (Currently I have it on a branch of my Guix fork at 
[2]; since there are many yacks left to shave before it could be 
upstreamed, I plan to turn it into a channel once it can build against 
Guix master, i.e. once this patch series is applied.) I discovered the 
problem with the missing node-debug only when webthings-service caused 
webthings-gateway to load webthings-addon-zwave-adapter at runtime. 
(Those are both node-build-system packages, but there are also 
webthings-addon-* packages in Python and Rust, and in principle any 
language could be used.) The webthings-addon-zwave-adapter has 
node-serialport as a package.json dependency. As I remember it, even 
then, the lack of node-debug only caused a runtime error on a certain 
code path, perhaps triggered by the presence or absence of Z-Wave 
adapter hardware: I had used all of the packages without problems before 
hitting the issue. There was a stack trace, and it did help somewhat, 
but it was immensely helpful to be able to find in node-xyz.scm all of 
the packages that wanted, but did not have, node-debug. I imagine it 
would be even more useful in a more tangled dependency graph.

In particular, we don't have any JavaScript test frameworks packaged for 
Guix yet, so most of the time we aren't actually running the code in our 
Node.js packages, just putting the right files in the right places. So 
the runtime error may not come until some application/tool has been 
created, potentially very far along the dependency graph, and may not be 
revealed by tests (that we can actually run) at all.

I think we should optimize for the kind of high-quality packages we 
aspire to have in mainline Guix, where eventually we hope to have all 
sufficiently useful libre Node.js packages available. In that case, 
#:absent-dependencies makes it explicit when Guix packagers are 
overriding an upstream decision. While we work to achieve that reality, 
I think #:absent-dependencies is a much better place for a to-do list 
than having to search build logs or source "package.json"s. However ...

> 
> An alternative to searching through the build logs would also be to
> build all the sources and grepping their package.jsons ;)
> 
>> More generally, I think truly "optional dependencies" (in the Node.js
>> sense, to the extent I understand it) and dependencies we actively
>> don't want (e.g. because node-sqlite3 shouldn't transitively depend
>> on node-aws-sdk) are relatively rare cases.
>>
>> The most common cases seem to be dependencies we really would like to
>> have, such as test frameworks or Typescript, but haven't packaged
>> yet, and thus need to work around. Many packages that have
>> #:absent-dependencies for such reasons also need to use `#:tests? #f`
>> or to replace the build phase with some kind of manual alternative.
>>
>> I guess I don't understand what case the warn-and-drop approach is
>> optimizing for. For both the case when dependencies aren't packaged
>> for Guix yet and the case when Guix packagers have actively decided
>> to skip some upstream dependencies, I think #:absent-dependencies is
>> more useful. Having to look for that information in warnings in the
>> build log seems much less ergonomic.
> That's why my original suggestion was to have a switch between "strict"
> meaning we fail as before and "warn" meaning "we know we have unmet
> dependencies".  The "warn" case would be annotated similar to #:tests?
> #f and the strict case default.  So you could still communicate
> important missing packages like typescript et al., but people who hack
> on their own channels with lower standards can wing it without having
> to delete configure.

I can see the use of a "warn" mode for hacking things together quickly 
without having to totally delete configure. I think this could coexist 
with #:absent-dependencies and could be done in a follow-on to this 
patch series.

Right now, the #:absent-dependencies argument must be a list of strings. 
To support a "warn" mode, we could loosen that contract a bit: we can 
bikeshed about details, but let's say that we're in "warn" mode if the 
list contains the symbol 'infer. We change this code:

---

diff --git a/guix/build/node-build-system.scm 
b/guix/build/node-build-system.scm
index b74e593838..892104b6d2 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -69,7 +69,8 @@ (define (list-modules directory)
                input-paths)
      index))

-(define* (patch-dependencies #:key inputs #:allow-other-keys)
+(define* (patch-dependencies #:key inputs absent-dependencies
+                             #:allow-other-keys)

    (define index (index-modules (map cdr inputs)))

@@ -86,7 +87,9 @@ (define (resolve-dependencies meta-alist meta-key)
        (('@ . orig-deps)
         (fold (match-lambda*
                 (((key . value) acc)
-                (acons key (hash-ref index key value) acc)))
+                (if (member key absent-dependencies)
+                    acc
+                    (acons key (hash-ref index key value) acc))))
               '()
               orig-deps))))

-- 
2.32.0


to do something like this:

--8<---------------cut here---------------start------------->8---
(if (or (member key absent-dependencies)
         (and (memq 'infer absent-dependencies)
              (not (hash-ref index key #f))))
     acc
     (acons key (hash-ref index key value) acc))
--8<---------------cut here---------------end--------------->8---


Would that meet your objective?

>> Also, currently node-build-system doesn't seem to be removing those
>> files which `npm pack` is supposed to exclude, which would probably
>> be a  prerequisite for addressing this.
> For the record, which files would that be?  Could we do emacs-build-
> system style #:include and #:exclude lists?

It at least includes files listed in ".npmignore", but I think there are 
entries in "package.json" that control the behavior, too. We should 
adjust our repack phase to ignore those files---but I, at least, would 
need to look into it further to know exactly what the correct behavior is.


>> I think there is room for improvement in node-build-system. One thing
>> I've been thinking about is some articles I've seen (but not fully
>> thought through yet) from the developers of PNPM, an alternative
>> package manager for Node.js, which seems to have some similarities to
>> Guix in symlinking things to a "store".[1][2][3] (It could be
>> especially interesting for bootstrapping npm! And the approach to
>> "monorepos" also seems relevant.) I also think an importer is very
>> important, even if it's an imperfect one: `guix import npm-binary`
>> was indispensable in developing these patches. I have some ideas
>> about improving it, in particular that we should assume the newer "^"
>> semantics for dependencies everywhere (i.e. that major versions and
>> only major versions have incompatible changes: a common case recently
>> seems to be moving from CommonJS modules to ES6 modules).
>>
>> As I understand it, node-build-system is undocumented, with no
>> guarantees of compatibility. If #:absent-dependencies is at least an
>> improvement over the status quo---which I think it is, since the new
>> packages wouldn't build with the status quo---could we apply this and
>> replace it later if someone implements a better strategy? I don't
>> think I can implement control-flow analysis for JavaScript within the
>> scope of this patch series.
> It's sadly not that easy.  See XKCD 1172.

Certainly that's true in general, but I thought this warning from [3] 
would apply here:

     When you maintain package definitions outside Guix, we, Guix
     developers, consider that *the compatibility burden is on you.*
     Remember that package modules and package definitions are just
     Scheme code that uses various programming interfaces (APIs). We
     want to remain free to change these APIs to keep improving Guix,
     possibly in ways that break your channel. We never change APIs
     gratuitously, but we will *not* commit to freezing APIs either.

-Philip

[1]: https://webthings.io/
[2]: https://gitlab.com/philip1/guix-patches/-/tree/wip-webthings
[3]: https://guix.gnu.org/manual/devel/en/html_node/Creating-a-Channel.html




^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 07/45] guix: node-build-system: Add #:absent-dependencies argument.
  2021-12-18 22:55                                                   ` Philip McGrath
@ 2021-12-19  1:02                                                     ` Liliana Marie Prikler
  2021-12-20 19:33                                                       ` Philip McGrath
  0 siblings, 1 reply; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-19  1:02 UTC (permalink / raw)
  To: Philip McGrath, Timothy Sample; +Cc: 51838, Pierre Langlois, Jelle Licht

Am Samstag, dem 18.12.2021 um 17:55 -0500 schrieb Philip McGrath:
> [T]he failure mode for CommonJS require (ES6 import may be at least 
> somewhat better) is much less clean than this seems to suggest.
I think the less I know about JavaScript, the better I'll sleep at
night.

> Returning to my concrete example, my motivation for this has been
> trying to set up a Guix System service to run the Webthings Gateway
> (formerly Mozilla IoT).[1] (Currently I have it on a branch of my Guix
> fork at [2]; since there are many yacks left to shave before it could
> be upstreamed, I plan to turn it into a channel once it can build
> against Guix master, i.e. once this patch series is applied.) I
> discovered the problem with the missing node-debug only when webthings-
> service caused webthings-gateway to load webthings-addon-zwave-adapter
> at runtime. 
> (Those are both node-build-system packages, but there are also 
> webthings-addon-* packages in Python and Rust, and in principle any 
> language could be used.) The webthings-addon-zwave-adapter has 
> node-serialport as a package.json dependency. As I remember it, even 
> then, the lack of node-debug only caused a runtime error on a certain
> code path, perhaps triggered by the presence or absence of Z-Wave 
> adapter hardware: I had used all of the packages without problems
> before hitting the issue. There was a stack trace, and it did help
> somewhat, but it was immensely helpful to be able to find in node-
> xyz.scm all of the packages that wanted, but did not have, node-debug.
> I imagine it would be even more useful in a more tangled dependency
> graph.
That might be beneficial in your particular use case here, but you also
have to think about the maintenance burden your mechanism introduces. 
What if another leftpad happens and we have to speedrun our core-
updates cycle to add #:absent-dependencies everywhere?

> In particular, we don't have any JavaScript test frameworks packaged
> for Guix yet, so most of the time we aren't actually running the code
> in our Node.js packages, just putting the right files in the right
> places. So the runtime error may not come until some application/tool
> has been created, potentially very far along the dependency graph, and
> may not be revealed by tests (that we can actually run) at all.
The fix to not having test frameworks is adding them, not 

> I think we should optimize for the kind of high-quality packages we 
> aspire to have in mainline Guix, where eventually we hope to have all
> sufficiently useful libre Node.js packages available. In that case, 
> #:absent-dependencies makes it explicit when Guix packagers are 
> overriding an upstream decision. While we work to achieve that reality,
> I think #:absent-dependencies is a much better place for a to-do list
> than having to search build logs or source "package.json"s. However...
Compare this to tests.  We have a keyword to disable all tests, which
defaults to #f and we have other idioms for disabling particular tests.
Your use case is no different.  If at all, we should only have a
keyword to disable the check completely and other idioms to e.g. patch
the package.json file so that sanity-check/patch-dependencies/what-
have-you doesn't error when it relies on its contents.

> I can see the use of a "warn" mode for hacking things together quickly
> without having to totally delete configure. I think this could coexist
> with #:absent-dependencies and could be done in a follow-on to this
> patch series.
> 
> Right now, the #:absent-dependencies argument must be a list of
> strings. To support a "warn" mode, we could loosen that contract a bit:
> we can bikeshed about details, but let's say that we're in "warn" mode
> if the list contains the symbol 'infer. We change this code:
> 
> ---
> 
> diff --git a/guix/build/node-build-system.scm 
> b/guix/build/node-build-system.scm
> index b74e593838..892104b6d2 100644
> --- a/guix/build/node-build-system.scm
> +++ b/guix/build/node-build-system.scm
> @@ -69,7 +69,8 @@ (define (list-modules directory)
>                 input-paths)
>       index))
> 
> -(define* (patch-dependencies #:key inputs #:allow-other-keys)
> +(define* (patch-dependencies #:key inputs absent-dependencies
> +                             #:allow-other-keys)
> 
>     (define index (index-modules (map cdr inputs)))
> 
> @@ -86,7 +87,9 @@ (define (resolve-dependencies meta-alist meta-key)
>         (('@ . orig-deps)
>          (fold (match-lambda*
>                  (((key . value) acc)
> -                (acons key (hash-ref index key value) acc)))
> +                (if (member key absent-dependencies)
> +                    acc
> +                    (acons key (hash-ref index key value) acc))))
>                '()
>                orig-deps))))
> 
> to do something like this:
> 
> --8<---------------cut here---------------start------------->8---
> (if (or (member key absent-dependencies)
>          (and (memq 'infer absent-dependencies)
>               (not (hash-ref index key #f))))
>      acc
>      (acons key (hash-ref index key value) acc))
> --8<---------------cut here---------------end--------------->8---
You're actively making the code that resolves dependencies worse to
look at only to keep the keyword.  Don't.  There are tools besides a
hammer.

> Would that meet your objective?
No.  As I repeatedly pointed out, I want either no keyword addition for
this "feature" or a keyword that can be regarded as essentially boolean
if not outright implemented as one.

Reading this again, the existing lines already do what I want (hash-ref
index key value) spits out value as a default if key is not found.  So
the solution is to not touch patch-dependencies at all; we don't have
to abuse a function that's not meant for sanity checking to check
sanity.

> It at least includes files listed in ".npmignore", but I think there
> are entries in "package.json" that control the behavior, too. We should
> adjust our repack phase to ignore those files---but I, at least, would
> need to look into it further to know exactly what the correct behavior
> is.
Fair enough, that is probably out of scope for now, but we should
revisit it before importing the node world and changing node-build-
system becomes a core-updates task.

> We never change APIs gratuitously.
In my personal opinion, #:absent-dependencies would be a gratuitous
change in API.  There's no need to have this in the build system.  We
should rather look into ways that make it possible/easy for users to
patch the package.json file between unpack and configure.

This also calls back to my earlier point of the assoc-set! being out of
place, which itself is also a manifestation of node-build-system not
exposing adequate primitives towards rewriting essential files.  For
instance, the procedure

  (lambda (file proc)
    (with-atomic-file-replacement file
      (lambda (in out)
        (write-json (proc (read-json in))))))

would probably deserve its own name and export from node-build-system.
Yes, you can export utility procedures from (guix build *-build-
system), look at the Emacs and Python build systems for example.

With this in place, we both get to have our cakes and eat it too. 
There would be no keyword added, and package maintainers would drop
"absent" dependencies in a phase like so

  (add-after 'unpack 'drop-dependencies
    (lambda _
      (with-atomic-json-replacement "package.json"
        (lambda (json)
          (map (match-lambda
                 (('dependencies '@ . DEPENDENCIES)
                  (filter away unwanted dependencies))
                 (('devDependencies '@ . DEPENDENCIES)
                  (same))
                 (otherwise otherwise))
               json)))))

Of course, if that's too verbose, you can also expose that as a
function from node-build-system.  Then all we'd have to bikeshed is the
name, which would be comparatively simple.

Does that sound like a reasonable plan to you?




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 20/45] guix: node-build-system: Add implicit libuv input.
  2021-12-18 17:01                                         ` Liliana Marie Prikler
@ 2021-12-19 20:34                                           ` Jelle Licht
  0 siblings, 0 replies; 458+ messages in thread
From: Jelle Licht @ 2021-12-19 20:34 UTC (permalink / raw)
  To: Liliana Marie Prikler, Philip McGrath, 51838
  Cc: Timothy Sample, Pierre Langlois

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

> Hi,
>
> Am Samstag, dem 18.12.2021 um 11:16 -0500 schrieb Philip McGrath:
>> > 
>> > Do this and #21 have to be separated so far from the rest?  If not,
>> > I'd do build system first, then new packages.  Otherwise fair
>> > enough.
>> 
>> I tried to follow Tim's suggestion in 
>> <https://issues.guix.gnu.org/51838#59> to put the changes related to 
>> #:absent-dependencies before the changes to support native addons, so
>> that the earlier changes could potentially be applied even if there
>> was more discussion needed for the later ones (if #:absent-
>> dependencies were less controversial.
> Fair enough, that does make sense.  However, I do think that "add
> package X" is not too big of a review burden, so I personally think the
> fact we're deleting 'configure everywhere is holding back the change to
> support native addons rather than the other way around.
>
>> But note that the patches before this one aren't adding new packages;
>> they are changing existing packages to use #:absent-dependencies
>> rather than deleting the configure phase. So the series is ordered
>> overall as:
>> 
>>   1. Changes to the `node` package itself
>>   2. Build system changes for #:absent-dependencies
>>      (including the delete-lockfiles phase, because un-deleting the
>>      configure phase exposes those problems)
>>   3. Packages changes to use #:absent-dependencies
>>   4. Build system changes to support native addons
>>   5. New packages to exercise the support for native addons
> There is an unspoken bit here in #5 in that those packages still need
> to get rid of unwanted dependencies, which makes this set still
> unsplittable in a sense.
>
> If everyone else here agrees, I think we could at least upstream the
> changes to node itself while we still discuss 2-5.  Timothy, Pierre,
> Jelle, WDYT?

Agreed, thanks for asking.




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 20/45] guix: node-build-system: Add implicit libuv input.
  2021-12-18 17:07                                       ` Philip McGrath
@ 2021-12-19 20:41                                         ` Jelle Licht
  2021-12-19 20:54                                           ` Liliana Marie Prikler
  0 siblings, 1 reply; 458+ messages in thread
From: Jelle Licht @ 2021-12-19 20:41 UTC (permalink / raw)
  To: Philip McGrath, Liliana Marie Prikler, 51838
  Cc: Timothy Sample, Pierre Langlois

Philip McGrath <philip@philipmcgrath.com> writes:

> Hi again,
>
> On 12/17/21 00:08, Liliana Marie Prikler wrote:
>> Am Donnerstag, dem 16.12.2021 um 21:03 -0500 schrieb Philip McGrath:
>>> * guix/build-system/node.scm (lower): Add the version of libuv
>>> used as an input to the #:node package as an additional implicit
>>> input, so that packages needing libuv always get the correct version.
>>> ---
>>>   guix/build-system/node.scm | 9 ++++++++-
>>>   1 file changed, 8 insertions(+), 1 deletion(-)
>>>
>
> Tangentially, for the record, I'd considered as an alternative approach 
> making libuv a propagated input of node. That might be worth considering 
> one day, when we unbundle npm, but for now I think libuv is only needed 
> in a small minority of cases.

Not trying to dismiss this suggestion without a constructive
alternative, but I would prefer not having node's libuv be a propagated
input. What we need is some kind of 'propagated-for-builds-only-input'.

FWIW, I really like the current approach which works as long as we have
npm bundled, which realistically will still be the case for some
{weeks,months,years}.

 - Jelle




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 20/45] guix: node-build-system: Add implicit libuv input.
  2021-12-19 20:41                                         ` Jelle Licht
@ 2021-12-19 20:54                                           ` Liliana Marie Prikler
  0 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-19 20:54 UTC (permalink / raw)
  To: Jelle Licht, Philip McGrath, 51838; +Cc: Timothy Sample, Pierre Langlois

Am Sonntag, dem 19.12.2021 um 21:41 +0100 schrieb Jelle Licht:
> Not trying to dismiss this suggestion without a constructive
> alternative, but I would prefer not having node's libuv be a propagated
> input. What we need is some kind of 'propagated-for-builds-only-input'.
Note that I already made a similar suggestion w.r.t. pkg-config-based
propagated inputs over at guix-devel[1, 2] (They're the same thread,
use whichever layout you prefer).  IMHO, adding it as implicit input to
node-build-system as is done here works for me.

Cheers 

[1] https://lists.gnu.org/archive/html/guix-devel/2021-09/msg00051.html
[2]
https://yhetil.org/guix-devel/045891c151c74e0d66d91973c9e55e0194272df5.camel@gmail.com/




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 06/45] guix: node-build-system: Refactor patch-dependencies phase.
  2021-12-18 17:52                                         ` Liliana Marie Prikler
  2021-12-18 18:59                                           ` Timothy Sample
@ 2021-12-20 18:03                                           ` Philip McGrath
  2021-12-20 19:54                                             ` Liliana Marie Prikler
  1 sibling, 1 reply; 458+ messages in thread
From: Philip McGrath @ 2021-12-20 18:03 UTC (permalink / raw)
  To: Liliana Marie Prikler, 51838; +Cc: Timothy Sample, Pierre Langlois, Jelle Licht

Hi,

On 12/18/21 12:52, Liliana Marie Prikler wrote:
> Hi,
> 
> Am Samstag, dem 18.12.2021 um 12:03 -0500 schrieb Philip McGrath:
>> [...]
>>
>>> The Guix codebase is generally not the place to play around with
>>> destructive semantics.  If you can avoid assoc-set!, I think you
>>> ought to, especially if it helps making a two-step process into a
>>> single-step one.  Anything I'm missing here?
>>
>> I agree that assoc-set! is best avoided. (I am a Racketeer: we don't
>> mutate pairs.) However, this code was already using assoc-set!: the
>> change in this patch is merely to use it correctly.
>>
>> AFAIK neither `info "(guile)Association Lists"` nor SRFI-1 (`info
>> "(guile)SRFI-1 Association Lists"`) provide a non-destructive assoc-
>> set operation. Note in particular that acons and alist-cons do not
>> work, since they don't remove existing entries for the same key: they
>> would result in duplicate keys being written to the JSON object. (In
>> theory this has undefined semantics; in practice, I believe Node.js
>> would use the wrong entry.)
>>
>> Of course, I know how to write a little library of purely functional
>> association list operations---but that seems vastly out of scope for
>> this patch series (which has already grown quite large). Furthermore,
>> if we were going to make such changes, I think it might be better to
>> change the representation of JSON objects to use a real immutable
>> dictionary type, probably VHash (though it looks like those would
>> still need missing functions, at which point a wrapper type that
>> validated keys and maintained a consistent hash-proc might be even
>> better). Alternatively we could use guile-json, which at least avoids
>> the need for improper alists to disambiguate objects from arrays, but
>> we would have to address the issues in Guix commit
>> a4bb18921099b2ec8c1699e08a73ca0fa78d0486.
>>
>> All of that reinforces my sense that we should not try to change this
>> here.
> I think you misread me here.  One thing that's bugging me is that you
> (just like whoever wrote this before) strip the @ only to reintroduce
> it.  I think it'd be better if (resolve-dependencies) simply took a
> list and the let-block deconstructed the json.
> 
> As for the package-meta -> package-meta conversion, imo that could
> perfectly be done with match or SXML transformation.  WDYT?
> 

I definitely am not understanding what you have in mind here. When you 
write "strip the @", I'm not sure what you're referring to, because 
there are multiple "@" tags here, one beginning each JSON object. (Maybe 
this is obvious, but it hadn't been obvious to me.) So, the (guix build 
json) representation of a "package.json" file might look like this:

```
`(@ ("name" . "apple")
     ("version" . "1.0")
     ("dependencies". (@ ("banana" . "*")
                         ("pear" . "*")))
     ("devDependencies" . (@ ("peach" . "*")
                             ("orange" . "*")))
     ("peerDependencies" . (@ ("node-gyp" . "7.x")))
     ("peerDependenciesMeta" . (@ ("node-gyp" . (@ ("optional" . #t)))))
     ("optionalDependencies" . (@ ("node-gyp" . "7.x"))))
```

An unfortunate consequence of this representation is that JSON objects 
are not usable directly as association lists: some procedures expecting 
association lists seem to silently ignore the non-pair at the head of 
the list, but I don't think that's guaranteed, and other procedures just 
don't work. In particular, `append` applied to two JSON objects does not 
produce a JSON object, even ignoring the problem of duplicate keys.

Given that the current code adds "peerDependencies" as additional 
"dependencies", the choice (as I see it) is between the current 
approach, in which `resolve-dependencies` returns genuine association 
lists and the `let*` block turns them JSON objects, or changing 
`resolve-dependencies` to return JSON objects and implementing 
`json-object-append`, which doesn't seem obviously better, unless it 
were part of broader changes. (As an aside, I am not convinced that the 
current handling of "peerDependencies" is right, but I think 
reevaluating that behavior is out of scope for this patch series, and 
particularly for this patch, in which, as Tim said in 
<https://issues.guix.gnu.org/51838#234>, my goal was merely to make the 
use of `assoc-set!` safe.)

I definitely think the broader situation should be improved!

But I think those improvements are out of scope for this patch series. 
It seems like much more discussion would be needed on what the 
improvements should be, and potentially coordination with other users of 
(guix build json). Personally, I'd want to represent JSON objects with a 
real immutable dictionary type that gave us more guarantees about 
correctness by construction. If we continue with tagged association 
lists, we should write a little library of purely functional operations 
on JSON objects. But that all seems very far afield.

-Philip




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 07/45] guix: node-build-system: Add #:absent-dependencies argument.
  2021-12-19  1:02                                                     ` Liliana Marie Prikler
@ 2021-12-20 19:33                                                       ` Philip McGrath
  2021-12-20 20:15                                                         ` Timothy Sample
  2021-12-20 21:50                                                         ` [bug#51838] [PATCH v5 07/45] guix: node-build-system: Add #:absent-dependencies argument Liliana Marie Prikler
  0 siblings, 2 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-20 19:33 UTC (permalink / raw)
  To: Liliana Marie Prikler, Timothy Sample; +Cc: 51838, Pierre Langlois, Jelle Licht

Hi,

On 12/18/21 20:02, Liliana Marie Prikler wrote:
> Am Samstag, dem 18.12.2021 um 17:55 -0500 schrieb Philip McGrath:
>> somewhat, but it was immensely helpful to be able to find in node-
>> xyz.scm all of the packages that wanted, but did not have, node-debug.
>> I imagine it would be even more useful in a more tangled dependency
>> graph.
> That might be beneficial in your particular use case here, but you also
> have to think about the maintenance burden your mechanism introduces.
> What if another leftpad happens and we have to speedrun our core-
> updates cycle to add #:absent-dependencies everywhere?

I don't understand the scenario you have in mind here.

As I remember/understand the left-pad debacle, the package was deleted 
from the NPM registry by its author. I don't understand how that would 
require changes to Guix package definitions. Hopefully, Software 
Heritage would save the day. Perhaps Guix would choose to provide an 
alternate, compatible package implementing that single, trivial 
function, but we could do that by just changing the definition of the 
hypothetical Scheme variable `node-left-pad`. Eventually, downstream 
packages would presumably make changes, but we'd have to address those 
changes anyway when updating those packages.

Even if I assume a scenario that is going to be fixed by removing a 
hypothetical `node-left-pad` packages from all the packages to which it 
is an input, that would change O(n) lines of code: having to change 
#:absent-dependencies in all cases would just be O(2n) lines, which 
doesn't seem prohibitive. Indeed, I think I would be glad to have an 
entry in #:absent-dependencies in such a case, communicating explicitly 
in the Guix repository that the package was affected and Guix packagers 
adopted a workaround. If I'm later updating the package, I can check to 
see if the workaround is still needed or if upstream has dropped 
node-left-pad. In any case, I much prefer to have this written 
explicitly in code in the Guix repository, rather than relying on 
external mechanisms like build logs and upstream source files.

Additionally, I think the use case I encountered with node-debug is 
likely to come up fairly often. For example, someone might notice that a 
lot of packages use `node-tap` for testing, package it for Guix, and 
then want to find all of the downstream packages to which to add it and 
enable tests.

>> I think we should optimize for the kind of high-quality packages we
>> aspire to have in mainline Guix, where eventually we hope to have all
>> sufficiently useful libre Node.js packages available. In that case,
>> #:absent-dependencies makes it explicit when Guix packagers are
>> overriding an upstream decision. While we work to achieve that reality,
>> I think #:absent-dependencies is a much better place for a to-do list
>> than having to search build logs or source "package.json"s. However...
> Compare this to tests.  We have a keyword to disable all tests, which
> defaults to #f and we have other idioms for disabling particular tests.
> Your use case is no different.  If at all, we should only have a
> keyword to disable the check completely and other idioms to e.g. patch
> the package.json file so that sanity-check/patch-dependencies/what-
> have-you doesn't error when it relies on its contents.

I don't mean to be dense, but I feel like I'm missing something. I 
assume the reason we don't have a declarative, high-level mechanism for 
disabling specific tests is that there isn't a general convention for 
doing that, AFAIK. We do have `#:configure-flags`, which can be used to 
pass things like `--disable-whatever`, even though, in principle, that 
could be done by replacing the configure phase. I see 
#:absent-dependencies as similar: it provides, IMO, a readable, 
declarative mechanism to make a commonly-needed adjustment to the 
behavior of the patch-dependencies phase.

>> I can see the use of a "warn" mode for hacking things together quickly
>> without having to totally delete configure. I think this could coexist
>> with #:absent-dependencies and could be done in a follow-on to this
>> patch series.

>> --8<---------------cut here---------------start------------->8---
>> (if (or (member key absent-dependencies)
>>           (and (memq 'infer absent-dependencies)
>>                (not (hash-ref index key #f))))
>>       acc
>>       (acons key (hash-ref index key value) acc))
>> --8<---------------cut here---------------end--------------->8---
> You're actively making the code that resolves dependencies worse to
> look at only to keep the keyword.  Don't.  There are tools besides a
> hammer.
> 
>> Would that meet your objective?
> No.  As I repeatedly pointed out, I want either no keyword addition for
> this "feature" or a keyword that can be regarded as essentially boolean
> if not outright implemented as one.
> 
> Reading this again, the existing lines already do what I want (hash-ref
> index key value) spits out value as a default if key is not found.  So
> the solution is to not touch patch-dependencies at all; we don't have
> to abuse a function that's not meant for sanity checking to check
> sanity.

To clarify, I thought you wanted `node-build-system` to issue a warning 
and drop dependencies not supplied as package inputs. Is that correct? 
In the existing code, if `key` is not found and `value` is returned, the 
configure phase (i.e. `npm install`) will always fail. (The name 
`patch-dependencies` may be a little vague about the actual purpose of 
this phase.)

>> We never change APIs gratuitously.
> In my personal opinion, #:absent-dependencies would be a gratuitous
> change in API.  There's no need to have this in the build system.  We
> should rather look into ways that make it possible/easy for users to
> patch the package.json file between unpack and configure.

I don't think adding #:absent-dependencies is a breaking change in the 
API at all. Any package that builds currently should continue to build 
with #:absent-dependencies support added, and indeed with this entire 
patch series.

> This also calls back to my earlier point of the assoc-set! being out of
> place, which itself is also a manifestation of node-build-system not
> exposing adequate primitives towards rewriting essential files.  For
> instance, the procedure
> 
>    (lambda (file proc)
>      (with-atomic-file-replacement file
>        (lambda (in out)
>          (write-json (proc (read-json in))))))
> 
> would probably deserve its own name and export from node-build-system.
> Yes, you can export utility procedures from (guix build *-build-
> system), look at the Emacs and Python build systems for example.

I do agree that we should provide more utilities for transforming 
"package.json" in general ways. It would be nice to make such 
transformations at least as convenient as more fragile ones using 
`substitute*`. But, as I wrote earlier, that seems out of scope for this 
patch series.

> 
> With this in place, we both get to have our cakes and eat it too.
> There would be no keyword added, and package maintainers would drop
> "absent" dependencies in a phase like so
> 
>    (add-after 'unpack 'drop-dependencies
>      (lambda _
>        (with-atomic-json-replacement "package.json"
>          (lambda (json)
>            (map (match-lambda
>                   (('dependencies '@ . DEPENDENCIES)
>                    (filter away unwanted dependencies))
>                   (('devDependencies '@ . DEPENDENCIES)
>                    (same))
>                   (otherwise otherwise))
>                 json)))))
> 
> Of course, if that's too verbose, you can also expose that as a
> function from node-build-system.  Then all we'd have to bikeshed is the
> name, which would be comparatively simple.
> 
> Does that sound like a reasonable plan to you?

I'm not sure how to proceed here.

I still think the #:absent-dependencies keyword, with or without a 
"warn" mode, is the best approach. It has sounded like others on this 
thread also liked the approach, though I don't want to speak for anyone 
but myself.

I can understand that you would prefer a different approach. I can see 
how a warn-and-ignore could be useful in some cases. My last proposal 
was an attempt at a compromise, showing how adding #:absent-dependencies 
would not preclude adding support for a warn-and-ignore mode later.

But the impression I'm getting is that you think the 
#:absent-dependencies approach would be not merely sub-optimal but 
actively harmful, and, if that is indeed your view, I feel like I'm 
still failing to understand what the harm is.

If we took your final suggestion above, I think we'd have something like 
this:

```
#:phases
(modify-phases %standard-phases
   (add-after 'unpack 'delete-dependencies
     (make-delete-dependencies-phase '("node-tap"))))
```

That seems pretty similar to, under the current patch series:

```
#:absent-dependencies '("node-tap")
```

I can see pros and cons to both approaches. I still like 
`#:absent-dependencies` better, as I find it less verbose, more 
declarative, ... trade-offs we probably don't need to rehash further. 
But it sounds like you see a huge, prohibitive downside to 
`#:absent-dependencies`, and I am just not managing to see what that is.

I don't know what further steps to take to resolve this disagreement or 
how some decision ultimately gets made.

More broadly, I agree with you that the current `node-build-system` has 
some ugly code and is missing some useful utility functions. But I don't 
feel like I can address all of those preexisting issues in the scope of 
this patch series, which has already become somewhat unwieldy.

Maybe someone else could weigh in on how to proceed?

-Philip




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 06/45] guix: node-build-system: Refactor patch-dependencies phase.
  2021-12-20 18:03                                           ` Philip McGrath
@ 2021-12-20 19:54                                             ` Liliana Marie Prikler
  2021-12-21  3:40                                               ` Philip McGrath
  0 siblings, 1 reply; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-20 19:54 UTC (permalink / raw)
  To: Philip McGrath, 51838; +Cc: Timothy Sample, Pierre Langlois, Jelle Licht

Hi,

Am Montag, dem 20.12.2021 um 13:03 -0500 schrieb Philip McGrath:
> I definitely am not understanding what you have in mind here. When
> you write "strip the @", I'm not sure what you're referring to,
> because there are multiple "@" tags here, one beginning each JSON
> object. (Maybe this is obvious, but it hadn't been obvious to me.)
I'm referring to this part:
> +  (define (resolve-dependencies meta-alist meta-key)
> +    ;; Given:
> +    ;;  - The alist from "package.json", with the '@ unwrapped
> +    ;;  - A string key, like "dependencies"
> +    ;; Returns: an alist (without a wrapping '@) like the entry in
> +    ;; meta-alist for meta-key, but with dependencies supplied
> +    ;; by Guix packages mapped to the absolute store paths to use.
> +    (match (assoc-ref meta-alist meta-key)
> +      (#f
> +       '())
> +      (('@ . orig-deps)
> +       (fold (match-lambda*
> +               (((key . value) acc)
> +                (acons key (hash-ref index key value) acc)))
> +             '()
> +             orig-deps))))
You could simply write the function s.t. (resolve-dependencies DEPS)
takes an alist and then produces an alist of resolved dependencies. 
Because you don't, you need to code around that quirk down in the file
replacements.  You can safely access the dependencies using
  (or (and=> (assoc "dependencies" json) cddr) '())
in the calling code.  If you replace "dependencies" by a generic KEY,
you can also outline that into a helper function.

> So, the (guix build json) representation of a "package.json" file
> might look like this:
> 
> ```
> `(@ ("name" . "apple")
>      ("version" . "1.0")
>      ("dependencies". (@ ("banana" . "*")
>                          ("pear" . "*")))
>      ("devDependencies" . (@ ("peach" . "*")
>                              ("orange" . "*")))
>      ("peerDependencies" . (@ ("node-gyp" . "7.x")))
>      ("peerDependenciesMeta" . (@ ("node-gyp" . (@ ("optional" .
> #t)))))
>      ("optionalDependencies" . (@ ("node-gyp" . "7.x"))))
> ```
Note that '("dependencies" . (@ ("banana" . "long") ("pear" . "*"))) is
equal to '("dependencies" @ ("banana" . "long") ("pear" . "juicy")).

> An unfortunate consequence of this representation is that JSON
> objects are not usable directly as association lists: some procedures
> expecting association lists seem to silently ignore the non-pair at
> the head of the list, but I don't think that's guaranteed, and other
> procedures just don't work. 
There are sloppy variants of the assoc functions, but again, you are
looking at this from the wrong angle.  Just ignore that you have a JSON
object and pass the alist to resolve-dependencies, then reconstruct a
JSON object from the result.  ezpz

> In particular, `append` applied to two JSON objects does not produce
> a JSON object, even ignoring the problem of duplicate keys.
I think we can ignore that for now, but if it bugs you you can convert
to hash table and back or at least assert that the keys are unique.

> Given that the current code adds "peerDependencies" as additional 
> "dependencies", the choice (as I see it) is between the current 
> approach, in which `resolve-dependencies` returns genuine association
> lists and the `let*` block turns them JSON objects, or changing 
> `resolve-dependencies` to return JSON objects and implementing 
> `json-object-append`, which doesn't seem obviously better, unless it 
> were part of broader changes. 
The return value of resolve-dependencies is okay imo.  It's the calling
convention that is not.

> (As an aside, I am not convinced that the current handling of
> "peerDependencies" is right, but I think reevaluating that behavior
> is out of scope for this patch series, and particularly for this
> patch, in which, as Tim said in 
> <https://issues.guix.gnu.org/51838#234>, my goal was merely to make
> the use of `assoc-set!` safe.)
I agree that we can ignore the semantics of peerDependencies for now
and we may even be able to look aside the use of assoc-set! (although
for the purpose of making it easier for the user to rewrite those files
on their own as I laid out before, it might still make sense to drop
that use regardless, leading by example).  

> But I think those improvements are out of scope for this patch
> series. 
I don't.  Particularly, the current implementation quirks appear to be
the sole reason you came up with the solution of #:absent-dependencies,
which for the record I still disagree with.  We can lay down a better
foundation to rewrite JSON data in node-build-system and should export
functions that are necessary to do so in build-side code if they're not
already part of core guile or other imports.

> It seems like much more discussion would be needed on what the 
> improvements should be, and potentially coordination with other users
> of (guix build json). Personally, I'd want to represent JSON objects
> with a real immutable dictionary type that gave us more guarantees
> about correctness by construction. If we continue with tagged
> association lists, we should write a little library of purely
> functional operations on JSON objects. But that all seems very far
> afield.
I'll have to say non sequitur to that.  The functionality we require to
efficiently rewrite JSON can perfectly be built on top of (a)list
primitives and pattern matching, both of which are available to be used
in build-side code.  We could even throw in SXML if we needed, not that
we do.  There is really no need to code up yet another set of JSON
primitives just to write "hello, world".

If you absolutely require it, though:
(define json-object->alist cdr)
(define (alist->json-object alist) (cons '@ alist))
Magic.

Cheers




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 07/45] guix: node-build-system: Add #:absent-dependencies argument.
  2021-12-20 19:33                                                       ` Philip McGrath
@ 2021-12-20 20:15                                                         ` Timothy Sample
  2021-12-20 22:00                                                           ` Liliana Marie Prikler
  2021-12-20 21:50                                                         ` [bug#51838] [PATCH v5 07/45] guix: node-build-system: Add #:absent-dependencies argument Liliana Marie Prikler
  1 sibling, 1 reply; 458+ messages in thread
From: Timothy Sample @ 2021-12-20 20:15 UTC (permalink / raw)
  To: Philip McGrath; +Cc: 51838, Pierre Langlois, Jelle Licht, Liliana Marie Prikler

Hi Philip,

Philip McGrath <philip@philipmcgrath.com> writes:

> If we took your final suggestion above, I think we'd have something
> like this:
>
> ```
> #:phases
> (modify-phases %standard-phases
>   (add-after 'unpack 'delete-dependencies
>     (make-delete-dependencies-phase '("node-tap"))))
> ```

I’m perfectly happy with this if it’s a compromise we all can agree on.
It is exactly what popped into my imagination when I read Liliana’s
suggestion.  I guess the one thing missing is that it would not
necessarily be implemented on top of better “package.json” manipulation
support.  That said, it doesn’t preclude providing that support if/when
the need arises.

> I don't know what further steps to take to resolve this disagreement
> or how some decision ultimately gets made.
>
> Maybe someone else could weigh in on how to proceed?

I’m probably not “someone else” enough at this point, but I guess we can
ask the maintainers to weigh in/help facilitate.  We try to move forward
by consensus, and maybe replacing the keyword with a phase-making
procedure will get us there.  Liliana, what do you say?  Have we found
an approach we can agree on?  If not, I think that we’re probably stuck
and will need some fresh voices to move forward.


-- Tim




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 07/45] guix: node-build-system: Add #:absent-dependencies argument.
  2021-12-20 19:33                                                       ` Philip McGrath
  2021-12-20 20:15                                                         ` Timothy Sample
@ 2021-12-20 21:50                                                         ` Liliana Marie Prikler
  2021-12-20 23:10                                                           ` Jelle Licht
  1 sibling, 1 reply; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-20 21:50 UTC (permalink / raw)
  To: Philip McGrath, Timothy Sample; +Cc: 51838, Pierre Langlois, Jelle Licht

Hi,

Am Montag, dem 20.12.2021 um 14:33 -0500 schrieb Philip McGrath:
> Hi,
> 
> On 12/18/21 20:02, Liliana Marie Prikler wrote:
> > Am Samstag, dem 18.12.2021 um 17:55 -0500 schrieb Philip McGrath:
> > > somewhat, but it was immensely helpful to be able to find in
> > > node-xyz.scm all of the packages that wanted, but did not have,
> > > node-debug. I imagine it would be even more useful in a more
> > > tangled dependency graph.
> > That might be beneficial in your particular use case here, but you
> > also have to think about the maintenance burden your mechanism
> > introduces. What if another leftpad happens and we have to speedrun
> > our core-updates cycle to add #:absent-dependencies everywhere?
> 
> [...]
> 
> Even if I assume a scenario that is going to be fixed by removing a 
> hypothetical `node-left-pad` packages from all the packages to which
> it is an input, that would change O(n) lines of code: having to
> change #:absent-dependencies in all cases would just be O(2n) lines,
> which doesn't seem prohibitive.
Sure.  While we're at it, let's add k #:absent-dependencies-esque
fields, because surely the big O notation is an accurate measurement of
painful monkey work.

We are talking about human labour and Kolmogorov complexity here, both
of which I'd like to keep low, kthxbye. 

>  Indeed, I think I would be glad to have an entry in #:absent-
> dependencies in such a case, communicating explicitly 
> in the Guix repository that the package was affected and Guix
> packagers adopted a workaround.
This might be fine and dandy if you only have one or two packages which
actually need this crutch, but when you start summoning a demon from
the seventh layer of hell to make your particular pattern-obsessed
hello world program work, you will curse your past self for being so
stubborn and not implementing something that could leverage the
expressiveness of a programming language.

> If I'm later updating the package, I can check to see if the
> workaround is still needed or if upstream has dropped node-left-pad.
> In any case, I much prefer to have this written explicitly in code in
> the Guix repository, rather than relying on external mechanisms like
> build logs and upstream source files.
How are upstream sources not a source of truth here?  If anything, you
would have to always check that whatever hack you employed back then
still produces a functional package and #:absent-dependencies is not
helping in that.

> Additionally, I think the use case I encountered with node-debug is 
> likely to come up fairly often. For example, someone might notice
> that a lot of packages use `node-tap` for testing, package it for
> Guix, and then want to find all of the downstream packages to which
> to add it and enable tests.
Whoever contributes node-tap will not be responsible to update any
package that might want to take advantage of it.  They can go out of
their way to add it, but the idea, that "I have to update 300 packages
in each and every patch set" is flawed from the get-go.  We can rely on
the community's collective brain to either remember in the future that
node-tap was optional for some package and add it or to not care. 
Whether they are aided by comments or glorified comments (or not) makes
little difference at that point.

> > Compare this to tests.  We have a keyword to disable all tests,
> > which defaults to #f and we have other idioms for disabling
> > particular tests.  Your use case is no different.  If at all, we
> > should only have a keyword to disable the check completely and
> > other idioms to e.g. patch the package.json file so that sanity-
> > check/patch-dependencies/what-have-you doesn't error when it relies
> > on its contents.
> 
> I don't mean to be dense, but I feel like I'm missing something. I 
> assume the reason we don't have a declarative, high-level mechanism
> for disabling specific tests is that there isn't a general convention
> for doing that, AFAIK. 
At least within GNU build system there's the convention of passing
TESTS="subset of tests you want" to your invocation of make check.  The
meson code could also be adapted to such a use-case.  It still doesn't
make sense to do so.

> We do have `#:configure-flags`, which can be used to pass things like
> `--disable-whatever`, even though, in principle, that could be done
> by replacing the configure phase. 
Guess what, even with #:configure-flags, we have to replace the
configure phase to *only* use #:configure-flags in certain packages. 
Then again, if node supported --without-left-pad, we wouldn't be here
discussing #:absent-dependencies, would we?

> I see #:absent-dependencies as similar: it provides, IMO, a readable,
> declarative mechanism to make a commonly-needed adjustment to the 
> behavior of the patch-dependencies phase.
"Readable" is quite a stretch here.  I prefer "parseable boilerplate".
What's more readable?

  (#:strict? #f) ; node-tap... 
  (#:absent-dependencies '("node-tap" "node-tap-the-cloud" "node-tap-
more" "node-tap-pat" "node-tap-atapter" "node-tap-left-pad" [...]))

> To clarify, I thought you wanted `node-build-system` to issue a
> warning and drop dependencies not supplied as package inputs. Is that
> correct? 
> In the existing code, if `key` is not found and `value` is returned,
> the configure phase (i.e. `npm install`) will always fail. (The name 
> `patch-dependencies` may be a little vague about the actual purpose
> of this phase.)
Both statements are correct.  My first suggestion was indeed to just
issue a warning, but after thinking about it harder, I feel as though
it shouldn't even be the responsibility of the patch-dependencies phase
to act as a generic json rewriting tool.  The `patch-dependencies'
phase is simply named that because we're not Java and thereby have no
moral obligation to name it
patchDependenciesAndWhileYoureAtItAlsoInlineDevDependenciesIntoTheMainT
hingKThxBye.

Back then, I thought that rewriting the package.json to reflect the
inputs during build ought to be the simple and correct choice, but I do
agree that at certain times you might also be right and deleting a
single dependency from the tree is the correct option.  So I think we
have a problem for which there cannot be a high-level solution in the
build system and we need to write #:phases into the packages, not the
build system.  The build system does need to provide some primitives to
make that simple, though, e.g. with-atomic-json-replacement.

> > > We never change APIs gratuitously.
> > In my personal opinion, #:absent-dependencies would be a gratuitous
> > change in API.  There's no need to have this in the build system. 
> > We should rather look into ways that make it possible/easy for
> > users to patch the package.json file between unpack and configure.
> 
> I don't think adding #:absent-dependencies is a breaking change in
> the API at all. Any package that builds currently should continue to
> build with #:absent-dependencies support added, and indeed with this
> entire patch series.
Merriam-Webster defines gratuitous as "don't fucking quote Merriam-
Webster during code review".
Your patch might itself not break anything, but the patch to remove it
and update it with something better will.  And as an armchair software
architect, I sit firmly in the "do it right the first time" camp.

> > This also calls back to my earlier point of the assoc-set! being
> > out of place, which itself is also a manifestation of node-build-
> > system not exposing adequate primitives towards rewriting essential
> > files. For instance, the procedure
> > 
> >    (lambda (file proc)
> >      (with-atomic-file-replacement file
> >        (lambda (in out)
> >          (write-json (proc (read-json in))))))
> > 
> > would probably deserve its own name and export from node-build-
> > system.
> > Yes, you can export utility procedures from (guix build *-build-
> > system), look at the Emacs and Python build systems for example.
> 
> I do agree that we should provide more utilities for transforming 
> "package.json" in general ways. It would be nice to make such 
> transformations at least as convenient as more fragile ones using 
> `substitute*`. But, as I wrote earlier, that seems out of scope for
> this patch series.
If this is out-of-scope for the series, then so is #:absent-
dependencies.  Please rewrite your series to not require a keyword
addition then and have fun building your new packages with substitute*.

I'm really not trying to be mean here in holding back your patch
without good reason, but I do think that there's enough things to fix
to require a v6 (perhaps even a v7, but let's stay optimistic) before
we can upstream this in good conscience.  There's also the fact, that
(as Jelle pointed out) we've discussed more than we've written patches.
If I wanted to dictate a solution here, I could easily have submitted a
v6 on my own at some time during review, but in my personal opinion
that doesn't help much in reaching a consensus.

> > With this in place, we both get to have our cakes and eat it too.
> > There would be no keyword added, and package maintainers would drop
> > "absent" dependencies in a phase like so
> > 
> >    (add-after 'unpack 'drop-dependencies
> >      (lambda _
> >        (with-atomic-json-replacement "package.json"
> >          (lambda (json)
> >            (map (match-lambda
> >                   (('dependencies '@ . DEPENDENCIES)
> >                    (filter away unwanted dependencies))
> >                   (('devDependencies '@ . DEPENDENCIES)
> >                    (same))
> >                   (otherwise otherwise))
> >                 json)))))
> > 
> > Of course, if that's too verbose, you can also expose that as a
> > function from node-build-system.  Then all we'd have to bikeshed is
> > the name, which would be comparatively simple.
> > 
> > Does that sound like a reasonable plan to you?
> 
> I'm not sure how to proceed here.
> 
> I still think the #:absent-dependencies keyword, with or without a 
> "warn" mode, is the best approach. It has sounded like others on this
> thread also liked the approach, though I don't want to speak for
> anyone but myself.
> 
> I can understand that you would prefer a different approach. I can
> see how a warn-and-ignore could be useful in some cases. My last
> proposal was an attempt at a compromise, showing how adding
> #:absent-dependencies would not preclude adding support for a warn-
> and-ignore mode later.
> 
> But the impression I'm getting is that you think the 
> #:absent-dependencies approach would be not merely sub-optimal but 
> actively harmful, and, if that is indeed your view, I feel like I'm 
> still failing to understand what the harm is.
#:absent-dependencies is brittle boilerplate and at the same time
extremely limited.
My initially suggested "warn, not fail" is somewhat less limited and
not boilerplate, but still brittle in another way (giving gratuitous
runtime errors).
Adding a phase opens up all the power of Guile Scheme, making the
package exactly as sensitive to errors as you want it to be, plus it
requires only minimal change in the API in the form of more exported
functions, but no changed calling conventions.

There ought to be no question as to which option is the superior one
here :)

> If we took your final suggestion above, I think we'd have something
> like this:
> 
> ```
> #:phases
> (modify-phases %standard-phases
>    (add-after 'unpack 'delete-dependencies
>      (make-delete-dependencies-phase '("node-tap"))))
> ```
> 
> That seems pretty similar to, under the current patch series:
> 
> ```
> #:absent-dependencies '("node-tap")
> ```
That is the point, but please don't add a function called "make-delete-
dependencies-phase".  We have lambda.  We can easily add with-atomic-
json-replacement.  We can also add a "delete-dependencies" function
that takes a json and a list of dependencies if you so want.

So in short

(add-after 'patch-dependencies 'drop-junk
  (lambda _
    (with-atomic-json-replacement "package.json"
      (lambda (json) (delete-dependencies json '("node-tap"))))))

would be the "verbose" style of disabling a list of dependencies.

> I can see pros and cons to both approaches. I still like 
> `#:absent-dependencies` better, as I find it less verbose, more 
> declarative, ... trade-offs we probably don't need to rehash further.
> But it sounds like you see a huge, prohibitive downside to 
> `#:absent-dependencies`, and I am just not managing to see what that
> is.
If you want something that's not verbose and declarative, implement
#:strict? #f.  #:absent-dependencies is extremely verbose for what it
achieves, particularly when we think about the implementation as well.

> I don't know what further steps to take to resolve this disagreement
> or how some decision ultimately gets made.
> 
> More broadly, I agree with you that the current `node-build-system`
> has some ugly code and is missing some useful utility functions. But
> I don't feel like I can address all of those preexisting issues in
> the scope of this patch series, which has already become somewhat
> unwieldy.
> 
> Maybe someone else could weigh in on how to proceed?
To be clear, I never demanded you fix all the bad code in node-build-
system or something like that.  I only pointed out issues, which are
adjacent to the patch set at hand and more importantly those that we
could "easily" fix with tools that we already have at our disposal. 
Perhaps I am misjudging the difficulty of some tasks involved here, but
I haven't really seen a call for help in your replies.  If you do think
I'm pushing unfair amounts of work onto you, please say so.  If not,
then happy hacking :)




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 07/45] guix: node-build-system: Add #:absent-dependencies argument.
  2021-12-20 20:15                                                         ` Timothy Sample
@ 2021-12-20 22:00                                                           ` Liliana Marie Prikler
  2021-12-21  3:59                                                             ` Philip McGrath
  0 siblings, 1 reply; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-20 22:00 UTC (permalink / raw)
  To: Timothy Sample, Philip McGrath; +Cc: 51838, Pierre Langlois, Jelle Licht

Hi Timothy,

Am Montag, dem 20.12.2021 um 15:15 -0500 schrieb Timothy Sample:
> Hi Philip,
> 
> Philip McGrath <philip@philipmcgrath.com> writes:
> 
> > If we took your final suggestion above, I think we'd have something
> > like this:
> > 
> > ```
> > #:phases
> > (modify-phases %standard-phases
> >   (add-after 'unpack 'delete-dependencies
> >     (make-delete-dependencies-phase '("node-tap"))))
> > ```
> 
> I’m perfectly happy with this if it’s a compromise we all can agree on.
> It is exactly what popped into my imagination when I read Liliana’s
> suggestion.  I guess the one thing missing is that it would not
> necessarily be implemented on top of better “package.json”
> manipulation support.  That said, it doesn’t preclude providing that
> support if/when the need arises.
In my personal opinion, we would write that support first and perhaps
the shorthands later.  I.e.

(add-after 'patch-dependencies 'drop-junk
  (lambda _
    (with-atomic-json-replacement "package.json"
      (lambda (json) (delete-dependencies json '("node-tap"))))))

although delete-dependencies could even be some chain of alist
rewriting procedures if we wanted to be super evil.

I don't think we would need to generate phases through FP, we can write
them as code.

> > I don't know what further steps to take to resolve this
> > disagreement or how some decision ultimately gets made.
> > 
> > Maybe someone else could weigh in on how to proceed?
> 
> I’m probably not “someone else” enough at this point, but I guess we
> can ask the maintainers to weigh in/help facilitate.  We try to move
> forward by consensus, and maybe replacing the keyword with a phase-
> making procedure will get us there.  Liliana, what do you say?  Have
> we found an approach we can agree on?  If not, I think that we’re
> probably stuck and will need some fresh voices to move forward.
I personally think phase making is out of scope and we need a solid
foundation first.  That said, if Philip does provide both that
foundation and a good reason to have a phase-making procedure, I'm
willing to strike a compromise.

Cheers




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 07/45] guix: node-build-system: Add #:absent-dependencies argument.
  2021-12-20 21:50                                                         ` [bug#51838] [PATCH v5 07/45] guix: node-build-system: Add #:absent-dependencies argument Liliana Marie Prikler
@ 2021-12-20 23:10                                                           ` Jelle Licht
  2021-12-20 23:33                                                             ` Philip McGrath
  0 siblings, 1 reply; 458+ messages in thread
From: Jelle Licht @ 2021-12-20 23:10 UTC (permalink / raw)
  To: Liliana Marie Prikler, Philip McGrath, Timothy Sample
  Cc: 51838, Pierre Langlois

Hey folks,

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

> Hi,
>
> Am Montag, dem 20.12.2021 um 14:33 -0500 schrieb Philip McGrath:
>> Hi,
>> 
>> On 12/18/21 20:02, Liliana Marie Prikler wrote:
>> > Am Samstag, dem 18.12.2021 um 17:55 -0500 schrieb Philip McGrath:
>> > > somewhat, but it was immensely helpful to be able to find in
>> > > node-xyz.scm all of the packages that wanted, but did not have,
>> > > node-debug. I imagine it would be even more useful in a more
>> > > tangled dependency graph.
>> > That might be beneficial in your particular use case here, but you
>> > also have to think about the maintenance burden your mechanism
>> > introduces. What if another leftpad happens and we have to speedrun
>> > our core-updates cycle to add #:absent-dependencies everywhere?
>> 
>> [...]
>> 
>> Even if I assume a scenario that is going to be fixed by removing a 
>> hypothetical `node-left-pad` packages from all the packages to which
>> it is an input, that would change O(n) lines of code: having to
>> change #:absent-dependencies in all cases would just be O(2n) lines,
>> which doesn't seem prohibitive.
> Sure.  While we're at it, let's add k #:absent-dependencies-esque
> fields, because surely the big O notation is an accurate measurement of
> painful monkey work.
>
> We are talking about human labour and Kolmogorov complexity here, both
> of which I'd like to keep low, kthxbye. 

I think we are drifting a bit off-topic here.

>>  Indeed, I think I would be glad to have an entry in #:absent-
>> dependencies in such a case, communicating explicitly 
>> in the Guix repository that the package was affected and Guix
>> packagers adopted a workaround.
> This might be fine and dandy if you only have one or two packages which
> actually need this crutch, but when you start summoning a demon from
> the seventh layer of hell to make your particular pattern-obsessed
> hello world program work, you will curse your past self for being so
> stubborn and not implementing something that could leverage the
> expressiveness of a programming language.
>
>> If I'm later updating the package, I can check to see if the
>> workaround is still needed or if upstream has dropped node-left-pad.
>> In any case, I much prefer to have this written explicitly in code in
>> the Guix repository, rather than relying on external mechanisms like
>> build logs and upstream source files.
> How are upstream sources not a source of truth here?  If anything, you
> would have to always check that whatever hack you employed back then
> still produces a functional package and #:absent-dependencies is not
> helping in that.
>> Additionally, I think the use case I encountered with node-debug is 
>> likely to come up fairly often. For example, someone might notice
>> that a lot of packages use `node-tap` for testing, package it for
>> Guix, and then want to find all of the downstream packages to which
>> to add it and enable tests.
> Whoever contributes node-tap will not be responsible to update any
> package that might want to take advantage of it.  They can go out of
> their way to add it, but the idea, that "I have to update 300 packages
> in each and every patch set" is flawed from the get-go.  We can rely on
> the community's collective brain to either remember in the future that
> node-tap was optional for some package and add it or to not care. 
> Whether they are aided by comments or glorified comments (or not) makes
> little difference at that point.
>> > Compare this to tests.  We have a keyword to disable all tests,
>> > which defaults to #f and we have other idioms for disabling
>> > particular tests.  Your use case is no different.  If at all, we
>> > should only have a keyword to disable the check completely and
>> > other idioms to e.g. patch the package.json file so that sanity-
>> > check/patch-dependencies/what-have-you doesn't error when it relies
>> > on its contents.
>> 
>> I don't mean to be dense, but I feel like I'm missing something. I 
>> assume the reason we don't have a declarative, high-level mechanism
>> for disabling specific tests is that there isn't a general convention
>> for doing that, AFAIK. 
> At least within GNU build system there's the convention of passing
> TESTS="subset of tests you want" to your invocation of make check.  The
> meson code could also be adapted to such a use-case.  It still doesn't
> make sense to do so.
>
What are you arguing against/for? 

>> We do have `#:configure-flags`, which can be used to pass things like
>> `--disable-whatever`, even though, in principle, that could be done
>> by replacing the configure phase. 
> Guess what, even with #:configure-flags, we have to replace the
> configure phase to *only* use #:configure-flags in certain packages. 
> Then again, if node supported --without-left-pad, we wouldn't be here
> discussing #:absent-dependencies, would we?
>
>> I see #:absent-dependencies as similar: it provides, IMO, a readable,
>> declarative mechanism to make a commonly-needed adjustment to the 
>> behavior of the patch-dependencies phase.
> "Readable" is quite a stretch here.  I prefer "parseable boilerplate".
> What's more readable?
>
>   (#:strict? #f) ; node-tap... 
>   (#:absent-dependencies '("node-tap" "node-tap-the-cloud" "node-tap-
> more" "node-tap-pat" "node-tap-atapter" "node-tap-left-pad" [...]))
>

I'm guessing that's a retorical question, but I vastly prefer the second
over the first because it is parseable boilerplate:

- This means we could add a transformation to define package variants
- This also means we could programmatically rewrite some of this code
  later, `guix style'-style.

With the first approach you are 'stuck' with something that no sane
person will ever manually refactor for any significant number of
packages.

>> To clarify, I thought you wanted `node-build-system` to issue a
>> warning and drop dependencies not supplied as package inputs. Is that
>> correct? 
>> In the existing code, if `key` is not found and `value` is returned,
>> the configure phase (i.e. `npm install`) will always fail. (The name 
>> `patch-dependencies` may be a little vague about the actual purpose
>> of this phase.)
> Both statements are correct.  My first suggestion was indeed to just
> issue a warning, but after thinking about it harder, I feel as though
> it shouldn't even be the responsibility of the patch-dependencies phase
> to act as a generic json rewriting tool.  The `patch-dependencies'
> phase is simply named that because we're not Java and thereby have no
> moral obligation to name it
> patchDependenciesAndWhileYoureAtItAlsoInlineDevDependenciesIntoTheMainT
> hingKThxBye.
>
> Back then, I thought that rewriting the package.json to reflect the
> inputs during build ought to be the simple and correct choice, but I do
> agree that at certain times you might also be right and deleting a
> single dependency from the tree is the correct option.  So I think we
> have a problem for which there cannot be a high-level solution in the
> build system and we need to write #:phases into the packages, not the
> build system.  The build system does need to provide some primitives to
> make that simple, though, e.g. with-atomic-json-replacement.
>
>> > > We never change APIs gratuitously.
>> > In my personal opinion, #:absent-dependencies would be a gratuitous
>> > change in API.  There's no need to have this in the build system. 
>> > We should rather look into ways that make it possible/easy for
>> > users to patch the package.json file between unpack and configure.
>> 
>> I don't think adding #:absent-dependencies is a breaking change in
>> the API at all. Any package that builds currently should continue to
>> build with #:absent-dependencies support added, and indeed with this
>> entire patch series.
> Merriam-Webster defines gratuitous as "don't fucking quote Merriam-
> Webster during code review".
> Your patch might itself not break anything, but the patch to remove it
> and update it with something better will.  And as an armchair software
> architect, I sit firmly in the "do it right the first time" camp.
>

Too late for that I'm afraid :).

>> > This also calls back to my earlier point of the assoc-set! being
>> > out of place, which itself is also a manifestation of node-build-
>> > system not exposing adequate primitives towards rewriting essential
>> > files. For instance, the procedure
>> > 
>> >    (lambda (file proc)
>> >      (with-atomic-file-replacement file
>> >        (lambda (in out)
>> >          (write-json (proc (read-json in))))))
>> > 
>> > would probably deserve its own name and export from node-build-
>> > system.
>> > Yes, you can export utility procedures from (guix build *-build-
>> > system), look at the Emacs and Python build systems for example.
>> 
>> I do agree that we should provide more utilities for transforming 
>> "package.json" in general ways. It would be nice to make such 
>> transformations at least as convenient as more fragile ones using 
>> `substitute*`. But, as I wrote earlier, that seems out of scope for
>> this patch series.
> If this is out-of-scope for the series, then so is #:absent-
> dependencies.  Please rewrite your series to not require a keyword
> addition then and have fun building your new packages with substitute*.

I think this is an unfair assesment.

>
> I'm really not trying to be mean here in holding back your patch
> without good reason, but I do think that there's enough things to fix
> to require a v6 (perhaps even a v7, but let's stay optimistic) before
> we can upstream this in good conscience.  There's also the fact, that
> (as Jelle pointed out) we've discussed more than we've written patches.
> If I wanted to dictate a solution here, I could easily have submitted a
> v6 on my own at some time during review, but in my personal opinion
> that doesn't help much in reaching a consensus.
>

My poor T400 takes about 10 seconds to render the entire conversation,
indeed.

>> > With this in place, we both get to have our cakes and eat it too.
>> > There would be no keyword added, and package maintainers would drop
>> > "absent" dependencies in a phase like so
>> > 
>> >    (add-after 'unpack 'drop-dependencies
>> >      (lambda _
>> >        (with-atomic-json-replacement "package.json"
>> >          (lambda (json)
>> >            (map (match-lambda
>> >                   (('dependencies '@ . DEPENDENCIES)
>> >                    (filter away unwanted dependencies))
>> >                   (('devDependencies '@ . DEPENDENCIES)
>> >                    (same))
>> >                   (otherwise otherwise))
>> >                 json)))))
>> > 
>> > Of course, if that's too verbose, you can also expose that as a
>> > function from node-build-system.  Then all we'd have to bikeshed is
>> > the name, which would be comparatively simple.
>> > 
>> > Does that sound like a reasonable plan to you?
>> 
>> I'm not sure how to proceed here.
>> 
>> I still think the #:absent-dependencies keyword, with or without a 
>> "warn" mode, is the best approach. It has sounded like others on this
>> thread also liked the approach, though I don't want to speak for
>> anyone but myself.
>> 
>> I can understand that you would prefer a different approach. I can
>> see how a warn-and-ignore could be useful in some cases. My last
>> proposal was an attempt at a compromise, showing how adding
>> #:absent-dependencies would not preclude adding support for a warn-
>> and-ignore mode later.
>> 
>> But the impression I'm getting is that you think the 
>> #:absent-dependencies approach would be not merely sub-optimal but 
>> actively harmful, and, if that is indeed your view, I feel like I'm 
>> still failing to understand what the harm is.
> #:absent-dependencies is brittle boilerplate and at the same time
> extremely limited.
> My initially suggested "warn, not fail" is somewhat less limited and
> not boilerplate, but still brittle in another way (giving gratuitous
> runtime errors).
> Adding a phase opens up all the power of Guile Scheme, making the
> package exactly as sensitive to errors as you want it to be, plus it
> requires only minimal change in the API in the form of more exported
> functions, but no changed calling conventions.
>
> There ought to be no question as to which option is the superior one
> here :)
>

To be fair, you can always add a phase (and remove existing phases), so
this is a bit of a silly argument. Power of Guile Scheme and all that ;)

>> If we took your final suggestion above, I think we'd have something
>> like this:
>> 
>> ```
>> #:phases
>> (modify-phases %standard-phases
>>    (add-after 'unpack 'delete-dependencies
>>      (make-delete-dependencies-phase '("node-tap"))))
>> ```
>> 
>> That seems pretty similar to, under the current patch series:
>> 
>> ```
>> #:absent-dependencies '("node-tap")
>> ```
> That is the point, but please don't add a function called "make-delete-
> dependencies-phase".  We have lambda.  We can easily add with-atomic-
> json-replacement.  We can also add a "delete-dependencies" function
> that takes a json and a list of dependencies if you so want.
>
> So in short
>
> (add-after 'patch-dependencies 'drop-junk
>   (lambda _
>     (with-atomic-json-replacement "package.json"
>       (lambda (json) (delete-dependencies json '("node-tap"))))))
>
> would be the "verbose" style of disabling a list of dependencies.
>

I think you are _really_ underestimating how many packages will need a
phase like this in the future. I would agree with this approach if it
were only needed incidentally, similar to the frequency of patching
version requirements in setup.py or requirements.txt for python
packages.

Pretty much everything except the '("node-tap") list will be identical
between packages; how do you propose we reduce this duplication? At this
point I feel like I'm rehasing the opposite of your last point, so let
me rephrase; how many times do you want to see/type/copy+paste the above
snippet before you would consider exposing this functionality on a
higher level?

>> I can see pros and cons to both approaches. I still like 
>> `#:absent-dependencies` better, as I find it less verbose, more 
>> declarative, ... trade-offs we probably don't need to rehash further.
>> But it sounds like you see a huge, prohibitive downside to 
>> `#:absent-dependencies`, and I am just not managing to see what that
>> is.
> If you want something that's not verbose and declarative, implement
> #:strict? #f.  #:absent-dependencies is extremely verbose for what it
> achieves, particularly when we think about the implementation as well.
>

This would be the equivalent to 'magically' patching out any dependency
that guix can't find. I like it in principle, but how is this
functionally different from the current approach of simply not checking
any node dependencies by deleting the configure phase? Perhaps I
misunderstood something somewhere along the way.

>> I don't know what further steps to take to resolve this disagreement
>> or how some decision ultimately gets made.
>> 
>> More broadly, I agree with you that the current `node-build-system`
>> has some ugly code and is missing some useful utility functions. But
>> I don't feel like I can address all of those preexisting issues in
>> the scope of this patch series, which has already become somewhat
>> unwieldy.
>> 
>> Maybe someone else could weigh in on how to proceed?
> To be clear, I never demanded you fix all the bad code in node-build-
> system or something like that.  I only pointed out issues, which are
> adjacent to the patch set at hand and more importantly those that we
> could "easily" fix with tools that we already have at our disposal. 
> Perhaps I am misjudging the difficulty of some tasks involved here, but
> I haven't really seen a call for help in your replies.  If you do think
> I'm pushing unfair amounts of work onto you, please say so.  If not,
> then happy hacking :)

I believe the best thing to do would be to push the earlier
uncontroversial node patches.

Perhaps we can get some of the gurus/victims of other build systems
involved on guix-devel as none of the fundamental issues you've been
talking about for a while are node-specific. As long as we want to reach
some kind on consensus, I believe writing/reviewing more code does not
get us to a desirable outcome at this time.

- Jelle




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 07/45] guix: node-build-system: Add #:absent-dependencies argument.
  2021-12-20 23:10                                                           ` Jelle Licht
@ 2021-12-20 23:33                                                             ` Philip McGrath
  0 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-20 23:33 UTC (permalink / raw)
  To: Jelle Licht, Liliana Marie Prikler, Timothy Sample; +Cc: 51838, Pierre Langlois

Hi Jelle,

Here's a short answer to one specific question:

On 12/20/21 18:10, Jelle Licht wrote:
> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
>> Am Montag, dem 20.12.2021 um 14:33 -0500 schrieb Philip McGrath:
>>> I can see pros and cons to both approaches. I still like
>>> `#:absent-dependencies` better, as I find it less verbose, more
>>> declarative, ... trade-offs we probably don't need to rehash further.
>>> But it sounds like you see a huge, prohibitive downside to
>>> `#:absent-dependencies`, and I am just not managing to see what that
>>> is.
>> If you want something that's not verbose and declarative, implement
>> #:strict? #f.  #:absent-dependencies is extremely verbose for what it
>> achieves, particularly when we think about the implementation as well.
>>
> 
> This would be the equivalent to 'magically' patching out any dependency
> that guix can't find. I like it in principle, but how is this
> functionally different from the current approach of simply not checking
> any node dependencies by deleting the configure phase? Perhaps I
> misunderstood something somewhere along the way.

One key difference between the proposed `#:strict? #f` and the current 
status quo of `(delete 'configure)` is that, at least as I've understood 
the proposal, the patch-dependencies phase would still remove the 
(implicitly detected) absent dependencies from the "package.json", so 
the configure phase would be able to run `npm install`. That would fix 
the problem I described back in <https://issues.guix.gnu.org/51838#13> 
(a month ago), and the native packages would successfully build.

I think it would be a less good option for the reasons you state, and 
which I've argued for elsewhere, but it's important to be clear that it 
would solve the problem building these packages.

Actually, in an ideal world, I would agree with Liliana that 
#:absent-dependencies ought to be out of scope for this patch series. 
However, the existing solution for the problem of missing 
dependencies---deleting the configure phase entirely---does not work for 
packages that need to build native add-ons. So, if I needed to solve the 
problem for the native add-on packages, I thought I should find a 
generally-applicable solution that, in my view, is an improvement for 
the existing packages as well.

More soon,
Philip




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 06/45] guix: node-build-system: Refactor patch-dependencies phase.
  2021-12-20 19:54                                             ` Liliana Marie Prikler
@ 2021-12-21  3:40                                               ` Philip McGrath
  0 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-21  3:40 UTC (permalink / raw)
  To: Liliana Marie Prikler, 51838; +Cc: Timothy Sample, Pierre Langlois, Jelle Licht

Hi Liliana,

On 12/20/21 14:54, Liliana Marie Prikler wrote:
> Hi,
> 
> Am Montag, dem 20.12.2021 um 13:03 -0500 schrieb Philip McGrath:
>> I definitely am not understanding what you have in mind here. When
>> you write "strip the @", I'm not sure what you're referring to,
>> because there are multiple "@" tags here, one beginning each JSON
>> object. (Maybe this is obvious, but it hadn't been obvious to me.)
> I'm referring to this part:
>> +  (define (resolve-dependencies meta-alist meta-key)
>> +    ;; Given:
>> +    ;;  - The alist from "package.json", with the '@ unwrapped
>> +    ;;  - A string key, like "dependencies"
>> +    ;; Returns: an alist (without a wrapping '@) like the entry in
>> +    ;; meta-alist for meta-key, but with dependencies supplied
>> +    ;; by Guix packages mapped to the absolute store paths to use.
>> +    (match (assoc-ref meta-alist meta-key)
>> +      (#f
>> +       '())
>> +      (('@ . orig-deps)
>> +       (fold (match-lambda*
>> +               (((key . value) acc)
>> +                (acons key (hash-ref index key value) acc)))
>> +             '()
>> +             orig-deps))))
> You could simply write the function s.t. (resolve-dependencies DEPS)
> takes an alist and then produces an alist of resolved dependencies.
> Because you don't, you need to code around that quirk down in the file
> replacements.  You can safely access the dependencies using
>    (or (and=> (assoc "dependencies" json) cddr) '())
> in the calling code.  If you replace "dependencies" by a generic KEY,
> you can also outline that into a helper function.
> 

>> An unfortunate consequence of this representation is that JSON
>> objects are not usable directly as association lists: some procedures
>> expecting association lists seem to silently ignore the non-pair at
>> the head of the list, but I don't think that's guaranteed, and other
>> procedures just don't work.
> There are sloppy variants of the assoc functions, but again, you are
> looking at this from the wrong angle.  Just ignore that you have a JSON
> object and pass the alist to resolve-dependencies, then reconstruct a
> JSON object from the result.  ezpz

To check my understanding, are you saying you'd like the code to look 
like this? (n.b. not tested)

```
(define* (patch-dependencies #:key inputs #:allow-other-keys)

   (define index (index-modules (map cdr inputs)))

   (define (resolve-dependencies orig-deps)
     (fold (match-lambda*
             (((key . value) acc)
              (acons key (hash-ref index key value) acc)))
           '()
           orig-deps))

   (define (lookup-deps-alist meta-alist meta-key)
     (match (assoc-ref meta-alist meta-key)
       (#f
        '())
       (('@ . deps)
        deps)))

   (with-atomic-file-replacement "package.json"
     (lambda (in out)
       (let* ((package-meta (read-json in))
              (alist (match package-meta
                       ((@ . alist) alist)))
              (alist
               (assoc-set!
                alist "dependencies"
                (cons '@ (resolve-dependencies
                          (append
                           (lookup-deps-alist alist "dependencies")
                           (lookup-deps-alist alist "peerDependencies"))))))
              (alist
               (assoc-set!
                alist "devDependencies"
                (cons '@ (resolve-dependencies
                          (lookup-deps-alist alist "devDependencies")))))
              (package-meta (cons '@ alist)))
         (write-json package-meta out))))
   #t)
```

I wouldn't have messed with it if I'd found it this way, but to me it 
does not seem obviously better. In particular, I think any benefit of 
simplifying `resolve-dependencies` is outweighed by `lookup-deps-alist` 
conflating looking up the key in the given alist with unwrapping the 
result, if there is one.

Just to be explicit, your much more elegant code with `match-lambda` 
from above:

 >            (map (match-lambda
 >                   (('dependencies '@ . DEPENDENCIES)
 >                    (filter away unwanted dependencies))
 >                   (('devDependencies '@ . DEPENDENCIES)
 >                    (same))
 >                   (otherwise otherwise))
 >                 json)))))

wouldn't quite be enough here: it's possible for the "dependencies" key 
to be absent but the "peerDependencies" key to be present, in which 
case, to preserve the current behavior, we still need to add the 
filtered/rewritten "peerDependencies" as "dependencies".

>> But I think those improvements are out of scope for this patch
>> series.
> I don't.  Particularly, the current implementation quirks appear to be
> the sole reason you came up with the solution of #:absent-dependencies,
> which for the record I still disagree with.  We can lay down a better
> foundation to rewrite JSON data in node-build-system and should export
> functions that are necessary to do so in build-side code if they're not
> already part of core guile or other imports.

I think the current implementation quirks have almost nothing to do with 
my reasoning for #:absent-dependencies.

It's probably true that, if it were more convenient to write phases 
transforming "package.json" generally, I probably wouldn't have looked 
into why so many existing packages were deleting the configure 
phase---but I think it's probably also true that, if that had been the 
case, those packages wouldn't currently be deleting the configure phase.

Part of my point is that, even if those utility functions did exist, I 
would still advocate for #:absent-dependencies. Jelle's latest email 
covers much of my reasoning, particularly this:

On 12/20/21 18:10, Jelle Licht wrote:
 > Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
 >> That is the point, but please don't add a function called "make-delete-
 >> dependencies-phase".  We have lambda.  We can easily add with-atomic-
 >> json-replacement.  We can also add a "delete-dependencies" function
 >> that takes a json and a list of dependencies if you so want.
 >>
 >> So in short
 >>
 >> (add-after 'patch-dependencies 'drop-junk
 >>    (lambda _
 >>      (with-atomic-json-replacement "package.json"
 >>        (lambda (json) (delete-dependencies json '("node-tap"))))))
 >>
 >> would be the "verbose" style of disabling a list of dependencies.
 >>
 >
 > I think you are _really_ underestimating how many packages will need a
 > phase like this in the future. I would agree with this approach if it
 > were only needed incidentally, similar to the frequency of patching
 > version requirements in setup.py or requirements.txt for python
 > packages.
 >
 > Pretty much everything except the '("node-tap") list will be identical
 > between packages; how do you propose we reduce this duplication? At this
 > point I feel like I'm rehasing the opposite of your last point, so let
 > me rephrase; how many times do you want to see/type/copy+paste the above
 > snippet before you would consider exposing this functionality on a
 > higher level?

On a similar note, as Jelle said elsewhere, I think 
#:absent-dependencies should be more amenable to programmatic code 
generation and transformation than a phase under `modify-phases` would 
be. The downside of having lambda, of course, is that some analysis is 
intractable or undecidable on Turing-complete (Church-complete?) code: 
there is a tradeoff to expressive power.

 >
 >> It seems like much more discussion would be needed on what the
 >> improvements should be, and potentially coordination with other users
 >> of (guix build json). Personally, I'd want to represent JSON objects
 >> with a real immutable dictionary type that gave us more guarantees
 >> about correctness by construction. If we continue with tagged
 >> association lists, we should write a little library of purely
 >> functional operations on JSON objects. But that all seems very far
 >> afield.
 > I'll have to say non sequitur to that.  The functionality we require to
 > efficiently rewrite JSON can perfectly be built on top of (a)list
 > primitives and pattern matching, both of which are available to be used
 > in build-side code.  We could even throw in SXML if we needed, not that
 > we do.  There is really no need to code up yet another set of JSON
 > primitives just to write "hello, world".

The other part of my point is that I think providing a nice set of 
utilities for more general JSON transformation is important enough that 
it should not be thrown into this patch series as an afterthought. The 
design is the hard part, not the code.

If it's useful as an illustration (maybe it's not ...), here's a 
non-quirky implementation (not tested) of the interesting parts of 
`patch-dependencies` in Racket, with (other than the actual IO) 
exclusively pure functions operating on immutable data structures, which 
would not eliminate the benefits of `#:absent-dependencies`:

```
(λ (index absent-dependencies in out)

   (define (resolve-dependencies orig-deps)
     (for/hasheq ([{k v} (in-immutable-hash orig-deps)]
                  #:unless (memq k absent-dependencies))
       (values k (hash-ref index k v))))

   (define (resolve-package-meta package-meta)
     (hash-update
      (hash-update package-meta
                   'devDependencies
                   resolve-dependencies
                   #hasheq())
      'dependencies
      (λ (orig-deps)
        (resolve-dependencies
         (hash-union orig-deps (hash-ref package-meta
                                         'peerDependencies
                                         #hasheq()))))
      #hasheq()))

   (write-json (resolve-package-meta (read-json in))
               out))
```

To have a similarly pleasant API---I think we could aspire to an even 
better one!---the absolute minimum we'd need is a non-destructive 
`assoc-set`, since apparently that doesn't exist: it is, admittedly, 
fairly trivial. To be really convenient, though, we'd probably want 
`assoc-update`. But should `assoc-update` have an implicit default of 
`#f`, like `assoc-ref`, or raising an error, like Racket's 
`hash-update`/`hash-ref`/`dict-update`/`dict-ref`? Should we borrow the 
Racket convention whereby the "default value" can be a thunk (in which 
case it is called, so it could escape or build up some 
expensive-to-compute default value)? Or maybe `assoc-update` should take 
four mandatory arguments, with the update procedure last, because it 
will often be a long lambda expression, and the code might look more 
beautiful with that argument last. Maybe the default should be passed as 
a keyword argument!

Then there's `assoc-set*`, `assoc-has-key?`, `assoc-delete`, 
`assoc-union` ...

But wait! A big source of repetitive boilerplate is wrapping and 
unwrapping JSON objects with the '@ tag. If we're implementing all of 
these functions anyway, why not effectively compose them with:

> 
> If you absolutely require it, though:
> (define json-object->alist cdr)
> (define (alist->json-object alist) (cons '@ alist))

so we can just write `jsobject-ref`, `jsobject-set`, `jsobject-delete`, 
`jsobject-update`, etc. directly? Insert bikeshedding about names here.

But wait! Today, (guix build json) is not part of node-build-system's 
public API. It is not even part of the default value for #:modules 
(though it is in #:imported-modules). If we are ever going to change the 
JSON representation we use, surely we should consider it before making 
it public. There is a commit [1] in the history changing to use 
guile-json: do the reasons it was reverted "for now" [2] in 2019 still 
apply? And guile-json is a deprecated alias: would we want guile-json-1, 
guile-json-3, or guile-json-4?

[1]: 
https://git.savannah.gnu.org/cgit/guix.git/commit/?id=8eb0ba532ebbebef23180e666e0607ea735f9c1a
[2]: 
https://git.savannah.gnu.org/cgit/guix.git/commit/?id=a4bb18921099b2ec8c1699e08a73ca0fa78d0486

... and so forth.

These questions do not strike me as trivially self-evident. I don't know 
what answers I'd come up with for all of them.

Given that, even if we already had these utility functions, I still 
think #:absent-dependencies would be The Right Thing, I'm very reluctant 
to add a prerequisite of designing general "package.json" manipulation 
tools.

-Philip




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 07/45] guix: node-build-system: Add #:absent-dependencies argument.
  2021-12-20 22:00                                                           ` Liliana Marie Prikler
@ 2021-12-21  3:59                                                             ` Philip McGrath
  2021-12-21  5:20                                                               ` Liliana Marie Prikler
  0 siblings, 1 reply; 458+ messages in thread
From: Philip McGrath @ 2021-12-21  3:59 UTC (permalink / raw)
  To: Liliana Marie Prikler, Timothy Sample; +Cc: 51838, Pierre Langlois, Jelle Licht

Hi all,

On 12/20/21 17:00, Liliana Marie Prikler wrote:
> Hi Timothy,
> 
> Am Montag, dem 20.12.2021 um 15:15 -0500 schrieb Timothy Sample:
>> Hi Philip,
>>
>> Philip McGrath <philip@philipmcgrath.com> writes:
>>
>>> If we took your final suggestion above, I think we'd have something
>>> like this:
>>>
>>> ```
>>> #:phases
>>> (modify-phases %standard-phases
>>>    (add-after 'unpack 'delete-dependencies
>>>      (make-delete-dependencies-phase '("node-tap"))))
>>> ```
>>
>> I’m perfectly happy with this if it’s a compromise we all can agree on.
>> It is exactly what popped into my imagination when I read Liliana’s
>> suggestion.  I guess the one thing missing is that it would not
>> necessarily be implemented on top of better “package.json”
>> manipulation support.  That said, it doesn’t preclude providing that
>> support if/when the need arises.
> In my personal opinion, we would write that support first and perhaps
> the shorthands later.

I could live with the above as a compromise.

My reservation regarding:

> 
> (add-after 'patch-dependencies 'drop-junk
>    (lambda _
>      (with-atomic-json-replacement "package.json"
>        (lambda (json) (delete-dependencies json '("node-tap"))))))
> 

is that `with-atomic-json-replacement` would make (guix build json)'s 
representation a part of node-build-system's API, which it currently is 
not. For the reasons I detailed in my last email, I think that would 
open up a larger can of worms than it might seem.

Liliana, I'm not entirely certain, but my impression from:

>> I’m probably not “someone else” enough at this point, but I guess we
>> can ask the maintainers to weigh in/help facilitate.  We try to move
>> forward by consensus, and maybe replacing the keyword with a phase-
>> making procedure will get us there.  Liliana, what do you say?  Have
>> we found an approach we can agree on?  If not, I think that we’re
>> probably stuck and will need some fresh voices to move forward.
> I personally think phase making is out of scope and we need a solid
> foundation first.  That said, if Philip does provide both that
> foundation and a good reason to have a phase-making procedure, I'm
> willing to strike a compromise.

was that you would still have objections to something like:

 >>> ```
 >>> #:phases
 >>> (modify-phases %standard-phases
 >>>    (add-after 'unpack 'delete-dependencies
 >>>      (make-delete-dependencies-phase '("node-tap"))))
 >>> ```

unless it came together with code like `with-atomic-json-replacement` 
for more general "package.json" transformations.

If that's the case, then I guess we should do as Jelle suggests:

On 12/20/21 18:10, Jelle Licht wrote:
 > I believe the best thing to do would be to push the earlier
 > uncontroversial node patches.
 >
 > Perhaps we can get some of the gurus/victims of other build systems
 > involved on guix-devel as none of the fundamental issues you've been
 > talking about for a while are node-specific. As long as we want to reach
 > some kind on consensus, I believe writing/reviewing more code does not
 > get us to a desirable outcome at this time.
 >
 > - Jelle
 >

-Philip




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 07/45] guix: node-build-system: Add #:absent-dependencies argument.
  2021-12-21  3:59                                                             ` Philip McGrath
@ 2021-12-21  5:20                                                               ` Liliana Marie Prikler
  2021-12-21 18:25                                                                 ` Philip McGrath
  0 siblings, 1 reply; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-21  5:20 UTC (permalink / raw)
  To: Philip McGrath, Timothy Sample; +Cc: 51838, Pierre Langlois, Jelle Licht

Hi,

excuse my brevity, but I'll be off to work soon.

Am Montag, dem 20.12.2021 um 22:59 -0500 schrieb Philip McGrath:
> My reservation regarding:
> 
> > 
> > (add-after 'patch-dependencies 'drop-junk
> >    (lambda _
> >      (with-atomic-json-replacement "package.json"
> >        (lambda (json) (delete-dependencies json '("node-tap"))))))
> > 
> 
> is that `with-atomic-json-replacement` would make (guix build json)'s
> representation a part of node-build-system's API, which it currently
> is not. For the reasons I detailed in my last email, I think that
> would open up a larger can of worms than it might seem.
That might be a valid concern, but I'd point to the "we don't
gratuitously change API" shield.  Plus if we do, we'd replace our
current JSON by Guile-JSON.  If that has a different internal
representation that would awfully break things, please do tell.

> I guess we should do as Jelle suggests:
> 
> On 12/20/21 18:10, Jelle Licht wrote:
>  > I believe the best thing to do would be to push the earlier
>  > uncontroversial node patches.
>  >
>  >[...]
I did suggest that too, but note that it would only upsteam patches 1-4
of 45, as patch 5 already touches node-build-system.
Patch 5 would probably be fine to go as well (can the others confirm
that?), but if the goal is to push today, someone else will have to do
it, as I'll be only back at night.

Cheers




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 07/45] guix: node-build-system: Add #:absent-dependencies argument.
  2021-12-21  5:20                                                               ` Liliana Marie Prikler
@ 2021-12-21 18:25                                                                 ` Philip McGrath
  2021-12-21 20:44                                                                   ` Liliana Marie Prikler
  0 siblings, 1 reply; 458+ messages in thread
From: Philip McGrath @ 2021-12-21 18:25 UTC (permalink / raw)
  To: Liliana Marie Prikler, Timothy Sample; +Cc: 51838, Pierre Langlois, Jelle Licht

Hi,

On 12/21/21 00:20, Liliana Marie Prikler wrote:
> Hi,
> 
> excuse my brevity, but I'll be off to work soon.
> 
> Am Montag, dem 20.12.2021 um 22:59 -0500 schrieb Philip McGrath:
>> My reservation regarding:
>>
>>>
>>> (add-after 'patch-dependencies 'drop-junk
>>>     (lambda _
>>>       (with-atomic-json-replacement "package.json"
>>>         (lambda (json) (delete-dependencies json '("node-tap"))))))
>>>
>>
>> is that `with-atomic-json-replacement` would make (guix build json)'s
>> representation a part of node-build-system's API, which it currently
>> is not. For the reasons I detailed in my last email, I think that
>> would open up a larger can of worms than it might seem.
> That might be a valid concern, but I'd point to the "we don't
> gratuitously change API" shield.  Plus if we do, we'd replace our
> current JSON by Guile-JSON.  If that has a different internal
> representation that would awfully break things, please do tell.

Here are, to the best of my understanding, the differences in 
representation among (guix build json) and the three versions of 
guile-json packaged in Guix. (For guile-json, this is based on my 
relatively-quick reading of the docs, not any direct experience.) An 
extra complication is that some part of Guix's code staging seems to 
incorrectly turn #nil into '(). I will see if I can narrow that down and 
file a bug report.

(guix build json):
   • object -> (Pairof '@ (Listof (Pairof String Json)))
   • array  -> (Listof Json)
   • null   -> #nil
   • string -> String

guile-json-4:
   • object -> (Listof (Pairof (U Symbol Number String) Json))
   • array  -> (Vectorof Json)
   • null   -> 'null ;; configurable by keyword argument
   • string -> (U Symbol String)

guile-json-3:
   • object -> (Listof (Pairof (U Symbol Number String) Json))
   • array  -> (Vectorof Json)
   • null   -> #nil
   • string -> (U Symbol String)

guile-json-1:
   • object -> (U (HashTable (U Symbol String) Json)
                  (Listof (Pairof (U Symbol String) Json)))
   • array  -> (Listof Json)
   • null   -> #nil
   • string -> (U Symbol String)

-Philip




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 07/45] guix: node-build-system: Add #:absent-dependencies argument.
  2021-12-21 18:25                                                                 ` Philip McGrath
@ 2021-12-21 20:44                                                                   ` Liliana Marie Prikler
  2021-12-23  4:41                                                                     ` Philip McGrath
  2021-12-23  5:19                                                                     ` Philip McGrath
  0 siblings, 2 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-21 20:44 UTC (permalink / raw)
  To: Philip McGrath, Timothy Sample; +Cc: 51838, Pierre Langlois, Jelle Licht

Hi,

Am Dienstag, dem 21.12.2021 um 13:25 -0500 schrieb Philip McGrath:
> Here are, to the best of my understanding, the differences in 
> representation among (guix build json) and the three versions of 
> guile-json packaged in Guix. (For guile-json, this is based on my 
> relatively-quick reading of the docs, not any direct experience.) An 
> extra complication is that some part of Guix's code staging seems to 
> incorrectly turn #nil into '(). I will see if I can narrow that down
> and file a bug report.
> 
> (guix build json):
>    • object -> (Pairof '@ (Listof (Pairof String Json)))
>    • array  -> (Listof Json)
>    • null   -> #nil
>    • string -> String
> 
> guile-json-4:
>    • object -> (Listof (Pairof (U Symbol Number String) Json))
>    • array  -> (Vectorof Json)
>    • null   -> 'null ;; configurable by keyword argument
>    • string -> (U Symbol String)
> 
> guile-json-3:
>    • object -> (Listof (Pairof (U Symbol Number String) Json))
>    • array  -> (Vectorof Json)
>    • null   -> #nil
>    • string -> (U Symbol String)
#nil to '() conversions are probably the fault of some syntax-case or
match expression.  That being said, I hope we don't have to worry about
code staging too much as comparison ought to be done using null? imo.

I think the main difference between (guix build json) and guile-json
here are the extended keys in the latter (guix only has strings) and
the vector/object distinction.  I think it'd be rather straight-forward
to write upgrade guidelines in case we ever make the switch. 
Similarly, all rules based on pattern-matching *will break*, forcing us
to upgrade all the recipes with it.  WDYT?  Would that be manageable
(assuming the change to require Guile-JSON would already be core-
updates material)?




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 07/45] guix: node-build-system: Add #:absent-dependencies argument.
  2021-12-21 20:44                                                                   ` Liliana Marie Prikler
@ 2021-12-23  4:41                                                                     ` Philip McGrath
  2021-12-23  5:19                                                                     ` Philip McGrath
  1 sibling, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-23  4:41 UTC (permalink / raw)
  To: Liliana Marie Prikler, Timothy Sample; +Cc: 51838, Pierre Langlois, Jelle Licht

Hi,

On 12/21/21 15:44, Liliana Marie Prikler wrote:
> Am Dienstag, dem 21.12.2021 um 13:25 -0500 schrieb Philip McGrath:
>> An
>> extra complication is that some part of Guix's code staging seems to
>> incorrectly turn #nil into '(). I will see if I can narrow that down
>> and file a bug report.
>>
> #nil to '() conversions are probably the fault of some syntax-case or
> match expression.  That being said, I hope we don't have to worry about
> code staging too much as comparison ought to be done using null? imo.

I've reported the problem with g-expressions here: 
https://issues.guix.gnu.org/52749

In brief, the problem is that a Scheme value like:

     '(@ ("k" . #nil))

ought to produce the JSON:

     {"k":null}

but, if it is part of a g-expression, it instead produces:

     {"k":[]}

-Philip




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 07/45] guix: node-build-system: Add #:absent-dependencies argument.
  2021-12-21 20:44                                                                   ` Liliana Marie Prikler
  2021-12-23  4:41                                                                     ` Philip McGrath
@ 2021-12-23  5:19                                                                     ` Philip McGrath
  2021-12-23 18:12                                                                       ` Liliana Marie Prikler
  1 sibling, 1 reply; 458+ messages in thread
From: Philip McGrath @ 2021-12-23  5:19 UTC (permalink / raw)
  To: Liliana Marie Prikler, Timothy Sample; +Cc: 51838, Pierre Langlois, Jelle Licht

On 12/21/21 15:44, Liliana Marie Prikler wrote:
> Am Dienstag, dem 21.12.2021 um 13:25 -0500 schrieb Philip McGrath:
>> Here are, to the best of my understanding, the differences in
>> representation among (guix build json) and the three versions of
>> guile-json packaged in Guix.
> I think the main difference between (guix build json) and guile-json
> here are the extended keys in the latter (guix only has strings) and
> the vector/object distinction.

For guile-json-4, the representation of the JSON value "null" is also 
different: #nil vs. the symbol 'null.

> I think it'd be rather straight-forward
> to write upgrade guidelines in case we ever make the switch.
> Similarly, all rules based on pattern-matching *will break*, forcing us
> to upgrade all the recipes with it.  WDYT?  Would that be manageable
> (assuming the change to require Guile-JSON would already be core-
> updates material)?
> 

I actually might like (guix build json) better than guile-json-*! Using 
vectors for arrays seems roughly awkward as tagged alists, especially if 
Guile really doesn't have purely functional update procedures for 
alists---and I sure can't find any---so we'd have to write a little 
algebra of operations on JSON objects either way. But I'm not really 
familiar with the pros and cons of each, and I don't know the context 
behind the previous attempt to switch.

My concern is that someone, or several someones, probably should know 
all of that context before exposing one representation or another as 
part of node-build-system's API. As I've said, I think that's a 
high-priority improvement! But it, and designing nice helper functions, 
seem quite far removed from the core purpose of this patch series. Since 
IMO #:absent-dependencies would still be The Right Thing even if those 
utilities already existed, and since #:absent-dependencies can be 
implemented without having to resolve any of the broader questions, I 
think it would be better not to entangle them with this patch series.

Would it mitigate your concerns with #:absent-dependencies at all if I 
send a separate patch series adding more general utilities based on 
(guix build json)?

-Philip




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v5 07/45] guix: node-build-system: Add #:absent-dependencies argument.
  2021-12-23  5:19                                                                     ` Philip McGrath
@ 2021-12-23 18:12                                                                       ` Liliana Marie Prikler
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
  0 siblings, 1 reply; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-23 18:12 UTC (permalink / raw)
  To: Philip McGrath, Timothy Sample; +Cc: 51838, Pierre Langlois, Jelle Licht

Am Donnerstag, dem 23.12.2021 um 00:19 -0500 schrieb Philip McGrath:
> On 12/21/21 15:44, Liliana Marie Prikler wrote:
> > Am Dienstag, dem 21.12.2021 um 13:25 -0500 schrieb Philip McGrath:
> > > Here are, to the best of my understanding, the differences in
> > > representation among (guix build json) and the three versions of
> > > guile-json packaged in Guix.
> > I think the main difference between (guix build json) and guile-
> > json here are the extended keys in the latter (guix only has
> > strings) and the vector/object distinction.
> 
> For guile-json-4, the representation of the JSON value "null" is also
> different: #nil vs. the symbol 'null.
Different, but configurable, i.e. you can make guile-json-4 return
#nil, which is what would be needed for the sake of compatibility.
> 
> > I think it'd be rather straight-forward to write upgrade guidelines
> > in case we ever make the switch. Similarly, all rules based on
> > pattern-matching *will break*, forcing us to upgrade all the
> > recipes with it.  WDYT?  Would that be manageable (assuming the
> > change to require Guile-JSON would already be core-updates
> > material)?
> > 
> 
> I actually might like (guix build json) better than guile-json-*!
> Using vectors for arrays seems roughly awkward as tagged alists,
> especially if Guile really doesn't have purely functional update
> procedures for alists---and I sure can't find any---so we'd have to
> write a little algebra of operations on JSON objects either way. But
> I'm not really familiar with the pros and cons of each, and I don't
> know the context behind the previous attempt to switch.
I don't think there's been any.  Note that Guix already uses guile-
json, just not at build side.  I don't think there's only one reason
for this; of course we have the incompatibility, but guile-json would
probably also pull in much more into the build than would be needed in
most cases, so that's that.

For the medium/long term I do think guile-json will eventually go the
emacs-json route of making everything about its (de)serialization
configurable, which ought to ease the porting of guix build to it. 
However, pointing at the API stability shield, I don't think we'll be
too hasty porting things over. 

> My concern is that someone, or several someones, probably should know
> all of that context before exposing one representation or another as 
> part of node-build-system's API. As I've said, I think that's a 
> high-priority improvement! But it, and designing nice helper
> functions, seem quite far removed from the core purpose of this patch
> series.
You would only have to implement helper functions as needed, i.e. for
now just (with-atomic-json-replacement proc) and (delete-dependencies
json).  My personal interpretation is that read-json/write-json are
already public Guix API and you can easily use them inside node-build-
system as-is (note: you do need to use-modules them, but it doesn't
require building another module closure), but perhaps someone else has
a different reading.

As for other helper functions, that might become useful over time,
those can be added as-needed.

> Since IMO #:absent-dependencies would still be The Right Thing even
> if those utilities already existed, and since #:absent-dependencies
> can be implemented without having to resolve any of the broader
> questions, I think it would be better not to entangle them with this
> patch series.
I agree, that we can both agree, that whatever we had in mind when
starting this discussion can be implemented without these primitives,
but I disagree on it being The Right Thing.  Particularly, in the case
of #:absent-dependencies, simplicity and completeness are lacking,
whereas in my original suggestion correctness and completeness were
lacking.

For the record, I don't think we can get to The Right Thing without
exposing the JSON somehow.  However, since you argue we can't, we need
to find a course of action, that will allow us to do The Right Thing
later.

I'm sadly a little out of options as I write this, but open to some
suggestions and perhaps I'll get another idea if I gaze at my navel for
some time.

> Would it mitigate your concerns with #:absent-dependencies at all if
> I send a separate patch series adding more general utilities based on
> (guix build json)?
That series would block this one in my opinion (aside from the node
changes, that could be done without it, but we're talking five patches
at most here and I plan to do them over the holidays).  This would
sound like a good idea if you could wait for that discussion to be
resolved, but I fear that's not the case, is it?

Cheers




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp.
  2021-12-23 18:12                                                                       ` Liliana Marie Prikler
@ 2021-12-30  7:38                                                                         ` Philip McGrath
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 01/41] guix: node-build-system: Add delete-lockfiles phase Philip McGrath
                                                                                             ` (42 more replies)
  0 siblings, 43 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:38 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

Hi Liliana (and everyone),

Thanks for taking care of the earlier patches from the series!

It sounds like (guix build json) is going to be around for a reasonably
long time, and I'm ok with that.

In the hope of clearing a path to move forward, I'm sending v6 of this
patch series, immediately followed by a closely-related v7: I strongly
prefer v7, but I would be ok with either version being applied if one of
them can achieve consensus. (If v6 is merged, I'll send a separate patch
series to propose '#:absent-dependencies'.)

I've put the two versions up on GitLab
as <https://gitlab.com/philip1/guix-patches/-/tags/guix-issue-51838-v6>
and <https://gitlab.com/philip1/guix-patches/-/tags/guix-issue-51838-v7>,
respectively.

I've re-organized the patches in the series somewhat to facilitate a
minimal, side-by-side comparison between '#:absent-dependencies' and this
approach:

On 12/20/21 17:00, Liliana Marie Prikler wrote:
> (add-after 'patch-dependencies 'drop-junk
>    (lambda _
>      (with-atomic-json-replacement "package.json"
>        (lambda (json) (delete-dependencies json '("node-tap"))))))

The series is now organized as follows:

  - The first 4 patches are identical in v6 and v7:

      - Patches 01 & 02/41 are non-controversial build system changes
        ('delete-lockfiles' and libuv).

      - Patch 03/41 adds to (guix build node-build-system) several utility
        functions for transforming JSON in the representation used by (guix
        build json), especially functional update of tagged JSON
        objects. It also adjusts the rest of (guix build node-build-system)
        to make use of those functions, eliminating all uses of
        'assoc-set!' and other procedures that mutate assosciation lists.

        Of the new functions, only 'with-atomic-json-file-replacement' is
        exported for now: my hope is that further (valuable and important!)
        discussion about the API design of these functions or their
        implementations need not block either v6 or v7 of this series.

      - Patch 04/41 adds the 'avoid-node-gyp-rebuild' phase. I've re-worked
        the implementation to use the new helper functions.

  - Patch 05/41 is the truly significant difference between v6 and v7: it
    implements the strategy for dealing with missing dependencies.

    In v6, it exports a new public function 'delete-dependencies' from
    (guix build node-build-system).

    In v7, it adds '#:absent-dependencies'. One difference from previous
    versions of this series is that it handles '#:absent-dependencies' in a
    new 'delete-dependencies' phase, which makes the change even more
    self-contained.

  - Patches 06 through 17/41 adjust existing packages to make use of the
    approach to missing dependencies from patch 05/41 of each series.

  - Patches 18 through 41/41 add the new packages excercising native addon
    support, again differing based on the approach from patch 05/41. The
    other slight difference from previous versions of this series is that,
    where applicable, I've adjusted the new package definitions to use
    'with-atomic-json-file-replacement' and never to use 'assoc-set!' or
    other procedures that mutate assosciation lists.

I continue to think that '#:absent-dependencies' is a good approach, in
brief, as Jelle put it in <https://issues.guix.gnu.org/51838#247>, because:

On 12/20/21 18:10, Jelle Licht wrote:
> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
>> Am Montag, dem 20.12.2021 um 14:33 -0500 schrieb Philip McGrath:
>>> If we took your final suggestion above, I think we'd have something
>>> like this:
>>>
>>> ```
>>> #:phases
>>> (modify-phases %standard-phases
>>>     (add-after 'unpack 'delete-dependencies
>>>       (make-delete-dependencies-phase '("node-tap"))))
>>> ```
>>>
>>> That seems pretty similar to, under the current patch series:
>>>
>>> ```
>>> #:absent-dependencies '("node-tap")
>>> ```
>> That is the point, but please don't add a function called "make-delete-
>> dependencies-phase".  We have lambda.  We can easily add with-atomic-
>> json-replacement.  We can also add a "delete-dependencies" function
>> that takes a json and a list of dependencies if you so want.
>>
>> So in short
>>
>> (add-after 'patch-dependencies 'drop-junk
>>    (lambda _
>>      (with-atomic-json-replacement "package.json"
>>        (lambda (json) (delete-dependencies json '("node-tap"))))))
>>
>> would be the "verbose" style of disabling a list of dependencies.
>>
> 
> I think you are _really_ underestimating how many packages will need a
> phase like this in the future. I would agree with this approach if it
> were only needed incidentally, similar to the frequency of patching
> version requirements in setup.py or requirements.txt for python
> packages.
> 
> Pretty much everything except the '("node-tap") list will be identical
> between packages; how do you propose we reduce this duplication? At this
> point I feel like I'm rehasing the opposite of your last point, so let
> me rephrase; how many times do you want to see/type/copy+paste the above
> snippet before you would consider exposing this functionality on a
> higher level?
> 

Additionally, I think having a phase in '%standard-phases' is a good way of
addressing the need to use 'delete-dependencies' after the
'patch-dependencies' phase, which I explain in patch v6 05/41.

But, again, I could live with either v6 or v7 being applied if one of them
can achieve consensus.

So, without further ado, here is v6!

  -Philip

Philip McGrath (41):
  guix: node-build-system: Add delete-lockfiles phase.
  guix: node-build-system: Add implicit libuv input.
  guix: node-build-system: Add JSON utilities.
  guix: node-build-system: Add avoid-node-gyp-rebuild phase.
  guix: node-build-system: Add 'delete-dependencies' helper function.
  gnu: node-semver-bootstrap: Use 'delete-dependencies'.
  gnu: node-ms-bootstrap: Use 'delete-dependencies'.
  gnu: node-binary-search-bootstrap: Use 'delete-dependencies'.
  gnu: node-debug-bootstrap: Use 'delete-dependencies'.
  gnu: node-llparse-builder-bootstrap: Use 'delete-dependencies'.
  gnu: node-llparse-frontend-bootstrap: Use 'delete-dependencies'.
  gnu: node-llparse-bootstrap: Use 'delete-dependencies'.
  gnu: node-semver: Use 'delete-dependencies'.
  gnu: node-wrappy: Use 'delete-dependencies'.
  gnu: node-once: Use 'delete-dependencies'.
  gnu: node-irc-colors: Use 'delete-dependencies'.
  gnu: node-irc: Use 'delete-dependencies'.
  gnu: Add node-inherits.
  gnu: Add node-safe-buffer.
  gnu: Add node-string-decoder.
  gnu: Add node-readable-stream.
  gnu: Add node-nan.
  gnu: Add node-openzwave-shared.
  gnu: Add node-addon-api.
  gnu: Add node-sqlite3.
  gnu: Add node-file-uri-to-path.
  gnu: Add node-bindings.
  gnu: Add node-segfault-handler.
  gnu: Add node-ms.
  gnu: Add node-debug.
  gnu: Add node-serialport-binding-abstract.
  gnu: Add node-serialport-parser-delimiter.
  gnu: Add node-serialport-parser-readline.
  gnu: Add node-serialport-bindings.
  gnu: Add node-serialport-parser-regex.
  gnu: Add node-serialport-parser-ready.
  gnu: Add node-serialport-parser-inter-byte-timeout.
  gnu: Add node-serialport-parser-cctalk.
  gnu: Add node-serialport-parser-byte-length.
  gnu: Add node-serialport-stream.
  gnu: Add node-serialport.

 gnu/packages/node-xyz.scm        | 1013 +++++++++++++++++++++++++++++-
 gnu/packages/node.scm            |   78 ++-
 gnu/packages/zwave.scm           |   64 ++
 guix/build-system/node.scm       |    9 +-
 guix/build/node-build-system.scm |  355 ++++++++++-
 5 files changed, 1464 insertions(+), 55 deletions(-)

-- 
2.32.0





^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 01/41] guix: node-build-system: Add delete-lockfiles phase.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
@ 2021-12-30  7:38                                                                           ` Philip McGrath
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 02/41] guix: node-build-system: Add implicit libuv input Philip McGrath
                                                                                             ` (41 subsequent siblings)
  42 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:38 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* guix/build/node-build-system.scm (delete-lockfiles): New function.
Remove 'package-lock.json', 'yarn.lock', and 'npm-shrinkwrap.json',
if they exist.  Because these files specify  both exact dependency
versions and integrity hashes, they only cause problems for Guix.
(%standard-phases): Add 'delete-lockfiles' after 'patch-dependencies'.
---
 guix/build/node-build-system.scm | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
index 70a367618e..dcaa719f40 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -96,6 +96,17 @@ (define (resolve-dependencies package-meta meta-key)
         (write-json package-meta out))))
   #t)
 
+(define* (delete-lockfiles #:key inputs #:allow-other-keys)
+  "Delete 'package-lock.json', 'yarn.lock', and 'npm-shrinkwrap.json', if they
+exist."
+  (for-each (lambda (pth)
+              (when (file-exists? pth)
+                (delete-file pth)))
+            '("package-lock.json"
+              "yarn.lock"
+              "npm-shrinkwrap.json"))
+  #t)
+
 (define* (configure #:key outputs inputs #:allow-other-keys)
   (let ((npm (string-append (assoc-ref inputs "node") "/bin/npm")))
     (invoke npm "--offline" "--ignore-scripts" "install")
@@ -146,6 +157,7 @@ (define %standard-phases
   (modify-phases gnu:%standard-phases
     (add-after 'unpack 'set-home set-home)
     (add-before 'configure 'patch-dependencies patch-dependencies)
+    (add-after 'patch-dependencies 'delete-lockfiles delete-lockfiles)
     (replace 'configure configure)
     (replace 'build build)
     (replace 'check check)
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 01/41] guix: node-build-system: Add delete-lockfiles phase.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (4 preceding siblings ...)
  2021-11-20 20:08 ` Timothy Sample
@ 2021-12-30  7:38 ` Liliana Marie Prikler
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 02/41] guix: node-build-system: Add implicit libuv input Liliana Marie Prikler
                   ` (40 subsequent siblings)
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:38 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1987 bytes --]

Guix does not use any of these lock files to determine the package versions
used during the build, so they only serve to cause problems.

* guix/build/node-build-system.scm (delete-lockfiles): New variable.
(%standard-phases): Add 'delete-lockfiles' after 'patch-dependencies'.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 guix/build/node-build-system.scm | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
index 70a367618e..2d7a3bdc67 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2015 David Thompson <davet@gnu.org>
 ;;; Copyright © 2016, 2020 Jelle Licht <jlicht@fsfe.org>
 ;;; Copyright © 2019, 2021 Timothy Sample <samplet@ngyro.com>
+;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -96,6 +97,17 @@ (define (resolve-dependencies package-meta meta-key)
         (write-json package-meta out))))
   #t)
 
+(define* (delete-lockfiles #:key inputs #:allow-other-keys)
+  "Delete 'package-lock.json', 'yarn.lock', and 'npm-shrinkwrap.json', if they
+exist."
+  (for-each (lambda (pth)
+              (when (file-exists? pth)
+                (delete-file pth)))
+            '("package-lock.json"
+              "yarn.lock"
+              "npm-shrinkwrap.json"))
+  #t)
+
 (define* (configure #:key outputs inputs #:allow-other-keys)
   (let ((npm (string-append (assoc-ref inputs "node") "/bin/npm")))
     (invoke npm "--offline" "--ignore-scripts" "install")
@@ -146,6 +158,7 @@ (define %standard-phases
   (modify-phases gnu:%standard-phases
     (add-after 'unpack 'set-home set-home)
     (add-before 'configure 'patch-dependencies patch-dependencies)
+    (add-after 'patch-dependencies 'delete-lockfiles delete-lockfiles)
     (replace 'configure configure)
     (replace 'build build)
     (replace 'check check)
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 02/41] guix: node-build-system: Add implicit libuv input.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 01/41] guix: node-build-system: Add delete-lockfiles phase Philip McGrath
@ 2021-12-30  7:38                                                                           ` Philip McGrath
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 03/41] guix: node-build-system: Add JSON utilities Philip McGrath
                                                                                             ` (40 subsequent siblings)
  42 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:38 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* guix/build-system/node.scm (lower): Add the version of libuv
used as an input to the #:node package as an additional implicit
input, so that packages needing libuv always get the correct version.
---
 guix/build-system/node.scm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/guix/build-system/node.scm b/guix/build-system/node.scm
index 735f8dd06e..24bd677bfc 100644
--- a/guix/build-system/node.scm
+++ b/guix/build-system/node.scm
@@ -2,6 +2,8 @@
 ;;; Copyright © 2016 Jelle Licht <jlicht@fsfe.org>
 ;;; Copyright © 2019 Timothy Sample <samplet@ngyro.com>
 ;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2021 Pierre Langlois <pierre.langlois@gmx.com>
+;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -61,10 +63,15 @@ (define private-keywords
                               `(("source" ,source))
                               '())
                         ,@inputs
-
                         ;; Keep the standard inputs of 'gnu-build-system'.
                         ,@(standard-packages)))
          (build-inputs `(("node" ,node)
+                         ;; Many packages with native addons need
+                         ;; libuv headers. The libuv version must
+                         ;; be exactly the same as for the node
+                         ;; package we are adding implicitly,
+                         ;; so we take care of adding libuv, too.
+                         ("libuv" ,@(assoc-ref (package-inputs node) "libuv"))
                          ,@native-inputs))
          (outputs outputs)
          (build node-build)
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 02/41] guix: node-build-system: Add implicit libuv input.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (5 preceding siblings ...)
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 01/41] guix: node-build-system: Add delete-lockfiles phase Liliana Marie Prikler
@ 2021-12-30  7:38 ` Liliana Marie Prikler
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 03/41] guix: node-build-system: Add JSON utilities Liliana Marie Prikler
                   ` (39 subsequent siblings)
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:38 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1749 bytes --]

* guix/build-system/node.scm (lower): Add the version of libuv
used as an input to the #:node package as an additional implicit
input, so that packages needing libuv always get the correct version.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 guix/build-system/node.scm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/guix/build-system/node.scm b/guix/build-system/node.scm
index 735f8dd06e..24bd677bfc 100644
--- a/guix/build-system/node.scm
+++ b/guix/build-system/node.scm
@@ -2,6 +2,8 @@
 ;;; Copyright © 2016 Jelle Licht <jlicht@fsfe.org>
 ;;; Copyright © 2019 Timothy Sample <samplet@ngyro.com>
 ;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2021 Pierre Langlois <pierre.langlois@gmx.com>
+;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -61,10 +63,15 @@ (define private-keywords
                               `(("source" ,source))
                               '())
                         ,@inputs
-
                         ;; Keep the standard inputs of 'gnu-build-system'.
                         ,@(standard-packages)))
          (build-inputs `(("node" ,node)
+                         ;; Many packages with native addons need
+                         ;; libuv headers. The libuv version must
+                         ;; be exactly the same as for the node
+                         ;; package we are adding implicitly,
+                         ;; so we take care of adding libuv, too.
+                         ("libuv" ,@(assoc-ref (package-inputs node) "libuv"))
                          ,@native-inputs))
          (outputs outputs)
          (build node-build)
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 03/41] guix: node-build-system: Add JSON utilities.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 01/41] guix: node-build-system: Add delete-lockfiles phase Philip McGrath
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 02/41] guix: node-build-system: Add implicit libuv input Philip McGrath
@ 2021-12-30  7:38                                                                           ` Philip McGrath
  2021-12-30 16:56                                                                             ` Liliana Marie Prikler
  2021-12-30 18:18                                                                             ` Liliana Marie Prikler
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 04/41] guix: node-build-system: Add avoid-node-gyp-rebuild phase Philip McGrath
                                                                                             ` (39 subsequent siblings)
  42 siblings, 2 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:38 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

This commit adds several utility functions for non-destructive
transformation of the JSON representation used by (guix build json),
particularly for purely functional update of JSON objects.  They should
eventually be exported, but most are private for now to allow for more
experience and consideration before commiting to the API.  The design
was largely inspired by the 'racket/dict' and 'racket/hash' libraries.
Liliana Marie Prikler proposed 'with-atomic-json-file-replacement'.

* guix/build/node-build-system.scm (jsobject-ref):
(alist-pop):
(alist-delete*):
(jsobject-delete):
(alist-set):
(jsobject-set):
(jsobject-set*):
(alist-update):
(jsobject-update):
(jsobject-update*):
(jsobject-union): New private procedures.
(with-atomic-json-file-replacement): New exported procedure.
(module-name): Use them.
(build): Use them.
(patch-dependencies): Use them.  Stop using 'assoc-set!' unsafely.

Co-authored-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 guix/build/node-build-system.scm | 275 ++++++++++++++++++++++++++++---
 1 file changed, 251 insertions(+), 24 deletions(-)

diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
index dcaa719f40..e5c4da5091 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -26,6 +26,7 @@ (define-module (guix build node-build-system)
   #:use-module (ice-9 match)
   #:use-module (srfi srfi-1)
   #:export (%standard-phases
+            with-atomic-json-file-replacement
             node-build))
 
 ;; Commentary:
@@ -34,6 +35,237 @@ (define-module (guix build node-build-system)
 ;;
 ;; Code:
 
+;;;
+;;; JSON utilities.
+;;;
+;;; The following procedures facilitate transforming JSON values using the
+;;; representation from (guix build json), particularly purely functional
+;;; update of JSON objects.  If we decide to make more of them public, we
+;;; might instead put them in their own file or, eventually, add them to
+;;; (guix build json).
+;;;
+;;; JSON objects with duplicate keys are not interoperable: see RFC 8259 § 4.
+;;; These procedures assume, but generally do not check, that JSON objects
+;;; given to them as arguments do not have duplicate keys.  As long as that
+;;; precondition is satisfied, they will produce JSON objects without
+;;; duplicate keys.  Procedures that operate on unwrapped assosciation lists
+;;; may do likewise, which should be considered before exporting them for
+;;; general use.
+;;;
+
+(define (with-atomic-json-file-replacement file proc)
+  "Like 'with-atomic-file-replacement', but PROC is called with a single
+argument---the result of parsing FILE's contents as json---and should a value
+to be written as json to the replacement FILE."
+  (with-atomic-file-replacement file
+    (lambda (in out)
+      (write-json (proc (read-json in)) out))))
+
+(define (jsobject-ref js key failure-result)
+  "Return the value assosciated with KEY in the json object JS.  If KEY is not
+found and FAILURE-RESULT is a procedure, it is called in tail position with
+zero arguments.  Otherwise, FAILURE-RESULT is returned."
+  ;; TODO: `failure-result` should be optional, but should the default
+  ;; `failure-result` be #f (like `assoc-ref`), a thunk raising an exception,
+  ;; '(@), or something else?  Keep it mandatory until we discuss and decide.
+  (match js
+    (('@ . alist)
+     (match (assoc key alist)
+       (#f
+        (if (procedure? failure-result)
+            (failure-result)
+            failure-result))
+       ((_ . value)
+        value)))))
+
+(define (alist-pop alist key)
+  "Return two values: the first pair in ALIST with the given KEY in its
+'car' (or #f, if no such pair exists) and an assosciation list like (and
+potentially sharing storage with) ALIST, but with no entry for KEY."
+  (match (assoc key alist)
+    ;; If key isn't present, we don't need to do any allocation
+    (#f
+     (values #f alist))
+    (found
+     (values found
+             ;; Because we have `found`, we can find it more
+             ;; efficiently this time with `eq?`. We avoid using
+             ;; `delq` because it would copy pairs in a shared
+             ;; tail. We assume a sufficiently smart compiler to
+             ;; handle "tail recursion modulo cons" (vid. e.g. Indiana
+             ;; University Technical Report No. 19, Friedman & Wise
+             ;; 1975) at least as efficiently as a hand-written
+             ;; tail-recursive implementation with an accumulator.
+             (let loop ((alist alist))
+               (match alist
+                 ;; We know that `found` is present,
+                 ;; so no need to check for '()
+                 ((this . alist)
+                  (if (eq? this found)
+                      alist
+                      (cons this (loop alist))))))))))
+
+;; Sadly, Guile's implementation of (@ (srfi srfi-1) alist-delete)
+;; performs unnecessary allocation, e.g. this currently evaluates to #f:
+;;
+;;     (let ((alist `(("a" . 1)("b" . 2)("c" . 3))))
+;;       (eq? alist (alist-delete "x" alist)))
+;;
+;; These functions generally choose to allocate a new outer pair (with the '@
+;; tag), even though in unusual cases the resulting object might not have
+;; changed, for the sake of simplicity and to avoid retaining a reference to
+;; the original alist longer than necessary. But that is O(1) allocation that
+;; could only rarely be avoided: `alist-delete` would allocate O(n) pairs,
+;; which would only be necessary in the worst case.
+(define (alist-delete* alist key)
+  "Return an assosciation list like (and potentially sharing storage with)
+ALIST, but with no entry for KEY."
+  (define-values (_popped remaining)
+    (alist-pop alist key))
+  remaining)
+
+(define (jsobject-delete js key)
+  "Return a json object like JS, but with no entry for KEY."
+  (cons '@ (match js
+             (('@ . alist)
+              (alist-delete* alist key)))))
+
+(define (alist-set alist key value)
+  "Return an assosciation list like ALIST, but with KEY mapped to VALUE,
+replacing any existing mapping for KEY."
+  (acons key value (alist-delete* alist key)))
+
+(define (jsobject-set js key value)
+  "Return a json object like JS, but with KEY mapped to VALUE, replacing any
+existing mapping for KEY."
+  (cons '@ (match js
+             (('@ . alist)
+              (alist-set alist key value)))))
+
+(define jsobject-set*
+  (case-lambda
+    "Return a json object like JS, but functionally extended by mapping each
+KEY to each VALUE, replacing any existing mapping for each KEY.  The update
+takes place from left to right, so later mappings overwrite earlier mappings
+for the same KEY."
+    ((js)
+     js)
+    ((js key value)
+     (jsobject-set js key value))
+    ((js . args)
+     (cons '@ (match js
+                (('@ . alist)
+                 (let loop ((alist alist)
+                            (args args))
+                   (match args
+                     (()
+                     alist)
+                     ((key value . args)
+                      (loop (alist-set alist key value)
+                            args))))))))))
+
+(define (alist-update alist key failure-result updater)
+  "Return an assosciation list like ALIST, but with KEY mapped to the result
+of applying UPDATER to the value to which KEY is mapped in ALIST.  When ALIST
+does not have an existing mapping for KEY, FAILURE-RESULT is used as with
+'jsobject-ref' to obtain the argument for UPDATER."
+  ;; Often, `updater` will be a lambda expression, so making it the last
+  ;; argument may help to makes the code legible, and the most likely
+  ;; `failure-result` arguments are all shorter than the keyword
+  ;; `#:failure-result`.  Plus, making `failure-result` mandatory helps make
+  ;; `alist-update` consistent with `alist-update*`.
+  (define-values (popped tail-alist)
+    (alist-pop alist key))
+  (acons key
+         (updater (match popped
+                    (#f
+                     (if (procedure? failure-result)
+                         (failure-result)
+                         failure-result))
+                    ((_ . value)
+                     value)))
+         tail-alist))
+
+(define (jsobject-update js key failure-result updater)
+  "Return a json object like JS, but with KEY mapped to the result of applying
+UPDATER to the value to which KEY is mapped in JS.  When JS does not have an
+existing mapping for KEY, FAILURE-RESULT is used as with 'jsobject-ref' to
+obtain the argument for UPDATER."
+  (cons '@ (match js
+             (('@ . alist)
+              (alist-update alist key failure-result updater)))))
+
+(define jsobject-update*
+  (case-lambda
+    "Return a json object like JS, but functionally extended by replacing the
+mapping for each KEY with the result of applying the corresponding UPDATER to
+the value to which that KEY is mapped in JS---or, if no such mapping exists,
+to a value based on the corresponding FAILURE-RESULT as with 'jsobject-ref'.
+The update takes place from left to right, so later UPDATERs will receive the
+values returned by earlier UPDATERs for the same KEY."
+    ((js)
+     js)
+    ((js key failure-result updater)
+     (jsobject-update js key failure-result updater))
+    ((js . args)
+     (cons '@ (match js
+                (('@ . alist)
+                 (let loop ((alist alist)
+                            (args args))
+                   (match args
+                     (()
+                     alist)
+                     ((key failure-result updater . args)
+                      (loop (alist-update alist key failure-result updater)
+                            args))))))))))
+
+(define* (jsobject-union #:key
+                         (combine (lambda (a b) b))
+                         (combine/key (lambda (k a b) (combine a b)))
+                         #:rest json-objects)
+  "Combine the given JSON-OBJECTS into a single json object.  The JSON-OBJECTS
+are merged from left to right by adding each key/value pair of each object to
+the aggregate object in turn.  When one of the JSON-OBJECTS contains a mapping
+from some key KEY to a value VAL such that the aggregate object already
+contains a mapping from KEY to a value VAL0, the aggregate object is
+functionally updated to instead map KEY to the value of (COMBINE/KEY KEY VAL0
+VAL).  The default COMBINE/KEY tail-calls (COMBINE VAL0 VAL), and the default
+COMBINE simply returns its second argument, so, by default, mappings in later
+JSON-OBJECTS supersede those in earlier ones."
+  (match (filter (lambda (v)
+                   (not (or (keyword? v)
+                            (procedure? v))))
+                 json-objects)
+    (()
+     '(@))
+    (((and js0 ('@ . _)))
+     js0)
+    ((('@ . alist0) ('@ . alist*) ...)
+     (cons '@ (fold (lambda (alist1 alist0)
+                      (if (null? alist0)
+                          alist1
+                          (fold (lambda (k+v alist0)
+                                  (match k+v
+                                    ((k . v)
+                                     (define-values (popped tail-alist)
+                                       (alist-pop alist0 k))
+                                     (match popped
+                                       (#f
+                                        (cons k+v tail-alist))
+                                       ((_ . v0)
+                                        (acons k
+                                               (combine/key k v0 v)
+                                               tail-alist))))))
+                                alist0
+                                alist1)))
+                    alist0
+                    alist*)))))
+
+\f
+;;;
+;;; Phases.
+;;;
+
 (define (set-home . _)
   (with-directory-excursion ".."
     (let loop ((i 0))
@@ -49,7 +281,7 @@ (define (set-home . _)
 (define (module-name module)
   (let* ((package.json (string-append module "/package.json"))
          (package-meta (call-with-input-file package.json read-json)))
-    (assoc-ref package-meta "name")))
+    (jsobject-ref package-meta "name" #f)))
 
 (define (index-modules input-paths)
   (define (list-modules directory)
@@ -73,27 +305,24 @@ (define* (patch-dependencies #:key inputs #:allow-other-keys)
 
   (define index (index-modules (map cdr inputs)))
 
-  (define (resolve-dependencies package-meta meta-key)
-    (fold (lambda (key+value acc)
-            (match key+value
-              ('@ acc)
-              ((key . value) (acons key (hash-ref index key value) acc))))
-          '()
-          (or (assoc-ref package-meta meta-key) '())))
+  (define resolve-dependencies
+    (match-lambda
+      (('@ . alist)
+       (cons '@ (map (match-lambda
+                       ((key . value)
+                        (cons key (hash-ref index key value))))
+                     alist)))))
 
-  (with-atomic-file-replacement "package.json"
-    (lambda (in out)
-      (let ((package-meta (read-json in)))
-        (assoc-set! package-meta "dependencies"
-                    (append
-                     '(@)
-                     (resolve-dependencies package-meta "dependencies")
-                     (resolve-dependencies package-meta "peerDependencies")))
-        (assoc-set! package-meta "devDependencies"
-                    (append
-                     '(@)
-                     (resolve-dependencies package-meta "devDependencies")))
-        (write-json package-meta out))))
+  (with-atomic-json-file-replacement "package.json"
+    (lambda (pkg-meta)
+      (jsobject-update*
+       pkg-meta
+       "devDependencies" '(@) resolve-dependencies
+       "dependencies" '(@) (lambda (deps)
+                             (resolve-dependencies
+                              (jsobject-union
+                               (jsobject-ref pkg-meta "peerDependencies" '(@))
+                               deps))))))
   #t)
 
 (define* (delete-lockfiles #:key inputs #:allow-other-keys)
@@ -114,9 +343,7 @@ (define* (configure #:key outputs inputs #:allow-other-keys)
 
 (define* (build #:key inputs #:allow-other-keys)
   (let ((package-meta (call-with-input-file "package.json" read-json)))
-    (if (and=> (assoc-ref package-meta "scripts")
-               (lambda (scripts)
-                 (assoc-ref scripts "build")))
+    (if (jsobject-ref (jsobject-ref package-meta "scripts" '(@)) "build" #f)
         (let ((npm (string-append (assoc-ref inputs "node") "/bin/npm")))
           (invoke npm "run" "build"))
         (format #t "there is no build script to run~%"))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 03/41] guix: node-build-system: Add JSON utilities.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (6 preceding siblings ...)
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 02/41] guix: node-build-system: Add implicit libuv input Liliana Marie Prikler
@ 2021-12-30  7:38 ` Liliana Marie Prikler
  2022-01-08  4:13   ` Philip McGrath
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 04/41] guix: node-build-system: Add avoid-node-gyp-rebuild phase Liliana Marie Prikler
                   ` (38 subsequent siblings)
  46 siblings, 1 reply; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:38 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 7993 bytes --]

This commit adds several utility functions for non-destructive
transformation of the JSON representation used by (guix build json),
particularly for purely functional update of JSON objects.  They ought
to eventually be exported from their own module, but for now are kept
private to allow experimentation.

* guix/build/node-build-system.scm (assoc-ref*, jsobject-ref, alist-pop)
(alist-update, jsobject-update*, jsobject-union): New variables.
(with-atomic-json-file-replacement): New public variable.
(module-name, build, patch-dependencies): Use them.  Do not resort to
unsafe alist primitives from Guile core.

Co-authored-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 guix/build/node-build-system.scm | 145 ++++++++++++++++++++++++-------
 1 file changed, 115 insertions(+), 30 deletions(-)

diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
index 2d7a3bdc67..c6602b876b 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2016, 2020 Jelle Licht <jlicht@fsfe.org>
 ;;; Copyright © 2019, 2021 Timothy Sample <samplet@ngyro.com>
 ;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
+;;; Copyright © 2021 Liliana Marie Prikler <liliana.prikler@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -26,14 +27,101 @@ (define-module (guix build node-build-system)
   #:use-module (ice-9 ftw)
   #:use-module (ice-9 match)
   #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-71)
   #:export (%standard-phases
+            with-atomic-json-file-replacement
             node-build))
 
-;; Commentary:
-;;
-;; Builder-side code of the standard Node/NPM package install procedure.
-;;
-;; Code:
+(define (with-atomic-json-file-replacement file proc)
+  "Like 'with-atomic-file-replacement', but PROC is called with a single
+argument---the result of parsing FILE's contents as json---and should a value
+to be written as json to the replacement FILE."
+  (with-atomic-file-replacement file
+    (lambda (in out)
+      (write-json (proc (read-json in)) out))))
+
+(define* (assoc-ref* alist key #:optional default)
+  "Like assoc-ref, but return DEFAULT instead of #f if no value exists."
+  (match (assoc key alist)
+    (#f default)
+    ((_ . value) value)))
+
+(define* (jsobject-ref obj key #:optional default)
+  (match obj
+    (('@ . alist) (assoc-ref* alist key default))))
+
+(define* (alist-pop alist key #:optional (= equal?))
+  "Return two values, the first pair in ALIST with key KEY, and the other
+elements.  Equality calls are made as (= KEY ALISTCAR)."
+  (define (found? pair)
+    (= key (car pair)))
+
+  (let ((before after (break found? alist)))
+    (if (pair? after)
+        (values (car after) (append before (cdr after)))
+        (values #f before))))
+
+(define* (alist-update alist key proc #:optional default (= equal?))
+  "Return an association list like ALIST, but with KEY mapped to the result of
+PROC applied to the first value found under the comparison (= KEY ALISTCAR).
+If no such value exists, use DEFAULT instead.
+Unlike acons, this removes the previous association of KEY (assuming it is
+unique), but the result may still share storage with ALIST."
+  (let ((pair rest (alist-pop alist key =)))
+    (acons key
+           (proc (if (pair? pair)
+                     (cdr pair)
+                     default))
+           rest)))
+
+(define (jsobject-update* js . updates)
+  "Return a json object like JS, but with all UPDATES applied.  Each update
+is a list (KEY PROC [DEFAULT]), so that KEY is mapped to the result of
+PROC applied to the value found for it, or DEFAULT otherwise."
+  (match js
+    (('@ . alist)
+     (let loop ((alist alist)
+                (updates updates))
+       (match updates
+         (() (cons '@ alist))
+         (((key proc) . updates)
+          (loop (alist-update alist key proc #f equal?) updates))
+         (((key proc default) . updates)
+          (loop (alist-update alist key proc default equal?) updates)))))))
+
+(define (jsobject-union combine seed . objects)
+  "Merge OBJECTS into SEED by applying (COMBINE KEY VAL0 VAL), where VAL0
+is the value found in the (possibly updated) SEED and VAL is the new value
+found in one of the OBJECTS."
+  (match seed
+    (('@ . aseed)
+     (match objects
+       (() seed)
+       ((('@ . alists) ...)
+        (cons
+         '@
+         (fold (lambda (alist aseed)
+                 (if (null? aseed) alist
+                     (fold
+                      (match-lambda*
+                        (((k . v) aseed)
+                         (let ((pair tail (alist-pop alist k)))
+                           (match pair
+                             (#f (acons k v aseed))
+                             ((_ . v0) (acons k (combine k v0 v) aseed))))))
+                      aseed
+                      alist)))
+               aseed
+               alists)))))))
+
+;; Possibly useful helper functions:
+;; (define (newest key val0 val) val)
+;; (define (unkeyed->keyed proc) (lambda (_key val0 val) (proc val0 val)))
+
+\f
+;;;
+;;; Phases.
+;;;
 
 (define (set-home . _)
   (with-directory-excursion ".."
@@ -50,7 +138,7 @@ (define (set-home . _)
 (define (module-name module)
   (let* ((package.json (string-append module "/package.json"))
          (package-meta (call-with-input-file package.json read-json)))
-    (assoc-ref package-meta "name")))
+    (jsobject-ref package-meta "name")))
 
 (define (index-modules input-paths)
   (define (list-modules directory)
@@ -74,27 +162,26 @@ (define* (patch-dependencies #:key inputs #:allow-other-keys)
 
   (define index (index-modules (map cdr inputs)))
 
-  (define (resolve-dependencies package-meta meta-key)
-    (fold (lambda (key+value acc)
-            (match key+value
-              ('@ acc)
-              ((key . value) (acons key (hash-ref index key value) acc))))
-          '()
-          (or (assoc-ref package-meta meta-key) '())))
-
-  (with-atomic-file-replacement "package.json"
-    (lambda (in out)
-      (let ((package-meta (read-json in)))
-        (assoc-set! package-meta "dependencies"
-                    (append
-                     '(@)
-                     (resolve-dependencies package-meta "dependencies")
-                     (resolve-dependencies package-meta "peerDependencies")))
-        (assoc-set! package-meta "devDependencies"
-                    (append
-                     '(@)
-                     (resolve-dependencies package-meta "devDependencies")))
-        (write-json package-meta out))))
+  (define resolve-dependencies
+    (match-lambda
+      (('@ . alist)
+       (cons '@ (map (match-lambda
+                       ((key . value)
+                        (cons key (hash-ref index key value))))
+                     alist)))))
+
+  (with-atomic-json-file-replacement "package.json"
+    (lambda (pkg-meta)
+      (jsobject-update*
+       pkg-meta
+       `("devDependencies" ,resolve-dependencies (@))
+       `("dependencies" ,(lambda (deps)
+                           (resolve-dependencies
+                            (jsobject-union
+                             (lambda (k a b) b)
+                             (jsobject-ref pkg-meta "peerDependencies" '(@))
+                             deps)))
+         (@)))))
   #t)
 
 (define* (delete-lockfiles #:key inputs #:allow-other-keys)
@@ -115,9 +202,7 @@ (define* (configure #:key outputs inputs #:allow-other-keys)
 
 (define* (build #:key inputs #:allow-other-keys)
   (let ((package-meta (call-with-input-file "package.json" read-json)))
-    (if (and=> (assoc-ref package-meta "scripts")
-               (lambda (scripts)
-                 (assoc-ref scripts "build")))
+    (if (jsobject-ref (jsobject-ref package-meta "scripts" '(@)) "build" #f)
         (let ((npm (string-append (assoc-ref inputs "node") "/bin/npm")))
           (invoke npm "run" "build"))
         (format #t "there is no build script to run~%"))
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 04/41] guix: node-build-system: Add avoid-node-gyp-rebuild phase.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (2 preceding siblings ...)
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 03/41] guix: node-build-system: Add JSON utilities Philip McGrath
@ 2021-12-30  7:38                                                                           ` Philip McGrath
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 05/41] guix: node-build-system: Add 'delete-dependencies' helper function Philip McGrath
                                                                                             ` (38 subsequent siblings)
  42 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:38 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* guix/build/node-build-system.scm (avoid-node-gyp-rebuild): New
function. Override the default install script for packages with
native addons to prevent it from attempting to write to the store
when such packages are used.
(%standard-phases): Add 'avoid-node-gyp-rebuild' after 'install'.
---
 guix/build/node-build-system.scm | 50 +++++++++++++++++++++++++++++++-
 1 file changed, 49 insertions(+), 1 deletion(-)

diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
index e5c4da5091..dc8b6a41c2 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -380,6 +380,53 @@ (define* (install #:key outputs inputs #:allow-other-keys)
             "install" "../package.tgz")
     #t))
 
+(define* (avoid-node-gyp-rebuild #:key outputs #:allow-other-keys)
+  "Adjust the installed 'package.json' to remove an 'install' script that
+would try to run 'node-gyp rebuild'."
+  ;; We want to take advantage of `npm install`'s automatic support for
+  ;; building native addons with node-gyp: in particular, it helps us avoid
+  ;; hard-coding the specifics of how npm's internal copy of node-gyp is
+  ;; currently packaged. However, the mechanism by which the automatic support
+  ;; is implemented causes problems for us.
+  ;;
+  ;; If a package contains a 'binding.gyp' file and does not define an
+  ;; 'install' or 'preinstall' script, 'npm install' runs a default install
+  ;; script consisting of 'node-gyp rebuild'. In our 'install' phase, this
+  ;; implicit 'install' script, if it is applicable, is explicitly added to
+  ;; the "package.json" file. However, if another Guix package were to use a
+  ;; Node.js package with such an 'install' script, the dependent package's
+  ;; build process would fail, because 'node-gyp rebuild' would try to write
+  ;; to the store.
+  ;;
+  ;; Here, if the installed "package.json" defines scripts.install as
+  ;; "node-gyp rebuild", we replace it with a no-op. Importantly, deleting the
+  ;; install script definition would not be enough, because the default
+  ;; install script would cause the same problem.
+  ;;
+  ;; 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")))
+  ;; not with-atomic-json-file-replacement, because we usually don't
+  ;; want or need to overwrite it
+  (define pkg-meta
+    (call-with-input-file installed-package.json read-json))
+  (define scripts
+    (jsobject-ref pkg-meta "scripts" '(@)))
+  (when (equal? "node-gyp rebuild" (jsobject-ref scripts "install" #f))
+    (call-with-output-file installed-package.json
+      (lambda (out)
+        (write-json
+         (jsobject-set pkg-meta
+                       "scripts"
+                       (jsobject-set scripts
+                                     "install"
+                                     "echo Guix: avoiding node-gyp rebuild"))
+         out)))))
+
 (define %standard-phases
   (modify-phases gnu:%standard-phases
     (add-after 'unpack 'set-home set-home)
@@ -389,7 +436,8 @@ (define %standard-phases
     (replace 'build build)
     (replace 'check check)
     (add-before 'install 'repack repack)
-    (replace 'install install)))
+    (replace 'install install)
+    (add-after 'install 'avoid-node-gyp-rebuild avoid-node-gyp-rebuild)))
 
 (define* (node-build #:key inputs (phases %standard-phases)
                      #:allow-other-keys #:rest args)
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 04/41] guix: node-build-system: Add avoid-node-gyp-rebuild phase.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (7 preceding siblings ...)
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 03/41] guix: node-build-system: Add JSON utilities Liliana Marie Prikler
@ 2021-12-30  7:38 ` Liliana Marie Prikler
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 05/41] guix: node-build-system: Add 'delete-dependencies' helper function Liliana Marie Prikler
                   ` (37 subsequent siblings)
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:38 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

Packages with native addons currently try to write to store paths
when used as dependecies.  This patch adds a phase to replace that
behaviour with a no-op.

* guix/build/node-build-system.scm (avoid-node-gyp-rebuild): New
variable.
(%standard-phases): Add 'avoid-node-gyp-rebuild' after 'install'.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 guix/build/node-build-system.scm | 54 +++++++++++++++++++++++++++++++-
 1 file changed, 53 insertions(+), 1 deletion(-)

diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
index c6602b876b..49b3db34ad 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -239,6 +239,57 @@ (define* (install #:key outputs inputs #:allow-other-keys)
             "install" "../package.tgz")
     #t))
 
+(define* (avoid-node-gyp-rebuild #:key outputs #:allow-other-keys)
+  "Adjust the installed 'package.json' to remove an 'install' script that
+would try to run 'node-gyp rebuild'."
+  ;; We want to take advantage of `npm install`'s automatic support for
+  ;; building native addons with node-gyp: in particular, it helps us avoid
+  ;; hard-coding the specifics of how npm's internal copy of node-gyp is
+  ;; currently packaged. However, the mechanism by which the automatic support
+  ;; is implemented causes problems for us.
+  ;;
+  ;; If a package contains a 'binding.gyp' file and does not define an
+  ;; 'install' or 'preinstall' script, 'npm install' runs a default install
+  ;; script consisting of 'node-gyp rebuild'. In our 'install' phase, this
+  ;; implicit 'install' script, if it is applicable, is explicitly added to
+  ;; the "package.json" file. However, if another Guix package were to use a
+  ;; Node.js package with such an 'install' script, the dependent package's
+  ;; build process would fail, because 'node-gyp rebuild' would try to write
+  ;; to the store.
+  ;;
+  ;; Here, if the installed "package.json" defines scripts.install as
+  ;; "node-gyp rebuild", we replace it with a no-op. Importantly, deleting the
+  ;; install script definition would not be enough, because the default
+  ;; install script would cause the same problem.
+  ;;
+  ;; 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 read-json))
+  (define scripts
+    (jsobject-ref pkg-meta "scripts" '(@)))
+  (define (jsobject-set js key val)
+    (jsobject-update* js (list key (const val))))
+
+  (when (equal? "node-gyp rebuild" (jsobject-ref scripts "install" #f))
+    (call-with-output-file installed-package.json
+      (lambda (out)
+        (write-json
+         (jsobject-set pkg-meta
+                       "scripts"
+                       (jsobject-set scripts
+                                     "install"
+                                     "echo Guix: avoiding node-gyp rebuild"))
+         out)))))
+
 (define %standard-phases
   (modify-phases gnu:%standard-phases
     (add-after 'unpack 'set-home set-home)
@@ -248,7 +299,8 @@ (define %standard-phases
     (replace 'build build)
     (replace 'check check)
     (add-before 'install 'repack repack)
-    (replace 'install install)))
+    (replace 'install install)
+    (add-after 'install 'avoid-node-gyp-rebuild avoid-node-gyp-rebuild)))
 
 (define* (node-build #:key inputs (phases %standard-phases)
                      #:allow-other-keys #:rest args)
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 05/41] guix: node-build-system: Add 'delete-dependencies' helper function.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (3 preceding siblings ...)
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 04/41] guix: node-build-system: Add avoid-node-gyp-rebuild phase Philip McGrath
@ 2021-12-30  7:38                                                                           ` Philip McGrath
  2021-12-30 17:29                                                                             ` Liliana Marie Prikler
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 06/41] gnu: node-semver-bootstrap: Use 'delete-dependencies' Philip McGrath
                                                                                             ` (37 subsequent siblings)
  42 siblings, 1 reply; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:38 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* guix/build/node-build-system.scm (delete-dependencies): New exported
procedure.  Functionally updates a "package.json"-like value by removing
specified npm packages from the "dependencies" and "devDependencies"
objects.
---
 guix/build/node-build-system.scm | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
index dc8b6a41c2..9967223b86 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -27,6 +27,7 @@ (define-module (guix build node-build-system)
   #:use-module (srfi srfi-1)
   #:export (%standard-phases
             with-atomic-json-file-replacement
+            delete-dependencies
             node-build))
 
 ;; Commentary:
@@ -325,6 +326,23 @@ (define resolve-dependencies
                                deps))))))
   #t)
 
+(define (delete-dependencies pkg-meta absent-dependencies)
+  "Functionally update PKG-META, a json object corresponding to a
+'package.json' file, to allow building without the ABSENT-DEPENDENCIES.  To
+avoid reintroducing the ABSENT-DEPENDENCIES, only use this procedure after the
+'patch-dependencies' phase."
+  (define delete-fom-jsobject
+    (match-lambda
+      (('@ . alist)
+       (cons '@ (filter (match-lambda
+                          ((k . v)
+                           (not (member k absent-dependencies))))
+                        alist)))))
+  (jsobject-update*
+   pkg-meta
+   "devDependencies" '(@) delete-fom-jsobject
+   "dependencies" '(@) delete-fom-jsobject))
+
 (define* (delete-lockfiles #:key inputs #:allow-other-keys)
   "Delete 'package-lock.json', 'yarn.lock', and 'npm-shrinkwrap.json', if they
 exist."
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 05/41] guix: node-build-system: Add 'delete-dependencies' helper function.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (8 preceding siblings ...)
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 04/41] guix: node-build-system: Add avoid-node-gyp-rebuild phase Liliana Marie Prikler
@ 2021-12-30  7:38 ` Liliana Marie Prikler
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 06/41] gnu: node-semver-bootstrap: Use 'delete-dependencies' Liliana Marie Prikler
                   ` (36 subsequent siblings)
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:38 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

Many node packages currently skip the configure phase, because they lack
both dependencies and a convenient way to build without all of them, e.g.
for the purposes of bootstrapping.  This patch adds a big hammer to flatten
these nails.

* guix/build/node-build-system.scm (delete-dependencies): New variable.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 guix/build/node-build-system.scm | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
index 49b3db34ad..75bded73af 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -25,11 +25,13 @@ (define-module (guix build node-build-system)
   #:use-module (guix build utils)
   #:use-module (guix build json)
   #:use-module (ice-9 ftw)
+  #:use-module (ice-9 regex)
   #:use-module (ice-9 match)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-71)
   #:export (%standard-phases
             with-atomic-json-file-replacement
+            delete-dependencies
             node-build))
 
 (define (with-atomic-json-file-replacement file proc)
@@ -184,6 +186,30 @@ (define resolve-dependencies
          (@)))))
   #t)
 
+(define (delete-dependencies unwanted)
+  "Rewrite package.json to remove UNWANTED dependencies.  Unwanted dependencies
+can be specified as regular expressions to exclude a range of related
+dependencies, e.g. \"tap\" excludes all dependencies including \"tap\" in their
+name, but \"^tap$\" explicitly excludes \"tap\"."
+  (define delete-from-jsobject
+    (match-lambda
+      (('@ . alist)
+       (cons '@ (filter (match-lambda
+                          ((k . v)
+                           (not (any
+                                 (lambda (pattern)
+                                   (string-match pattern k))
+                                 unwanted))))
+                        alist)))))
+
+  (with-atomic-json-file-replacement "package.json"
+    (lambda (pkg-meta)
+      (jsobject-update*
+       pkg-meta
+       `("peerDependencies" ,delete-from-jsobject (@))
+       `("devDependencies" ,delete-from-jsobject (@))
+       `("dependencies" ,delete-from-jsobject (@))))))
+
 (define* (delete-lockfiles #:key inputs #:allow-other-keys)
   "Delete 'package-lock.json', 'yarn.lock', and 'npm-shrinkwrap.json', if they
 exist."
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 06/41] gnu: node-semver-bootstrap: Use 'delete-dependencies'.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (4 preceding siblings ...)
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 05/41] guix: node-build-system: Add 'delete-dependencies' helper function Philip McGrath
@ 2021-12-30  7:38                                                                           ` Philip McGrath
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 07/41] gnu: node-ms-bootstrap: " Philip McGrath
                                                                                             ` (36 subsequent siblings)
  42 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:38 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node.scm (node-semver-bootstrap)[arguments]: Use
'delete-dependencies'. Stop deleting the 'configure' phase.
---
 gnu/packages/node.scm | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 51a393caab..255a92964d 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -346,7 +346,11 @@ (define-public node-semver-bootstrap
        #:tests? #f
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure))))
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (with-atomic-json-file-replacement "package.json"
+               (lambda (pkg-meta)
+                 (delete-dependencies pkg-meta '("tap")))))))))
     (home-page "https://github.com/npm/node-semver")
     (properties '((hidden? . #t)))
     (synopsis "Parses semantic versions strings")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 06/41] gnu: node-semver-bootstrap: Use 'delete-dependencies'.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (9 preceding siblings ...)
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 05/41] guix: node-build-system: Add 'delete-dependencies' helper function Liliana Marie Prikler
@ 2021-12-30  7:38 ` Liliana Marie Prikler
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 07/41] gnu: node-ms-bootstrap: " Liliana Marie Prikler
                   ` (35 subsequent siblings)
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:38 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

gnu/packages/node.scm (node-semver-bootstrap)[arguments]: Use
'delete-dependencies'.  Stop deleting the 'configure' phase.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 gnu/packages/node.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 51a393caab..47d5c3ecdb 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -346,7 +346,9 @@ (define-public node-semver-bootstrap
        #:tests? #f
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure))))
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies '("^tap$")))))))
     (home-page "https://github.com/npm/node-semver")
     (properties '((hidden? . #t)))
     (synopsis "Parses semantic versions strings")
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 07/41] gnu: node-ms-bootstrap: Use 'delete-dependencies'.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (5 preceding siblings ...)
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 06/41] gnu: node-semver-bootstrap: Use 'delete-dependencies' Philip McGrath
@ 2021-12-30  7:38                                                                           ` Philip McGrath
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 08/41] gnu: node-binary-search-bootstrap: " Philip McGrath
                                                                                             ` (35 subsequent siblings)
  42 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:38 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node.scm (node-ms-bootstrap)[arguments]: Use
'delete-dependencies'. Stop deleting the 'configure' phase.
---
 gnu/packages/node.scm | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 255a92964d..e5a1c58140 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -379,7 +379,15 @@ (define-public node-ms-bootstrap
        #:tests? #f
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure))))
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (with-atomic-json-file-replacement "package.json"
+               (lambda (pkg-meta)
+                 (delete-dependencies pkg-meta '("eslint"
+                                                 "expect.js"
+                                                 "husky"
+                                                 "lint-staged"
+                                                 "mocha")))))))))
     (home-page "https://github.com/zeit/ms#readme")
     (properties '((hidden? . #t)))
     (synopsis "Tiny millisecond conversion utility")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 07/41] gnu: node-ms-bootstrap: Use 'delete-dependencies'.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (10 preceding siblings ...)
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 06/41] gnu: node-semver-bootstrap: Use 'delete-dependencies' Liliana Marie Prikler
@ 2021-12-30  7:38 ` Liliana Marie Prikler
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 08/41] gnu: node-binary-search-bootstrap: " Liliana Marie Prikler
                   ` (34 subsequent siblings)
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:38 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

gnu/packages/node.scm (node-ms-bootstrap)[arguments]: Use
'delete-dependencies'.  Stop deleting the 'configure' phase.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 gnu/packages/node.scm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 47d5c3ecdb..9a5739b5de 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -377,7 +377,13 @@ (define-public node-ms-bootstrap
        #:tests? #f
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure))))
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies '("^eslint$"
+                                    "^expect\\.js$"
+                                    "^husky$"
+                                    "^lint-staged$"
+                                    "^mocha$")))))))
     (home-page "https://github.com/zeit/ms#readme")
     (properties '((hidden? . #t)))
     (synopsis "Tiny millisecond conversion utility")
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 08/41] gnu: node-binary-search-bootstrap: Use 'delete-dependencies'.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (6 preceding siblings ...)
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 07/41] gnu: node-ms-bootstrap: " Philip McGrath
@ 2021-12-30  7:38                                                                           ` Philip McGrath
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 09/41] gnu: node-debug-bootstrap: " Philip McGrath
                                                                                             ` (34 subsequent siblings)
  42 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:38 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node.scm (node-binary-search-bootstrap)[arguments]: Use
'delete-dependencies'. Stop deleting the 'configure' phase.
---
 gnu/packages/node.scm | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index e5a1c58140..32f7c8f980 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -415,7 +415,12 @@ (define-public node-binary-search-bootstrap
        #:tests? #f
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure))))
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (with-atomic-json-file-replacement "package.json"
+               (lambda (pkg-meta)
+                 (delete-dependencies pkg-meta `("chai"
+                                                 "mocha")))))))))
     (home-page "https://github.com/darkskyapp/binary-search#readme")
     (properties '((hidden? . #t)))
     (synopsis "Tiny binary search function with comparators")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 08/41] gnu: node-binary-search-bootstrap: Use 'delete-dependencies'.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (11 preceding siblings ...)
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 07/41] gnu: node-ms-bootstrap: " Liliana Marie Prikler
@ 2021-12-30  7:38 ` Liliana Marie Prikler
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 09/41] gnu: node-debug-bootstrap: " Liliana Marie Prikler
                   ` (33 subsequent siblings)
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:38 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

gnu/packages/node.scm (node-binary-search-bootstrap)[arguments]: Use
'delete-dependencies'.  Stop deleting the 'configure' phase.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 gnu/packages/node.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 9a5739b5de..0974c5647a 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -411,7 +411,9 @@ (define-public node-binary-search-bootstrap
        #:tests? #f
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure))))
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies `("^(chai\|mocha)$")))))))
     (home-page "https://github.com/darkskyapp/binary-search#readme")
     (properties '((hidden? . #t)))
     (synopsis "Tiny binary search function with comparators")
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 09/41] gnu: node-debug-bootstrap: Use 'delete-dependencies'.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (7 preceding siblings ...)
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 08/41] gnu: node-binary-search-bootstrap: " Philip McGrath
@ 2021-12-30  7:38                                                                           ` Philip McGrath
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 10/41] gnu: node-llparse-builder-bootstrap: " Philip McGrath
                                                                                             ` (33 subsequent siblings)
  42 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:38 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node.scm (node-debug-bootstrap)[arguments]: Use
'delete-dependencies'. Stop deleting the 'configure' phase.
---
 gnu/packages/node.scm | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 32f7c8f980..6e37097f5e 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -447,7 +447,22 @@ (define-public node-debug-bootstrap
        #:tests? #f
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure))))
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (with-atomic-json-file-replacement "package.json"
+               (lambda (pkg-meta)
+                 (delete-dependencies pkg-meta
+                                      `("brfs"
+                                        "browserify"
+                                        "coveralls"
+                                        "istanbul"
+                                        "karma"
+                                        "karma-browserify"
+                                        "karma-chrome-launcher"
+                                        "karma-mocha"
+                                        "mocha"
+                                        "mocha-lcov-reporter"
+                                        "xo")))))))))
     (inputs (list node-ms-bootstrap))
     (home-page "https://github.com/visionmedia/debug#readme")
     (properties '((hidden? . #t)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 09/41] gnu: node-debug-bootstrap: Use 'delete-dependencies'.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (12 preceding siblings ...)
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 08/41] gnu: node-binary-search-bootstrap: " Liliana Marie Prikler
@ 2021-12-30  7:38 ` Liliana Marie Prikler
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 10/41] gnu: node-llparse-builder-bootstrap: " Liliana Marie Prikler
                   ` (32 subsequent siblings)
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:38 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

gnu/packages/node.scm (node-debug-bootstrap)[arguments]: Use
'delete-dependencies'.  Stop deleting the 'configure' phase.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 gnu/packages/node.scm | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 0974c5647a..0b8d958e80 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -440,7 +440,15 @@ (define-public node-debug-bootstrap
        #:tests? #f
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure))))
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies `("^brfs$"
+                                    "^browserify$"
+                                    "^coveralls$"
+                                    "^istanbul$"
+                                    "^karma"
+                                    "^mocha"
+                                    "^xo$")))))))
     (inputs (list node-ms-bootstrap))
     (home-page "https://github.com/visionmedia/debug#readme")
     (properties '((hidden? . #t)))
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 10/41] gnu: node-llparse-builder-bootstrap: Use 'delete-dependencies'.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (8 preceding siblings ...)
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 09/41] gnu: node-debug-bootstrap: " Philip McGrath
@ 2021-12-30  7:38                                                                           ` Philip McGrath
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 11/41] gnu: node-llparse-frontend-bootstrap: " Philip McGrath
                                                                                             ` (32 subsequent siblings)
  42 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:38 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node.scm (node-llparse-builder-bootstrap)[arguments]: Use
'delete-dependencies'. Stop deleting the 'configure' phase.
---
 gnu/packages/node.scm | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 6e37097f5e..0563d9c290 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -516,7 +516,16 @@ (define-public node-llparse-builder-bootstrap
        #:tests? #f
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure)
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (with-atomic-json-file-replacement "package.json"
+               (lambda (pkg-meta)
+                 (delete-dependencies pkg-meta `("@types/mocha"
+                                                 "@types/node"
+                                                 "mocha"
+                                                 "ts-node"
+                                                 "tslint"
+                                                 "typescript"))))))
          (replace 'build
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((esbuild (search-input-file inputs "/bin/esbuild")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 10/41] gnu: node-llparse-builder-bootstrap: Use 'delete-dependencies'.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (13 preceding siblings ...)
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 09/41] gnu: node-debug-bootstrap: " Liliana Marie Prikler
@ 2021-12-30  7:38 ` Liliana Marie Prikler
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 11/41] gnu: node-llparse-frontend-bootstrap: " Liliana Marie Prikler
                   ` (31 subsequent siblings)
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:38 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

gnu/packages/node.scm (node-llparse-builder-bootstrap)[arguments]: Use
'delete-dependencies'.  Stop deleting the 'configure' phase.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 gnu/packages/node.scm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 0b8d958e80..c86fcc36f5 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -502,7 +502,13 @@ (define-public node-llparse-builder-bootstrap
        #:tests? #f
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure)
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda _
+             (delete-dependencies `("^@types/node$"
+                                    "mocha$"
+                                    "^ts-node$"
+                                    "^tslint$"
+                                    "^typescript$"))))
          (replace 'build
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((esbuild (search-input-file inputs "/bin/esbuild")))
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 11/41] gnu: node-llparse-frontend-bootstrap: Use 'delete-dependencies'.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (9 preceding siblings ...)
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 10/41] gnu: node-llparse-builder-bootstrap: " Philip McGrath
@ 2021-12-30  7:38                                                                           ` Philip McGrath
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 12/41] gnu: node-llparse-bootstrap: " Philip McGrath
                                                                                             ` (31 subsequent siblings)
  42 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:38 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node.scm (node-llparse-frontend-bootstrap)[arguments]:  Use
'delete-dependencies'. Stop deleting the 'configure' phase.
---
 gnu/packages/node.scm | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 0563d9c290..b132ce730b 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -579,7 +579,17 @@ (define-public node-llparse-frontend-bootstrap
        #:tests? #f
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure)
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (with-atomic-json-file-replacement "package.json"
+               (lambda (pkg-meta)
+                 (delete-dependencies pkg-meta `("@types/debug"
+                                                 "@types/mocha"
+                                                 "@types/node"
+                                                 "mocha"
+                                                 "ts-node"
+                                                 "tslint"
+                                                 "typescript"))))))
          (replace 'build
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((esbuild (search-input-file inputs "/bin/esbuild")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 11/41] gnu: node-llparse-frontend-bootstrap: Use 'delete-dependencies'.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (14 preceding siblings ...)
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 10/41] gnu: node-llparse-builder-bootstrap: " Liliana Marie Prikler
@ 2021-12-30  7:38 ` Liliana Marie Prikler
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 12/41] gnu: node-llparse-bootstrap: " Liliana Marie Prikler
                   ` (30 subsequent siblings)
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:38 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

gnu/packages/node.scm (node-llparse-frontend-bootstrap)[arguments]:  Use
'delete-dependencies'.  Stop deleting the 'configure' phase.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 gnu/packages/node.scm | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index c86fcc36f5..398982a7b0 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -562,7 +562,15 @@ (define-public node-llparse-frontend-bootstrap
        #:tests? #f
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure)
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies `("^@types/debug$"
+                                    "^@types/mocha$"
+                                    "^@types/node$"
+                                    "^mocha$"
+                                    "^ts-node$"
+                                    "^tslint$"
+                                    "^typescript$"))))
          (replace 'build
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((esbuild (search-input-file inputs "/bin/esbuild")))
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 12/41] gnu: node-llparse-bootstrap: Use 'delete-dependencies'.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (10 preceding siblings ...)
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 11/41] gnu: node-llparse-frontend-bootstrap: " Philip McGrath
@ 2021-12-30  7:38                                                                           ` Philip McGrath
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 13/41] gnu: node-semver: " Philip McGrath
                                                                                             ` (30 subsequent siblings)
  42 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:38 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node.scm (node-llparse-bootstrap)[arguments]: Use
'delete-dependencies'. Stop deleting the 'configure' phase.
---
 gnu/packages/node.scm | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index b132ce730b..5a4401e779 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -642,7 +642,20 @@ (define-public node-llparse-bootstrap
        #:tests? #f
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure)
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (with-atomic-json-file-replacement "package.json"
+               (lambda (pkg-meta)
+                 (delete-dependencies pkg-meta
+                                      `("@types/debug"
+                                        "@types/mocha"
+                                        "@types/node"
+                                        "esm"
+                                        "llparse-test-fixture"
+                                        "mocha"
+                                        "ts-node"
+                                        "tslint"
+                                        "typescript"))))))
          (replace 'build
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((esbuild (search-input-file inputs "/bin/esbuild")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 12/41] gnu: node-llparse-bootstrap: Use 'delete-dependencies'.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (15 preceding siblings ...)
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 11/41] gnu: node-llparse-frontend-bootstrap: " Liliana Marie Prikler
@ 2021-12-30  7:38 ` Liliana Marie Prikler
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 13/41] gnu: node-semver: " Liliana Marie Prikler
                   ` (29 subsequent siblings)
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:38 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

gnu/packages/node.scm (node-llparse-bootstrap)[arguments]: Use
'delete-dependencies'.  Stop deleting the 'configure' phase.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 gnu/packages/node.scm | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 398982a7b0..49e6323a9d 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -623,7 +623,17 @@ (define-public node-llparse-bootstrap
        #:tests? #f
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure)
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies `("^@types/debug$"
+                                    "^@types/mocha$"
+                                    "^@types/node$"
+                                    "^esm$"
+                                    "^llparse-test-fixture$"
+                                    "^mocha$"
+                                    "^ts-node$"
+                                    "^tslint$"
+                                    "^typescript$"))))
          (replace 'build
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((esbuild (search-input-file inputs "/bin/esbuild")))
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 13/41] gnu: node-semver: Use 'delete-dependencies'.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (11 preceding siblings ...)
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 12/41] gnu: node-llparse-bootstrap: " Philip McGrath
@ 2021-12-30  7:38                                                                           ` Philip McGrath
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 14/41] gnu: node-wrappy: " Philip McGrath
                                                                                             ` (29 subsequent siblings)
  42 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:38 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node-xyz.scm (node-semver)[arguments]: Use
'delete-dependencies'. Stop deleting the 'configure' phase.
---
 gnu/packages/node-xyz.scm | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 9a0be96852..08a22f4aff 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -288,11 +288,15 @@ (define-public node-semver
                 "06biknqb05r9xsmcflm3ygh50pjvdk84x6r79w43kmck4fn3qn5p"))))
     (build-system node-build-system)
     (arguments
-     '(#:tests? #f ; FIXME: Tests depend on node-tap
-       #:phases
+     '(#:phases
        (modify-phases %standard-phases
-         ;; The only dependency to check for is tap, which we don't have.
-         (delete 'configure))))
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (with-atomic-json-file-replacement "package.json"
+               (lambda (pkg-meta)
+                 (delete-dependencies pkg-meta '("tap")))))))
+       ;; FIXME: Tests depend on node-tap
+       #:tests? #f))
     (home-page "https://github.com/npm/node-semver")
     (synopsis "Parses semantic versions strings")
     (description
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 13/41] gnu: node-semver: Use 'delete-dependencies'.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (16 preceding siblings ...)
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 12/41] gnu: node-llparse-bootstrap: " Liliana Marie Prikler
@ 2021-12-30  7:38 ` Liliana Marie Prikler
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 14/41] gnu: node-wrappy: " Liliana Marie Prikler
                   ` (28 subsequent siblings)
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:38 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

gnu/packages/node-xyz.scm (node-semver)[arguments]: Use
'delete-dependencies'.  Stop deleting the 'configure' phase.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 gnu/packages/node-xyz.scm | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 9a0be96852..1dbae8b0d2 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -288,11 +288,13 @@ (define-public node-semver
                 "06biknqb05r9xsmcflm3ygh50pjvdk84x6r79w43kmck4fn3qn5p"))))
     (build-system node-build-system)
     (arguments
-     '(#:tests? #f ; FIXME: Tests depend on node-tap
-       #:phases
+     '(#:phases
        (modify-phases %standard-phases
-         ;; The only dependency to check for is tap, which we don't have.
-         (delete 'configure))))
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies '("^tap$")))))
+       ;; FIXME: Tests depend on node-tap
+       #:tests? #f))
     (home-page "https://github.com/npm/node-semver")
     (synopsis "Parses semantic versions strings")
     (description
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 14/41] gnu: node-wrappy: Use 'delete-dependencies'.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (12 preceding siblings ...)
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 13/41] gnu: node-semver: " Philip McGrath
@ 2021-12-30  7:38                                                                           ` Philip McGrath
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 15/41] gnu: node-once: " Philip McGrath
                                                                                             ` (28 subsequent siblings)
  42 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:38 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node-xyz.scm (node-wrappy)[arguments]: Use
'delete-dependencies'. Stop deleting the 'configure' phase.
---
 gnu/packages/node-xyz.scm | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 08a22f4aff..da855cb16e 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -322,8 +322,11 @@ (define-public node-wrappy
      '(#:tests? #f ; FIXME: Tests depend on node-tap
        #:phases
        (modify-phases %standard-phases
-         ;; The only dependency to check for is tap, which we don't have.
-         (delete 'configure))))
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (with-atomic-json-file-replacement "package.json"
+               (lambda (pkg-meta)
+                 (delete-dependencies pkg-meta '("tap")))))))))
     (home-page "https://github.com/npm/wrappy")
     (synopsis "Callback wrapping utility")
     (description "@code{wrappy} is a utility for Node.js to wrap callbacks.")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 14/41] gnu: node-wrappy: Use 'delete-dependencies'.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (17 preceding siblings ...)
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 13/41] gnu: node-semver: " Liliana Marie Prikler
@ 2021-12-30  7:38 ` Liliana Marie Prikler
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 15/41] gnu: node-once: " Liliana Marie Prikler
                   ` (27 subsequent siblings)
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:38 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

gnu/packages/node-xyz.scm (node-wrappy)[arguments]: Use
'delete-dependencies'.  Stop deleting the 'configure' phase.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 gnu/packages/node-xyz.scm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 1dbae8b0d2..de11351f88 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -320,8 +320,9 @@ (define-public node-wrappy
      '(#:tests? #f ; FIXME: Tests depend on node-tap
        #:phases
        (modify-phases %standard-phases
-         ;; The only dependency to check for is tap, which we don't have.
-         (delete 'configure))))
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies '("^tap$")))))))
     (home-page "https://github.com/npm/wrappy")
     (synopsis "Callback wrapping utility")
     (description "@code{wrappy} is a utility for Node.js to wrap callbacks.")
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 15/41] gnu: node-once: Use 'delete-dependencies'.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (13 preceding siblings ...)
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 14/41] gnu: node-wrappy: " Philip McGrath
@ 2021-12-30  7:38                                                                           ` Philip McGrath
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 16/41] gnu: node-irc-colors: " Philip McGrath
                                                                                             ` (27 subsequent siblings)
  42 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:38 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node-xyz.scm (node-once)[arguments]: Use
'delete-dependencies'. Stop deleting the 'configure' phase.
---
 gnu/packages/node-xyz.scm | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index da855cb16e..ef251c07bf 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -347,13 +347,15 @@ (define-public node-once
                 "1z8dcbf28dqdcp4wb0c53wrs90a07nkrax2c9kk26dsk1dhrnxav"))))
     (build-system node-build-system)
     (arguments
-     '(#:tests? #f                      ; FIXME: tests depend on node-tap
-       #:phases
+     '(#:phases
        (modify-phases %standard-phases
-         ;; The default configure phase fails due to tap being missing, as we do
-         ;; not have tap packaged yet.  It is used only for tests.  This package
-         ;; still works as a dependency of node-glob and node-inflight.
-         (delete 'configure))))
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (with-atomic-json-file-replacement "package.json"
+               (lambda (pkg-meta)
+                 (delete-dependencies pkg-meta '("tap")))))))
+       ;; FIXME: Tests depend on node-tap
+       #:tests? #f))
     (inputs
      (list node-wrappy))
     (home-page "https://github.com/isaacs/once")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 15/41] gnu: node-once: Use 'delete-dependencies'.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (18 preceding siblings ...)
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 14/41] gnu: node-wrappy: " Liliana Marie Prikler
@ 2021-12-30  7:38 ` Liliana Marie Prikler
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 16/41] gnu: node-irc-colors: " Liliana Marie Prikler
                   ` (26 subsequent siblings)
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:38 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

gnu/packages/node-xyz.scm (node-once)[arguments]: Use
'delete-dependencies'.  Stop deleting the 'configure' phase.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 gnu/packages/node-xyz.scm | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index de11351f88..75f163a849 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -343,13 +343,13 @@ (define-public node-once
                 "1z8dcbf28dqdcp4wb0c53wrs90a07nkrax2c9kk26dsk1dhrnxav"))))
     (build-system node-build-system)
     (arguments
-     '(#:tests? #f                      ; FIXME: tests depend on node-tap
-       #:phases
+     '(#:phases
        (modify-phases %standard-phases
-         ;; The default configure phase fails due to tap being missing, as we do
-         ;; not have tap packaged yet.  It is used only for tests.  This package
-         ;; still works as a dependency of node-glob and node-inflight.
-         (delete 'configure))))
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies '("^tap$")))))
+       ;; FIXME: Tests depend on node-tap
+       #:tests? #f))
     (inputs
      (list node-wrappy))
     (home-page "https://github.com/isaacs/once")
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 16/41] gnu: node-irc-colors: Use 'delete-dependencies'.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (14 preceding siblings ...)
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 15/41] gnu: node-once: " Philip McGrath
@ 2021-12-30  7:38                                                                           ` Philip McGrath
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 17/41] gnu: node-irc: " Philip McGrath
                                                                                             ` (26 subsequent siblings)
  42 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:38 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node-xyz.scm (node-irc-colors)[arguments]: Use
'delete-dependencies'. Stop deleting the 'configure' phase.
---
 gnu/packages/node-xyz.scm | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index ef251c07bf..f9c7f7ac2a 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -381,12 +381,15 @@ (define-public node-irc-colors
                 "0q3y34rbnlc55jcakmdxkicwazyvyph9r6gaf6hi8k7wj2nfwfli"))))
     (build-system node-build-system)
     (arguments
-     '(#:tests? #f                      ; FIXME: tests depend on node-istanbul
-       #:phases
+     '(#:phases
        (modify-phases %standard-phases
-         ;; The default configure phase fails due to various packages
-         ;; being missing, as we don't have them packaged yet.
-         (delete 'configure))))
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (with-atomic-json-file-replacement "package.json"
+               (lambda (pkg-meta)
+                 (delete-dependencies pkg-meta `("istanbul"
+                                                 "vows")))))))
+       #:tests? #f))
     (home-page "https://github.com/fent/irc-colors.js")
     (synopsis "Node.js module providing color and formatting for IRC")
     (description "@code{node-irc-colors} is a Node.js module that
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 16/41] gnu: node-irc-colors: Use 'delete-dependencies'.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (19 preceding siblings ...)
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 15/41] gnu: node-once: " Liliana Marie Prikler
@ 2021-12-30  7:38 ` Liliana Marie Prikler
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 17/41] gnu: node-irc: " Liliana Marie Prikler
                   ` (25 subsequent siblings)
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:38 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

gnu/packages/node-xyz.scm (node-irc-colors)[arguments]: Use
'delete-dependencies'.  Stop deleting the 'configure' phase.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 gnu/packages/node-xyz.scm | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 75f163a849..8930c30bed 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -375,12 +375,12 @@ (define-public node-irc-colors
                 "0q3y34rbnlc55jcakmdxkicwazyvyph9r6gaf6hi8k7wj2nfwfli"))))
     (build-system node-build-system)
     (arguments
-     '(#:tests? #f                      ; FIXME: tests depend on node-istanbul
-       #:phases
+     '(#:phases
        (modify-phases %standard-phases
-         ;; The default configure phase fails due to various packages
-         ;; being missing, as we don't have them packaged yet.
-         (delete 'configure))))
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies `("^istanbul$" "^vows$")))))
+       #:tests? #f))
     (home-page "https://github.com/fent/irc-colors.js")
     (synopsis "Node.js module providing color and formatting for IRC")
     (description "@code{node-irc-colors} is a Node.js module that
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 17/41] gnu: node-irc: Use 'delete-dependencies'.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (15 preceding siblings ...)
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 16/41] gnu: node-irc-colors: " Philip McGrath
@ 2021-12-30  7:38                                                                           ` Philip McGrath
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 18/41] gnu: Add node-inherits Philip McGrath
                                                                                             ` (25 subsequent siblings)
  42 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:38 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node-xyz.scm (node-irc)[arguments]: Use
'delete-dependencies'. Stop deleting the 'configure' phase.
---
 gnu/packages/node-xyz.scm | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index f9c7f7ac2a..feea4ca614 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -413,12 +413,17 @@ (define-public node-irc
                 "1ln4qfx20jbwg4cp8lp0vf27m5281z2sz16d15xd6150n26cbi4x"))))
     (build-system node-build-system)
     (arguments
-     '(#:tests? #f                      ; FIXME: tests depend on node-faucet
-       #:phases
+     '(#:phases
        (modify-phases %standard-phases
-         ;; The default configure phase fails due to various packages
-         ;; being missing, as we don't have them packaged yet.
-         (delete 'configure))))
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (with-atomic-json-file-replacement "package.json"
+               (lambda (pkg-meta)
+                 (delete-dependencies pkg-meta `("ansi-color"
+                                                 "faucet"
+                                                 "jscs"
+                                                 "tape")))))))
+       #:tests? #f))
     (inputs
      (list node-irc-colors))
     (home-page "https://github.com/martynsmith/node-irc")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 17/41] gnu: node-irc: Use 'delete-dependencies'.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (20 preceding siblings ...)
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 16/41] gnu: node-irc-colors: " Liliana Marie Prikler
@ 2021-12-30  7:38 ` Liliana Marie Prikler
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 18/41] gnu: Add node-inherits Liliana Marie Prikler
                   ` (24 subsequent siblings)
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:38 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

gnu/packages/node-xyz.scm (node-irc)[arguments]: Use
'delete-dependencies'.  Stop deleting the 'configure' phase.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 gnu/packages/node-xyz.scm | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 8930c30bed..c2bbe441cf 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -404,12 +404,13 @@ (define-public node-irc
                 "1ln4qfx20jbwg4cp8lp0vf27m5281z2sz16d15xd6150n26cbi4x"))))
     (build-system node-build-system)
     (arguments
-     '(#:tests? #f                      ; FIXME: tests depend on node-faucet
-       #:phases
+     '(#:phases
        (modify-phases %standard-phases
-         ;; The default configure phase fails due to various packages
-         ;; being missing, as we don't have them packaged yet.
-         (delete 'configure))))
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies
+              `("^ansi-color$" "^faucet$" "^jscs$" "^tape$")))))
+       #:tests? #f))
     (inputs
      (list node-irc-colors))
     (home-page "https://github.com/martynsmith/node-irc")
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 18/41] gnu: Add node-inherits.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (16 preceding siblings ...)
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 17/41] gnu: node-irc: " Philip McGrath
@ 2021-12-30  7:38                                                                           ` Philip McGrath
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 19/41] gnu: Add node-safe-buffer Philip McGrath
                                                                                             ` (24 subsequent siblings)
  42 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:38 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-inherits): New variable.
---
 gnu/packages/node-xyz.scm | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index feea4ca614..49d99534fb 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2020 Giacomo Leidi <goodoldpaul@autistici.org>
 ;;; Copyright © 2021 Noisytoot <noisytoot@disroot.org>
 ;;; Copyright © 2021 Charles <charles.b.jackson@protonmail.com>
+;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -366,6 +367,40 @@ (define-public node-once
 if desired.")
     (license license:isc)))
 
+(define-public node-inherits
+  (package
+    (name "node-inherits")
+    (version "2.0.4")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/isaacs/inherits")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0cpsr5yqwkxpbbbbl0rwk4mcby6zbx841k2zb4c3gb1579i5wq9p"))))
+    (build-system node-build-system)
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (with-atomic-json-file-replacement "package.json"
+               (lambda (pkg-meta)
+                 (delete-dependencies pkg-meta '("tap")))))))
+       ;; FIXME: Tests depend on node-tap
+       #:tests? #f))
+    (home-page
+     "https://github.com/isaacs/inherits")
+    (synopsis
+     "Browser-friendly inheritance Node.js")
+    (description
+     "Browser-friendly inheritance fully compatible with standard Node.js
+@code{inherits()}.")
+    (license license:isc)))
+
 (define-public node-irc-colors
   (package
     (name "node-irc-colors")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 18/41] gnu: Add node-inherits.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (21 preceding siblings ...)
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 17/41] gnu: node-irc: " Liliana Marie Prikler
@ 2021-12-30  7:38 ` Liliana Marie Prikler
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 19/41] gnu: Add node-safe-buffer Liliana Marie Prikler
                   ` (23 subsequent siblings)
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:38 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1909 bytes --]

* gnu/packages/node-xyz.scm (node-inherits): New variable.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 gnu/packages/node-xyz.scm | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index c2bbe441cf..99e026f9e3 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2020 Giacomo Leidi <goodoldpaul@autistici.org>
 ;;; Copyright © 2021 Noisytoot <noisytoot@disroot.org>
 ;;; Copyright © 2021 Charles <charles.b.jackson@protonmail.com>
+;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -360,6 +361,38 @@ (define-public node-once
 if desired.")
     (license license:isc)))
 
+(define-public node-inherits
+  (package
+    (name "node-inherits")
+    (version "2.0.4")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/isaacs/inherits")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0cpsr5yqwkxpbbbbl0rwk4mcby6zbx841k2zb4c3gb1579i5wq9p"))))
+    (build-system node-build-system)
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies '("^tap$")))))
+       ;; FIXME: Tests depend on node-tap
+       #:tests? #f))
+    (home-page
+     "https://github.com/isaacs/inherits")
+    (synopsis
+     "Browser-friendly inheritance Node.js")
+    (description
+     "Browser-friendly inheritance fully compatible with standard Node.js
+@code{inherits()}.")
+    (license license:isc)))
+
 (define-public node-irc-colors
   (package
     (name "node-irc-colors")
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 19/41] gnu: Add node-safe-buffer.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (17 preceding siblings ...)
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 18/41] gnu: Add node-inherits Philip McGrath
@ 2021-12-30  7:38                                                                           ` Philip McGrath
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 20/41] gnu: Add node-string-decoder Philip McGrath
                                                                                             ` (23 subsequent siblings)
  42 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:38 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-safe-buffer): New variable.
---
 gnu/packages/node-xyz.scm | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 49d99534fb..6b4b7efd7e 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -401,6 +401,39 @@ (define-public node-inherits
 @code{inherits()}.")
     (license license:isc)))
 
+(define-public node-safe-buffer
+  (package
+    (name "node-safe-buffer")
+    (version "5.2.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/feross/safe-buffer")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0r26m0nl41h90ihnl2xf0cqs6z9z7jb87dl5j8yqb7887r9jlbpi"))))
+    (build-system node-build-system)
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (with-atomic-json-file-replacement "package.json"
+               (lambda (pkg-meta)
+                 (delete-dependencies pkg-meta  '("tape"
+                                                  "standard")))))))
+       #:tests? #f))
+    (home-page
+     "https://github.com/feross/safe-buffer")
+    (synopsis "Safer Node.js Buffer API")
+    (description "A safe drop-in replacement the Node.js @code{Buffer} API
+that works in all versions of Node.js, using the built-in implementation when
+available.")
+    (license license:expat)))
+
 (define-public node-irc-colors
   (package
     (name "node-irc-colors")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 19/41] gnu: Add node-safe-buffer.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (22 preceding siblings ...)
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 18/41] gnu: Add node-inherits Liliana Marie Prikler
@ 2021-12-30  7:38 ` Liliana Marie Prikler
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 20/41] gnu: Add node-string-decoder Liliana Marie Prikler
                   ` (22 subsequent siblings)
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:38 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

* gnu/packages/node-xyz.scm (node-safe-buffer): New variable.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 gnu/packages/node-xyz.scm | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 99e026f9e3..38491b4f64 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -393,6 +393,36 @@ (define-public node-inherits
 @code{inherits()}.")
     (license license:isc)))
 
+(define-public node-safe-buffer
+  (package
+    (name "node-safe-buffer")
+    (version "5.2.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/feross/safe-buffer")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0r26m0nl41h90ihnl2xf0cqs6z9z7jb87dl5j8yqb7887r9jlbpi"))))
+    (build-system node-build-system)
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies '("^tape$" "^standard$")))))
+       #:tests? #f))
+    (home-page
+     "https://github.com/feross/safe-buffer")
+    (synopsis "Safer Node.js Buffer API")
+    (description "A safe drop-in replacement the Node.js @code{Buffer} API
+that works in all versions of Node.js, using the built-in implementation when
+available.")
+    (license license:expat)))
+
 (define-public node-irc-colors
   (package
     (name "node-irc-colors")
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 20/41] gnu: Add node-string-decoder.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (18 preceding siblings ...)
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 19/41] gnu: Add node-safe-buffer Philip McGrath
@ 2021-12-30  7:38                                                                           ` Philip McGrath
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 21/41] gnu: Add node-readable-stream Philip McGrath
                                                                                             ` (22 subsequent siblings)
  42 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:38 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-string-decoder): New variable.
---
 gnu/packages/node-xyz.scm | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 6b4b7efd7e..c8a0f79eba 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -434,6 +434,45 @@ (define-public node-safe-buffer
 available.")
     (license license:expat)))
 
+(define-public node-string-decoder
+  (package
+    (name "node-string-decoder")
+    (version "1.3.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nodejs/string_decoder")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0xxvyya9fl9rlkqwmxzqzbz4rdr3jgw4vf37hff7cgscxkhg266k"))))
+    (build-system node-build-system)
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (with-atomic-json-file-replacement "package.json"
+               (lambda (pkg-meta)
+                 (delete-dependencies pkg-meta
+                                      '("tap"
+                                        "core-util-is"
+                                        "babel-polyfill")))))))
+       ;; FIXME: Tests depend on node-tap
+       #:tests? #f))
+    (inputs
+     (list node-safe-buffer node-inherits))
+    (home-page
+     "https://github.com/nodejs/string_decoder")
+    (synopsis
+     "Node.js core @code{string_decoder} for userland")
+    (description
+     "This package is a mirror of the @code{string_decoder} implementation in
+Node-core.")
+    (license license:expat)))
+
 (define-public node-irc-colors
   (package
     (name "node-irc-colors")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 20/41] gnu: Add node-string-decoder.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (23 preceding siblings ...)
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 19/41] gnu: Add node-safe-buffer Liliana Marie Prikler
@ 2021-12-30  7:38 ` Liliana Marie Prikler
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 21/41] gnu: Add node-readable-stream Liliana Marie Prikler
                   ` (21 subsequent siblings)
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:38 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

* gnu/packages/node-xyz.scm (node-string-decoder): New variable.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 gnu/packages/node-xyz.scm | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 38491b4f64..c833356703 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -423,6 +423,41 @@ (define-public node-safe-buffer
 available.")
     (license license:expat)))
 
+(define-public node-string-decoder
+  (package
+    (name "node-string-decoder")
+    (version "1.3.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nodejs/string_decoder")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0xxvyya9fl9rlkqwmxzqzbz4rdr3jgw4vf37hff7cgscxkhg266k"))))
+    (build-system node-build-system)
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies
+              '("^tap$" "^core-util-is$" "^babel-polyfill$")))))
+       ;; FIXME: Tests depend on node-tap
+       #:tests? #f))
+    (inputs
+     (list node-safe-buffer node-inherits))
+    (home-page
+     "https://github.com/nodejs/string_decoder")
+    (synopsis
+     "Node.js core @code{string_decoder} for userland")
+    (description
+     "This package is a mirror of the @code{string_decoder} implementation in
+Node-core.")
+    (license license:expat)))
+
 (define-public node-irc-colors
   (package
     (name "node-irc-colors")
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 21/41] gnu: Add node-readable-stream.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (19 preceding siblings ...)
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 20/41] gnu: Add node-string-decoder Philip McGrath
@ 2021-12-30  7:38                                                                           ` Philip McGrath
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 22/41] gnu: Add node-nan Philip McGrath
                                                                                             ` (21 subsequent siblings)
  42 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:38 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-readable-stream): New variable.
---
 gnu/packages/node-xyz.scm | 58 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index c8a0f79eba..3f0ec35547 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -473,6 +473,64 @@ (define-public node-string-decoder
 Node-core.")
     (license license:expat)))
 
+(define-public node-readable-stream
+  (package
+    (name "node-readable-stream")
+    (version "3.6.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nodejs/readable-stream")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0ybl4cdgsm9c5jq3xq8s01201jk8w0yakh63hlclsfbcdfqhd9ri"))))
+    (build-system node-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (with-atomic-json-file-replacement "package.json"
+               (lambda (pkg-meta)
+                 (delete-dependencies pkg-meta
+                                      `("@babel/cli"
+                                        "@babel/core"
+                                        "@babel/polyfill"
+                                        "@babel/preset-env"
+                                        "airtap"
+                                        "assert"
+                                        "bl"
+                                        "deep-strict-equal"
+                                        "events.once"
+                                        "glob"
+                                        "gunzip-maybe"
+                                        "hyperquest"
+                                        "lolex"
+                                        "nyc"
+                                        "pump"
+                                        "rimraf"
+                                        "tap"
+                                        "tape"
+                                        "tar-fs"
+                                        "util-promisify")))))))
+       #:tests? #f))
+    (inputs
+     (list node-util-deprecate node-string-decoder node-inherits))
+    (home-page
+     "https://github.com/nodejs/readable-stream")
+    (synopsis
+     "Node.js core streams for userland")
+    (description
+     "This package is a mirror of the streams implementations in Node.js.
+
+If you want to guarantee a stable streams base, regardless of what version of
+Node you (or the users of your libraries) are using, use
+@code{readable-stream} only and avoid the @code{stream} module in Node-core.")
+    (license license:expat)))
+
 (define-public node-irc-colors
   (package
     (name "node-irc-colors")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 21/41] gnu: Add node-readable-stream.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (24 preceding siblings ...)
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 20/41] gnu: Add node-string-decoder Liliana Marie Prikler
@ 2021-12-30  7:38 ` Liliana Marie Prikler
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 22/41] gnu: Add node-nan Liliana Marie Prikler
                   ` (20 subsequent siblings)
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:38 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

* gnu/packages/node-xyz.scm (node-readable-stream): New variable.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 gnu/packages/node-xyz.scm | 51 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index c833356703..9bca308dba 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -458,6 +458,57 @@ (define-public node-string-decoder
 Node-core.")
     (license license:expat)))
 
+(define-public node-readable-stream
+  (package
+    (name "node-readable-stream")
+    (version "3.6.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nodejs/readable-stream")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0ybl4cdgsm9c5jq3xq8s01201jk8w0yakh63hlclsfbcdfqhd9ri"))))
+    (build-system node-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies `("^@babel/"
+                                    "^airtap$"
+                                    "^assert$"
+                                    "^bl$"
+                                    "^deep-strict-equal$"
+                                    "^events\\.once$"
+                                    "^glob$"
+                                    "^gunzip-maybe$"
+                                    "^hyperquest$"
+                                    "^lolex$"
+                                    "^nyc$"
+                                    "^pump$"
+                                    "^rimraf$"
+                                    "^tape?$"
+                                    "^tar-fs$"
+                                    "^util-promisify$")))))
+       #:tests? #f))
+    (inputs
+     (list node-util-deprecate node-string-decoder node-inherits))
+    (home-page
+     "https://github.com/nodejs/readable-stream")
+    (synopsis
+     "Node.js core streams for userland")
+    (description
+     "This package is a mirror of the streams implementations in Node.js.
+
+If you want to guarantee a stable streams base, regardless of what version of
+Node you (or the users of your libraries) are using, use
+@code{readable-stream} only and avoid the @code{stream} module in Node-core.")
+    (license license:expat)))
+
 (define-public node-irc-colors
   (package
     (name "node-irc-colors")
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 22/41] gnu: Add node-nan.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (20 preceding siblings ...)
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 21/41] gnu: Add node-readable-stream Philip McGrath
@ 2021-12-30  7:39                                                                           ` Philip McGrath
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 23/41] gnu: Add node-openzwave-shared Philip McGrath
                                                                                             ` (20 subsequent siblings)
  42 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:39 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-nan): New variable.
---
 gnu/packages/node-xyz.scm | 46 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 3f0ec35547..4eda001dc4 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -596,3 +596,49 @@ (define-public node-irc
     (description "@code{node-irc} is an IRC client library for Node.js.
 It has functions for joining, parting, talking, and many other IRC commands.")
     (license license:gpl3+)))
+
+(define-public node-nan
+  (package
+    (name "node-nan")
+    (version "2.15.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nodejs/nan")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "18xslh9va5ld872scrp5y4251ax9s3c6qh0lnl1200lpzbsxy7yd"))))
+    (build-system node-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (with-atomic-json-file-replacement "package.json"
+               (lambda (pkg-meta)
+                 (delete-dependencies
+                  pkg-meta
+                  '("bindings"
+                    "commander"
+                    "glob"
+                    "request"
+                    "node-gyp" ;; would be needed for tests
+                    "tap"
+                    "xtend")))))))
+       ;; tests need tap and other dependencies
+       #:tests? #f))
+    (inputs
+     (list node-readable-stream))
+    (home-page "https://github.com/nodejs/nan")
+    (synopsis "Native Abstractions for Node.js")
+    (description "Native Abstractions for Node.js (``NaN'') provides a header
+file filled with macro and utility goodness for making add-on development for
+Node.js easier across versions.  The goal of this project is to store all logic
+necessary to develop native Node.js addons without having to inspect
+@code{NODE_MODULE_VERSION} and get yourself into a macro-tangle.
+
+This project also contains some helper utilities that make addon development a
+bit more pleasant.")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 22/41] gnu: Add node-nan.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (25 preceding siblings ...)
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 21/41] gnu: Add node-readable-stream Liliana Marie Prikler
@ 2021-12-30  7:39 ` Liliana Marie Prikler
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 23/41] gnu: Add node-openzwave-shared Liliana Marie Prikler
                   ` (19 subsequent siblings)
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:39 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

* gnu/packages/node-xyz.scm (node-nan): New variable.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 gnu/packages/node-xyz.scm | 43 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 9bca308dba..c689c3e3c2 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -567,3 +567,46 @@ (define-public node-irc
     (description "@code{node-irc} is an IRC client library for Node.js.
 It has functions for joining, parting, talking, and many other IRC commands.")
     (license license:gpl3+)))
+
+(define-public node-nan
+  (package
+    (name "node-nan")
+    (version "2.15.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nodejs/nan")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "18xslh9va5ld872scrp5y4251ax9s3c6qh0lnl1200lpzbsxy7yd"))))
+    (build-system node-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies
+              '("^bindings$"
+                "^commander$"
+                "^glob$"
+                "^request$"
+                "^node-gyp$" ;; would be needed for tests
+                "^tap$"
+                "^xtend$")))))
+       ;; tests need tap and other dependencies
+       #:tests? #f))
+    (inputs
+     (list node-readable-stream))
+    (home-page "https://github.com/nodejs/nan")
+    (synopsis "Native Abstractions for Node.js")
+    (description "Native Abstractions for Node.js (``NaN'') provides a header
+file filled with macro and utility goodness for making add-on development for
+Node.js easier across versions.  The goal of this project is to store all logic
+necessary to develop native Node.js addons without having to inspect
+@code{NODE_MODULE_VERSION} and get yourself into a macro-tangle.
+
+This project also contains some helper utilities that make addon development a
+bit more pleasant.")
+    (license license:expat)))
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 23/41] gnu: Add node-openzwave-shared.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (21 preceding siblings ...)
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 22/41] gnu: Add node-nan Philip McGrath
@ 2021-12-30  7:39                                                                           ` Philip McGrath
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 24/41] gnu: Add node-addon-api Philip McGrath
                                                                                             ` (19 subsequent siblings)
  42 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:39 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/zwave.scm (node-openzwave-shared): New variable.
---
 gnu/packages/zwave.scm | 64 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)

diff --git a/gnu/packages/zwave.scm b/gnu/packages/zwave.scm
index 4d8286e334..3e99bd7687 100644
--- a/gnu/packages/zwave.scm
+++ b/gnu/packages/zwave.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -21,11 +22,14 @@ (define-module (gnu packages zwave)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix git-download)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system node)
   #:use-module (gnu packages)
   #:use-module (gnu packages base)
+  #:use-module (gnu packages node-xyz)
   #:use-module (gnu packages libusb)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages perl)
+  #:use-module (gnu packages python)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages xml))
 
@@ -85,3 +89,63 @@ (define-public open-zwave
 and respond to devices on a Z-Wave network, without requiring in-depth
 knowledge of the Z-Wave protocol.")
     (license license:lgpl3+)))
+
+(define-public node-openzwave-shared
+  (package
+    (name "node-openzwave-shared")
+    (version "1.7.2")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/OpenZWave/node-openzwave-shared")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "1bqqy12dzqj05j9wsh50dmn84dddmhz0gjzvd3y20z4hpy1v8rsc"))))
+    (inputs
+     (list open-zwave node-nan))
+    (native-inputs
+     (list which python pkg-config))
+    (build-system node-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (replace 'build
+           ;; For some reason, `npm install` doesn't build
+           ;; the addon automatically, so we do it explicitly here.
+           ;; We go through `npx` so the npmrc file sets the
+           ;; configuration up properly.
+           (lambda* (#:key native-inputs inputs #:allow-other-keys)
+             (invoke (search-input-file (or native-inputs inputs) "/bin/npx")
+                     "--call"
+                     (string-append
+                      (search-input-file
+                       (or native-inputs inputs)
+                       "/lib/node_modules/npm/bin/node-gyp-bin/node-gyp")
+                      " rebuild")))))))
+    (home-page "https://github.com/OpenZWave/node-openzwave-shared")
+    (synopsis "Node.js bindings for OpenZWave")
+    (description
+     "With the @code{node-openzwave-shared} package, you can easily control
+and manage your Z-Wave devices (lights, dimmers, blinds, you name it) from
+within Node.js applications.  This library also supports secure
+devices (e.g. door locks) that require encryption.  All widely used Node.js
+versions are supported with the help of @code{node-nan}.
+
+This library is currently able to:
+@itemize @bullet
+@item
+scan a Z-Wave network and report on connected devices;
+@item
+write values to Z-Wave nodes;
+@item
+monitor the network for changes;
+@item
+heal nodes and/or the network; and
+@item
+perform management tasks: add or remove nodes, replace failed nodes,
+manage their group associations, etc.
+@end itemize")
+    (license license:isc)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 23/41] gnu: Add node-openzwave-shared.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (26 preceding siblings ...)
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 22/41] gnu: Add node-nan Liliana Marie Prikler
@ 2021-12-30  7:39 ` Liliana Marie Prikler
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 24/41] gnu: Add node-addon-api Liliana Marie Prikler
                   ` (18 subsequent siblings)
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:39 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 3657 bytes --]

* gnu/packages/zwave.scm (node-openzwave-shared): New variable.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 gnu/packages/zwave.scm | 64 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)

diff --git a/gnu/packages/zwave.scm b/gnu/packages/zwave.scm
index 4d8286e334..3e99bd7687 100644
--- a/gnu/packages/zwave.scm
+++ b/gnu/packages/zwave.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -21,11 +22,14 @@ (define-module (gnu packages zwave)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix git-download)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system node)
   #:use-module (gnu packages)
   #:use-module (gnu packages base)
+  #:use-module (gnu packages node-xyz)
   #:use-module (gnu packages libusb)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages perl)
+  #:use-module (gnu packages python)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages xml))
 
@@ -85,3 +89,63 @@ (define-public open-zwave
 and respond to devices on a Z-Wave network, without requiring in-depth
 knowledge of the Z-Wave protocol.")
     (license license:lgpl3+)))
+
+(define-public node-openzwave-shared
+  (package
+    (name "node-openzwave-shared")
+    (version "1.7.2")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/OpenZWave/node-openzwave-shared")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "1bqqy12dzqj05j9wsh50dmn84dddmhz0gjzvd3y20z4hpy1v8rsc"))))
+    (inputs
+     (list open-zwave node-nan))
+    (native-inputs
+     (list which python pkg-config))
+    (build-system node-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (replace 'build
+           ;; For some reason, `npm install` doesn't build
+           ;; the addon automatically, so we do it explicitly here.
+           ;; We go through `npx` so the npmrc file sets the
+           ;; configuration up properly.
+           (lambda* (#:key native-inputs inputs #:allow-other-keys)
+             (invoke (search-input-file (or native-inputs inputs) "/bin/npx")
+                     "--call"
+                     (string-append
+                      (search-input-file
+                       (or native-inputs inputs)
+                       "/lib/node_modules/npm/bin/node-gyp-bin/node-gyp")
+                      " rebuild")))))))
+    (home-page "https://github.com/OpenZWave/node-openzwave-shared")
+    (synopsis "Node.js bindings for OpenZWave")
+    (description
+     "With the @code{node-openzwave-shared} package, you can easily control
+and manage your Z-Wave devices (lights, dimmers, blinds, you name it) from
+within Node.js applications.  This library also supports secure
+devices (e.g. door locks) that require encryption.  All widely used Node.js
+versions are supported with the help of @code{node-nan}.
+
+This library is currently able to:
+@itemize @bullet
+@item
+scan a Z-Wave network and report on connected devices;
+@item
+write values to Z-Wave nodes;
+@item
+monitor the network for changes;
+@item
+heal nodes and/or the network; and
+@item
+perform management tasks: add or remove nodes, replace failed nodes,
+manage their group associations, etc.
+@end itemize")
+    (license license:isc)))
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 24/41] gnu: Add node-addon-api.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (22 preceding siblings ...)
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 23/41] gnu: Add node-openzwave-shared Philip McGrath
@ 2021-12-30  7:39                                                                           ` Philip McGrath
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 25/41] gnu: Add node-sqlite3 Philip McGrath
                                                                                             ` (18 subsequent siblings)
  42 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:39 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-addon-api): New variable.
---
 gnu/packages/node-xyz.scm | 87 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 87 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 4eda001dc4..656642eb43 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -22,6 +22,9 @@
 
 (define-module (gnu packages node-xyz)
   #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (gnu packages sqlite)
+  #:use-module (gnu packages python)
+  #:use-module (guix gexp)
   #:use-module (guix packages)
   #:use-module (guix git-download)
   #:use-module (guix build-system node))
@@ -642,3 +645,87 @@ (define-public node-nan
 This project also contains some helper utilities that make addon development a
 bit more pleasant.")
     (license license:expat)))
+
+(define-public node-addon-api
+  (package
+    (name "node-addon-api")
+    (version "4.2.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nodejs/node-addon-api")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1bhvfi2m9nxfz418s619914vmidcnrzbjv6l9nid476c3zlpazch"))))
+    (inputs
+     (list python node-safe-buffer))
+    (build-system node-build-system)
+    (arguments
+     `(#:modules
+       ((guix build node-build-system)
+        (srfi srfi-1)
+        (ice-9 match)
+        (guix build utils))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (with-atomic-json-file-replacement "package.json"
+               (lambda (pkg-meta)
+                 (delete-dependencies pkg-meta
+                                      `("benchmark"
+                                        "bindings"
+                                        "clang-format"
+                                        "eslint"
+                                        "eslint-config-semistandard"
+                                        "eslint-config-standard"
+                                        "eslint-plugin-import"
+                                        "eslint-plugin-node"
+                                        "eslint-plugin-promise"
+                                        "fs-extra"
+                                        "path"
+                                        "pre-commit"))))))
+         (add-after 'unpack 'skip-js-tests
+           ;; We can't run the js-based tests,
+           ;; but we can still do the C++ parts
+           (lambda args
+             (define new-test-script
+               "echo stopping after pretest on Guix")
+             (with-atomic-json-file-replacement "package.json"
+               (match-lambda
+                 (('@ . pkg-meta-alist)
+                  (cons
+                   '@
+                   (map (match-lambda
+                          (("scripts" '@ . scripts-alist)
+                           `("scripts" @ ,@(map (match-lambda
+                                                  (("test" . _)
+                                                   (cons "test"
+                                                         new-test-script))
+                                                  (other
+                                                   other))
+                                                scripts-alist)))
+                          (other
+                           other))
+                        pkg-meta-alist))))))))))
+    (home-page "https://github.com/nodejs/node-addon-api")
+    (synopsis "Node.js API (Node-API) header-only C++ wrappers")
+    (description "This module contains header-only C++ wrapper classes which
+simplify the use of the C based Node-API provided by Node.js when using C++.
+It provides a C++ object model and exception handling semantics with low
+overhead.
+
+Node-API is an ABI stable C interface provided by Node.js for building native
+addons.  It is intended to insulate native addons from changes in the
+underlying JavaScript engine and allow modules compiled for one version to run
+on later versions of Node.js without recompilation.  The @code{node-addon-api}
+module, which is not part of Node.js, preserves the benefits of the Node-API
+as it consists only of inline code that depends only on the stable API
+provided by Node-API.
+
+It is important to remember that @emph{other} Node.js interfaces such as
+@code{libuv} (included in a project via @code{#include <uv.h>}) are not
+ABI-stable across Node.js major versions.")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 24/41] gnu: Add node-addon-api.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (27 preceding siblings ...)
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 23/41] gnu: Add node-openzwave-shared Liliana Marie Prikler
@ 2021-12-30  7:39 ` Liliana Marie Prikler
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 25/41] gnu: Add node-sqlite3 Liliana Marie Prikler
                   ` (17 subsequent siblings)
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:39 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

* gnu/packages/node-xyz.scm (node-addon-api): New variable.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 gnu/packages/node-xyz.scm | 77 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 77 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index c689c3e3c2..325424f8ca 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -22,6 +22,9 @@
 
 (define-module (gnu packages node-xyz)
   #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (gnu packages sqlite)
+  #:use-module (gnu packages python)
+  #:use-module (guix gexp)
   #:use-module (guix packages)
   #:use-module (guix git-download)
   #:use-module (guix build-system node))
@@ -610,3 +613,77 @@ (define-public node-nan
 This project also contains some helper utilities that make addon development a
 bit more pleasant.")
     (license license:expat)))
+
+(define-public node-addon-api
+  (package
+    (name "node-addon-api")
+    (version "4.2.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nodejs/node-addon-api")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1bhvfi2m9nxfz418s619914vmidcnrzbjv6l9nid476c3zlpazch"))))
+    (inputs
+     (list python node-safe-buffer))
+    (build-system node-build-system)
+    (arguments
+     `(#:modules
+       ((guix build node-build-system)
+        (srfi srfi-1)
+        (ice-9 match)
+        (guix build utils))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies
+              `("^benchmark$" "^bindings$" "^clang-format$"
+                "^eslint"
+                "^fs-extra$" "^path$" "^pre-commit$"))
+             ))
+         (add-after 'unpack 'skip-js-tests
+           ;; We can't run the js-based tests,
+           ;; but we can still do the C++ parts
+           (lambda args
+             (define new-test-script
+               "echo stopping after pretest on Guix")
+             (with-atomic-json-file-replacement "package.json"
+               (match-lambda
+                 (('@ . pkg-meta-alist)
+                  (cons
+                   '@
+                   (map (match-lambda
+                          (("scripts" '@ . scripts-alist)
+                           `("scripts" @ ,@(map (match-lambda
+                                                  (("test" . _)
+                                                   (cons "test"
+                                                         new-test-script))
+                                                  (other
+                                                   other))
+                                                scripts-alist)))
+                          (other
+                           other))
+                        pkg-meta-alist))))))))))
+    (home-page "https://github.com/nodejs/node-addon-api")
+    (synopsis "Node.js API (Node-API) header-only C++ wrappers")
+    (description "This module contains header-only C++ wrapper classes which
+simplify the use of the C based Node-API provided by Node.js when using C++.
+It provides a C++ object model and exception handling semantics with low
+overhead.
+
+Node-API is an ABI stable C interface provided by Node.js for building native
+addons.  It is intended to insulate native addons from changes in the
+underlying JavaScript engine and allow modules compiled for one version to run
+on later versions of Node.js without recompilation.  The @code{node-addon-api}
+module, which is not part of Node.js, preserves the benefits of the Node-API
+as it consists only of inline code that depends only on the stable API
+provided by Node-API.
+
+It is important to remember that @emph{other} Node.js interfaces such as
+@code{libuv} (included in a project via @code{#include <uv.h>}) are not
+ABI-stable across Node.js major versions.")
+    (license license:expat)))
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 25/41] gnu: Add node-sqlite3.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (23 preceding siblings ...)
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 24/41] gnu: Add node-addon-api Philip McGrath
@ 2021-12-30  7:39                                                                           ` Philip McGrath
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 26/41] gnu: Add node-file-uri-to-path Philip McGrath
                                                                                             ` (17 subsequent siblings)
  42 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:39 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-sqlite3): New variable.
---
 gnu/packages/node-xyz.scm | 133 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 133 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 656642eb43..23ed209fd1 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -729,3 +729,136 @@ (define new-test-script
 @code{libuv} (included in a project via @code{#include <uv.h>}) are not
 ABI-stable across Node.js major versions.")
     (license license:expat)))
+
+(define-public node-sqlite3
+  (package
+    (name "node-sqlite3")
+    (version "5.0.2")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/mapbox/node-sqlite3")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0sbbzzli282nxyfha10zx0k5m8hdp0sf3ipl59khjb7wm449j86h"))
+       (snippet
+        (with-imported-modules '((guix build utils))
+          #~(begin
+              (use-modules (guix build utils))
+              ;; unbundle sqlite
+              (for-each delete-file-recursively
+                        (find-files "deps"
+                                    (lambda (pth stat)
+                                      (gzip-file? pth)))))))))
+    (inputs
+     (list node-addon-api python sqlite))
+    (build-system node-build-system)
+    (arguments
+     `(#:modules
+       ((guix build node-build-system)
+        (srfi srfi-1)
+        (ice-9 match)
+        (guix build utils))
+       #:tests? #f ; FIXME: tests depend on node-mocha
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (with-atomic-json-file-replacement "package.json"
+               (lambda (pkg-meta)
+                 (delete-dependencies
+                  pkg-meta
+                  `(;; Normally, this is "built" using @mapbox/node-pre-gyp,
+                    ;; which publishes or downloads pre-built binaries or
+                    ;; falls back to building from source.  Here, we patch out
+                    ;; all of that and just build directly.  It might be
+                    ;; better to patch a version of @mapbox/node-pre-gyp that
+                    ;; always builds from source, as Debian does, but there
+                    ;; are a number of dependencies that need to be packaged
+                    ;; or removed.
+                    "@mapbox/node-pre-gyp"
+                    "node-pre-gyp" ;; deprecated name still used in some places
+                    "aws-sdk"
+                    "@mapbox/cloudfriend"
+                    ;; Confusingly, this is only a dependency because of
+                    ;; @mapbox/node-pre-gyp: with that removed,
+                    ;; npm will use its own copy:
+                    "node-gyp"
+                    ;; These we'd like, we just don't have them yet:
+                    "eslint"
+                    "mocha"))))))
+         (add-before 'configure 'npm-config-sqlite
+           ;; We need this step even if we do replace @mapbox/node-pre-gyp
+           ;; because the package expects to build its bundled sqlite
+           (lambda* (#:key inputs #:allow-other-keys)
+             (setenv "npm_config_sqlite" (assoc-ref inputs "sqlite"))))
+         (add-after 'install 'patch-binding-path
+           ;; We replace a file that dynamic searches for the addon using
+           ;; node-pre-gyp (which we don't have) with a version that
+           ;; simply uses the path to the addon we built directly.
+           ;; The exact path is supposed to depend on things like the
+           ;; architecture and napi_build_version, so, to avoid having
+           ;; hard-code the details accurately, we do this after the addon
+           ;; has been built so we can just find where it ended up.
+           (lambda* (#:key outputs #:allow-other-keys)
+             (with-directory-excursion
+                 (search-input-directory outputs
+                                         "lib/node_modules/sqlite3/lib")
+               (match (find-files "binding" "\\.node$")
+                 ((rel-path)
+                  (with-atomic-file-replacement "sqlite3-binding.js"
+                    (lambda (in out)
+                      (format out "var binding = require('./~a');\n" rel-path)
+                      (display "module.exports = exports = binding;\n"
+                               out))))))))
+         (add-after 'patch-dependencies 'avoid-node-pre-gyp
+           (lambda args
+             ;; We need to patch .npmignore before the 'repack phase
+             ;; so that the built addon is installed with in the package.
+             ;; (Upstream assumes node-pre-gyp will download a pre-built
+             ;; version when this package is installed.)
+             (substitute* ".npmignore"
+               (("lib/binding")
+                "#lib/binding # <- patched for Guix"))
+             (with-atomic-json-file-replacement "package.json"
+               (match-lambda
+                 (('@ . pkg-meta-alist)
+                  (match (assoc-ref pkg-meta-alist "binary")
+                    (('@ . binary-alist)
+                     ;; When it builds from source, node-pre-gyp supplies
+                     ;; module_name and module_path based on the entries under
+                     ;; "binary" from "package.json", so this package's
+                     ;; "binding.gyp" doesn't define them. Thus, we also need
+                     ;; to supply them. The GYP_DEFINES environment variable
+                     ;; turns out to be the easiest way to make sure they are
+                     ;; propagated from npm to node-gyp to gyp.
+                     (setenv "GYP_DEFINES"
+                             (string-append
+                              "module_name="
+                              (assoc-ref binary-alist "module_name")
+                              " "
+                              "module_path="
+                              (assoc-ref binary-alist "module_path")))))
+                  ;; We need to remove the install script from "package.json",
+                  ;; as it would try to use node-pre-gyp and would block the
+                  ;; automatic building performed by `npm install`.
+                  (cons '@ (map (match-lambda
+                                  (("scripts" @ . scripts-alist)
+                                   `("scripts" @ ,@(filter (match-lambda
+                                                             (("install" . _)
+                                                              #f)
+                                                             (_
+                                                              #t))
+                                                           scripts-alist)))
+                                  (other
+                                   other))
+                                pkg-meta-alist))))))))))
+    (home-page "https://github.com/mapbox/node-sqlite3")
+    (synopsis "Asynchronous, non-blocking SQLite3 bindings for Node.js")
+    (description
+     "The Node.js add-on @code{node-sqlite3} provides a set of a asynchronous,
+non-blocking bindings for SQLite3, written in modern C++ and tested for memory
+leaks.")
+     (license license:bsd-3)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 25/41] gnu: Add node-sqlite3.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (28 preceding siblings ...)
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 24/41] gnu: Add node-addon-api Liliana Marie Prikler
@ 2021-12-30  7:39 ` Liliana Marie Prikler
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 26/41] gnu: Add node-file-uri-to-path Liliana Marie Prikler
                   ` (16 subsequent siblings)
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:39 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

* gnu/packages/node-xyz.scm (node-sqlite3): New variable.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 gnu/packages/node-xyz.scm | 130 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 130 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 325424f8ca..c22291f66a 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -687,3 +687,133 @@ (define new-test-script
 @code{libuv} (included in a project via @code{#include <uv.h>}) are not
 ABI-stable across Node.js major versions.")
     (license license:expat)))
+
+(define-public node-sqlite3
+  (package
+    (name "node-sqlite3")
+    (version "5.0.2")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/mapbox/node-sqlite3")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0sbbzzli282nxyfha10zx0k5m8hdp0sf3ipl59khjb7wm449j86h"))
+       (snippet
+        (with-imported-modules '((guix build utils))
+          #~(begin
+              (use-modules (guix build utils))
+              ;; unbundle sqlite
+              (for-each delete-file-recursively
+                        (find-files "deps"
+                                    (lambda (pth stat)
+                                      (gzip-file? pth)))))))))
+    (inputs
+     (list node-addon-api python sqlite))
+    (build-system node-build-system)
+    (arguments
+     `(#:modules
+       ((guix build node-build-system)
+        (srfi srfi-1)
+        (ice-9 match)
+        (guix build utils))
+       #:tests? #f ; FIXME: tests depend on node-mocha
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies
+              `(;; Normally, this is "built" using @mapbox/node-pre-gyp,
+                ;; which publishes or downloads pre-built binaries or
+                ;; falls back to building from source.  Here, we patch out
+                ;; all of that and just build directly.  It might be
+                ;; better to patch a version of @mapbox/node-pre-gyp that
+                ;; always builds from source, as Debian does, but there
+                ;; are a number of dependencies that need to be packaged
+                ;; or removed.
+                "^@mapbox/node-pre-gyp$"
+                "^node-pre-gyp$" ;; deprecated name still used in some places
+                "^aws-sdk$"
+                "^@mapbox/cloudfriend$"
+                ;; Confusingly, this is only a dependency because of
+                ;; @mapbox/node-pre-gyp: with that removed,
+                ;; npm will use its own copy:
+                "^node-gyp$"
+                ;; These we'd like, we just don't have them yet:
+                "^eslint$"
+                "^mocha$"))))
+         (add-before 'configure 'npm-config-sqlite
+           ;; We need this step even if we do replace @mapbox/node-pre-gyp
+           ;; because the package expects to build its bundled sqlite
+           (lambda* (#:key inputs #:allow-other-keys)
+             (setenv "npm_config_sqlite" (assoc-ref inputs "sqlite"))))
+         (add-after 'install 'patch-binding-path
+           ;; We replace a file that dynamic searches for the addon using
+           ;; node-pre-gyp (which we don't have) with a version that
+           ;; simply uses the path to the addon we built directly.
+           ;; The exact path is supposed to depend on things like the
+           ;; architecture and napi_build_version, so, to avoid having
+           ;; hard-code the details accurately, we do this after the addon
+           ;; has been built so we can just find where it ended up.
+           (lambda* (#:key outputs #:allow-other-keys)
+             (with-directory-excursion
+                 (search-input-directory outputs
+                                         "lib/node_modules/sqlite3/lib")
+               (match (find-files "binding" "\\.node$")
+                 ((rel-path)
+                  (with-atomic-file-replacement "sqlite3-binding.js"
+                    (lambda (in out)
+                      (format out "var binding = require('./~a');\n" rel-path)
+                      (display "module.exports = exports = binding;\n"
+                               out))))))))
+         (add-after 'patch-dependencies 'avoid-node-pre-gyp
+           (lambda args
+             ;; We need to patch .npmignore before the 'repack phase
+             ;; so that the built addon is installed with in the package.
+             ;; (Upstream assumes node-pre-gyp will download a pre-built
+             ;; version when this package is installed.)
+             (substitute* ".npmignore"
+               (("lib/binding")
+                "#lib/binding # <- patched for Guix"))
+             (with-atomic-json-file-replacement "package.json"
+               (match-lambda
+                 (('@ . pkg-meta-alist)
+                  (match (assoc-ref pkg-meta-alist "binary")
+                    (('@ . binary-alist)
+                     ;; When it builds from source, node-pre-gyp supplies
+                     ;; module_name and module_path based on the entries under
+                     ;; "binary" from "package.json", so this package's
+                     ;; "binding.gyp" doesn't define them. Thus, we also need
+                     ;; to supply them. The GYP_DEFINES environment variable
+                     ;; turns out to be the easiest way to make sure they are
+                     ;; propagated from npm to node-gyp to gyp.
+                     (setenv "GYP_DEFINES"
+                             (string-append
+                              "module_name="
+                              (assoc-ref binary-alist "module_name")
+                              " "
+                              "module_path="
+                              (assoc-ref binary-alist "module_path")))))
+                  ;; We need to remove the install script from "package.json",
+                  ;; as it would try to use node-pre-gyp and would block the
+                  ;; automatic building performed by `npm install`.
+                  (cons '@ (map (match-lambda
+                                  (("scripts" @ . scripts-alist)
+                                   `("scripts" @ ,@(filter (match-lambda
+                                                             (("install" . _)
+                                                              #f)
+                                                             (_
+                                                              #t))
+                                                           scripts-alist)))
+                                  (other
+                                   other))
+                                pkg-meta-alist))))))))))
+    (home-page "https://github.com/mapbox/node-sqlite3")
+    (synopsis "Asynchronous, non-blocking SQLite3 bindings for Node.js")
+    (description
+     "The Node.js add-on @code{node-sqlite3} provides a set of a asynchronous,
+non-blocking bindings for SQLite3, written in modern C++ and tested for memory
+leaks.")
+     (license license:bsd-3)))
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 26/41] gnu: Add node-file-uri-to-path.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (24 preceding siblings ...)
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 25/41] gnu: Add node-sqlite3 Philip McGrath
@ 2021-12-30  7:39                                                                           ` Philip McGrath
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 27/41] gnu: Add node-bindings Philip McGrath
                                                                                             ` (16 subsequent siblings)
  42 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:39 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-file-uri-to-path): New variable.
---
 gnu/packages/node-xyz.scm | 58 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 23ed209fd1..ef190e56c1 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -24,6 +24,7 @@ (define-module (gnu packages node-xyz)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (gnu packages sqlite)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages web)
   #:use-module (guix gexp)
   #:use-module (guix packages)
   #:use-module (guix git-download)
@@ -862,3 +863,60 @@ (define-public node-sqlite3
 non-blocking bindings for SQLite3, written in modern C++ and tested for memory
 leaks.")
      (license license:bsd-3)))
+
+(define-public node-file-uri-to-path
+  (package
+    (name "node-file-uri-to-path")
+    (version "2.0.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/TooTallNate/file-uri-to-path")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "08l779az44czm12xdhgcrnzpqw34s59hbrlfphs7g9y2k26drqav"))))
+    (native-inputs
+     (list esbuild))
+    (build-system node-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (with-atomic-json-file-replacement "package.json"
+               (lambda (pkg-meta)
+                 (delete-dependencies pkg-meta
+                                      `("@types/mocha"
+                                        "@types/node"
+                                        "@typescript-eslint/eslint-plugin"
+                                        "@typescript-eslint/parser"
+                                        "cpy-cli"
+                                        "eslint"
+                                        "eslint-config-airbnb"
+                                        "eslint-config-prettier"
+                                        "eslint-import-resolver-typescript"
+                                        "eslint-plugin-import"
+                                        "eslint-plugin-jsx-a11y"
+                                        "eslint-plugin-react"
+                                        "mocha"
+                                        "rimraf"
+                                        "typescript"))))))
+         (replace 'build
+           (lambda* (#:key inputs native-inputs #:allow-other-keys)
+             (copy-recursively "src" "dist")
+             (invoke (search-input-file (or native-inputs inputs)
+                                        "/bin/esbuild")
+                     "dist/index.ts"
+                     "--outfile=dist/src/index.js"
+                     "--format=cjs"
+                     "--sourcemap"
+                     "--platform=node"))))
+       #:tests? #f))
+    (home-page "https://github.com/TooTallNate/file-uri-to-path")
+    (synopsis "Convert a @code{file:} URI to a file path")
+    (description "This package provides a function to convert a @code{file:}
+URI to a file path.  It accepts a @code{file:} URI and returns a file path
+suitable for use with the @code{fs} module functions.")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 26/41] gnu: Add node-file-uri-to-path.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (29 preceding siblings ...)
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 25/41] gnu: Add node-sqlite3 Liliana Marie Prikler
@ 2021-12-30  7:39 ` Liliana Marie Prikler
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 27/41] gnu: Add node-bindings Liliana Marie Prikler
                   ` (15 subsequent siblings)
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:39 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

* gnu/packages/node-xyz.scm (node-file-uri-to-path): New variable.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 gnu/packages/node-xyz.scm | 46 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index c22291f66a..d3dc7c0b2b 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -24,6 +24,7 @@ (define-module (gnu packages node-xyz)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (gnu packages sqlite)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages web)
   #:use-module (guix gexp)
   #:use-module (guix packages)
   #:use-module (guix git-download)
@@ -817,3 +818,48 @@ (define-public node-sqlite3
 non-blocking bindings for SQLite3, written in modern C++ and tested for memory
 leaks.")
      (license license:bsd-3)))
+
+(define-public node-file-uri-to-path
+  (package
+    (name "node-file-uri-to-path")
+    (version "2.0.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/TooTallNate/file-uri-to-path")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "08l779az44czm12xdhgcrnzpqw34s59hbrlfphs7g9y2k26drqav"))))
+    (native-inputs
+     (list esbuild))
+    (build-system node-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies
+              `("^@types/mocha$" "^@types/node$"
+                "typescript"
+                "eslint"
+                "^cpy-cli$"
+                "^mocha$" "^rimraf$"))))
+         (replace 'build
+           (lambda* (#:key inputs native-inputs #:allow-other-keys)
+             (copy-recursively "src" "dist")
+             (invoke (search-input-file (or native-inputs inputs)
+                                        "/bin/esbuild")
+                     "dist/index.ts"
+                     "--outfile=dist/src/index.js"
+                     "--format=cjs"
+                     "--sourcemap"
+                     "--platform=node"))))
+       #:tests? #f))
+    (home-page "https://github.com/TooTallNate/file-uri-to-path")
+    (synopsis "Convert a @code{file:} URI to a file path")
+    (description "This package provides a function to convert a @code{file:}
+URI to a file path.  It accepts a @code{file:} URI and returns a file path
+suitable for use with the @code{fs} module functions.")
+    (license license:expat)))
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 27/41] gnu: Add node-bindings.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (25 preceding siblings ...)
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 26/41] gnu: Add node-file-uri-to-path Philip McGrath
@ 2021-12-30  7:39                                                                           ` Philip McGrath
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 28/41] gnu: Add node-segfault-handler Philip McGrath
                                                                                             ` (15 subsequent siblings)
  42 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:39 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-bindings): New variable.
---
 gnu/packages/node-xyz.scm | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index ef190e56c1..8d183cbe97 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -920,3 +920,29 @@ (define-public node-file-uri-to-path
 URI to a file path.  It accepts a @code{file:} URI and returns a file path
 suitable for use with the @code{fs} module functions.")
     (license license:expat)))
+
+(define-public node-bindings
+  (package
+    (name "node-bindings")
+    (version "1.5.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/TooTallNate/node-bindings")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "100gp6kpjvd4j1dqnp0sbjr1hqx5mz7r61q9qy527jyhk9mj47wk"))))
+    (inputs
+     (list node-file-uri-to-path))
+    (build-system node-build-system)
+    (arguments
+     ;; there are no tests
+     `(#:tests? #f))
+    (home-page "https://github.com/TooTallNate/node-bindings")
+    (synopsis "Help for loading your native module's @code{.node} file")
+    (description "This is a helper module for authors of Node.js native addon
+modules.  It is basically the ``swiss army knife'' of @code{require()}ing your
+native module's @code{.node} file.")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 27/41] gnu: Add node-bindings.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (30 preceding siblings ...)
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 26/41] gnu: Add node-file-uri-to-path Liliana Marie Prikler
@ 2021-12-30  7:39 ` Liliana Marie Prikler
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 28/41] gnu: Add node-segfault-handler Liliana Marie Prikler
                   ` (14 subsequent siblings)
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:39 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

* gnu/packages/node-xyz.scm (node-bindings): New variable.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 gnu/packages/node-xyz.scm | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index d3dc7c0b2b..df4342a3bf 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -863,3 +863,29 @@ (define-public node-file-uri-to-path
 URI to a file path.  It accepts a @code{file:} URI and returns a file path
 suitable for use with the @code{fs} module functions.")
     (license license:expat)))
+
+(define-public node-bindings
+  (package
+    (name "node-bindings")
+    (version "1.5.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/TooTallNate/node-bindings")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "100gp6kpjvd4j1dqnp0sbjr1hqx5mz7r61q9qy527jyhk9mj47wk"))))
+    (inputs
+     (list node-file-uri-to-path))
+    (build-system node-build-system)
+    (arguments
+     ;; there are no tests
+     `(#:tests? #f))
+    (home-page "https://github.com/TooTallNate/node-bindings")
+    (synopsis "Help for loading your native module's @code{.node} file")
+    (description "This is a helper module for authors of Node.js native addon
+modules.  It is basically the ``swiss army knife'' of @code{require()}ing your
+native module's @code{.node} file.")
+    (license license:expat)))
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 28/41] gnu: Add node-segfault-handler.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (26 preceding siblings ...)
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 27/41] gnu: Add node-bindings Philip McGrath
@ 2021-12-30  7:39                                                                           ` Philip McGrath
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 29/41] gnu: Add node-ms Philip McGrath
                                                                                             ` (14 subsequent siblings)
  42 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:39 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-segfault-handler): New variable.
---
 gnu/packages/node-xyz.scm | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 8d183cbe97..e2eb17b23c 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -946,3 +946,32 @@ (define-public node-bindings
 modules.  It is basically the ``swiss army knife'' of @code{require()}ing your
 native module's @code{.node} file.")
     (license license:expat)))
+
+(define-public node-segfault-handler
+  (package
+    (name "node-segfault-handler")
+    (version "1.3.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/ddopson/node-segfault-handler")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "07nbw35wvrr18kmh8f388v4k5mpjgyy0260bx0xzjdv795i3xvfv"))))
+    (native-inputs
+     (list python))
+    (inputs
+     (list node-bindings node-nan))
+    (build-system node-build-system)
+    (arguments
+     ;; there are no tests
+     `(#:tests? #f))
+    (home-page "https://github.com/ddopson/node-segfault-handler")
+    (synopsis "Catches @code{SIGSEGV} and prints diagnostic information")
+    (description "This package is a tool for debugging Node.js C/C++ native
+code modules and getting stack traces when things go wrong.  If a
+@code{SIGSEGV} signal is raised, the module will print a native stack trace to
+both @code{STDERR} and to a timestamped file.")
+    (license license:bsd-3)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 28/41] gnu: Add node-segfault-handler.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (31 preceding siblings ...)
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 27/41] gnu: Add node-bindings Liliana Marie Prikler
@ 2021-12-30  7:39 ` Liliana Marie Prikler
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 29/41] gnu: Add node-ms Liliana Marie Prikler
                   ` (13 subsequent siblings)
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:39 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

* gnu/packages/node-xyz.scm (node-segfault-handler): New variable.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 gnu/packages/node-xyz.scm | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index df4342a3bf..e4cfb1796a 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -889,3 +889,32 @@ (define-public node-bindings
 modules.  It is basically the ``swiss army knife'' of @code{require()}ing your
 native module's @code{.node} file.")
     (license license:expat)))
+
+(define-public node-segfault-handler
+  (package
+    (name "node-segfault-handler")
+    (version "1.3.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/ddopson/node-segfault-handler")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "07nbw35wvrr18kmh8f388v4k5mpjgyy0260bx0xzjdv795i3xvfv"))))
+    (native-inputs
+     (list python))
+    (inputs
+     (list node-bindings node-nan))
+    (build-system node-build-system)
+    (arguments
+     ;; there are no tests
+     `(#:tests? #f))
+    (home-page "https://github.com/ddopson/node-segfault-handler")
+    (synopsis "Catches @code{SIGSEGV} and prints diagnostic information")
+    (description "This package is a tool for debugging Node.js C/C++ native
+code modules and getting stack traces when things go wrong.  If a
+@code{SIGSEGV} signal is raised, the module will print a native stack trace to
+both @code{STDERR} and to a timestamped file.")
+    (license license:bsd-3)))
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 29/41] gnu: Add node-ms.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (27 preceding siblings ...)
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 28/41] gnu: Add node-segfault-handler Philip McGrath
@ 2021-12-30  7:39                                                                           ` Philip McGrath
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 30/41] gnu: Add node-debug Philip McGrath
                                                                                             ` (13 subsequent siblings)
  42 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:39 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-ms): New variable.
---
 gnu/packages/node-xyz.scm | 48 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index e2eb17b23c..23c45d971e 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -975,3 +975,51 @@ (define-public node-segfault-handler
 @code{SIGSEGV} signal is raised, the module will print a native stack trace to
 both @code{STDERR} and to a timestamped file.")
     (license license:bsd-3)))
+
+(define-public node-ms
+  (package
+    (name "node-ms")
+    (version "2.1.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/vercel/ms")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1l74kmmwffmzdz38lli0v5mdb9p9jmsjxpb48ncknqw2n74cgf08"))))
+    (build-system node-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (with-atomic-json-file-replacement "package.json"
+               (lambda (pkg-meta)
+                 (delete-dependencies pkg-meta `("eslint"
+                                                 "expect.js"
+                                                 "husky"
+                                                 "lint-staged"
+                                                 "mocha"
+                                                 "prettier")))))))
+       #:tests? #f))
+    (home-page "https://github.com/vercel/ms")
+    (synopsis "Tiny millisecond conversion utility")
+    (description "Use this package to easily convert various time formats to
+milliseconds.
+
+Features:
+@itemize @bullet
+@item
+Works both in Node.js and in the browser.
+@item
+If a number is supplied to @code{ms}, a string with a unit is returned.
+@item
+If a string that contains the number is supplied, it returns it as a
+number (e.g. it returns @code{100} for @code{'100'}).
+@item
+If you pass a string with a number and a valid unit, the number of
+equivalent milliseconds is returned.
+@end itemize")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 29/41] gnu: Add node-ms.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (32 preceding siblings ...)
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 28/41] gnu: Add node-segfault-handler Liliana Marie Prikler
@ 2021-12-30  7:39 ` Liliana Marie Prikler
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 30/41] gnu: Add node-debug Liliana Marie Prikler
                   ` (12 subsequent siblings)
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:39 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

* gnu/packages/node-xyz.scm (node-ms): New variable.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 gnu/packages/node-xyz.scm | 46 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index e4cfb1796a..d8ff3d2b97 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -918,3 +918,49 @@ (define-public node-segfault-handler
 @code{SIGSEGV} signal is raised, the module will print a native stack trace to
 both @code{STDERR} and to a timestamped file.")
     (license license:bsd-3)))
+
+(define-public node-ms
+  (package
+    (name "node-ms")
+    (version "2.1.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/vercel/ms")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1l74kmmwffmzdz38lli0v5mdb9p9jmsjxpb48ncknqw2n74cgf08"))))
+    (build-system node-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies `("^eslint$"
+                                    "^expect\\.js$"
+                                    "^husky$"
+                                    "^lint-staged$"
+                                    "^mocha$"
+                                    "^prettier$")))))
+       #:tests? #f))
+    (home-page "https://github.com/vercel/ms")
+    (synopsis "Tiny millisecond conversion utility")
+    (description "Use this package to easily convert various time formats to
+milliseconds.
+
+Features:
+@itemize @bullet
+@item
+Works both in Node.js and in the browser.
+@item
+If a number is supplied to @code{ms}, a string with a unit is returned.
+@item
+If a string that contains the number is supplied, it returns it as a
+number (e.g. it returns @code{100} for @code{'100'}).
+@item
+If you pass a string with a number and a valid unit, the number of
+equivalent milliseconds is returned.
+@end itemize")
+    (license license:expat)))
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 30/41] gnu: Add node-debug.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (28 preceding siblings ...)
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 29/41] gnu: Add node-ms Philip McGrath
@ 2021-12-30  7:39                                                                           ` Philip McGrath
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 31/41] gnu: Add node-serialport-binding-abstract Philip McGrath
                                                                                             ` (12 subsequent siblings)
  42 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:39 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-debug): New variable.
---
 gnu/packages/node-xyz.scm | 47 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 23c45d971e..f1cbb184bd 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1023,3 +1023,50 @@ (define-public node-ms
 equivalent milliseconds is returned.
 @end itemize")
     (license license:expat)))
+
+(define-public node-debug
+  (package
+    (name "node-debug")
+    (version "4.3.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/debug-js/debug")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0ji0dmdl2xkgxqxvd6xjy7k3mmknmhvqjgc40vyly9ka1mpf20vb"))))
+    (inputs
+     (list node-ms))
+    (build-system node-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (with-atomic-json-file-replacement "package.json"
+               (lambda (pkg-meta)
+                 (delete-dependencies pkg-meta `("brfs"
+                                                 "browserify"
+                                                 "coveralls"
+                                                 "istanbul"
+                                                 "karma"
+                                                 "karma-browserify"
+                                                 "karma-chrome-launcher"
+                                                 "karma-mocha"
+                                                 "mocha"
+                                                 "mocha-lcov-reporter"
+                                                 "xo"
+                                                 "supports-color")))))))
+       #:tests? #f))
+    (home-page "https://github.com/debug-js/debug")
+    (synopsis "Lightweight debugging utility for Node.js and the browser")
+    (description "A tiny JavaScript debugging utility modelled after Node.js
+core's debugging technique.  orks in Node.js and web browsers.
+
+The @code{debug} module exposes a function; simply pass this function the name
+of your module, and it will return a decorated version of @code{console.error}
+for you to pass debug statements to.  This will allow you to toggle the debug
+output for different parts of your module as well as the module as a whole.")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 30/41] gnu: Add node-debug.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (33 preceding siblings ...)
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 29/41] gnu: Add node-ms Liliana Marie Prikler
@ 2021-12-30  7:39 ` Liliana Marie Prikler
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 31/41] gnu: Add node-serialport-binding-abstract Liliana Marie Prikler
                   ` (11 subsequent siblings)
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:39 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

* gnu/packages/node-xyz.scm (node-debug): New variable.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 gnu/packages/node-xyz.scm | 42 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index d8ff3d2b97..5196394a5c 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -964,3 +964,45 @@ (define-public node-ms
 equivalent milliseconds is returned.
 @end itemize")
     (license license:expat)))
+
+(define-public node-debug
+  (package
+    (name "node-debug")
+    (version "4.3.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/debug-js/debug")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0ji0dmdl2xkgxqxvd6xjy7k3mmknmhvqjgc40vyly9ka1mpf20vb"))))
+    (inputs
+     (list node-ms))
+    (build-system node-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies
+              `("^brfs$"
+                "^browserify$"
+                "^coveralls$"
+                "^istanbul$"
+                "^karma"
+                "^mocha"
+                "^xo$"
+                "^supports-color$")))))
+       #:tests? #f))
+    (home-page "https://github.com/debug-js/debug")
+    (synopsis "Lightweight debugging utility for Node.js and the browser")
+    (description "A tiny JavaScript debugging utility modelled after Node.js
+core's debugging technique.  orks in Node.js and web browsers.
+
+The @code{debug} module exposes a function; simply pass this function the name
+of your module, and it will return a decorated version of @code{console.error}
+for you to pass debug statements to.  This will allow you to toggle the debug
+output for different parts of your module as well as the module as a whole.")
+    (license license:expat)))
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 31/41] gnu: Add node-serialport-binding-abstract.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (29 preceding siblings ...)
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 30/41] gnu: Add node-debug Philip McGrath
@ 2021-12-30  7:39                                                                           ` Philip McGrath
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 32/41] gnu: Add node-serialport-parser-delimiter Philip McGrath
                                                                                             ` (11 subsequent siblings)
  42 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:39 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport-binding-abstract): New
variable.
---
 gnu/packages/node-xyz.scm | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index f1cbb184bd..462d5d844a 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1070,3 +1070,37 @@ (define-public node-debug
 for you to pass debug statements to.  This will allow you to toggle the debug
 output for different parts of your module as well as the module as a whole.")
     (license license:expat)))
+
+(define-public node-serialport-binding-abstract
+  (package
+    (name "node-serialport-binding-abstract")
+    (version "9.2.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/serialport/node-serialport")
+             (commit "v9.2.7")))
+       (file-name (git-file-name "serialport-monorepo" version))
+       (sha256
+        (base32 "0x7zm59a5ff5yygjyw15xs3r5m3rb8av1yfrh4snn44mrwq87yg8"))))
+    (inputs
+     (list node-debug))
+    (build-system node-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/binding-abstract"))))
+       #:tests? #f))
+    (home-page "https://serialport.io")
+    (synopsis "Abstract base class for Node SerialPort bindings")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+This package provides the @code{AbstractBinding} class, the base for all Node
+SerialPort bindings.  You wouldn't use this class directly, but instead extend
+it to make a new binding for a different platform or underling technology.")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 31/41] gnu: Add node-serialport-binding-abstract.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (34 preceding siblings ...)
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 30/41] gnu: Add node-debug Liliana Marie Prikler
@ 2021-12-30  7:39 ` Liliana Marie Prikler
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 32/41] gnu: Add node-serialport-parser-delimiter Liliana Marie Prikler
                   ` (10 subsequent siblings)
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:39 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

* gnu/packages/node-xyz.scm (node-serialport-binding-abstract): New
variable.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 gnu/packages/node-xyz.scm | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 5196394a5c..a8649d928d 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1006,3 +1006,37 @@ (define-public node-debug
 for you to pass debug statements to.  This will allow you to toggle the debug
 output for different parts of your module as well as the module as a whole.")
     (license license:expat)))
+
+(define-public node-serialport-binding-abstract
+  (package
+    (name "node-serialport-binding-abstract")
+    (version "9.2.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/serialport/node-serialport")
+             (commit "v9.2.7")))
+       (file-name (git-file-name "serialport-monorepo" version))
+       (sha256
+        (base32 "0x7zm59a5ff5yygjyw15xs3r5m3rb8av1yfrh4snn44mrwq87yg8"))))
+    (inputs
+     (list node-debug))
+    (build-system node-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/binding-abstract"))))
+       #:tests? #f))
+    (home-page "https://serialport.io")
+    (synopsis "Abstract base class for Node SerialPort bindings")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+This package provides the @code{AbstractBinding} class, the base for all Node
+SerialPort bindings.  You wouldn't use this class directly, but instead extend
+it to make a new binding for a different platform or underling technology.")
+    (license license:expat)))
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 32/41] gnu: Add node-serialport-parser-delimiter.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (30 preceding siblings ...)
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 31/41] gnu: Add node-serialport-binding-abstract Philip McGrath
@ 2021-12-30  7:39                                                                           ` Philip McGrath
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 33/41] gnu: Add node-serialport-parser-readline Philip McGrath
                                                                                             ` (10 subsequent siblings)
  42 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:39 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport-parser-delimiter): New
variable.
---
 gnu/packages/node-xyz.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 462d5d844a..34de7e0819 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1104,3 +1104,25 @@ (define-public node-serialport-binding-abstract
 SerialPort bindings.  You wouldn't use this class directly, but instead extend
 it to make a new binding for a different platform or underling technology.")
     (license license:expat)))
+
+(define-public node-serialport-parser-delimiter
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-delimiter")
+    (version "9.2.4")
+    (inputs `())
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-delimiter"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser to split data on a delimiter")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{Delimiter}, a parser that emits data
+each time a specified byte sequence is received.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 32/41] gnu: Add node-serialport-parser-delimiter.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (35 preceding siblings ...)
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 31/41] gnu: Add node-serialport-binding-abstract Liliana Marie Prikler
@ 2021-12-30  7:39 ` Liliana Marie Prikler
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 33/41] gnu: Add node-serialport-parser-readline Liliana Marie Prikler
                   ` (9 subsequent siblings)
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:39 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

* gnu/packages/node-xyz.scm (node-serialport-parser-delimiter): New
variable.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 gnu/packages/node-xyz.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index a8649d928d..1dc1853240 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1040,3 +1040,25 @@ (define-public node-serialport-binding-abstract
 SerialPort bindings.  You wouldn't use this class directly, but instead extend
 it to make a new binding for a different platform or underling technology.")
     (license license:expat)))
+
+(define-public node-serialport-parser-delimiter
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-delimiter")
+    (version "9.2.4")
+    (inputs `())
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-delimiter"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser to split data on a delimiter")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{Delimiter}, a parser that emits data
+each time a specified byte sequence is received.")))
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 33/41] gnu: Add node-serialport-parser-readline.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (31 preceding siblings ...)
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 32/41] gnu: Add node-serialport-parser-delimiter Philip McGrath
@ 2021-12-30  7:39                                                                           ` Philip McGrath
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 34/41] gnu: Add node-serialport-bindings Philip McGrath
                                                                                             ` (9 subsequent siblings)
  42 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:39 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport-parser-readline): New
variable.
---
 gnu/packages/node-xyz.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 34de7e0819..e33a35a0a0 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1126,3 +1126,26 @@ (define-public node-serialport-parser-delimiter
 Parsers are used to take raw binary data and transform them into usable
 messages.  This package provides @code{Delimiter}, a parser that emits data
 each time a specified byte sequence is received.")))
+
+(define-public node-serialport-parser-readline
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-readline")
+    (version "9.2.4")
+    (inputs
+     (list node-serialport-parser-delimiter))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-readline"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser to split data on newlines")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{Readline}, a parser that emits data
+after a (configurable) newline delimiter is received.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 33/41] gnu: Add node-serialport-parser-readline.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (36 preceding siblings ...)
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 32/41] gnu: Add node-serialport-parser-delimiter Liliana Marie Prikler
@ 2021-12-30  7:39 ` Liliana Marie Prikler
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 34/41] gnu: Add node-serialport-bindings Liliana Marie Prikler
                   ` (8 subsequent siblings)
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:39 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

* gnu/packages/node-xyz.scm (node-serialport-parser-readline): New
variable.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 gnu/packages/node-xyz.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 1dc1853240..aa3ec31718 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1062,3 +1062,26 @@ (define-public node-serialport-parser-delimiter
 Parsers are used to take raw binary data and transform them into usable
 messages.  This package provides @code{Delimiter}, a parser that emits data
 each time a specified byte sequence is received.")))
+
+(define-public node-serialport-parser-readline
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-readline")
+    (version "9.2.4")
+    (inputs
+     (list node-serialport-parser-delimiter))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-readline"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser to split data on newlines")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{Readline}, a parser that emits data
+after a (configurable) newline delimiter is received.")))
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 34/41] gnu: Add node-serialport-bindings.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (32 preceding siblings ...)
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 33/41] gnu: Add node-serialport-parser-readline Philip McGrath
@ 2021-12-30  7:39                                                                           ` Philip McGrath
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 35/41] gnu: Add node-serialport-parser-regex Philip McGrath
                                                                                             ` (8 subsequent siblings)
  42 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:39 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport-bindings): New variable.
---
 gnu/packages/node-xyz.scm | 56 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index e33a35a0a0..fe1a2d4e5f 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1149,3 +1149,59 @@ (define-public node-serialport-parser-readline
 Parsers are used to take raw binary data and transform them into usable
 messages.  This package provides @code{Readline}, a parser that emits data
 after a (configurable) newline delimiter is received.")))
+
+(define-public node-serialport-bindings
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-bindings")
+    (version "9.2.7")
+    (native-inputs
+     (list python))
+    (inputs
+     (list node-nan node-bindings node-serialport-binding-abstract
+           node-serialport-parser-readline node-debug))
+    (arguments
+     `(#:modules
+       ((guix build node-build-system)
+        (srfi srfi-1)
+        (ice-9 match)
+        (guix build utils))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/bindings")))
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (with-atomic-json-file-replacement "package.json"
+               (lambda (pkg-meta)
+                 (delete-dependencies pkg-meta `("prebuild-install"
+                                                 ;; devDependencies
+                                                 "@serialport/binding-mock"
+                                                 "node-abi"))))))
+         (add-after 'chdir 'avoid-prebuild-install
+           (lambda args
+             (with-atomic-json-file-replacement "package.json"
+               (match-lambda
+                 (('@ . pkg-meta-alist)
+                  (cons '@ (map (match-lambda
+                                  (("scripts" @ . scripts-alist)
+                                   `("scripts" @ ,@(filter (match-lambda
+                                                             (("install" . _)
+                                                              #f)
+                                                             (_
+                                                              #t))
+                                                           scripts-alist)))
+                                  (other
+                                   other))
+                                pkg-meta-alist))))))))
+       #:tests? #f))
+    (synopsis "Abstract base class for Node SerialPort bindings")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+This package provides the @code{Binding} class, which uses a native addon to
+talk to the underlying system.  You never have to use @code{Binding} objects
+directly.  There is also a @code{MockBinding} available (but not yet packaged
+for Guix) to assist with testing.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 34/41] gnu: Add node-serialport-bindings.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (37 preceding siblings ...)
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 33/41] gnu: Add node-serialport-parser-readline Liliana Marie Prikler
@ 2021-12-30  7:39 ` Liliana Marie Prikler
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 35/41] gnu: Add node-serialport-parser-regex Liliana Marie Prikler
                   ` (7 subsequent siblings)
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:39 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

* gnu/packages/node-xyz.scm (node-serialport-bindings): New variable.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 gnu/packages/node-xyz.scm | 54 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index aa3ec31718..3128b1f7f3 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1085,3 +1085,57 @@ (define-public node-serialport-parser-readline
 Parsers are used to take raw binary data and transform them into usable
 messages.  This package provides @code{Readline}, a parser that emits data
 after a (configurable) newline delimiter is received.")))
+
+(define-public node-serialport-bindings
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-bindings")
+    (version "9.2.7")
+    (native-inputs
+     (list python))
+    (inputs
+     (list node-nan node-bindings node-serialport-binding-abstract
+           node-serialport-parser-readline node-debug))
+    (arguments
+     `(#:modules
+       ((guix build node-build-system)
+        (srfi srfi-1)
+        (ice-9 match)
+        (guix build utils))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/bindings")))
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies `("^prebuild-install$"
+                                    ;; devDependencies
+                                    "^@serialport/binding-mock$"
+                                    "^node-abi$"))))
+         (add-after 'chdir 'avoid-prebuild-install
+           (lambda args
+             (with-atomic-json-file-replacement "package.json"
+               (match-lambda
+                 (('@ . pkg-meta-alist)
+                  (cons '@ (map (match-lambda
+                                  (("scripts" @ . scripts-alist)
+                                   `("scripts" @ ,@(filter (match-lambda
+                                                             (("install" . _)
+                                                              #f)
+                                                             (_
+                                                              #t))
+                                                           scripts-alist)))
+                                  (other
+                                   other))
+                                pkg-meta-alist))))))))
+       #:tests? #f))
+    (synopsis "Abstract base class for Node SerialPort bindings")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+This package provides the @code{Binding} class, which uses a native addon to
+talk to the underlying system.  You never have to use @code{Binding} objects
+directly.  There is also a @code{MockBinding} available (but not yet packaged
+for Guix) to assist with testing.")))
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 35/41] gnu: Add node-serialport-parser-regex.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (33 preceding siblings ...)
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 34/41] gnu: Add node-serialport-bindings Philip McGrath
@ 2021-12-30  7:39                                                                           ` Philip McGrath
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 36/41] gnu: Add node-serialport-parser-ready Philip McGrath
                                                                                             ` (7 subsequent siblings)
  42 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:39 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport-parser-regex): New variable.
---
 gnu/packages/node-xyz.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index fe1a2d4e5f..2fada26799 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1205,3 +1205,25 @@ (define-public node-serialport-bindings
 talk to the underlying system.  You never have to use @code{Binding} objects
 directly.  There is also a @code{MockBinding} available (but not yet packaged
 for Guix) to assist with testing.")))
+
+(define-public node-serialport-parser-regex
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-regex")
+    (version "9.2.4")
+    (inputs `())
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-regex"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser to split data on a regular expression")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{Regex}, a parser that uses a regular
+expression to split the incoming text.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 35/41] gnu: Add node-serialport-parser-regex.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (38 preceding siblings ...)
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 34/41] gnu: Add node-serialport-bindings Liliana Marie Prikler
@ 2021-12-30  7:39 ` Liliana Marie Prikler
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 36/41] gnu: Add node-serialport-parser-ready Liliana Marie Prikler
                   ` (6 subsequent siblings)
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:39 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

* gnu/packages/node-xyz.scm (node-serialport-parser-regex): New variable.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 gnu/packages/node-xyz.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 3128b1f7f3..17e65a4079 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1139,3 +1139,25 @@ (define-public node-serialport-bindings
 talk to the underlying system.  You never have to use @code{Binding} objects
 directly.  There is also a @code{MockBinding} available (but not yet packaged
 for Guix) to assist with testing.")))
+
+(define-public node-serialport-parser-regex
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-regex")
+    (version "9.2.4")
+    (inputs `())
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-regex"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser to split data on a regular expression")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{Regex}, a parser that uses a regular
+expression to split the incoming text.")))
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 36/41] gnu: Add node-serialport-parser-ready.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (34 preceding siblings ...)
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 35/41] gnu: Add node-serialport-parser-regex Philip McGrath
@ 2021-12-30  7:39                                                                           ` Philip McGrath
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 37/41] gnu: Add node-serialport-parser-inter-byte-timeout Philip McGrath
                                                                                             ` (6 subsequent siblings)
  42 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:39 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport-parser-ready): New variable.
---
 gnu/packages/node-xyz.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 2fada26799..55b60fa773 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1227,3 +1227,26 @@ (define-public node-serialport-parser-regex
 Parsers are used to take raw binary data and transform them into usable
 messages.  This package provides @code{Regex}, a parser that uses a regular
 expression to split the incoming text.")))
+
+(define-public node-serialport-parser-ready
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-ready")
+    (version "9.2.4")
+    (inputs `())
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-ready"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser to wait for specified byte sequence")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{Ready}, a parser that waits for a
+specified sequence of ``ready'' bytes before emitting a ready event and
+emitting data events.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 36/41] gnu: Add node-serialport-parser-ready.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (39 preceding siblings ...)
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 35/41] gnu: Add node-serialport-parser-regex Liliana Marie Prikler
@ 2021-12-30  7:39 ` Liliana Marie Prikler
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 37/41] gnu: Add node-serialport-parser-inter-byte-timeout Liliana Marie Prikler
                   ` (5 subsequent siblings)
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:39 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

* gnu/packages/node-xyz.scm (node-serialport-parser-ready): New variable.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 gnu/packages/node-xyz.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 17e65a4079..623281f64c 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1161,3 +1161,26 @@ (define-public node-serialport-parser-regex
 Parsers are used to take raw binary data and transform them into usable
 messages.  This package provides @code{Regex}, a parser that uses a regular
 expression to split the incoming text.")))
+
+(define-public node-serialport-parser-ready
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-ready")
+    (version "9.2.4")
+    (inputs `())
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-ready"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser to wait for specified byte sequence")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{Ready}, a parser that waits for a
+specified sequence of ``ready'' bytes before emitting a ready event and
+emitting data events.")))
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 37/41] gnu: Add node-serialport-parser-inter-byte-timeout.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (35 preceding siblings ...)
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 36/41] gnu: Add node-serialport-parser-ready Philip McGrath
@ 2021-12-30  7:39                                                                           ` Philip McGrath
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 38/41] gnu: Add node-serialport-parser-cctalk Philip McGrath
                                                                                             ` (5 subsequent siblings)
  42 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:39 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm
(node-serialport-parser-inter-byte-timeout): New variable.
---
 gnu/packages/node-xyz.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 55b60fa773..6337554830 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1250,3 +1250,25 @@ (define-public node-serialport-parser-ready
 messages.  This package provides @code{Ready}, a parser that waits for a
 specified sequence of ``ready'' bytes before emitting a ready event and
 emitting data events.")))
+
+(define-public node-serialport-parser-inter-byte-timeout
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-inter-byte-timeout")
+    (version "9.2.4")
+    (inputs `())
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-inter-byte-timeout"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser to detect pauses in data")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{InterByteTimeout}, a parser that emits
+data if there is a pause between packets for the specified amount of time.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 37/41] gnu: Add node-serialport-parser-inter-byte-timeout.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (40 preceding siblings ...)
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 36/41] gnu: Add node-serialport-parser-ready Liliana Marie Prikler
@ 2021-12-30  7:39 ` Liliana Marie Prikler
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 38/41] gnu: Add node-serialport-parser-cctalk Liliana Marie Prikler
                   ` (4 subsequent siblings)
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:39 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

* gnu/packages/node-xyz.scm
(node-serialport-parser-inter-byte-timeout): New variable.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 gnu/packages/node-xyz.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 623281f64c..84e66f5c20 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1184,3 +1184,25 @@ (define-public node-serialport-parser-ready
 messages.  This package provides @code{Ready}, a parser that waits for a
 specified sequence of ``ready'' bytes before emitting a ready event and
 emitting data events.")))
+
+(define-public node-serialport-parser-inter-byte-timeout
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-inter-byte-timeout")
+    (version "9.2.4")
+    (inputs `())
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-inter-byte-timeout"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser to detect pauses in data")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{InterByteTimeout}, a parser that emits
+data if there is a pause between packets for the specified amount of time.")))
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 38/41] gnu: Add node-serialport-parser-cctalk.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (36 preceding siblings ...)
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 37/41] gnu: Add node-serialport-parser-inter-byte-timeout Philip McGrath
@ 2021-12-30  7:39                                                                           ` Philip McGrath
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 39/41] gnu: Add node-serialport-parser-byte-length Philip McGrath
                                                                                             ` (4 subsequent siblings)
  42 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:39 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport-parser-cctalk): New variable.
---
 gnu/packages/node-xyz.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 6337554830..758d72a52a 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1272,3 +1272,26 @@ (define-public node-serialport-parser-inter-byte-timeout
 Parsers are used to take raw binary data and transform them into usable
 messages.  This package provides @code{InterByteTimeout}, a parser that emits
 data if there is a pause between packets for the specified amount of time.")))
+
+(define-public node-serialport-parser-cctalk
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-cctalk")
+    (version "9.2.4")
+    (inputs `())
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-cctalk"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser for the ccTalk protocol")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{CCTalk}, which emits packets for the
+ccTalk protocol (an open standard for currency detectors) as they are
+received.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 38/41] gnu: Add node-serialport-parser-cctalk.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (41 preceding siblings ...)
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 37/41] gnu: Add node-serialport-parser-inter-byte-timeout Liliana Marie Prikler
@ 2021-12-30  7:39 ` Liliana Marie Prikler
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 39/41] gnu: Add node-serialport-parser-byte-length Liliana Marie Prikler
                   ` (3 subsequent siblings)
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:39 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

* gnu/packages/node-xyz.scm (node-serialport-parser-cctalk): New variable.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 gnu/packages/node-xyz.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 84e66f5c20..14a5af12ff 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1206,3 +1206,26 @@ (define-public node-serialport-parser-inter-byte-timeout
 Parsers are used to take raw binary data and transform them into usable
 messages.  This package provides @code{InterByteTimeout}, a parser that emits
 data if there is a pause between packets for the specified amount of time.")))
+
+(define-public node-serialport-parser-cctalk
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-cctalk")
+    (version "9.2.4")
+    (inputs `())
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-cctalk"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser for the ccTalk protocol")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{CCTalk}, which emits packets for the
+ccTalk protocol (an open standard for currency detectors) as they are
+received.")))
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 39/41] gnu: Add node-serialport-parser-byte-length.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (37 preceding siblings ...)
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 38/41] gnu: Add node-serialport-parser-cctalk Philip McGrath
@ 2021-12-30  7:39                                                                           ` Philip McGrath
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 40/41] gnu: Add node-serialport-stream Philip McGrath
                                                                                             ` (3 subsequent siblings)
  42 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:39 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport-parser-byte-length): New
variable.
---
 gnu/packages/node-xyz.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 758d72a52a..e427f31b1a 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1295,3 +1295,25 @@ (define-public node-serialport-parser-cctalk
 messages.  This package provides @code{CCTalk}, which emits packets for the
 ccTalk protocol (an open standard for currency detectors) as they are
 received.")))
+
+(define-public node-serialport-parser-byte-length
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-byte-length")
+    (version "9.2.4")
+    (inputs `())
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-byte-length"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser for fixed-length buffers")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{ByteLength}, a parser that emits data
+as a buffer every time a specified number of bytes are received.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 39/41] gnu: Add node-serialport-parser-byte-length.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (42 preceding siblings ...)
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 38/41] gnu: Add node-serialport-parser-cctalk Liliana Marie Prikler
@ 2021-12-30  7:39 ` Liliana Marie Prikler
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 40/41] gnu: Add node-serialport-stream Liliana Marie Prikler
                   ` (2 subsequent siblings)
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:39 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

* gnu/packages/node-xyz.scm (node-serialport-parser-byte-length): New
variable.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 gnu/packages/node-xyz.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 14a5af12ff..9e770afef6 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1229,3 +1229,25 @@ (define-public node-serialport-parser-cctalk
 messages.  This package provides @code{CCTalk}, which emits packets for the
 ccTalk protocol (an open standard for currency detectors) as they are
 received.")))
+
+(define-public node-serialport-parser-byte-length
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-byte-length")
+    (version "9.2.4")
+    (inputs `())
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-byte-length"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser for fixed-length buffers")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{ByteLength}, a parser that emits data
+as a buffer every time a specified number of bytes are received.")))
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 40/41] gnu: Add node-serialport-stream.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (38 preceding siblings ...)
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 39/41] gnu: Add node-serialport-parser-byte-length Philip McGrath
@ 2021-12-30  7:39                                                                           ` Philip McGrath
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 41/41] gnu: Add node-serialport Philip McGrath
                                                                                             ` (2 subsequent siblings)
  42 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:39 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport-stream): New variable.
---
 gnu/packages/node-xyz.scm | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index e427f31b1a..a95749f737 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1317,3 +1317,34 @@ (define-public node-serialport-parser-byte-length
 Parsers are used to take raw binary data and transform them into usable
 messages.  This package provides @code{ByteLength}, a parser that emits data
 as a buffer every time a specified number of bytes are received.")))
+
+(define-public node-serialport-stream
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-stream")
+    (version "9.2.4")
+    (inputs
+     (list node-debug))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (with-atomic-json-file-replacement "package.json"
+               (lambda (pkg-meta)
+                 (delete-dependencies pkg-meta
+                                      `(;; devDependencies
+                                        "@serialport/binding-mock"))))))
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/stream"))))
+       #:tests? #f))
+    (synopsis "Node.js stream interface for Node SerialPort")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+This package provides an interface for using Node SerialPort bindings via the
+Node.js Stream API.  The stream is a duplex stream, allowing for reading and
+writing.  It has additional methods for managing the SerialPort
+connection.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 40/41] gnu: Add node-serialport-stream.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (43 preceding siblings ...)
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 39/41] gnu: Add node-serialport-parser-byte-length Liliana Marie Prikler
@ 2021-12-30  7:39 ` Liliana Marie Prikler
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 41/41] gnu: Add node-serialport Liliana Marie Prikler
  2022-01-06 17:45 ` [bug#51838] [PATCH v8 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Liliana Marie Prikler
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:39 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

* gnu/packages/node-xyz.scm (node-serialport-stream): New variable.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 gnu/packages/node-xyz.scm | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 9e770afef6..5a142dd422 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1251,3 +1251,31 @@ (define-public node-serialport-parser-byte-length
 Parsers are used to take raw binary data and transform them into usable
 messages.  This package provides @code{ByteLength}, a parser that emits data
 as a buffer every time a specified number of bytes are received.")))
+
+(define-public node-serialport-stream
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-stream")
+    (version "9.2.4")
+    (inputs
+     (list node-debug))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies `(;; devDependencies
+                                    "^@serialport/binding-mock$"))))
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/stream"))))
+       #:tests? #f))
+    (synopsis "Node.js stream interface for Node SerialPort")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+This package provides an interface for using Node SerialPort bindings via the
+Node.js Stream API.  The stream is a duplex stream, allowing for reading and
+writing.  It has additional methods for managing the SerialPort
+connection.")))
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 41/41] gnu: Add node-serialport.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (39 preceding siblings ...)
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 40/41] gnu: Add node-serialport-stream Philip McGrath
@ 2021-12-30  7:39                                                                           ` Philip McGrath
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
  2021-12-30 20:03                                                                           ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Ryan Sundberg via Guix-patches via
  42 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:39 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport): New variable.
---
 gnu/packages/node-xyz.scm | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index a95749f737..1f51c0d636 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1348,3 +1348,38 @@ (define-public node-serialport-stream
 Node.js Stream API.  The stream is a duplex stream, allowing for reading and
 writing.  It has additional methods for managing the SerialPort
 connection.")))
+
+(define-public node-serialport
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport")
+    (version "9.2.7")
+    (inputs
+     (list node-serialport-bindings
+           node-serialport-parser-delimiter
+           node-serialport-parser-readline
+           node-serialport-parser-regex
+           node-serialport-parser-ready
+           node-serialport-parser-inter-byte-timeout
+           node-serialport-parser-cctalk
+           node-serialport-parser-byte-length
+           node-serialport-stream
+           node-debug))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (with-atomic-json-file-replacement "package.json"
+               (lambda (pkg-meta)
+                 (delete-dependencies pkg-meta
+                                      `("@serialport/binding-mock"))))))
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/serialport"))))
+       #:tests? #f))
+    (synopsis "Node.js package to access serial ports")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  This package is the recommended entry point for most
+projects.  It combines a high-level Node.js stream interface with a useful
+default set of parsers and bindings.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 41/41] gnu: Add node-serialport.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (44 preceding siblings ...)
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 40/41] gnu: Add node-serialport-stream Liliana Marie Prikler
@ 2021-12-30  7:39 ` Liliana Marie Prikler
  2022-01-06 17:45 ` [bug#51838] [PATCH v8 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Liliana Marie Prikler
  46 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30  7:39 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

* gnu/packages/node-xyz.scm (node-serialport): New variable.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 gnu/packages/node-xyz.scm | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 5a142dd422..990b26a689 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1279,3 +1279,36 @@ (define-public node-serialport-stream
 Node.js Stream API.  The stream is a duplex stream, allowing for reading and
 writing.  It has additional methods for managing the SerialPort
 connection.")))
+
+(define-public node-serialport
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport")
+    (version "9.2.7")
+    (inputs
+     (list node-serialport-bindings
+           node-serialport-parser-delimiter
+           node-serialport-parser-readline
+           node-serialport-parser-regex
+           node-serialport-parser-ready
+           node-serialport-parser-inter-byte-timeout
+           node-serialport-parser-cctalk
+           node-serialport-parser-byte-length
+           node-serialport-stream
+           node-debug))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies `("^@serialport/binding-mock$"))
+             ))
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/serialport"))))
+       #:tests? #f))
+    (synopsis "Node.js package to access serial ports")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  This package is the recommended entry point for most
+projects.  It combines a high-level Node.js stream interface with a useful
+default set of parsers and bindings.")))
-- 
2.34.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (40 preceding siblings ...)
  2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 41/41] gnu: Add node-serialport Philip McGrath
@ 2021-12-30  7:44                                                                           ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 01/41] guix: node-build-system: Add delete-lockfiles phase Philip McGrath
                                                                                               ` (40 more replies)
  2021-12-30 20:03                                                                           ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Ryan Sundberg via Guix-patches via
  42 siblings, 41 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

Hi again,

Here, as promised, is v7!

As I said above, this is my preferred version of this patch series, but I
could also live with v6 if it could achieve consensus.

 -Philip

Philip McGrath (41):
  guix: node-build-system: Add delete-lockfiles phase.
  guix: node-build-system: Add implicit libuv input.
  guix: node-build-system: Add JSON utilities.
  guix: node-build-system: Add avoid-node-gyp-rebuild phase.
  guix: node-build-system: Add #:absent-dependencies argument.
  gnu: node-semver-bootstrap: Use #:absent-dependencies.
  gnu: node-ms-bootstrap: Use #:absent-dependencies.
  gnu: node-binary-search-bootstrap: Use #:absent-dependencies.
  gnu: node-debug-bootstrap: Use #:absent-dependencies.
  gnu: node-llparse-builder-bootstrap: Use #:absent-dependencies.
  gnu: node-llparse-frontend-bootstrap: Use #:absent-dependencies.
  gnu: node-llparse-bootstrap: Use #:absent-dependencies.
  gnu: node-semver: Use #:absent-dependencies.
  gnu: node-wrappy: Use #:absent-dependencies.
  gnu: node-once: Use #:absent-dependencies.
  gnu: node-irc-colors: Use #:absent-dependencies.
  gnu: node-irc: Use #:absent-dependencies.
  gnu: Add node-inherits.
  gnu: Add node-safe-buffer.
  gnu: Add node-string-decoder.
  gnu: Add node-readable-stream.
  gnu: Add node-nan.
  gnu: Add node-openzwave-shared.
  gnu: Add node-addon-api.
  gnu: Add node-sqlite3.
  gnu: Add node-file-uri-to-path.
  gnu: Add node-bindings.
  gnu: Add node-segfault-handler.
  gnu: Add node-ms.
  gnu: Add node-debug.
  gnu: Add node-serialport-binding-abstract.
  gnu: Add node-serialport-parser-delimiter.
  gnu: Add node-serialport-parser-readline.
  gnu: Add node-serialport-bindings.
  gnu: Add node-serialport-parser-regex.
  gnu: Add node-serialport-parser-ready.
  gnu: Add node-serialport-parser-inter-byte-timeout.
  gnu: Add node-serialport-parser-cctalk.
  gnu: Add node-serialport-parser-byte-length.
  gnu: Add node-serialport-stream.
  gnu: Add node-serialport.

 gnu/packages/node-xyz.scm        | 937 ++++++++++++++++++++++++++++++-
 gnu/packages/node.scm            |  63 ++-
 gnu/packages/zwave.scm           |  64 +++
 guix/build-system/node.scm       |  28 +-
 guix/build/node-build-system.scm | 354 +++++++++++-
 5 files changed, 1376 insertions(+), 70 deletions(-)

-- 
2.32.0





^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 01/41] guix: node-build-system: Add delete-lockfiles phase.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 02/41] guix: node-build-system: Add implicit libuv input Philip McGrath
                                                                                               ` (39 subsequent siblings)
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* guix/build/node-build-system.scm (delete-lockfiles): New function.
Remove 'package-lock.json', 'yarn.lock', and 'npm-shrinkwrap.json',
if they exist.  Because these files specify  both exact dependency
versions and integrity hashes, they only cause problems for Guix.
(%standard-phases): Add 'delete-lockfiles' after 'patch-dependencies'.
---
 guix/build/node-build-system.scm | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
index 70a367618e..dcaa719f40 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -96,6 +96,17 @@ (define (resolve-dependencies package-meta meta-key)
         (write-json package-meta out))))
   #t)
 
+(define* (delete-lockfiles #:key inputs #:allow-other-keys)
+  "Delete 'package-lock.json', 'yarn.lock', and 'npm-shrinkwrap.json', if they
+exist."
+  (for-each (lambda (pth)
+              (when (file-exists? pth)
+                (delete-file pth)))
+            '("package-lock.json"
+              "yarn.lock"
+              "npm-shrinkwrap.json"))
+  #t)
+
 (define* (configure #:key outputs inputs #:allow-other-keys)
   (let ((npm (string-append (assoc-ref inputs "node") "/bin/npm")))
     (invoke npm "--offline" "--ignore-scripts" "install")
@@ -146,6 +157,7 @@ (define %standard-phases
   (modify-phases gnu:%standard-phases
     (add-after 'unpack 'set-home set-home)
     (add-before 'configure 'patch-dependencies patch-dependencies)
+    (add-after 'patch-dependencies 'delete-lockfiles delete-lockfiles)
     (replace 'configure configure)
     (replace 'build build)
     (replace 'check check)
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 02/41] guix: node-build-system: Add implicit libuv input.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 01/41] guix: node-build-system: Add delete-lockfiles phase Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 03/41] guix: node-build-system: Add JSON utilities Philip McGrath
                                                                                               ` (38 subsequent siblings)
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* guix/build-system/node.scm (lower): Add the version of libuv
used as an input to the #:node package as an additional implicit
input, so that packages needing libuv always get the correct version.
---
 guix/build-system/node.scm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/guix/build-system/node.scm b/guix/build-system/node.scm
index 735f8dd06e..24bd677bfc 100644
--- a/guix/build-system/node.scm
+++ b/guix/build-system/node.scm
@@ -2,6 +2,8 @@
 ;;; Copyright © 2016 Jelle Licht <jlicht@fsfe.org>
 ;;; Copyright © 2019 Timothy Sample <samplet@ngyro.com>
 ;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2021 Pierre Langlois <pierre.langlois@gmx.com>
+;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -61,10 +63,15 @@ (define private-keywords
                               `(("source" ,source))
                               '())
                         ,@inputs
-
                         ;; Keep the standard inputs of 'gnu-build-system'.
                         ,@(standard-packages)))
          (build-inputs `(("node" ,node)
+                         ;; Many packages with native addons need
+                         ;; libuv headers. The libuv version must
+                         ;; be exactly the same as for the node
+                         ;; package we are adding implicitly,
+                         ;; so we take care of adding libuv, too.
+                         ("libuv" ,@(assoc-ref (package-inputs node) "libuv"))
                          ,@native-inputs))
          (outputs outputs)
          (build node-build)
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 03/41] guix: node-build-system: Add JSON utilities.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 01/41] guix: node-build-system: Add delete-lockfiles phase Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 02/41] guix: node-build-system: Add implicit libuv input Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 04/41] guix: node-build-system: Add avoid-node-gyp-rebuild phase Philip McGrath
                                                                                               ` (37 subsequent siblings)
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

This commit adds several utility functions for non-destructive
transformation of the JSON representation used by (guix build json),
particularly for purely functional update of JSON objects.  They should
eventually be exported, but most are private for now to allow for more
experience and consideration before commiting to the API.  The design
was largely inspired by the 'racket/dict' and 'racket/hash' libraries.
Liliana Marie Prikler proposed 'with-atomic-json-file-replacement'.

* guix/build/node-build-system.scm (jsobject-ref):
(alist-pop):
(alist-delete*):
(jsobject-delete):
(alist-set):
(jsobject-set):
(jsobject-set*):
(alist-update):
(jsobject-update):
(jsobject-update*):
(jsobject-union): New private procedures.
(with-atomic-json-file-replacement): New exported procedure.
(module-name): Use them.
(build): Use them.
(patch-dependencies): Use them.  Stop using 'assoc-set!' unsafely.

Co-authored-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 guix/build/node-build-system.scm | 275 ++++++++++++++++++++++++++++---
 1 file changed, 251 insertions(+), 24 deletions(-)

diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
index dcaa719f40..e5c4da5091 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -26,6 +26,7 @@ (define-module (guix build node-build-system)
   #:use-module (ice-9 match)
   #:use-module (srfi srfi-1)
   #:export (%standard-phases
+            with-atomic-json-file-replacement
             node-build))
 
 ;; Commentary:
@@ -34,6 +35,237 @@ (define-module (guix build node-build-system)
 ;;
 ;; Code:
 
+;;;
+;;; JSON utilities.
+;;;
+;;; The following procedures facilitate transforming JSON values using the
+;;; representation from (guix build json), particularly purely functional
+;;; update of JSON objects.  If we decide to make more of them public, we
+;;; might instead put them in their own file or, eventually, add them to
+;;; (guix build json).
+;;;
+;;; JSON objects with duplicate keys are not interoperable: see RFC 8259 § 4.
+;;; These procedures assume, but generally do not check, that JSON objects
+;;; given to them as arguments do not have duplicate keys.  As long as that
+;;; precondition is satisfied, they will produce JSON objects without
+;;; duplicate keys.  Procedures that operate on unwrapped assosciation lists
+;;; may do likewise, which should be considered before exporting them for
+;;; general use.
+;;;
+
+(define (with-atomic-json-file-replacement file proc)
+  "Like 'with-atomic-file-replacement', but PROC is called with a single
+argument---the result of parsing FILE's contents as json---and should a value
+to be written as json to the replacement FILE."
+  (with-atomic-file-replacement file
+    (lambda (in out)
+      (write-json (proc (read-json in)) out))))
+
+(define (jsobject-ref js key failure-result)
+  "Return the value assosciated with KEY in the json object JS.  If KEY is not
+found and FAILURE-RESULT is a procedure, it is called in tail position with
+zero arguments.  Otherwise, FAILURE-RESULT is returned."
+  ;; TODO: `failure-result` should be optional, but should the default
+  ;; `failure-result` be #f (like `assoc-ref`), a thunk raising an exception,
+  ;; '(@), or something else?  Keep it mandatory until we discuss and decide.
+  (match js
+    (('@ . alist)
+     (match (assoc key alist)
+       (#f
+        (if (procedure? failure-result)
+            (failure-result)
+            failure-result))
+       ((_ . value)
+        value)))))
+
+(define (alist-pop alist key)
+  "Return two values: the first pair in ALIST with the given KEY in its
+'car' (or #f, if no such pair exists) and an assosciation list like (and
+potentially sharing storage with) ALIST, but with no entry for KEY."
+  (match (assoc key alist)
+    ;; If key isn't present, we don't need to do any allocation
+    (#f
+     (values #f alist))
+    (found
+     (values found
+             ;; Because we have `found`, we can find it more
+             ;; efficiently this time with `eq?`. We avoid using
+             ;; `delq` because it would copy pairs in a shared
+             ;; tail. We assume a sufficiently smart compiler to
+             ;; handle "tail recursion modulo cons" (vid. e.g. Indiana
+             ;; University Technical Report No. 19, Friedman & Wise
+             ;; 1975) at least as efficiently as a hand-written
+             ;; tail-recursive implementation with an accumulator.
+             (let loop ((alist alist))
+               (match alist
+                 ;; We know that `found` is present,
+                 ;; so no need to check for '()
+                 ((this . alist)
+                  (if (eq? this found)
+                      alist
+                      (cons this (loop alist))))))))))
+
+;; Sadly, Guile's implementation of (@ (srfi srfi-1) alist-delete)
+;; performs unnecessary allocation, e.g. this currently evaluates to #f:
+;;
+;;     (let ((alist `(("a" . 1)("b" . 2)("c" . 3))))
+;;       (eq? alist (alist-delete "x" alist)))
+;;
+;; These functions generally choose to allocate a new outer pair (with the '@
+;; tag), even though in unusual cases the resulting object might not have
+;; changed, for the sake of simplicity and to avoid retaining a reference to
+;; the original alist longer than necessary. But that is O(1) allocation that
+;; could only rarely be avoided: `alist-delete` would allocate O(n) pairs,
+;; which would only be necessary in the worst case.
+(define (alist-delete* alist key)
+  "Return an assosciation list like (and potentially sharing storage with)
+ALIST, but with no entry for KEY."
+  (define-values (_popped remaining)
+    (alist-pop alist key))
+  remaining)
+
+(define (jsobject-delete js key)
+  "Return a json object like JS, but with no entry for KEY."
+  (cons '@ (match js
+             (('@ . alist)
+              (alist-delete* alist key)))))
+
+(define (alist-set alist key value)
+  "Return an assosciation list like ALIST, but with KEY mapped to VALUE,
+replacing any existing mapping for KEY."
+  (acons key value (alist-delete* alist key)))
+
+(define (jsobject-set js key value)
+  "Return a json object like JS, but with KEY mapped to VALUE, replacing any
+existing mapping for KEY."
+  (cons '@ (match js
+             (('@ . alist)
+              (alist-set alist key value)))))
+
+(define jsobject-set*
+  (case-lambda
+    "Return a json object like JS, but functionally extended by mapping each
+KEY to each VALUE, replacing any existing mapping for each KEY.  The update
+takes place from left to right, so later mappings overwrite earlier mappings
+for the same KEY."
+    ((js)
+     js)
+    ((js key value)
+     (jsobject-set js key value))
+    ((js . args)
+     (cons '@ (match js
+                (('@ . alist)
+                 (let loop ((alist alist)
+                            (args args))
+                   (match args
+                     (()
+                     alist)
+                     ((key value . args)
+                      (loop (alist-set alist key value)
+                            args))))))))))
+
+(define (alist-update alist key failure-result updater)
+  "Return an assosciation list like ALIST, but with KEY mapped to the result
+of applying UPDATER to the value to which KEY is mapped in ALIST.  When ALIST
+does not have an existing mapping for KEY, FAILURE-RESULT is used as with
+'jsobject-ref' to obtain the argument for UPDATER."
+  ;; Often, `updater` will be a lambda expression, so making it the last
+  ;; argument may help to makes the code legible, and the most likely
+  ;; `failure-result` arguments are all shorter than the keyword
+  ;; `#:failure-result`.  Plus, making `failure-result` mandatory helps make
+  ;; `alist-update` consistent with `alist-update*`.
+  (define-values (popped tail-alist)
+    (alist-pop alist key))
+  (acons key
+         (updater (match popped
+                    (#f
+                     (if (procedure? failure-result)
+                         (failure-result)
+                         failure-result))
+                    ((_ . value)
+                     value)))
+         tail-alist))
+
+(define (jsobject-update js key failure-result updater)
+  "Return a json object like JS, but with KEY mapped to the result of applying
+UPDATER to the value to which KEY is mapped in JS.  When JS does not have an
+existing mapping for KEY, FAILURE-RESULT is used as with 'jsobject-ref' to
+obtain the argument for UPDATER."
+  (cons '@ (match js
+             (('@ . alist)
+              (alist-update alist key failure-result updater)))))
+
+(define jsobject-update*
+  (case-lambda
+    "Return a json object like JS, but functionally extended by replacing the
+mapping for each KEY with the result of applying the corresponding UPDATER to
+the value to which that KEY is mapped in JS---or, if no such mapping exists,
+to a value based on the corresponding FAILURE-RESULT as with 'jsobject-ref'.
+The update takes place from left to right, so later UPDATERs will receive the
+values returned by earlier UPDATERs for the same KEY."
+    ((js)
+     js)
+    ((js key failure-result updater)
+     (jsobject-update js key failure-result updater))
+    ((js . args)
+     (cons '@ (match js
+                (('@ . alist)
+                 (let loop ((alist alist)
+                            (args args))
+                   (match args
+                     (()
+                     alist)
+                     ((key failure-result updater . args)
+                      (loop (alist-update alist key failure-result updater)
+                            args))))))))))
+
+(define* (jsobject-union #:key
+                         (combine (lambda (a b) b))
+                         (combine/key (lambda (k a b) (combine a b)))
+                         #:rest json-objects)
+  "Combine the given JSON-OBJECTS into a single json object.  The JSON-OBJECTS
+are merged from left to right by adding each key/value pair of each object to
+the aggregate object in turn.  When one of the JSON-OBJECTS contains a mapping
+from some key KEY to a value VAL such that the aggregate object already
+contains a mapping from KEY to a value VAL0, the aggregate object is
+functionally updated to instead map KEY to the value of (COMBINE/KEY KEY VAL0
+VAL).  The default COMBINE/KEY tail-calls (COMBINE VAL0 VAL), and the default
+COMBINE simply returns its second argument, so, by default, mappings in later
+JSON-OBJECTS supersede those in earlier ones."
+  (match (filter (lambda (v)
+                   (not (or (keyword? v)
+                            (procedure? v))))
+                 json-objects)
+    (()
+     '(@))
+    (((and js0 ('@ . _)))
+     js0)
+    ((('@ . alist0) ('@ . alist*) ...)
+     (cons '@ (fold (lambda (alist1 alist0)
+                      (if (null? alist0)
+                          alist1
+                          (fold (lambda (k+v alist0)
+                                  (match k+v
+                                    ((k . v)
+                                     (define-values (popped tail-alist)
+                                       (alist-pop alist0 k))
+                                     (match popped
+                                       (#f
+                                        (cons k+v tail-alist))
+                                       ((_ . v0)
+                                        (acons k
+                                               (combine/key k v0 v)
+                                               tail-alist))))))
+                                alist0
+                                alist1)))
+                    alist0
+                    alist*)))))
+
+\f
+;;;
+;;; Phases.
+;;;
+
 (define (set-home . _)
   (with-directory-excursion ".."
     (let loop ((i 0))
@@ -49,7 +281,7 @@ (define (set-home . _)
 (define (module-name module)
   (let* ((package.json (string-append module "/package.json"))
          (package-meta (call-with-input-file package.json read-json)))
-    (assoc-ref package-meta "name")))
+    (jsobject-ref package-meta "name" #f)))
 
 (define (index-modules input-paths)
   (define (list-modules directory)
@@ -73,27 +305,24 @@ (define* (patch-dependencies #:key inputs #:allow-other-keys)
 
   (define index (index-modules (map cdr inputs)))
 
-  (define (resolve-dependencies package-meta meta-key)
-    (fold (lambda (key+value acc)
-            (match key+value
-              ('@ acc)
-              ((key . value) (acons key (hash-ref index key value) acc))))
-          '()
-          (or (assoc-ref package-meta meta-key) '())))
+  (define resolve-dependencies
+    (match-lambda
+      (('@ . alist)
+       (cons '@ (map (match-lambda
+                       ((key . value)
+                        (cons key (hash-ref index key value))))
+                     alist)))))
 
-  (with-atomic-file-replacement "package.json"
-    (lambda (in out)
-      (let ((package-meta (read-json in)))
-        (assoc-set! package-meta "dependencies"
-                    (append
-                     '(@)
-                     (resolve-dependencies package-meta "dependencies")
-                     (resolve-dependencies package-meta "peerDependencies")))
-        (assoc-set! package-meta "devDependencies"
-                    (append
-                     '(@)
-                     (resolve-dependencies package-meta "devDependencies")))
-        (write-json package-meta out))))
+  (with-atomic-json-file-replacement "package.json"
+    (lambda (pkg-meta)
+      (jsobject-update*
+       pkg-meta
+       "devDependencies" '(@) resolve-dependencies
+       "dependencies" '(@) (lambda (deps)
+                             (resolve-dependencies
+                              (jsobject-union
+                               (jsobject-ref pkg-meta "peerDependencies" '(@))
+                               deps))))))
   #t)
 
 (define* (delete-lockfiles #:key inputs #:allow-other-keys)
@@ -114,9 +343,7 @@ (define* (configure #:key outputs inputs #:allow-other-keys)
 
 (define* (build #:key inputs #:allow-other-keys)
   (let ((package-meta (call-with-input-file "package.json" read-json)))
-    (if (and=> (assoc-ref package-meta "scripts")
-               (lambda (scripts)
-                 (assoc-ref scripts "build")))
+    (if (jsobject-ref (jsobject-ref package-meta "scripts" '(@)) "build" #f)
         (let ((npm (string-append (assoc-ref inputs "node") "/bin/npm")))
           (invoke npm "run" "build"))
         (format #t "there is no build script to run~%"))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 04/41] guix: node-build-system: Add avoid-node-gyp-rebuild phase.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                               ` (2 preceding siblings ...)
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 03/41] guix: node-build-system: Add JSON utilities Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 05/41] guix: node-build-system: Add #:absent-dependencies argument Philip McGrath
                                                                                               ` (36 subsequent siblings)
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* guix/build/node-build-system.scm (avoid-node-gyp-rebuild): New
function. Override the default install script for packages with
native addons to prevent it from attempting to write to the store
when such packages are used.
(%standard-phases): Add 'avoid-node-gyp-rebuild' after 'install'.
---
 guix/build/node-build-system.scm | 50 +++++++++++++++++++++++++++++++-
 1 file changed, 49 insertions(+), 1 deletion(-)

diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
index e5c4da5091..dc8b6a41c2 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -380,6 +380,53 @@ (define* (install #:key outputs inputs #:allow-other-keys)
             "install" "../package.tgz")
     #t))
 
+(define* (avoid-node-gyp-rebuild #:key outputs #:allow-other-keys)
+  "Adjust the installed 'package.json' to remove an 'install' script that
+would try to run 'node-gyp rebuild'."
+  ;; We want to take advantage of `npm install`'s automatic support for
+  ;; building native addons with node-gyp: in particular, it helps us avoid
+  ;; hard-coding the specifics of how npm's internal copy of node-gyp is
+  ;; currently packaged. However, the mechanism by which the automatic support
+  ;; is implemented causes problems for us.
+  ;;
+  ;; If a package contains a 'binding.gyp' file and does not define an
+  ;; 'install' or 'preinstall' script, 'npm install' runs a default install
+  ;; script consisting of 'node-gyp rebuild'. In our 'install' phase, this
+  ;; implicit 'install' script, if it is applicable, is explicitly added to
+  ;; the "package.json" file. However, if another Guix package were to use a
+  ;; Node.js package with such an 'install' script, the dependent package's
+  ;; build process would fail, because 'node-gyp rebuild' would try to write
+  ;; to the store.
+  ;;
+  ;; Here, if the installed "package.json" defines scripts.install as
+  ;; "node-gyp rebuild", we replace it with a no-op. Importantly, deleting the
+  ;; install script definition would not be enough, because the default
+  ;; install script would cause the same problem.
+  ;;
+  ;; 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")))
+  ;; not with-atomic-json-file-replacement, because we usually don't
+  ;; want or need to overwrite it
+  (define pkg-meta
+    (call-with-input-file installed-package.json read-json))
+  (define scripts
+    (jsobject-ref pkg-meta "scripts" '(@)))
+  (when (equal? "node-gyp rebuild" (jsobject-ref scripts "install" #f))
+    (call-with-output-file installed-package.json
+      (lambda (out)
+        (write-json
+         (jsobject-set pkg-meta
+                       "scripts"
+                       (jsobject-set scripts
+                                     "install"
+                                     "echo Guix: avoiding node-gyp rebuild"))
+         out)))))
+
 (define %standard-phases
   (modify-phases gnu:%standard-phases
     (add-after 'unpack 'set-home set-home)
@@ -389,7 +436,8 @@ (define %standard-phases
     (replace 'build build)
     (replace 'check check)
     (add-before 'install 'repack repack)
-    (replace 'install install)))
+    (replace 'install install)
+    (add-after 'install 'avoid-node-gyp-rebuild avoid-node-gyp-rebuild)))
 
 (define* (node-build #:key inputs (phases %standard-phases)
                      #:allow-other-keys #:rest args)
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 05/41] guix: node-build-system: Add #:absent-dependencies argument.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                               ` (3 preceding siblings ...)
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 04/41] guix: node-build-system: Add avoid-node-gyp-rebuild phase Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 06/41] gnu: node-semver-bootstrap: Use #:absent-dependencies Philip McGrath
                                                                                               ` (35 subsequent siblings)
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* guix/build-system/node.scm (lower, node-build): Add optional
argument #:absent-dependencies with default of ''().  Pass it on
to the build-side code.
* guix/build/node-build-system.scm (delete-dependencies): New
procedure.  Respect the #:absent-dependencies argument, removing
specified npm packages from the "dependencies" or "devDependencies"
tables in "package.json".
(%standard-phases): Add 'delete-dependencies after
'patch-dependencies.
---
 guix/build-system/node.scm       | 19 ++++++++++++++++++-
 guix/build/node-build-system.scm | 19 ++++++++++++++++++-
 2 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/guix/build-system/node.scm b/guix/build-system/node.scm
index 24bd677bfc..47af4bb9e2 100644
--- a/guix/build-system/node.scm
+++ b/guix/build-system/node.scm
@@ -49,6 +49,7 @@ (define (default-node)
 (define* (lower name
                 #:key source inputs native-inputs outputs system target
                 (node (default-node))
+                (absent-dependencies ''())
                 #:allow-other-keys
                 #:rest arguments)
   "Return a bag for NAME."
@@ -84,6 +85,7 @@ (define* (node-build name inputs
                      (test-target "test")
                      (tests? #t)
                      (phases '%standard-phases)
+                     (absent-dependencies ''())
                      (outputs '("out"))
                      (search-paths '())
                      (system (%current-system))
@@ -91,7 +93,21 @@ (define* (node-build name inputs
                      (imported-modules %node-build-system-modules)
                      (modules '((guix build node-build-system)
                                 (guix build utils))))
-  "Build SOURCE using NODE and INPUTS."
+  "Build SOURCE using NODE and INPUTS.
+
+The builder will remove Node.js packages listed in ABSENT-DEPENCENCIES from
+the 'package.json' file's 'dependencies' and 'devDependencies' tables.  This
+mechanism can be used both avoid dependencies we don't want (e.g. optional
+features that would increase closure size) and to work around dependencies
+that haven't been packaged for Guix yet (e.g. test utilities)."
+  ;; Before #:absent-dependencies existed, this scenario was often handled by
+  ;; deleting the 'configure phase. Using #:absent-dependencies, instead,
+  ;; retains the check that no dependencies are silently missing and other
+  ;; actions performed by 'npm install', such as building native
+  ;; addons. Having an explicit list of absent dependencies in the package
+  ;; definition should also facilitate future maintenence: for example, if we
+  ;; add a package for a test framework, it should be easy to find all the
+  ;; other packages that use it and enable their tests.
   (define builder
     (with-imported-modules imported-modules
       #~(begin
@@ -103,6 +119,7 @@ (define builder
                       #:test-target #$test-target
                       #:tests? #$tests?
                       #:phases #$phases
+                      #:absent-dependencies #$absent-dependencies
                       #:outputs #$(outputs->gexp outputs)
                       #:search-paths '#$(sexp->gexp
                                          (map search-path-specification->sexp
diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
index dc8b6a41c2..e6b0811ca1 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -325,6 +325,22 @@ (define resolve-dependencies
                                deps))))))
   #t)
 
+(define* (delete-dependencies #:key absent-dependencies #:allow-other-keys)
+  "Modify 'package.json' to allow building without the ABSENT-DEPENDENCIES."
+  (define delete-fom-jsobject
+    (match-lambda
+      (('@ . alist)
+       (cons '@ (filter (match-lambda
+                          ((k . v)
+                           (not (member k absent-dependencies))))
+                        alist)))))
+  (with-atomic-json-file-replacement "package.json"
+    (lambda (pkg-meta)
+      (jsobject-update*
+       pkg-meta
+       "devDependencies" '(@) delete-fom-jsobject
+       "dependencies" '(@) delete-fom-jsobject))))
+
 (define* (delete-lockfiles #:key inputs #:allow-other-keys)
   "Delete 'package-lock.json', 'yarn.lock', and 'npm-shrinkwrap.json', if they
 exist."
@@ -431,7 +447,8 @@ (define %standard-phases
   (modify-phases gnu:%standard-phases
     (add-after 'unpack 'set-home set-home)
     (add-before 'configure 'patch-dependencies patch-dependencies)
-    (add-after 'patch-dependencies 'delete-lockfiles delete-lockfiles)
+    (add-after 'patch-dependencies 'delete-dependencies delete-dependencies)
+    (add-after 'delete-dependencies 'delete-lockfiles delete-lockfiles)
     (replace 'configure configure)
     (replace 'build build)
     (replace 'check check)
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 06/41] gnu: node-semver-bootstrap: Use #:absent-dependencies.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                               ` (4 preceding siblings ...)
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 05/41] guix: node-build-system: Add #:absent-dependencies argument Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 07/41] gnu: node-ms-bootstrap: " Philip McGrath
                                                                                               ` (34 subsequent siblings)
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node.scm (node-semver-bootstrap)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node.scm | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 51a393caab..95f5f28b3d 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -344,9 +344,8 @@ (define-public node-semver-bootstrap
     (arguments
      `(#:node ,node-bootstrap
        #:tests? #f
-       #:phases
-       (modify-phases %standard-phases
-         (delete 'configure))))
+       #:absent-dependencies
+       '("tap")))
     (home-page "https://github.com/npm/node-semver")
     (properties '((hidden? . #t)))
     (synopsis "Parses semantic versions strings")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 07/41] gnu: node-ms-bootstrap: Use #:absent-dependencies.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                               ` (5 preceding siblings ...)
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 06/41] gnu: node-semver-bootstrap: Use #:absent-dependencies Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 08/41] gnu: node-binary-search-bootstrap: " Philip McGrath
                                                                                               ` (33 subsequent siblings)
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node.scm (node-ms-bootstrap)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node.scm | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 95f5f28b3d..bec3f4620a 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -372,9 +372,12 @@ (define-public node-ms-bootstrap
     (arguments
      `(#:node ,node-bootstrap
        #:tests? #f
-       #:phases
-       (modify-phases %standard-phases
-         (delete 'configure))))
+       #:absent-dependencies
+       `("eslint"
+         "expect.js"
+         "husky"
+         "lint-staged"
+         "mocha")))
     (home-page "https://github.com/zeit/ms#readme")
     (properties '((hidden? . #t)))
     (synopsis "Tiny millisecond conversion utility")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 08/41] gnu: node-binary-search-bootstrap: Use #:absent-dependencies.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                               ` (6 preceding siblings ...)
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 07/41] gnu: node-ms-bootstrap: " Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 09/41] gnu: node-debug-bootstrap: " Philip McGrath
                                                                                               ` (32 subsequent siblings)
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node.scm (node-binary-search-bootstrap)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node.scm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index bec3f4620a..0a66b032bb 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -403,9 +403,9 @@ (define-public node-binary-search-bootstrap
     (arguments
      `(#:node ,node-bootstrap
        #:tests? #f
-       #:phases
-       (modify-phases %standard-phases
-         (delete 'configure))))
+       #:absent-dependencies
+       `("chai"
+         "mocha")))
     (home-page "https://github.com/darkskyapp/binary-search#readme")
     (properties '((hidden? . #t)))
     (synopsis "Tiny binary search function with comparators")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 09/41] gnu: node-debug-bootstrap: Use #:absent-dependencies.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                               ` (7 preceding siblings ...)
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 08/41] gnu: node-binary-search-bootstrap: " Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 10/41] gnu: node-llparse-builder-bootstrap: " Philip McGrath
                                                                                               ` (31 subsequent siblings)
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node.scm (node-debug-bootstrap)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node.scm | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 0a66b032bb..985a2fdb20 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -430,9 +430,18 @@ (define-public node-debug-bootstrap
     (arguments
      `(#:node ,node-bootstrap
        #:tests? #f
-       #:phases
-       (modify-phases %standard-phases
-         (delete 'configure))))
+       #:absent-dependencies
+       `("brfs"
+         "browserify"
+         "coveralls"
+         "istanbul"
+         "karma"
+         "karma-browserify"
+         "karma-chrome-launcher"
+         "karma-mocha"
+         "mocha"
+         "mocha-lcov-reporter"
+         "xo")))
     (inputs (list node-ms-bootstrap))
     (home-page "https://github.com/visionmedia/debug#readme")
     (properties '((hidden? . #t)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 10/41] gnu: node-llparse-builder-bootstrap: Use #:absent-dependencies.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                               ` (8 preceding siblings ...)
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 09/41] gnu: node-debug-bootstrap: " Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 11/41] gnu: node-llparse-frontend-bootstrap: " Philip McGrath
                                                                                               ` (30 subsequent siblings)
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node.scm (node-llparse-builder-bootstrap)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node.scm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 985a2fdb20..31df15ffc3 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -493,9 +493,15 @@ (define-public node-llparse-builder-bootstrap
     (arguments
      `(#:node ,node-bootstrap
        #:tests? #f
+       #:absent-dependencies
+       `("@types/mocha"
+         "@types/node"
+         "mocha"
+         "ts-node"
+         "tslint"
+         "typescript")
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure)
          (replace 'build
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((esbuild (search-input-file inputs "/bin/esbuild")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 11/41] gnu: node-llparse-frontend-bootstrap: Use #:absent-dependencies.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                               ` (9 preceding siblings ...)
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 10/41] gnu: node-llparse-builder-bootstrap: " Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 12/41] gnu: node-llparse-bootstrap: " Philip McGrath
                                                                                               ` (29 subsequent siblings)
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node.scm (node-llparse-frontend-bootstrap)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node.scm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 31df15ffc3..4d3db6a8ea 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -553,9 +553,16 @@ (define-public node-llparse-frontend-bootstrap
     (arguments
      `(#:node ,node-bootstrap
        #:tests? #f
+       #:absent-dependencies
+       `("@types/debug"
+         "@types/mocha"
+         "@types/node"
+         "mocha"
+         "ts-node"
+         "tslint"
+         "typescript")
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure)
          (replace 'build
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((esbuild (search-input-file inputs "/bin/esbuild")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 12/41] gnu: node-llparse-bootstrap: Use #:absent-dependencies.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                               ` (10 preceding siblings ...)
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 11/41] gnu: node-llparse-frontend-bootstrap: " Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 13/41] gnu: node-semver: " Philip McGrath
                                                                                               ` (28 subsequent siblings)
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node.scm (node-llparse-bootstrap)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node.scm | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 4d3db6a8ea..f952119a9f 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -613,9 +613,18 @@ (define-public node-llparse-bootstrap
     (arguments
      `(#:node ,node-bootstrap
        #:tests? #f
+       #:absent-dependencies
+       `("@types/debug"
+         "@types/mocha"
+         "@types/node"
+         "esm"
+         "llparse-test-fixture"
+         "mocha"
+         "ts-node"
+         "tslint"
+         "typescript")
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure)
          (replace 'build
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((esbuild (search-input-file inputs "/bin/esbuild")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 13/41] gnu: node-semver: Use #:absent-dependencies.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                               ` (11 preceding siblings ...)
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 12/41] gnu: node-llparse-bootstrap: " Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 14/41] gnu: node-wrappy: " Philip McGrath
                                                                                               ` (27 subsequent siblings)
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node-xyz.scm (node-semver)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node-xyz.scm | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 9a0be96852..bd72eea807 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -288,11 +288,10 @@ (define-public node-semver
                 "06biknqb05r9xsmcflm3ygh50pjvdk84x6r79w43kmck4fn3qn5p"))))
     (build-system node-build-system)
     (arguments
-     '(#:tests? #f ; FIXME: Tests depend on node-tap
-       #:phases
-       (modify-phases %standard-phases
-         ;; The only dependency to check for is tap, which we don't have.
-         (delete 'configure))))
+     '(#:absent-dependencies
+       '("tap")
+       ;; FIXME: Tests depend on node-tap
+       #:tests? #f))
     (home-page "https://github.com/npm/node-semver")
     (synopsis "Parses semantic versions strings")
     (description
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 14/41] gnu: node-wrappy: Use #:absent-dependencies.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                               ` (12 preceding siblings ...)
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 13/41] gnu: node-semver: " Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 15/41] gnu: node-once: " Philip McGrath
                                                                                               ` (26 subsequent siblings)
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node-xyz.scm (node-wrappy)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node-xyz.scm | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index bd72eea807..ceef48887e 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -315,10 +315,8 @@ (define-public node-wrappy
     (build-system node-build-system)
     (arguments
      '(#:tests? #f ; FIXME: Tests depend on node-tap
-       #:phases
-       (modify-phases %standard-phases
-         ;; The only dependency to check for is tap, which we don't have.
-         (delete 'configure))))
+       #:absent-dependencies
+       '("tap")))
     (home-page "https://github.com/npm/wrappy")
     (synopsis "Callback wrapping utility")
     (description "@code{wrappy} is a utility for Node.js to wrap callbacks.")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 15/41] gnu: node-once: Use #:absent-dependencies.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                               ` (13 preceding siblings ...)
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 14/41] gnu: node-wrappy: " Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 16/41] gnu: node-irc-colors: " Philip McGrath
                                                                                               ` (25 subsequent siblings)
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node-xyz.scm (node-once)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node-xyz.scm | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index ceef48887e..9e602fd0e8 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -337,13 +337,10 @@ (define-public node-once
                 "1z8dcbf28dqdcp4wb0c53wrs90a07nkrax2c9kk26dsk1dhrnxav"))))
     (build-system node-build-system)
     (arguments
-     '(#:tests? #f                      ; FIXME: tests depend on node-tap
-       #:phases
-       (modify-phases %standard-phases
-         ;; The default configure phase fails due to tap being missing, as we do
-         ;; not have tap packaged yet.  It is used only for tests.  This package
-         ;; still works as a dependency of node-glob and node-inflight.
-         (delete 'configure))))
+     '(#:absent-dependencies
+       '("tap")
+       ;; FIXME: Tests depend on node-tap
+       #:tests? #f))
     (inputs
      (list node-wrappy))
     (home-page "https://github.com/isaacs/once")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 16/41] gnu: node-irc-colors: Use #:absent-dependencies.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                               ` (14 preceding siblings ...)
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 15/41] gnu: node-once: " Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 17/41] gnu: node-irc: " Philip McGrath
                                                                                               ` (24 subsequent siblings)
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node-xyz.scm (node-irc-colors)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node-xyz.scm | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 9e602fd0e8..6c3811528a 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -366,12 +366,10 @@ (define-public node-irc-colors
                 "0q3y34rbnlc55jcakmdxkicwazyvyph9r6gaf6hi8k7wj2nfwfli"))))
     (build-system node-build-system)
     (arguments
-     '(#:tests? #f                      ; FIXME: tests depend on node-istanbul
-       #:phases
-       (modify-phases %standard-phases
-         ;; The default configure phase fails due to various packages
-         ;; being missing, as we don't have them packaged yet.
-         (delete 'configure))))
+     '(#:absent-dependencies
+       `("istanbul"
+         "vows")
+       #:tests? #f))
     (home-page "https://github.com/fent/irc-colors.js")
     (synopsis "Node.js module providing color and formatting for IRC")
     (description "@code{node-irc-colors} is a Node.js module that
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 17/41] gnu: node-irc: Use #:absent-dependencies.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                               ` (15 preceding siblings ...)
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 16/41] gnu: node-irc-colors: " Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 18/41] gnu: Add node-inherits Philip McGrath
                                                                                               ` (23 subsequent siblings)
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

gnu/packages/node-xyz.scm (node-irc)[arguments]: Add
`#:absent-dependencies`. Stop deleting the `'configure` phase.
---
 gnu/packages/node-xyz.scm | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 6c3811528a..93bd067311 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -393,12 +393,12 @@ (define-public node-irc
                 "1ln4qfx20jbwg4cp8lp0vf27m5281z2sz16d15xd6150n26cbi4x"))))
     (build-system node-build-system)
     (arguments
-     '(#:tests? #f                      ; FIXME: tests depend on node-faucet
-       #:phases
-       (modify-phases %standard-phases
-         ;; The default configure phase fails due to various packages
-         ;; being missing, as we don't have them packaged yet.
-         (delete 'configure))))
+     '(#:absent-dependencies
+       `("ansi-color"
+         "faucet"
+         "jscs"
+         "tape")
+       #:tests? #f))
     (inputs
      (list node-irc-colors))
     (home-page "https://github.com/martynsmith/node-irc")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 18/41] gnu: Add node-inherits.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                               ` (16 preceding siblings ...)
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 17/41] gnu: node-irc: " Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 19/41] gnu: Add node-safe-buffer Philip McGrath
                                                                                               ` (22 subsequent siblings)
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-inherits): New variable.
---
 gnu/packages/node-xyz.scm | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 93bd067311..ce098e6e8c 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2020 Giacomo Leidi <goodoldpaul@autistici.org>
 ;;; Copyright © 2021 Noisytoot <noisytoot@disroot.org>
 ;;; Copyright © 2021 Charles <charles.b.jackson@protonmail.com>
+;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -351,6 +352,35 @@ (define-public node-once
 if desired.")
     (license license:isc)))
 
+(define-public node-inherits
+  (package
+    (name "node-inherits")
+    (version "2.0.4")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/isaacs/inherits")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0cpsr5yqwkxpbbbbl0rwk4mcby6zbx841k2zb4c3gb1579i5wq9p"))))
+    (build-system node-build-system)
+    (arguments
+     '(#:absent-dependencies
+       '("tap")
+       ;; FIXME: Tests depend on node-tap
+       #:tests? #f))
+    (home-page
+     "https://github.com/isaacs/inherits")
+    (synopsis
+     "Browser-friendly inheritance Node.js")
+    (description
+     "Browser-friendly inheritance fully compatible with standard Node.js
+@code{inherits()}.")
+    (license license:isc)))
+
 (define-public node-irc-colors
   (package
     (name "node-irc-colors")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 19/41] gnu: Add node-safe-buffer.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                               ` (17 preceding siblings ...)
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 18/41] gnu: Add node-inherits Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 20/41] gnu: Add node-string-decoder Philip McGrath
                                                                                               ` (21 subsequent siblings)
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-safe-buffer): New variable.
---
 gnu/packages/node-xyz.scm | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index ce098e6e8c..410dfd6a62 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -381,6 +381,34 @@ (define-public node-inherits
 @code{inherits()}.")
     (license license:isc)))
 
+(define-public node-safe-buffer
+  (package
+    (name "node-safe-buffer")
+    (version "5.2.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/feross/safe-buffer")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0r26m0nl41h90ihnl2xf0cqs6z9z7jb87dl5j8yqb7887r9jlbpi"))))
+    (build-system node-build-system)
+    (arguments
+     '(#:absent-dependencies
+       '("tape"
+         "standard")
+       #:tests? #f))
+    (home-page
+     "https://github.com/feross/safe-buffer")
+    (synopsis "Safer Node.js Buffer API")
+    (description "A safe drop-in replacement the Node.js @code{Buffer} API
+that works in all versions of Node.js, using the built-in implementation when
+available.")
+    (license license:expat)))
+
 (define-public node-irc-colors
   (package
     (name "node-irc-colors")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 20/41] gnu: Add node-string-decoder.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                               ` (18 preceding siblings ...)
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 19/41] gnu: Add node-safe-buffer Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 21/41] gnu: Add node-readable-stream Philip McGrath
                                                                                               ` (20 subsequent siblings)
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-string-decoder): New variable.
---
 gnu/packages/node-xyz.scm | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 410dfd6a62..5dbe2cf244 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -409,6 +409,39 @@ (define-public node-safe-buffer
 available.")
     (license license:expat)))
 
+(define-public node-string-decoder
+  (package
+    (name "node-string-decoder")
+    (version "1.3.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nodejs/string_decoder")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0xxvyya9fl9rlkqwmxzqzbz4rdr3jgw4vf37hff7cgscxkhg266k"))))
+    (build-system node-build-system)
+    (arguments
+     '(#:absent-dependencies
+       '("tap"
+         "core-util-is"
+         "babel-polyfill")
+       ;; FIXME: Tests depend on node-tap
+       #:tests? #f))
+    (inputs
+     (list node-safe-buffer node-inherits))
+    (home-page
+     "https://github.com/nodejs/string_decoder")
+    (synopsis
+     "Node.js core @code{string_decoder} for userland")
+    (description
+     "This package is a mirror of the @code{string_decoder} implementation in
+Node-core.")
+    (license license:expat)))
+
 (define-public node-irc-colors
   (package
     (name "node-irc-colors")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 21/41] gnu: Add node-readable-stream.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                               ` (19 preceding siblings ...)
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 20/41] gnu: Add node-string-decoder Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 22/41] gnu: Add node-nan Philip McGrath
                                                                                               ` (19 subsequent siblings)
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-readable-stream): New variable.
---
 gnu/packages/node-xyz.scm | 52 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 5dbe2cf244..87694c7d00 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -442,6 +442,58 @@ (define-public node-string-decoder
 Node-core.")
     (license license:expat)))
 
+(define-public node-readable-stream
+  (package
+    (name "node-readable-stream")
+    (version "3.6.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nodejs/readable-stream")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0ybl4cdgsm9c5jq3xq8s01201jk8w0yakh63hlclsfbcdfqhd9ri"))))
+    (build-system node-build-system)
+    (arguments
+     `(#:absent-dependencies
+       `("@babel/cli"
+         "@babel/core"
+         "@babel/polyfill"
+         "@babel/preset-env"
+         "airtap"
+         "assert"
+         "bl"
+         "deep-strict-equal"
+         "events.once"
+         "glob"
+         "gunzip-maybe"
+         "hyperquest"
+         "lolex"
+         "nyc"
+         "pump"
+         "rimraf"
+         "tap"
+         "tape"
+         "tar-fs"
+         "util-promisify")
+       #:tests? #f))
+    (inputs
+     (list node-util-deprecate node-string-decoder node-inherits))
+    (home-page
+     "https://github.com/nodejs/readable-stream")
+    (synopsis
+     "Node.js core streams for userland")
+    (description
+     "This package is a mirror of the streams implementations in Node.js.
+
+If you want to guarantee a stable streams base, regardless of what version of
+Node you (or the users of your libraries) are using, use
+@code{readable-stream} only and avoid the @code{stream} module in Node-core.")
+    (license license:expat)))
+
 (define-public node-irc-colors
   (package
     (name "node-irc-colors")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 22/41] gnu: Add node-nan.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                               ` (20 preceding siblings ...)
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 21/41] gnu: Add node-readable-stream Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 23/41] gnu: Add node-openzwave-shared Philip McGrath
                                                                                               ` (18 subsequent siblings)
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-nan): New variable.
---
 gnu/packages/node-xyz.scm | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 87694c7d00..d8ce7248f8 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -549,3 +549,42 @@ (define-public node-irc
     (description "@code{node-irc} is an IRC client library for Node.js.
 It has functions for joining, parting, talking, and many other IRC commands.")
     (license license:gpl3+)))
+
+(define-public node-nan
+  (package
+    (name "node-nan")
+    (version "2.15.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nodejs/nan")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "18xslh9va5ld872scrp5y4251ax9s3c6qh0lnl1200lpzbsxy7yd"))))
+    (build-system node-build-system)
+    (arguments
+     `(#:absent-dependencies
+       '("bindings"
+         "commander"
+         "glob"
+         "request"
+         "node-gyp" ;; would be needed for tests
+         "tap"
+         "xtend")
+       ;; tests need tap and other dependencies
+       #:tests? #f))
+    (inputs
+     (list node-readable-stream))
+    (home-page "https://github.com/nodejs/nan")
+    (synopsis "Native Abstractions for Node.js")
+    (description "Native Abstractions for Node.js (``NaN'') provides a header
+file filled with macro and utility goodness for making add-on development for
+Node.js easier across versions.  The goal of this project is to store all logic
+necessary to develop native Node.js addons without having to inspect
+@code{NODE_MODULE_VERSION} and get yourself into a macro-tangle.
+
+This project also contains some helper utilities that make addon development a
+bit more pleasant.")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 23/41] gnu: Add node-openzwave-shared.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                               ` (21 preceding siblings ...)
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 22/41] gnu: Add node-nan Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 24/41] gnu: Add node-addon-api Philip McGrath
                                                                                               ` (17 subsequent siblings)
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/zwave.scm (node-openzwave-shared): New variable.
---
 gnu/packages/zwave.scm | 64 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)

diff --git a/gnu/packages/zwave.scm b/gnu/packages/zwave.scm
index 4d8286e334..3e99bd7687 100644
--- a/gnu/packages/zwave.scm
+++ b/gnu/packages/zwave.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -21,11 +22,14 @@ (define-module (gnu packages zwave)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix git-download)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system node)
   #:use-module (gnu packages)
   #:use-module (gnu packages base)
+  #:use-module (gnu packages node-xyz)
   #:use-module (gnu packages libusb)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages perl)
+  #:use-module (gnu packages python)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages xml))
 
@@ -85,3 +89,63 @@ (define-public open-zwave
 and respond to devices on a Z-Wave network, without requiring in-depth
 knowledge of the Z-Wave protocol.")
     (license license:lgpl3+)))
+
+(define-public node-openzwave-shared
+  (package
+    (name "node-openzwave-shared")
+    (version "1.7.2")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/OpenZWave/node-openzwave-shared")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "1bqqy12dzqj05j9wsh50dmn84dddmhz0gjzvd3y20z4hpy1v8rsc"))))
+    (inputs
+     (list open-zwave node-nan))
+    (native-inputs
+     (list which python pkg-config))
+    (build-system node-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (replace 'build
+           ;; For some reason, `npm install` doesn't build
+           ;; the addon automatically, so we do it explicitly here.
+           ;; We go through `npx` so the npmrc file sets the
+           ;; configuration up properly.
+           (lambda* (#:key native-inputs inputs #:allow-other-keys)
+             (invoke (search-input-file (or native-inputs inputs) "/bin/npx")
+                     "--call"
+                     (string-append
+                      (search-input-file
+                       (or native-inputs inputs)
+                       "/lib/node_modules/npm/bin/node-gyp-bin/node-gyp")
+                      " rebuild")))))))
+    (home-page "https://github.com/OpenZWave/node-openzwave-shared")
+    (synopsis "Node.js bindings for OpenZWave")
+    (description
+     "With the @code{node-openzwave-shared} package, you can easily control
+and manage your Z-Wave devices (lights, dimmers, blinds, you name it) from
+within Node.js applications.  This library also supports secure
+devices (e.g. door locks) that require encryption.  All widely used Node.js
+versions are supported with the help of @code{node-nan}.
+
+This library is currently able to:
+@itemize @bullet
+@item
+scan a Z-Wave network and report on connected devices;
+@item
+write values to Z-Wave nodes;
+@item
+monitor the network for changes;
+@item
+heal nodes and/or the network; and
+@item
+perform management tasks: add or remove nodes, replace failed nodes,
+manage their group associations, etc.
+@end itemize")
+    (license license:isc)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 24/41] gnu: Add node-addon-api.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                               ` (22 preceding siblings ...)
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 23/41] gnu: Add node-openzwave-shared Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 25/41] gnu: Add node-sqlite3 Philip McGrath
                                                                                               ` (16 subsequent siblings)
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-addon-api): New variable.
---
 gnu/packages/node-xyz.scm | 83 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 83 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index d8ce7248f8..91a007b55c 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -22,6 +22,9 @@
 
 (define-module (gnu packages node-xyz)
   #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (gnu packages sqlite)
+  #:use-module (gnu packages python)
+  #:use-module (guix gexp)
   #:use-module (guix packages)
   #:use-module (guix git-download)
   #:use-module (guix build-system node))
@@ -588,3 +591,83 @@ (define-public node-nan
 This project also contains some helper utilities that make addon development a
 bit more pleasant.")
     (license license:expat)))
+
+(define-public node-addon-api
+  (package
+    (name "node-addon-api")
+    (version "4.2.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nodejs/node-addon-api")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1bhvfi2m9nxfz418s619914vmidcnrzbjv6l9nid476c3zlpazch"))))
+    (inputs
+     (list python node-safe-buffer))
+    (build-system node-build-system)
+    (arguments
+     `(#:absent-dependencies
+       `("benchmark"
+         "bindings"
+         "clang-format"
+         "eslint"
+         "eslint-config-semistandard"
+         "eslint-config-standard"
+         "eslint-plugin-import"
+         "eslint-plugin-node"
+         "eslint-plugin-promise"
+         "fs-extra"
+         "path"
+         "pre-commit")
+       #:modules
+       ((guix build node-build-system)
+        (srfi srfi-1)
+        (ice-9 match)
+        (guix build utils))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'skip-js-tests
+           ;; We can't run the js-based tests,
+           ;; but we can still do the C++ parts
+           (lambda args
+             (define new-test-script
+               "echo stopping after pretest on Guix")
+             (with-atomic-json-file-replacement "package.json"
+               (match-lambda
+                 (('@ . pkg-meta-alist)
+                  (cons
+                   '@
+                   (map (match-lambda
+                          (("scripts" '@ . scripts-alist)
+                           `("scripts" @ ,@(map (match-lambda
+                                                  (("test" . _)
+                                                   (cons "test"
+                                                         new-test-script))
+                                                  (other
+                                                   other))
+                                                scripts-alist)))
+                          (other
+                           other))
+                        pkg-meta-alist))))))))))
+    (home-page "https://github.com/nodejs/node-addon-api")
+    (synopsis "Node.js API (Node-API) header-only C++ wrappers")
+    (description "This module contains header-only C++ wrapper classes which
+simplify the use of the C based Node-API provided by Node.js when using C++.
+It provides a C++ object model and exception handling semantics with low
+overhead.
+
+Node-API is an ABI stable C interface provided by Node.js for building native
+addons.  It is intended to insulate native addons from changes in the
+underlying JavaScript engine and allow modules compiled for one version to run
+on later versions of Node.js without recompilation.  The @code{node-addon-api}
+module, which is not part of Node.js, preserves the benefits of the Node-API
+as it consists only of inline code that depends only on the stable API
+provided by Node-API.
+
+It is important to remember that @emph{other} Node.js interfaces such as
+@code{libuv} (included in a project via @code{#include <uv.h>}) are not
+ABI-stable across Node.js major versions.")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 25/41] gnu: Add node-sqlite3.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                               ` (23 preceding siblings ...)
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 24/41] gnu: Add node-addon-api Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 26/41] gnu: Add node-file-uri-to-path Philip McGrath
                                                                                               ` (15 subsequent siblings)
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-sqlite3): New variable.
---
 gnu/packages/node-xyz.scm | 128 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 128 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 91a007b55c..d525da8dc3 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -671,3 +671,131 @@ (define new-test-script
 @code{libuv} (included in a project via @code{#include <uv.h>}) are not
 ABI-stable across Node.js major versions.")
     (license license:expat)))
+
+(define-public node-sqlite3
+  (package
+    (name "node-sqlite3")
+    (version "5.0.2")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/mapbox/node-sqlite3")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0sbbzzli282nxyfha10zx0k5m8hdp0sf3ipl59khjb7wm449j86h"))
+       (snippet
+        (with-imported-modules '((guix build utils))
+          #~(begin
+              (use-modules (guix build utils))
+              ;; unbundle sqlite
+              (for-each delete-file-recursively
+                        (find-files "deps"
+                                    (lambda (pth stat)
+                                      (gzip-file? pth)))))))))
+    (inputs
+     (list node-addon-api python sqlite))
+    (build-system node-build-system)
+    (arguments
+     `(#:modules
+       ((guix build node-build-system)
+        (srfi srfi-1)
+        (ice-9 match)
+        (guix build utils))
+       #:tests? #f ; FIXME: tests depend on node-mocha
+       #:absent-dependencies
+       `(;; Normally, this is "built" using @mapbox/node-pre-gyp,
+         ;; which publishes or downloads pre-built binaries
+         ;; or falls back to building from source.
+         ;; Here, we patch out all of that and just build directly.
+         ;; It would be better to patch a version of @mapbox/node-pre-gyp
+         ;; that always builds from source, as Debian does,
+         ;; but there are a number of dependencies that need
+         ;; to be packaged or removed.
+         "@mapbox/node-pre-gyp"
+         "node-pre-gyp" ;; deprecated name still used in some places
+         "aws-sdk"
+         "@mapbox/cloudfriend"
+         ;; Confusingly, this is only a dependency because of
+         ;; @mapbox/node-pre-gyp: with that removed,
+         ;; npm will use its own copy:
+         "node-gyp"
+         ;; These we'd like, we just don't have them yet:
+         "eslint"
+         "mocha")
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'configure 'npm-config-sqlite
+           ;; We need this step even if we do replace @mapbox/node-pre-gyp
+           ;; because the package expects to build its bundled sqlite
+           (lambda* (#:key inputs #:allow-other-keys)
+             (setenv "npm_config_sqlite" (assoc-ref inputs "sqlite"))))
+         (add-after 'install 'patch-binding-path
+           ;; We replace a file that dynamic searches for the addon using
+           ;; node-pre-gyp (which we don't have) with a version that
+           ;; simply uses the path to the addon we built directly.
+           ;; The exact path is supposed to depend on things like the
+           ;; architecture and napi_build_version, so, to avoid having
+           ;; hard-code the details accurately, we do this after the addon
+           ;; has been built so we can just find where it ended up.
+           (lambda* (#:key outputs #:allow-other-keys)
+             (with-directory-excursion
+                 (search-input-directory outputs
+                                         "lib/node_modules/sqlite3/lib")
+               (match (find-files "binding" "\\.node$")
+                 ((rel-path)
+                  (with-atomic-file-replacement "sqlite3-binding.js"
+                    (lambda (in out)
+                      (format out "var binding = require('./~a');\n" rel-path)
+                      (display "module.exports = exports = binding;\n"
+                               out))))))))
+         (add-after 'patch-dependencies 'avoid-node-pre-gyp
+           (lambda args
+             ;; We need to patch .npmignore before the 'repack phase
+             ;; so that the built addon is installed with in the package.
+             ;; (Upstream assumes node-pre-gyp will download a pre-built
+             ;; version when this package is installed.)
+             (substitute* ".npmignore"
+               (("lib/binding")
+                "#lib/binding # <- patched for Guix"))
+             (with-atomic-json-file-replacement "package.json"
+               (match-lambda
+                 (('@ . pkg-meta-alist)
+                  (match (assoc-ref pkg-meta-alist "binary")
+                    (('@ . binary-alist)
+                     ;; When it builds from source, node-pre-gyp supplies
+                     ;; module_name and module_path based on the entries under
+                     ;; "binary" from "package.json", so this package's
+                     ;; "binding.gyp" doesn't define them. Thus, we also need
+                     ;; to supply them. The GYP_DEFINES environment variable
+                     ;; turns out to be the easiest way to make sure they are
+                     ;; propagated from npm to node-gyp to gyp.
+                     (setenv "GYP_DEFINES"
+                             (string-append
+                              "module_name="
+                              (assoc-ref binary-alist "module_name")
+                              " "
+                              "module_path="
+                              (assoc-ref binary-alist "module_path")))))
+                  ;; We need to remove the install script from "package.json",
+                  ;; as it would try to use node-pre-gyp and would block the
+                  ;; automatic building performed by `npm install`.
+                  (cons '@ (map (match-lambda
+                                  (("scripts" @ . scripts-alist)
+                                   `("scripts" @ ,@(filter (match-lambda
+                                                             (("install" . _)
+                                                              #f)
+                                                             (_
+                                                              #t))
+                                                           scripts-alist)))
+                                  (other
+                                   other))
+                                pkg-meta-alist))))))))))
+    (home-page "https://github.com/mapbox/node-sqlite3")
+    (synopsis "Asynchronous, non-blocking SQLite3 bindings for Node.js")
+    (description
+     "The Node.js add-on @code{node-sqlite3} provides a set of a asynchronous,
+non-blocking bindings for SQLite3, written in modern C++ and tested for memory
+leaks.")
+     (license license:bsd-3)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 26/41] gnu: Add node-file-uri-to-path.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                               ` (24 preceding siblings ...)
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 25/41] gnu: Add node-sqlite3 Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 27/41] gnu: Add node-bindings Philip McGrath
                                                                                               ` (14 subsequent siblings)
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-file-uri-to-path): New variable.
---
 gnu/packages/node-xyz.scm | 54 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index d525da8dc3..6aeb651c4e 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -24,6 +24,7 @@ (define-module (gnu packages node-xyz)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (gnu packages sqlite)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages web)
   #:use-module (guix gexp)
   #:use-module (guix packages)
   #:use-module (guix git-download)
@@ -799,3 +800,56 @@ (define-public node-sqlite3
 non-blocking bindings for SQLite3, written in modern C++ and tested for memory
 leaks.")
      (license license:bsd-3)))
+
+(define-public node-file-uri-to-path
+  (package
+    (name "node-file-uri-to-path")
+    (version "2.0.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/TooTallNate/file-uri-to-path")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "08l779az44czm12xdhgcrnzpqw34s59hbrlfphs7g9y2k26drqav"))))
+    (native-inputs
+     (list esbuild))
+    (build-system node-build-system)
+    (arguments
+     `(#:absent-dependencies
+       `("@types/mocha"
+         "@types/node"
+         "@typescript-eslint/eslint-plugin"
+         "@typescript-eslint/parser"
+         "cpy-cli"
+         "eslint"
+         "eslint-config-airbnb"
+         "eslint-config-prettier"
+         "eslint-import-resolver-typescript"
+         "eslint-plugin-import"
+         "eslint-plugin-jsx-a11y"
+         "eslint-plugin-react"
+         "mocha"
+         "rimraf"
+         "typescript")
+       #:phases
+       (modify-phases %standard-phases
+         (replace 'build
+           (lambda* (#:key inputs native-inputs #:allow-other-keys)
+             (copy-recursively "src" "dist")
+             (invoke (search-input-file (or native-inputs inputs)
+                                        "/bin/esbuild")
+                     "dist/index.ts"
+                     "--outfile=dist/src/index.js"
+                     "--format=cjs"
+                     "--sourcemap"
+                     "--platform=node"))))
+       #:tests? #f))
+    (home-page "https://github.com/TooTallNate/file-uri-to-path")
+    (synopsis "Convert a @code{file:} URI to a file path")
+    (description "This package provides a function to convert a @code{file:}
+URI to a file path.  It accepts a @code{file:} URI and returns a file path
+suitable for use with the @code{fs} module functions.")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 27/41] gnu: Add node-bindings.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                               ` (25 preceding siblings ...)
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 26/41] gnu: Add node-file-uri-to-path Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 28/41] gnu: Add node-segfault-handler Philip McGrath
                                                                                               ` (13 subsequent siblings)
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-bindings): New variable.
---
 gnu/packages/node-xyz.scm | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 6aeb651c4e..ff59028e69 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -853,3 +853,29 @@ (define-public node-file-uri-to-path
 URI to a file path.  It accepts a @code{file:} URI and returns a file path
 suitable for use with the @code{fs} module functions.")
     (license license:expat)))
+
+(define-public node-bindings
+  (package
+    (name "node-bindings")
+    (version "1.5.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/TooTallNate/node-bindings")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "100gp6kpjvd4j1dqnp0sbjr1hqx5mz7r61q9qy527jyhk9mj47wk"))))
+    (inputs
+     (list node-file-uri-to-path))
+    (build-system node-build-system)
+    (arguments
+     ;; there are no tests
+     `(#:tests? #f))
+    (home-page "https://github.com/TooTallNate/node-bindings")
+    (synopsis "Help for loading your native module's @code{.node} file")
+    (description "This is a helper module for authors of Node.js native addon
+modules.  It is basically the ``swiss army knife'' of @code{require()}ing your
+native module's @code{.node} file.")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 28/41] gnu: Add node-segfault-handler.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                               ` (26 preceding siblings ...)
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 27/41] gnu: Add node-bindings Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 29/41] gnu: Add node-ms Philip McGrath
                                                                                               ` (12 subsequent siblings)
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-segfault-handler): New variable.
---
 gnu/packages/node-xyz.scm | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index ff59028e69..595885b191 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -879,3 +879,32 @@ (define-public node-bindings
 modules.  It is basically the ``swiss army knife'' of @code{require()}ing your
 native module's @code{.node} file.")
     (license license:expat)))
+
+(define-public node-segfault-handler
+  (package
+    (name "node-segfault-handler")
+    (version "1.3.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/ddopson/node-segfault-handler")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "07nbw35wvrr18kmh8f388v4k5mpjgyy0260bx0xzjdv795i3xvfv"))))
+    (native-inputs
+     (list python))
+    (inputs
+     (list node-bindings node-nan))
+    (build-system node-build-system)
+    (arguments
+     ;; there are no tests
+     `(#:tests? #f))
+    (home-page "https://github.com/ddopson/node-segfault-handler")
+    (synopsis "Catches @code{SIGSEGV} and prints diagnostic information")
+    (description "This package is a tool for debugging Node.js C/C++ native
+code modules and getting stack traces when things go wrong.  If a
+@code{SIGSEGV} signal is raised, the module will print a native stack trace to
+both @code{STDERR} and to a timestamped file.")
+    (license license:bsd-3)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 29/41] gnu: Add node-ms.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                               ` (27 preceding siblings ...)
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 28/41] gnu: Add node-segfault-handler Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 30/41] gnu: Add node-debug Philip McGrath
                                                                                               ` (11 subsequent siblings)
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-ms): New variable.
---
 gnu/packages/node-xyz.scm | 43 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 595885b191..6415fb92f5 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -908,3 +908,46 @@ (define-public node-segfault-handler
 @code{SIGSEGV} signal is raised, the module will print a native stack trace to
 both @code{STDERR} and to a timestamped file.")
     (license license:bsd-3)))
+
+(define-public node-ms
+  (package
+    (name "node-ms")
+    (version "2.1.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/vercel/ms")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1l74kmmwffmzdz38lli0v5mdb9p9jmsjxpb48ncknqw2n74cgf08"))))
+    (build-system node-build-system)
+    (arguments
+     `(#:absent-dependencies
+       `("eslint"
+         "expect.js"
+         "husky"
+         "lint-staged"
+         "mocha"
+         "prettier")
+       #:tests? #f))
+    (home-page "https://github.com/vercel/ms")
+    (synopsis "Tiny millisecond conversion utility")
+    (description "Use this package to easily convert various time formats to
+milliseconds.
+
+Features:
+@itemize @bullet
+@item
+Works both in Node.js and in the browser.
+@item
+If a number is supplied to @code{ms}, a string with a unit is returned.
+@item
+If a string that contains the number is supplied, it returns it as a
+number (e.g. it returns @code{100} for @code{'100'}).
+@item
+If you pass a string with a number and a valid unit, the number of
+equivalent milliseconds is returned.
+@end itemize")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 30/41] gnu: Add node-debug.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                               ` (28 preceding siblings ...)
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 29/41] gnu: Add node-ms Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 31/41] gnu: Add node-serialport-binding-abstract Philip McGrath
                                                                                               ` (10 subsequent siblings)
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-debug): New variable.
---
 gnu/packages/node-xyz.scm | 42 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 6415fb92f5..c07822f65b 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -951,3 +951,45 @@ (define-public node-ms
 equivalent milliseconds is returned.
 @end itemize")
     (license license:expat)))
+
+(define-public node-debug
+  (package
+    (name "node-debug")
+    (version "4.3.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/debug-js/debug")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0ji0dmdl2xkgxqxvd6xjy7k3mmknmhvqjgc40vyly9ka1mpf20vb"))))
+    (inputs
+     (list node-ms))
+    (build-system node-build-system)
+    (arguments
+     `(#:absent-dependencies
+       `("brfs"
+         "browserify"
+         "coveralls"
+         "istanbul"
+         "karma"
+         "karma-browserify"
+         "karma-chrome-launcher"
+         "karma-mocha"
+         "mocha"
+         "mocha-lcov-reporter"
+         "xo"
+         "supports-color")
+       #:tests? #f))
+    (home-page "https://github.com/debug-js/debug")
+    (synopsis "Lightweight debugging utility for Node.js and the browser")
+    (description "A tiny JavaScript debugging utility modelled after Node.js
+core's debugging technique.  orks in Node.js and web browsers.
+
+The @code{debug} module exposes a function; simply pass this function the name
+of your module, and it will return a decorated version of @code{console.error}
+for you to pass debug statements to.  This will allow you to toggle the debug
+output for different parts of your module as well as the module as a whole.")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 31/41] gnu: Add node-serialport-binding-abstract.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                               ` (29 preceding siblings ...)
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 30/41] gnu: Add node-debug Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 32/41] gnu: Add node-serialport-parser-delimiter Philip McGrath
                                                                                               ` (9 subsequent siblings)
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport-binding-abstract): New
variable.
---
 gnu/packages/node-xyz.scm | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index c07822f65b..e459f9fa40 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -993,3 +993,37 @@ (define-public node-debug
 for you to pass debug statements to.  This will allow you to toggle the debug
 output for different parts of your module as well as the module as a whole.")
     (license license:expat)))
+
+(define-public node-serialport-binding-abstract
+  (package
+    (name "node-serialport-binding-abstract")
+    (version "9.2.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/serialport/node-serialport")
+             (commit "v9.2.7")))
+       (file-name (git-file-name "serialport-monorepo" version))
+       (sha256
+        (base32 "0x7zm59a5ff5yygjyw15xs3r5m3rb8av1yfrh4snn44mrwq87yg8"))))
+    (inputs
+     (list node-debug))
+    (build-system node-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/binding-abstract"))))
+       #:tests? #f))
+    (home-page "https://serialport.io")
+    (synopsis "Abstract base class for Node SerialPort bindings")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+This package provides the @code{AbstractBinding} class, the base for all Node
+SerialPort bindings.  You wouldn't use this class directly, but instead extend
+it to make a new binding for a different platform or underling technology.")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 32/41] gnu: Add node-serialport-parser-delimiter.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                               ` (30 preceding siblings ...)
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 31/41] gnu: Add node-serialport-binding-abstract Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 33/41] gnu: Add node-serialport-parser-readline Philip McGrath
                                                                                               ` (8 subsequent siblings)
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport-parser-delimiter): New
variable.
---
 gnu/packages/node-xyz.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index e459f9fa40..7a04e66efa 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1027,3 +1027,25 @@ (define-public node-serialport-binding-abstract
 SerialPort bindings.  You wouldn't use this class directly, but instead extend
 it to make a new binding for a different platform or underling technology.")
     (license license:expat)))
+
+(define-public node-serialport-parser-delimiter
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-delimiter")
+    (version "9.2.4")
+    (inputs `())
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-delimiter"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser to split data on a delimiter")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{Delimiter}, a parser that emits data
+each time a specified byte sequence is received.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 33/41] gnu: Add node-serialport-parser-readline.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                               ` (31 preceding siblings ...)
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 32/41] gnu: Add node-serialport-parser-delimiter Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 34/41] gnu: Add node-serialport-bindings Philip McGrath
                                                                                               ` (7 subsequent siblings)
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport-parser-readline): New
variable.
---
 gnu/packages/node-xyz.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 7a04e66efa..ca18e5055e 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1049,3 +1049,26 @@ (define-public node-serialport-parser-delimiter
 Parsers are used to take raw binary data and transform them into usable
 messages.  This package provides @code{Delimiter}, a parser that emits data
 each time a specified byte sequence is received.")))
+
+(define-public node-serialport-parser-readline
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-readline")
+    (version "9.2.4")
+    (inputs
+     (list node-serialport-parser-delimiter))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-readline"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser to split data on newlines")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{Readline}, a parser that emits data
+after a (configurable) newline delimiter is received.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 34/41] gnu: Add node-serialport-bindings.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                               ` (32 preceding siblings ...)
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 33/41] gnu: Add node-serialport-parser-readline Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 35/41] gnu: Add node-serialport-parser-regex Philip McGrath
                                                                                               ` (6 subsequent siblings)
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport-bindings): New variable.
---
 gnu/packages/node-xyz.scm | 53 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index ca18e5055e..4495ea9b68 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1072,3 +1072,56 @@ (define-public node-serialport-parser-readline
 Parsers are used to take raw binary data and transform them into usable
 messages.  This package provides @code{Readline}, a parser that emits data
 after a (configurable) newline delimiter is received.")))
+
+(define-public node-serialport-bindings
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-bindings")
+    (version "9.2.7")
+    (native-inputs
+     (list python))
+    (inputs
+     (list node-nan node-bindings node-serialport-binding-abstract
+           node-serialport-parser-readline node-debug))
+    (arguments
+     `(#:absent-dependencies
+       `("prebuild-install"
+         ;; devDependencies
+         "@serialport/binding-mock"
+         "node-abi")
+       #:modules
+       ((guix build node-build-system)
+        (srfi srfi-1)
+        (ice-9 match)
+        (guix build utils))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/bindings")))
+         (add-after 'chdir 'avoid-prebuild-install
+           (lambda args
+             (with-atomic-json-file-replacement "package.json"
+               (match-lambda
+                 (('@ . pkg-meta-alist)
+                  (cons '@ (map (match-lambda
+                                  (("scripts" @ . scripts-alist)
+                                   `("scripts" @ ,@(filter (match-lambda
+                                                             (("install" . _)
+                                                              #f)
+                                                             (_
+                                                              #t))
+                                                           scripts-alist)))
+                                  (other
+                                   other))
+                                pkg-meta-alist))))))))
+       #:tests? #f))
+    (synopsis "Abstract base class for Node SerialPort bindings")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+This package provides the @code{Binding} class, which uses a native addon to
+talk to the underlying system.  You never have to use @code{Binding} objects
+directly.  There is also a @code{MockBinding} available (but not yet packaged
+for Guix) to assist with testing.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 35/41] gnu: Add node-serialport-parser-regex.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                               ` (33 preceding siblings ...)
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 34/41] gnu: Add node-serialport-bindings Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 36/41] gnu: Add node-serialport-parser-ready Philip McGrath
                                                                                               ` (5 subsequent siblings)
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport-parser-regex): New variable.
---
 gnu/packages/node-xyz.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 4495ea9b68..d26c4b8ba1 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1125,3 +1125,25 @@ (define-public node-serialport-bindings
 talk to the underlying system.  You never have to use @code{Binding} objects
 directly.  There is also a @code{MockBinding} available (but not yet packaged
 for Guix) to assist with testing.")))
+
+(define-public node-serialport-parser-regex
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-regex")
+    (version "9.2.4")
+    (inputs `())
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-regex"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser to split data on a regular expression")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{Regex}, a parser that uses a regular
+expression to split the incoming text.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 36/41] gnu: Add node-serialport-parser-ready.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                               ` (34 preceding siblings ...)
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 35/41] gnu: Add node-serialport-parser-regex Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 37/41] gnu: Add node-serialport-parser-inter-byte-timeout Philip McGrath
                                                                                               ` (4 subsequent siblings)
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport-parser-ready): New variable.
---
 gnu/packages/node-xyz.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index d26c4b8ba1..125b32ea74 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1147,3 +1147,26 @@ (define-public node-serialport-parser-regex
 Parsers are used to take raw binary data and transform them into usable
 messages.  This package provides @code{Regex}, a parser that uses a regular
 expression to split the incoming text.")))
+
+(define-public node-serialport-parser-ready
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-ready")
+    (version "9.2.4")
+    (inputs `())
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-ready"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser to wait for specified byte sequence")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{Ready}, a parser that waits for a
+specified sequence of ``ready'' bytes before emitting a ready event and
+emitting data events.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 37/41] gnu: Add node-serialport-parser-inter-byte-timeout.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                               ` (35 preceding siblings ...)
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 36/41] gnu: Add node-serialport-parser-ready Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 38/41] gnu: Add node-serialport-parser-cctalk Philip McGrath
                                                                                               ` (3 subsequent siblings)
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm
(node-serialport-parser-inter-byte-timeout): New variable.
---
 gnu/packages/node-xyz.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 125b32ea74..b240890c5b 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1170,3 +1170,25 @@ (define-public node-serialport-parser-ready
 messages.  This package provides @code{Ready}, a parser that waits for a
 specified sequence of ``ready'' bytes before emitting a ready event and
 emitting data events.")))
+
+(define-public node-serialport-parser-inter-byte-timeout
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-inter-byte-timeout")
+    (version "9.2.4")
+    (inputs `())
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-inter-byte-timeout"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser to detect pauses in data")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{InterByteTimeout}, a parser that emits
+data if there is a pause between packets for the specified amount of time.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 38/41] gnu: Add node-serialport-parser-cctalk.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                               ` (36 preceding siblings ...)
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 37/41] gnu: Add node-serialport-parser-inter-byte-timeout Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 39/41] gnu: Add node-serialport-parser-byte-length Philip McGrath
                                                                                               ` (2 subsequent siblings)
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport-parser-cctalk): New variable.
---
 gnu/packages/node-xyz.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index b240890c5b..e6e25f036a 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1192,3 +1192,26 @@ (define-public node-serialport-parser-inter-byte-timeout
 Parsers are used to take raw binary data and transform them into usable
 messages.  This package provides @code{InterByteTimeout}, a parser that emits
 data if there is a pause between packets for the specified amount of time.")))
+
+(define-public node-serialport-parser-cctalk
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-cctalk")
+    (version "9.2.4")
+    (inputs `())
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-cctalk"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser for the ccTalk protocol")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{CCTalk}, which emits packets for the
+ccTalk protocol (an open standard for currency detectors) as they are
+received.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 39/41] gnu: Add node-serialport-parser-byte-length.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                               ` (37 preceding siblings ...)
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 38/41] gnu: Add node-serialport-parser-cctalk Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 40/41] gnu: Add node-serialport-stream Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 41/41] gnu: Add node-serialport Philip McGrath
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport-parser-byte-length): New
variable.
---
 gnu/packages/node-xyz.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index e6e25f036a..fa9498e31e 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1215,3 +1215,25 @@ (define-public node-serialport-parser-cctalk
 messages.  This package provides @code{CCTalk}, which emits packets for the
 ccTalk protocol (an open standard for currency detectors) as they are
 received.")))
+
+(define-public node-serialport-parser-byte-length
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-byte-length")
+    (version "9.2.4")
+    (inputs `())
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-byte-length"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser for fixed-length buffers")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{ByteLength}, a parser that emits data
+as a buffer every time a specified number of bytes are received.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 40/41] gnu: Add node-serialport-stream.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                               ` (38 preceding siblings ...)
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 39/41] gnu: Add node-serialport-parser-byte-length Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 41/41] gnu: Add node-serialport Philip McGrath
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport-stream): New variable.
---
 gnu/packages/node-xyz.scm | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index fa9498e31e..e3fc8c23b7 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1237,3 +1237,30 @@ (define-public node-serialport-parser-byte-length
 Parsers are used to take raw binary data and transform them into usable
 messages.  This package provides @code{ByteLength}, a parser that emits data
 as a buffer every time a specified number of bytes are received.")))
+
+(define-public node-serialport-stream
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-stream")
+    (version "9.2.4")
+    (inputs
+     (list node-debug))
+    (arguments
+     `(#:absent-dependencies
+       `(;; devDependencies
+         "@serialport/binding-mock")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/stream"))))
+       #:tests? #f))
+    (synopsis "Node.js stream interface for Node SerialPort")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+This package provides an interface for using Node SerialPort bindings via the
+Node.js Stream API.  The stream is a duplex stream, allowing for reading and
+writing.  It has additional methods for managing the SerialPort
+connection.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v7 41/41] gnu: Add node-serialport.
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                               ` (39 preceding siblings ...)
  2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 40/41] gnu: Add node-serialport-stream Philip McGrath
@ 2021-12-30  7:44                                                                             ` Philip McGrath
  40 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2021-12-30  7:44 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Philip McGrath,
	Liliana Marie Prikler

* gnu/packages/node-xyz.scm (node-serialport): New variable.
---
 gnu/packages/node-xyz.scm | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index e3fc8c23b7..449b2a04fd 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1264,3 +1264,34 @@ (define-public node-serialport-stream
 Node.js Stream API.  The stream is a duplex stream, allowing for reading and
 writing.  It has additional methods for managing the SerialPort
 connection.")))
+
+(define-public node-serialport
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport")
+    (version "9.2.7")
+    (inputs
+     (list node-serialport-bindings
+           node-serialport-parser-delimiter
+           node-serialport-parser-readline
+           node-serialport-parser-regex
+           node-serialport-parser-ready
+           node-serialport-parser-inter-byte-timeout
+           node-serialport-parser-cctalk
+           node-serialport-parser-byte-length
+           node-serialport-stream
+           node-debug))
+    (arguments
+     `(#:absent-dependencies
+       `("@serialport/binding-mock")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/serialport"))))
+       #:tests? #f))
+    (synopsis "Node.js package to access serial ports")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  This package is the recommended entry point for most
+projects.  It combines a high-level Node.js stream interface with a useful
+default set of parsers and bindings.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 03/41] guix: node-build-system: Add JSON utilities.
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 03/41] guix: node-build-system: Add JSON utilities Philip McGrath
@ 2021-12-30 16:56                                                                             ` Liliana Marie Prikler
  2021-12-30 18:18                                                                             ` Liliana Marie Prikler
  1 sibling, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30 16:56 UTC (permalink / raw)
  To: Philip McGrath, 51838; +Cc: Timothy Sample, Pierre Langlois, Jelle Licht

Am Donnerstag, dem 30.12.2021 um 02:38 -0500 schrieb Philip McGrath:
> This commit adds several utility functions for non-destructive
> transformation of the JSON representation used by (guix build json),
> particularly for purely functional update of JSON objects.  They
> should
> eventually be exported, but most are private for now to allow for
> more
> experience and consideration before commiting to the API.  The design
> was largely inspired by the 'racket/dict' and 'racket/hash'
> libraries.
> Liliana Marie Prikler proposed 'with-atomic-json-file-replacement'.
Given that this is a fair amount of procedures that you're proposing, I
think a new file would be appropriate.  Perhaps (guix build json-
utils)?  Adding that should IIUC not cause a world rebuild, so we could
do that on master.




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 05/41] guix: node-build-system: Add 'delete-dependencies' helper function.
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 05/41] guix: node-build-system: Add 'delete-dependencies' helper function Philip McGrath
@ 2021-12-30 17:29                                                                             ` Liliana Marie Prikler
  2021-12-31  1:09                                                                               ` Philip McGrath
  0 siblings, 1 reply; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30 17:29 UTC (permalink / raw)
  To: Philip McGrath, 51838; +Cc: Timothy Sample, Pierre Langlois, Jelle Licht

Am Donnerstag, dem 30.12.2021 um 02:38 -0500 schrieb Philip McGrath:
> * guix/build/node-build-system.scm (delete-dependencies): New
> exported procedure.  Functionally updates a "package.json"-like value
> by removing specified npm packages from the "dependencies" and
> "devDependencies" objects.
> ---
>  guix/build/node-build-system.scm | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/guix/build/node-build-system.scm b/guix/build/node-
> build-system.scm
> index dc8b6a41c2..9967223b86 100644
> --- a/guix/build/node-build-system.scm
> +++ b/guix/build/node-build-system.scm
> @@ -27,6 +27,7 @@ (define-module (guix build node-build-system)
>    #:use-module (srfi srfi-1)
>    #:export (%standard-phases
>              with-atomic-json-file-replacement
> +            delete-dependencies
>              node-build))
>  
>  ;; Commentary:
> @@ -325,6 +326,23 @@ (define resolve-dependencies
>                                 deps))))))
>    #t)
>  
> +(define (delete-dependencies pkg-meta absent-dependencies)
> +  "Functionally update PKG-META, a json object corresponding to a
> +'package.json' file, to allow building without the ABSENT-
> DEPENDENCIES.  To
> +avoid reintroducing the ABSENT-DEPENDENCIES, only use this procedure
> after the
> +'patch-dependencies' phase."
> +  (define delete-fom-jsobject
> +    (match-lambda
> +      (('@ . alist)
> +       (cons '@ (filter (match-lambda
> +                          ((k . v)
> +                           (not (member k absent-dependencies))))
> +                        alist)))))
> +  (jsobject-update*
> +   pkg-meta
> +   "devDependencies" '(@) delete-fom-jsobject
> +   "dependencies" '(@) delete-fom-jsobject))
Given this rather easy definition in terms of our helper functions, I
think this procedure can do more.  Particularly, I'd argue that we can
define it as such:

(define* (delete-dependencies dependencies #:key (file "package.json")
                              (json-keys 
                               '("dependencies" "devDependencies"))
  "Remove DEPENDENCIES from JSON_KEYS in FILE."
  (with-atomic-json-file-replacement ...))

This would in turn make it easier to delete dependencies from #:phases,
eliminating the need to shorten it to #:absent-dependencies.  WDYT?




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 03/41] guix: node-build-system: Add JSON utilities.
  2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 03/41] guix: node-build-system: Add JSON utilities Philip McGrath
  2021-12-30 16:56                                                                             ` Liliana Marie Prikler
@ 2021-12-30 18:18                                                                             ` Liliana Marie Prikler
  2021-12-31  5:22                                                                               ` Philip McGrath
  1 sibling, 1 reply; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-30 18:18 UTC (permalink / raw)
  To: Philip McGrath, 51838; +Cc: Timothy Sample, Pierre Langlois, Jelle Licht

Having argued for these procedures to be moved into their own file in a
separate mail, now it's time to bikeshed stylistic choices.

Am Donnerstag, dem 30.12.2021 um 02:38 -0500 schrieb Philip McGrath:
> +(define (jsobject-ref js key failure-result)
> +  "Return the value assosciated with KEY in the json object JS.  If
> KEY is not
> +found and FAILURE-RESULT is a procedure, it is called in tail position
> with
> +zero arguments.  Otherwise, FAILURE-RESULT is returned."
> +  ;; TODO: `failure-result` should be optional, but should the default
> +  ;; `failure-result` be #f (like `assoc-ref`), a thunk raising an
> exception,
> +  ;; '(@), or something else?  Keep it mandatory until we discuss and
> decide.
> +  (match js
> +    (('@ . alist)
> +     (match (assoc key alist)
> +       (#f
> +        (if (procedure? failure-result)
> +            (failure-result)
> +            failure-result))
> +       ((_ . value)
> +        value)))))
We can safely replace failure-result by Guile's DEFAULT and leave error
handling to the user.

> +(define (alist-pop alist key)
> +  "Return two values: the first pair in ALIST with the given KEY in
> its
> +'car' (or #f, if no such pair exists) and an assosciation list like
> (and
> +potentially sharing storage with) ALIST, but with no entry for KEY."
> +  (match (assoc key alist)
> +    ;; If key isn't present, we don't need to do any allocation
> +    (#f
> +     (values #f alist))
> +    (found
> +     (values found
> +             ;; Because we have `found`, we can find it more
> +             ;; efficiently this time with `eq?`. We avoid using
> +             ;; `delq` because it would copy pairs in a shared
> +             ;; tail. We assume a sufficiently smart compiler to
> +             ;; handle "tail recursion modulo cons" (vid. e.g. Indiana
> +             ;; University Technical Report No. 19, Friedman & Wise
> +             ;; 1975) at least as efficiently as a hand-written
> +             ;; tail-recursive implementation with an accumulator.
> +             (let loop ((alist alist))
> +               (match alist
> +                 ;; We know that `found` is present,
> +                 ;; so no need to check for '()
> +                 ((this . alist)
> +                  (if (eq? this found)
> +                      alist
> +                      (cons this (loop alist))))))))))
I think this can be more efficiently be done in a "single" loop.

  (let loop ((rest alist)
             (previous '()))
    (match rest
      (() (values #f alist))
      ((first . rest)
       (if (eq? (car first) key)
           (values first (reverse! previous rest))
           (loop rest (cons first previous))))))

Also, I don't think your version is tail-recursive.  (loop alist) is
not in tail position from what I can tell.

We should also look into SRFI-1 span.

> +;; Sadly, Guile's implementation of (@ (srfi srfi-1) alist-delete)
> +;; performs unnecessary allocation, e.g. this currently evaluates to
> #f:
> +;;
> +;;     (let ((alist `(("a" . 1)("b" . 2)("c" . 3))))
> +;;       (eq? alist (alist-delete "x" alist)))
> +;;
> +;; These functions generally choose to allocate a new outer pair
> (with the '@
> +;; tag), even though in unusual cases the resulting object might not
> have
> +;; changed, for the sake of simplicity and to avoid retaining a
> reference to
> +;; the original alist longer than necessary. But that is O(1)
> allocation that
> +;; could only rarely be avoided: `alist-delete` would allocate O(n)
> pairs,
> +;; which would only be necessary in the worst case.
> +(define (alist-delete* alist key)
> +  "Return an assosciation list like (and potentially sharing storage
> with)
> +ALIST, but with no entry for KEY."
> +  (define-values (_popped remaining)
> +    (alist-pop alist key))
> +  remaining)
That's a pretty long comment around something that could be done with
call-with-values or SRFI-71 let.  I think one of these two should be
preferred.

Note that both our versions of alist-pop only pop the first key (as
they should).  This means that alist-delete* should really be called
alist-delete-1 as in "remove the first pair in ALIST belonging to KEY".
For the larger JSON handling below, this makes no difference however.

> +(define (jsobject-delete js key)
> +  "Return a json object like JS, but with no entry for KEY."
> +  (cons '@ (match js
> +             (('@ . alist)
> +              (alist-delete* alist key)))))
Fair enough.

> +(define (alist-set alist key value)
> +  "Return an assosciation list like ALIST, but with KEY mapped to
> VALUE,
> +replacing any existing mapping for KEY."
> +  (acons key value (alist-delete* alist key)))
Is order relevant here?  Because we could just as well reimplement our
alist-delete* loop and cons the replacement onto the rest.  WDYT?

> +(define (jsobject-set js key value)
> +  "Return a json object like JS, but with KEY mapped to VALUE,
> replacing any
> +existing mapping for KEY."
> +  (cons '@ (match js
> +             (('@ . alist)
> +              (alist-set alist key value)))))
I think it'd be wiser to put the cons inside the match.

> +(define jsobject-set*
> +  (case-lambda
> +    "Return a json object like JS, but functionally extended by
> mapping each
> +KEY to each VALUE, replacing any existing mapping for each KEY.  The
> update
> +takes place from left to right, so later mappings overwrite earlier
> mappings
> +for the same KEY."
> +    ((js)
> +     js)
> +    ((js key value)
> +     (jsobject-set js key value))
> +    ((js . args)
> +     (cons '@ (match js
> +                (('@ . alist)
> +                 (let loop ((alist alist)
> +                            (args args))
> +                   (match args
> +                     (()
> +                     alist)
> +                     ((key value . args)
> +                      (loop (alist-set alist key value)
> +                            args))))))))))
I'm not sure if I like this "syntax".  I think I'd prefer
  (jsobject-set* obj (FIELD1 VALUE1) (FIELD2 VALUE2) ...)
with FIELD1, FIELD2 being identifiers
WDYT?
> +(define (alist-update alist key failure-result updater)
> +  "Return an assosciation list like ALIST, but with KEY mapped to
> the result
> +of applying UPDATER to the value to which KEY is mapped in ALIST. 
> When ALIST
> +does not have an existing mapping for KEY, FAILURE-RESULT is used as
> with
> +'jsobject-ref' to obtain the argument for UPDATER."
> +  ;; Often, `updater` will be a lambda expression, so making it the
> last
> +  ;; argument may help to makes the code legible, and the most
> likely
> +  ;; `failure-result` arguments are all shorter than the keyword
> +  ;; `#:failure-result`.  Plus, making `failure-result` mandatory
> helps make
> +  ;; `alist-update` consistent with `alist-update*`.
Which alist-update* are you referring to here?  Either way, the
failure-result to default argument from above applies, but we could
keyword it.
> +  (define-values (popped tail-alist)
> +    (alist-pop alist key))
> +  (acons key
> +         (updater (match popped
> +                    (#f
> +                     (if (procedure? failure-result)
> +                         (failure-result)
> +                         failure-result))
> +                    ((_ . value)
> +                     value)))
> +         tail-alist))
SRFI-71 let says hi.  Also the ordering question applies.  I'm starting
to think we should implement alist-pop, alist-set and alist-update in
terms of a single more powerful function producing three values (or
SRFI-1 span).

> +(define (jsobject-update js key failure-result updater)
> +  "Return a json object like JS, but with KEY mapped to the result
> of applying
> +UPDATER to the value to which KEY is mapped in JS.  When JS does not
> have an
> +existing mapping for KEY, FAILURE-RESULT is used as with 'jsobject-
> ref' to
> +obtain the argument for UPDATER."
> +  (cons '@ (match js
> +             (('@ . alist)
> +              (alist-update alist key failure-result updater)))))
Same default argument.  Cons inside.

> +(define jsobject-update*
> +  (case-lambda
> +    "Return a json object like JS, but functionally extended by
> replacing the
> +mapping for each KEY with the result of applying the corresponding
> UPDATER to
> +the value to which that KEY is mapped in JS---or, if no such mapping
> exists,
> +to a value based on the corresponding FAILURE-RESULT as with
> 'jsobject-ref'.
> +The update takes place from left to right, so later UPDATERs will
> receive the
> +values returned by earlier UPDATERs for the same KEY."
> +    ((js)
> +     js)
> +    ((js key failure-result updater)
> +     (jsobject-update js key failure-result updater))
> +    ((js . args)
> +     (cons '@ (match js
> +                (('@ . alist)
> +                 (let loop ((alist alist)
> +                            (args args))
> +                   (match args
> +                     (()
> +                     alist)
> +                     ((key failure-result updater . args)
> +                      (loop (alist-update alist key failure-result
> updater)
> +                            args))))))))))
Same default argument.  Cons inside.

> +(define* (jsobject-union #:key
> +                         (combine (lambda (a b) b))
> +                         (combine/key (lambda (k a b) (combine a
> b)))
> +                         #:rest json-objects)
> +  "Combine the given JSON-OBJECTS into a single json object.  The
> JSON-OBJECTS
> +are merged from left to right by adding each key/value pair of each
> object to
> +the aggregate object in turn.  When one of the JSON-OBJECTS contains
> a mapping
> +from some key KEY to a value VAL such that the aggregate object
> already
> +contains a mapping from KEY to a value VAL0, the aggregate object is
> +functionally updated to instead map KEY to the value of (COMBINE/KEY
> KEY VAL0
> +VAL).  The default COMBINE/KEY tail-calls (COMBINE VAL0 VAL), and
> the default
> +COMBINE simply returns its second argument, so, by default, mappings
> in later
> +JSON-OBJECTS supersede those in earlier ones."
> +  (match (filter (lambda (v)
> +                   (not (or (keyword? v)
> +                            (procedure? v))))
> +                 json-objects)
> +    (()
> +     '(@))
> +    (((and js0 ('@ . _)))
> +     js0)
> +    ((('@ . alist0) ('@ . alist*) ...)
> +     (cons '@ (fold (lambda (alist1 alist0)
> +                      (if (null? alist0)
> +                          alist1
> +                          (fold (lambda (k+v alist0)
> +                                  (match k+v
> +                                    ((k . v)
> +                                     (define-values (popped tail-
> alist)
> +                                       (alist-pop alist0 k))
> +                                     (match popped
> +                                       (#f
> +                                        (cons k+v tail-alist))
> +                                       ((_ . v0)
> +                                        (acons k
> +                                               (combine/key k v0 v)
> +                                               tail-alist))))))
> +                                alist0
> +                                alist1)))
> +                    alist0
> +                    alist*)))))
Same default argument.  Cons inside.
I think having a single combine function taking (k a b) would be less
confusing than having two.  Is there a rationale for the form you
chose?

> +\f
> +;;;
> +;;; Phases.
> +;;;
> +
>  (define (set-home . _)
>    (with-directory-excursion ".."
>      (let loop ((i 0))
> @@ -49,7 +281,7 @@ (define (set-home . _)
>  (define (module-name module)
>    (let* ((package.json (string-append module "/package.json"))
>           (package-meta (call-with-input-file package.json read-
> json)))
> -    (assoc-ref package-meta "name")))
> +    (jsobject-ref package-meta "name" #f)))
>  
>  (define (index-modules input-paths)
>    (define (list-modules directory)
> @@ -73,27 +305,24 @@ (define* (patch-dependencies #:key inputs
> #:allow-other-keys)
>  
>    (define index (index-modules (map cdr inputs)))
>  
> -  (define (resolve-dependencies package-meta meta-key)
> -    (fold (lambda (key+value acc)
> -            (match key+value
> -              ('@ acc)
> -              ((key . value) (acons key (hash-ref index key value)
> acc))))
> -          '()
> -          (or (assoc-ref package-meta meta-key) '())))
> +  (define resolve-dependencies
> +    (match-lambda
> +      (('@ . alist)
> +       (cons '@ (map (match-lambda
> +                       ((key . value)
> +                        (cons key (hash-ref index key value))))
> +                     alist)))))
>  
> -  (with-atomic-file-replacement "package.json"
> -    (lambda (in out)
> -      (let ((package-meta (read-json in)))
> -        (assoc-set! package-meta "dependencies"
> -                    (append
> -                     '(@)
> -                     (resolve-dependencies package-meta
> "dependencies")
> -                     (resolve-dependencies package-meta
> "peerDependencies")))
> -        (assoc-set! package-meta "devDependencies"
> -                    (append
> -                     '(@)
> -                     (resolve-dependencies package-meta
> "devDependencies")))
> -        (write-json package-meta out))))
> +  (with-atomic-json-file-replacement "package.json"
> +    (lambda (pkg-meta)
> +      (jsobject-update*
> +       pkg-meta
> +       "devDependencies" '(@) resolve-dependencies
> +       "dependencies" '(@) (lambda (deps)
> +                             (resolve-dependencies
> +                              (jsobject-union
> +                               (jsobject-ref pkg-meta
> "peerDependencies" '(@))
> +                               deps))))))
>    #t)
We should probably add a function to our js utils that "generates an
empty object", because '(@) is quite confusing to see in these
circumstances.  Otherwise LGTM with the aforementioned caveats. 

Cheers




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp.
  2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                                                                                             ` (41 preceding siblings ...)
  2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
@ 2021-12-30 20:03                                                                           ` Ryan Sundberg via Guix-patches via
  42 siblings, 0 replies; 458+ messages in thread
From: Ryan Sundberg via Guix-patches via @ 2021-12-30 20:03 UTC (permalink / raw)
  To: 51838


[-- Attachment #1.1: Type: text/plain, Size: 8525 bytes --]

I think the #:absent-dependencies pattern is very straightforward
argument and is clearly a common enough occurrence to merit a shorthand
expression. I have not been following the developments in the
node-build-system here recently but it looks like lots of progress is
being made. Thanks all for contributing!

--
Sincerely,
Ryan Sundberg

On 12/29/21 11:38 PM, Philip McGrath wrote:
> Hi Liliana (and everyone),
> 
> Thanks for taking care of the earlier patches from the series!
> 
> It sounds like (guix build json) is going to be around for a reasonably
> long time, and I'm ok with that.
> 
> In the hope of clearing a path to move forward, I'm sending v6 of this
> patch series, immediately followed by a closely-related v7: I strongly
> prefer v7, but I would be ok with either version being applied if one of
> them can achieve consensus. (If v6 is merged, I'll send a separate patch
> series to propose '#:absent-dependencies'.)
> 
> I've put the two versions up on GitLab
> as <https://gitlab.com/philip1/guix-patches/-/tags/guix-issue-51838-v6>
> and <https://gitlab.com/philip1/guix-patches/-/tags/guix-issue-51838-v7>,
> respectively.
> 
> I've re-organized the patches in the series somewhat to facilitate a
> minimal, side-by-side comparison between '#:absent-dependencies' and this
> approach:
> 
> On 12/20/21 17:00, Liliana Marie Prikler wrote:
>> (add-after 'patch-dependencies 'drop-junk
>>    (lambda _
>>      (with-atomic-json-replacement "package.json"
>>        (lambda (json) (delete-dependencies json '("node-tap"))))))
> 
> The series is now organized as follows:
> 
>   - The first 4 patches are identical in v6 and v7:
> 
>       - Patches 01 & 02/41 are non-controversial build system changes
>         ('delete-lockfiles' and libuv).
> 
>       - Patch 03/41 adds to (guix build node-build-system) several utility
>         functions for transforming JSON in the representation used by (guix
>         build json), especially functional update of tagged JSON
>         objects. It also adjusts the rest of (guix build node-build-system)
>         to make use of those functions, eliminating all uses of
>         'assoc-set!' and other procedures that mutate assosciation lists.
> 
>         Of the new functions, only 'with-atomic-json-file-replacement' is
>         exported for now: my hope is that further (valuable and important!)
>         discussion about the API design of these functions or their
>         implementations need not block either v6 or v7 of this series.
> 
>       - Patch 04/41 adds the 'avoid-node-gyp-rebuild' phase. I've re-worked
>         the implementation to use the new helper functions.
> 
>   - Patch 05/41 is the truly significant difference between v6 and v7: it
>     implements the strategy for dealing with missing dependencies.
> 
>     In v6, it exports a new public function 'delete-dependencies' from
>     (guix build node-build-system).
> 
>     In v7, it adds '#:absent-dependencies'. One difference from previous
>     versions of this series is that it handles '#:absent-dependencies' in a
>     new 'delete-dependencies' phase, which makes the change even more
>     self-contained.
> 
>   - Patches 06 through 17/41 adjust existing packages to make use of the
>     approach to missing dependencies from patch 05/41 of each series.
> 
>   - Patches 18 through 41/41 add the new packages excercising native addon
>     support, again differing based on the approach from patch 05/41. The
>     other slight difference from previous versions of this series is that,
>     where applicable, I've adjusted the new package definitions to use
>     'with-atomic-json-file-replacement' and never to use 'assoc-set!' or
>     other procedures that mutate assosciation lists.
> 
> I continue to think that '#:absent-dependencies' is a good approach, in
> brief, as Jelle put it in <https://issues.guix.gnu.org/51838#247>, because:
> 
> On 12/20/21 18:10, Jelle Licht wrote:
>> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
>>> Am Montag, dem 20.12.2021 um 14:33 -0500 schrieb Philip McGrath:
>>>> If we took your final suggestion above, I think we'd have something
>>>> like this:
>>>>
>>>> ```
>>>> #:phases
>>>> (modify-phases %standard-phases
>>>>     (add-after 'unpack 'delete-dependencies
>>>>       (make-delete-dependencies-phase '("node-tap"))))
>>>> ```
>>>>
>>>> That seems pretty similar to, under the current patch series:
>>>>
>>>> ```
>>>> #:absent-dependencies '("node-tap")
>>>> ```
>>> That is the point, but please don't add a function called "make-delete-
>>> dependencies-phase".  We have lambda.  We can easily add with-atomic-
>>> json-replacement.  We can also add a "delete-dependencies" function
>>> that takes a json and a list of dependencies if you so want.
>>>
>>> So in short
>>>
>>> (add-after 'patch-dependencies 'drop-junk
>>>    (lambda _
>>>      (with-atomic-json-replacement "package.json"
>>>        (lambda (json) (delete-dependencies json '("node-tap"))))))
>>>
>>> would be the "verbose" style of disabling a list of dependencies.
>>>
>>
>> I think you are _really_ underestimating how many packages will need a
>> phase like this in the future. I would agree with this approach if it
>> were only needed incidentally, similar to the frequency of patching
>> version requirements in setup.py or requirements.txt for python
>> packages.
>>
>> Pretty much everything except the '("node-tap") list will be identical
>> between packages; how do you propose we reduce this duplication? At this
>> point I feel like I'm rehasing the opposite of your last point, so let
>> me rephrase; how many times do you want to see/type/copy+paste the above
>> snippet before you would consider exposing this functionality on a
>> higher level?
>>
> 
> Additionally, I think having a phase in '%standard-phases' is a good way of
> addressing the need to use 'delete-dependencies' after the
> 'patch-dependencies' phase, which I explain in patch v6 05/41.
> 
> But, again, I could live with either v6 or v7 being applied if one of them
> can achieve consensus.
> 
> So, without further ado, here is v6!
> 
>   -Philip
> 
> Philip McGrath (41):
>   guix: node-build-system: Add delete-lockfiles phase.
>   guix: node-build-system: Add implicit libuv input.
>   guix: node-build-system: Add JSON utilities.
>   guix: node-build-system: Add avoid-node-gyp-rebuild phase.
>   guix: node-build-system: Add 'delete-dependencies' helper function.
>   gnu: node-semver-bootstrap: Use 'delete-dependencies'.
>   gnu: node-ms-bootstrap: Use 'delete-dependencies'.
>   gnu: node-binary-search-bootstrap: Use 'delete-dependencies'.
>   gnu: node-debug-bootstrap: Use 'delete-dependencies'.
>   gnu: node-llparse-builder-bootstrap: Use 'delete-dependencies'.
>   gnu: node-llparse-frontend-bootstrap: Use 'delete-dependencies'.
>   gnu: node-llparse-bootstrap: Use 'delete-dependencies'.
>   gnu: node-semver: Use 'delete-dependencies'.
>   gnu: node-wrappy: Use 'delete-dependencies'.
>   gnu: node-once: Use 'delete-dependencies'.
>   gnu: node-irc-colors: Use 'delete-dependencies'.
>   gnu: node-irc: Use 'delete-dependencies'.
>   gnu: Add node-inherits.
>   gnu: Add node-safe-buffer.
>   gnu: Add node-string-decoder.
>   gnu: Add node-readable-stream.
>   gnu: Add node-nan.
>   gnu: Add node-openzwave-shared.
>   gnu: Add node-addon-api.
>   gnu: Add node-sqlite3.
>   gnu: Add node-file-uri-to-path.
>   gnu: Add node-bindings.
>   gnu: Add node-segfault-handler.
>   gnu: Add node-ms.
>   gnu: Add node-debug.
>   gnu: Add node-serialport-binding-abstract.
>   gnu: Add node-serialport-parser-delimiter.
>   gnu: Add node-serialport-parser-readline.
>   gnu: Add node-serialport-bindings.
>   gnu: Add node-serialport-parser-regex.
>   gnu: Add node-serialport-parser-ready.
>   gnu: Add node-serialport-parser-inter-byte-timeout.
>   gnu: Add node-serialport-parser-cctalk.
>   gnu: Add node-serialport-parser-byte-length.
>   gnu: Add node-serialport-stream.
>   gnu: Add node-serialport.
> 
>  gnu/packages/node-xyz.scm        | 1013 +++++++++++++++++++++++++++++-
>  gnu/packages/node.scm            |   78 ++-
>  gnu/packages/zwave.scm           |   64 ++
>  guix/build-system/node.scm       |    9 +-
>  guix/build/node-build-system.scm |  355 ++++++++++-
>  5 files changed, 1464 insertions(+), 55 deletions(-)
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 05/41] guix: node-build-system: Add 'delete-dependencies' helper function.
  2021-12-30 17:29                                                                             ` Liliana Marie Prikler
@ 2021-12-31  1:09                                                                               ` Philip McGrath
  2021-12-31  2:46                                                                                 ` Liliana Marie Prikler
  0 siblings, 1 reply; 458+ messages in thread
From: Philip McGrath @ 2021-12-31  1:09 UTC (permalink / raw)
  To: Liliana Marie Prikler, 51838; +Cc: Timothy Sample, Pierre Langlois, Jelle Licht

Hi,

On 12/30/21 12:29, Liliana Marie Prikler wrote:
> Am Donnerstag, dem 30.12.2021 um 02:38 -0500 schrieb Philip McGrath:
>> +(define (delete-dependencies pkg-meta absent-dependencies)
>> +  "Functionally update PKG-META, a json object corresponding to a
>> +'package.json' file, to allow building without the ABSENT-
>> DEPENDENCIES.  To
>> +avoid reintroducing the ABSENT-DEPENDENCIES, only use this procedure
>> after the
>> +'patch-dependencies' phase."
>> +  (define delete-fom-jsobject
>> +    (match-lambda
>> +      (('@ . alist)
>> +       (cons '@ (filter (match-lambda
>> +                          ((k . v)
>> +                           (not (member k absent-dependencies))))
>> +                        alist)))))
>> +  (jsobject-update*
>> +   pkg-meta
>> +   "devDependencies" '(@) delete-fom-jsobject
>> +   "dependencies" '(@) delete-fom-jsobject))
> Given this rather easy definition in terms of our helper functions, I
> think this procedure can do more.  Particularly, I'd argue that we can
> define it as such:
> 
> (define* (delete-dependencies dependencies #:key (file "package.json")
>                                (json-keys
>                                 '("dependencies" "devDependencies"))
>    "Remove DEPENDENCIES from JSON_KEYS in FILE."
>    (with-atomic-json-file-replacement ...))
> 
> This would in turn make it easier to delete dependencies from #:phases,
> eliminating the need to shorten it to #:absent-dependencies.  WDYT?
> 

I don't think '#:json-keys' would be helpful.

In my view, the high-level purpose of 'delete-dependencies', 
'#:absent-dependencies', or whatever is to gather our collective 
procedural knowledge about how to modify a "package.json" file to build 
a package without some of the dependencies its developers have declared 
and to encode that knowledge in a single, abstracted point of control in 
'node-build-system', so that authors of Node.js package definitions can 
simply specify which declared dependencies are absent and leave it to 
'node-build-system' to act accordingly. (I don't think it matters _why_ 
the dependencies are absent, i.e. whether we don't want the them or 
merely don't have them.)

In our experience so far, the necessary modification does concretely 
amount to "Remove DEPENDENCIES from JSON_KEYS in FILE.", but that is not 
the ultimate purpose of this code, and I think that description, along 
with '#:json-keys', ends up being simultaneously too flexible and too 
restrictive. It is unnecessarily flexible because, if a package author 
ever passes some other value for '#:json-keys', that would seem to 
indicate that there's some procedural knowledge missing from 
'node-build-system', and it should be added there. More significantly, 
it unnecessarily seems to restrict 'delete-dependencies' from taking 
other kinds of actions to handle the absent dependencies, if in the 
future we should discover that there's something we need to do that 
wouldn't amount to just adding another JSON key. It's a little odd to 
give an example of something we might not know, but, for example, I 
could imagine learning that correct handling of absent 
"peerDependencies" could require more involved transformation of the 
structures under "peerDependenciesMeta".

As far as the rest of your suggestion, on the one hand, this:

   (define* (delete-dependencies deps #:key (file "package.json"))
     (with-atomic-json-file-replacement ...))

seems like a fine enhancement, and I could live with it---I'd even 
prefer it, if v6 but not v7 of this patch series can achieve consensus.

On the other hand, at the risk of beating a dead horse, it seems like a 
tiny step from the above to:

   (define* ((delete-dependencies deps #:key (file "package.json")) . _)
     (with-atomic-json-file-replacement ...))

which is just another name for 'make-delete-dependencies-phase', which 
AIUI you had found objectionable. (Apparently that shorthand would need 
(ice-9 curried-definitions).)

Indeed, if we observe that '#:file', similarly to '#:json-keys', will 
never be anything _other_ than "package.json", we could further simplify to:

   (define* ((delete-dependencies deps) . _)
     (with-atomic-json-file-replacement ...))

at which point we've basically re-invented the implementation of patch 
v7 05/41, which basically amounts to:

   (define* (delete-dependencies #:key absent-dependencies)
     (with-atomic-json-file-replacement ...))

In other words, I don't agree that any of these possible changes would 
"eliminat[e] the need to shorten it to #:absent-dependencies",

I still feel that there's something I'm fundamentally not understanding 
about your objections to '#:make-absent-dependencies', which is why, in 
v6, I tried to do exactly as you had proposed:

On 12/20/21 17:00, Liliana Marie Prikler wrote:
 > Hi Timothy,
 >
 > Am Montag, dem 20.12.2021 um 15:15 -0500 schrieb Timothy Sample:
 >> Hi Philip,
 >>
 >> Philip McGrath <philip@philipmcgrath.com> writes:
 >>
 >>> If we took your final suggestion above, I think we'd have something
 >>> like this:
 >>>
 >>> ```
 >>> #:phases
 >>> (modify-phases %standard-phases
 >>>    (add-after 'unpack 'delete-dependencies
 >>>      (make-delete-dependencies-phase '("node-tap"))))
 >>> ```
 >>
 >> I’m perfectly happy with this if it’s a compromise we all can agree on.
 >> It is exactly what popped into my imagination when I read Liliana’s
 >> suggestion.  I guess the one thing missing is that it would not
 >> necessarily be implemented on top of better “package.json”
 >> manipulation support.  That said, it doesn’t preclude providing that
 >> support if/when the need arises.
 > In my personal opinion, we would write that support first and perhaps
 > the shorthands later.  I.e.
 >
 > (add-after 'patch-dependencies 'drop-junk
 >    (lambda _
 >      (with-atomic-json-replacement "package.json"
 >        (lambda (json) (delete-dependencies json '("node-tap"))))))

Certainly I do agree that it would be better to support code more 
concise than that! But I think all of these variations are strictly 
worse than '#:absent-dependencies'. It isn't just that they are more 
typing: the require authors of package definitions to have some (not 
very much, but some) procedural knowledge about _how_ 
'node-build-system' deals with the absence of dependencies, rather than 
with '#:absent-dependencies', declaratively specifying _what_ is to be 
done. For example, as I mentioned in my cover letter at 
<https://issues.guix.gnu.org/51838#257>, even my own code from the 
exchange I just quoted:

 >>>    (add-after 'unpack 'delete-dependencies
 >>>      (make-delete-dependencies-phase '("node-tap"))))

would be broken in v6, because the implementation of 
'delete-dependencies' assumes that the 'patch-dependencies' phase has 
already been run. I think this is an implementation detail that users of 
'node-build-system' should not be required to know! Indeed, I think that 
would be a good reason to have 'patch-dependencies' handle the absent 
dependencies itself, as previous versions of this series have done, but 
at least making 'delete-dependencies' a phase in 'standard-phases', as 
v7 does, relieves the user of burden of managing the ordering 
requirement manually.

I expect the majority of Guix's Node.js packages will continue for the 
foreseeable future to need the functionality for absent dependencies I 
described at the beginning of this email, so I think we should provide 
it through a mechanism that is as high-level, concise, declarative as 
possible, and ideally one that will facilitate automated code generation 
and static analysis. On each of these criteria, I think 
'#:absent-dependencies' is better than any of the other proposals I've 
heard.

But, as I said, in the interest of compromise and moving forward, I'm 
willing to live with something based on v6 for now if that's what can 
achieve consensus, and then propose '#:absent-dependencies' separately. 
So, if you want me to send a new version with one of these other 
variations, tell me which one, and I'll do it.

I hope my tone isn't coming across the wrong way---I really don't mean 
to be snarky! But I am genuinely struggling to understand the 
significance of the difference between:

 >>>    (add-after 'unpack 'delete-dependencies
 >>>      (make-delete-dependencies-phase '("node-tap"))))

which I thought you objected to, and the result of what I think you've 
most recently proposed:

     (add-after 'patch-dependencies 'delete-dependencies
       (lambda () (delete-dependencies '("node-tap"))))

which would have avoided my earlier reservations about making the JSON 
representation part of the build system's public API for the first time.

So I'm not feeling very confident in my ability to predict what changes 
would or would not block consensus.

-Philip




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 05/41] guix: node-build-system: Add 'delete-dependencies' helper function.
  2021-12-31  1:09                                                                               ` Philip McGrath
@ 2021-12-31  2:46                                                                                 ` Liliana Marie Prikler
  2022-01-05 19:08                                                                                   ` Philip McGrath
  0 siblings, 1 reply; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-31  2:46 UTC (permalink / raw)
  To: Philip McGrath, 51838; +Cc: Timothy Sample, Pierre Langlois, Jelle Licht

Hi,

Am Donnerstag, dem 30.12.2021 um 20:09 -0500 schrieb Philip McGrath:
> Hi,
> 
> On 12/30/21 12:29, Liliana Marie Prikler wrote:
> > Am Donnerstag, dem 30.12.2021 um 02:38 -0500 schrieb Philip
> > McGrath:
> > > +  (define delete-fom-jsobject
For the record, I forgot to mention the typo here.  It obviously ought
to be delete-from-jsobject.

> [...]
> I don't think '#:json-keys' would be helpful.
> 
> In my view, the high-level purpose of 'delete-dependencies', 
> '#:absent-dependencies', or whatever is to gather our collective 
> procedural knowledge about how to modify a "package.json" file to
> build a package without some of the dependencies its developers have
> declared and to encode that knowledge in a single, abstracted point
> of control in 'node-build-system', so that authors of Node.js package
> definitions can simply specify which declared dependencies are absent
> and leave it to 'node-build-system' to act accordingly. (I don't
> think it matters _why_ the dependencies are absent, i.e. whether we
> don't want the them or merely don't have them.)
For the record, you can delete present dependencies as well, which is
one shortcoming in the "absent dependencies" metaphor.  As for deleting
absent packages automatically without specifying them, one could argue
that a shortcoming of this set is that it doesn't provide a way of
doing that.  I'll take a closer look at the ease-of-use as I walk down
your reply.

> In our experience so far, the necessary modification does concretely 
> amount to "Remove DEPENDENCIES from JSON_KEYS in FILE.", but that is
> not the ultimate purpose of this code, and I think that description,
> along with '#:json-keys', ends up being simultaneously too flexible
> and too restrictive. 
Admittedly, if you read DEPENDENCIES, JSON_KEYS and FILE as mere
variables with no meaning that's bad, but the key here is that
DEPENDENCIES is a list of dependencies and JSON_KEYS is a list of json
keys that refer to dependency lists.  Anything else would be unlawful
use.

> It is unnecessarily flexible because, if a package author ever passes
> some other value for '#:json-keys', that would seem to indicate that
> there's some procedural knowledge missing from 'node-build-system',
> and it should be added there.
The reason I have it as such is that a packager might decide in the
future to e.g. only drop a peer dependency, that might share a name
with a dev dependency or something along those lines.  Along with
#:file, it's also supposed to guard against files other than
package.json containing a list of dependencies that blows up in our
faces, which we could edit with the same primitive.  That being said, I
do get your point in that it's overly flexible for now in which the
point is just to rewrite package.json.

> More significantly, it unnecessarily seems to restrict 'delete-
> dependencies' from taking other kinds of actions to handle the absent
> dependencies, if in the future we should discover that there's
> something we need to do that wouldn't amount to just adding another
> JSON key. It's a little odd to give an example of something we might
> not know, but, for example, I could imagine learning that correct
> handling of absent "peerDependencies" could require more involved
> transformation of the structures under "peerDependenciesMeta".
Do you mean that as in "if a dependency is found under this key, then
foo, bar and baz also need to happen"?  If so, that would be
concerning, but also a good reason to have that abstraction.

> As far as the rest of your suggestion, on the one hand, this:
> 
>    (define* (delete-dependencies deps #:key (file "package.json"))
>      (with-atomic-json-file-replacement ...))
> 
> seems like a fine enhancement, and I could live with it---I'd even 
> prefer it, if v6 but not v7 of this patch series can achieve
> consensus.
Given that you deleted keys, I don't think there's a good reason to
keep around file... or can it be located in a subdirectory?

> On the other hand, at the risk of beating a dead horse, it seems like
> a tiny step from the above to:
> 
>    (define* ((delete-dependencies deps #:key (file "package.json")) .
> _)
>      (with-atomic-json-file-replacement ...))
> 
> which is just another name for 'make-delete-dependencies-phase',
> which AIUI you had found objectionable. (Apparently that shorthand
> would need (ice-9 curried-definitions).)
The reason to not use a phase writer here, is that you could combine it
with other stuff in a single phase.  E.g.

  (add-after 'unpack 'remove-foo
    (lambda _
      (delete-dependencies '("foo" "bar" "baz"))
      (delete-file "baz-loader.js")))

> Indeed, if we observe that '#:file', similarly to '#:json-keys', will
> never be anything _other_ than "package.json", we could further
> simplify to:
> 
>    (define* ((delete-dependencies deps) . _)
>      (with-atomic-json-file-replacement ...))
> 
> at which point we've basically re-invented the implementation of
> patch v7 05/41, which basically amounts to:
> 
>    (define* (delete-dependencies #:key absent-dependencies)
>      (with-atomic-json-file-replacement ...))
> 
> In other words, I don't agree that any of these possible changes
> would "eliminat[e] the need to shorten it to #:absent-dependencies",
Sorry for the typo.

> I still feel that there's something I'm fundamentally not
> understanding about your objections to '#:make-absent-dependencies',
> which is why, in v6, I tried to do exactly as you had proposed:
> 
> On 12/20/21 17:00, Liliana Marie Prikler wrote:
>  > Hi Timothy,
>  >
>  > Am Montag, dem 20.12.2021 um 15:15 -0500 schrieb Timothy Sample:
>  >> Hi Philip,
>  >>
>  >> Philip McGrath <philip@philipmcgrath.com> writes:
>  >>
>  >>> If we took your final suggestion above, I think we'd have
> something
>  >>> like this:
>  >>>
>  >>> ```
>  >>> #:phases
>  >>> (modify-phases %standard-phases
>  >>>    (add-after 'unpack 'delete-dependencies
>  >>>      (make-delete-dependencies-phase '("node-tap"))))
>  >>> ```
>  >>
>  >> I’m perfectly happy with this if it’s a compromise we all can
> agree on.
>  >> It is exactly what popped into my imagination when I read
> Liliana’s
>  >> suggestion.  I guess the one thing missing is that it would not
>  >> necessarily be implemented on top of better “package.json”
>  >> manipulation support.  That said, it doesn’t preclude providing
> that
>  >> support if/when the need arises.
>  > In my personal opinion, we would write that support first and
> perhaps
>  > the shorthands later.  I.e.
>  >
>  > (add-after 'patch-dependencies 'drop-junk
>  >    (lambda _
>  >      (with-atomic-json-replacement "package.json"
>  >        (lambda (json) (delete-dependencies json '("node-tap"))))))
To be fair, finding the right sweet spot between being overly verbose
and code golfing is difficult.

> Certainly I do agree that it would be better to support code more 
> concise than that! But I think all of these variations are strictly 
> worse than '#:absent-dependencies'. It isn't just that they are more 
> typing: the require authors of package definitions to have some (not 
> very much, but some) procedural knowledge about _how_ 'node-build-
> system' deals with the absence of dependencies, rather
> than with '#:absent-dependencies', declaratively specifying _what_ is
> to be done. 
Understanding build systems is for nerds.  We here at leftpad.org care
about the things that are really important.

> For example, as I mentioned in my cover letter at 
> <https://issues.guix.gnu.org/51838#257>, even my own code from the 
> exchange I just quoted:
> 
>  >>>    (add-after 'unpack 'delete-dependencies
>  >>>      (make-delete-dependencies-phase '("node-tap"))))
> 
> would be broken in v6, because the implementation of 
> 'delete-dependencies' assumes that the 'patch-dependencies' phase has
> already been run. 
I think that is an issue with your patch, however.  With mine, you
could at least add "peerDependencies" on your own.

> I think this is an implementation detail that users of 
> 'node-build-system' should not be required to know! Indeed, I think
> that would be a good reason to have 'patch-dependencies' handle the
> absent dependencies itself [...]
I think something like that can be arranged.  We could make patch-
dependencies drop all the dependencies it doesn't know about if we add
a "verify-dependencies" phase before it.  (Note that I already
suggested that once).  verify-dependencies would raise an error if a
dependency is missing and the user could then decide to drop it or
(add-before 'verify-dependencies 'drop-dependencies ...).

> I expect the majority of Guix's Node.js packages will continue for
> the foreseeable future to need the functionality for absent
> dependencies I described at the beginning of this email, so I think
> we should provide it through a mechanism that is as high-level,
> concise, declarative as possible, and ideally one that will
> facilitate automated code generation and static analysis. On each of
> these criteria, I think '#:absent-dependencies' is better than any of
> the other proposals I've heard.
> 
> But, as I said, in the interest of compromise and moving forward, I'm
> willing to live with something based on v6 for now if that's what can
> achieve consensus, and then propose '#:absent-dependencies'
> separately.  So, if you want me to send a new version with one of
> these other variations, tell me which one, and I'll do it.
I think amending v6 with what we learn from this discussion and the
discussion on patch 3 of this series is the way to go.

Another thing I forget to mention all the time are regexps.  I think
it'd be beneficial if delete-dependencies could delete dependencies
based on their name matching a regexp rather than a string exactly. 
This would make some of your lists shorter (e.g. "karma.*"), but there
might be a debate on whether to use "^karma.*$" or whether to only
consider regexps that match the dependency fully.

> I hope my tone isn't coming across the wrong way---I really don't
> mean to be snarky! But I am genuinely struggling to understand the 
> significance of the difference between:
> 
>  >>>    (add-after 'unpack 'delete-dependencies
>  >>>      (make-delete-dependencies-phase '("node-tap"))))
> 
> which I thought you objected to, and the result of what I think
> you've most recently proposed:
> 
>      (add-after 'patch-dependencies 'delete-dependencies
>        (lambda () (delete-dependencies '("node-tap"))))
To be clear, there are two things in here which I objected.
1. make-delete-dependencies-phase as a procedure which returns the
actual phase instead of writing the lambda out.  BTW if I ever wrote
(lambda () (delete-dependencies ...)), that was a mistake on my part.
As for the reason, scroll up.
2. implementing delete-dependencies in terms of messy ad-hoc json
primitives using inner defines rather than reusable ones.

The goal was not to create the most unwieldy incantation even though it
certainly appears as though it was looking back.  Sorry for the
misunderstanding.

> which would have avoided my earlier reservations about making the
> JSON representation part of the build system's public API for the
> first time.
> 
> So I'm not feeling very confident in my ability to predict what
> changes would or would not block consensus.
Adding a gratuitous keyword is an immediate blocker as we've discussed
at length ;)
Using curried functions is also unlikely going to meaningfully advance
the discussion, but there could be a niche application in which they're
actually useful that I had not thought about.

Apart from that, there is a large room simply for discussions, where it
is unclear what form consensus will take before it is shaped.  For
instance, for patch 3, you had to write a lot of functionality from
scratch, which prompted me to suggest that you put them in their own
file (which would then be public API, though), but with a little bit of
refactoring in terms of SRFI-1 we might make it small enough to keep to
npm-build-system until Rust folks demand the same goodies.  Phase
ordering as you mentioned is also still up to debate.  So there's a lot
in which you can can add your opinion.

If you are doubtful about whether or not a particular change would be
good, you could probe different versions you have in your head and ask
for opinions on them.  E.g. provide two or three implementations of
assoc-set and let the "best" be selected.  If you only have a single
one, you can still ask if something like that would be okay and if you
receive a "No" that you don't understand it's okay to ask "what would
be the problem, what solution do you propose?" etc.  XKCD's "inventing
a new standard to cover both use-cases" applies as always too :)

Cheers




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 03/41] guix: node-build-system: Add JSON utilities.
  2021-12-30 18:18                                                                             ` Liliana Marie Prikler
@ 2021-12-31  5:22                                                                               ` Philip McGrath
  2021-12-31 10:18                                                                                 ` Liliana Marie Prikler
  0 siblings, 1 reply; 458+ messages in thread
From: Philip McGrath @ 2021-12-31  5:22 UTC (permalink / raw)
  To: Liliana Marie Prikler, 51838; +Cc: Timothy Sample, Pierre Langlois, Jelle Licht

Hi Liliana,

On 12/30/21 11:56, Liliana Marie Prikler wrote:
 > Am Donnerstag, dem 30.12.2021 um 02:38 -0500 schrieb Philip McGrath:
 >> This commit adds several utility functions for non-destructive
 >> transformation of the JSON representation used by (guix build json),
 >> particularly for purely functional update of JSON objects.  They
 >> should
 >> eventually be exported, but most are private for now to allow for
 >> more
 >> experience and consideration before commiting to the API.  The design
 >> was largely inspired by the 'racket/dict' and 'racket/hash'
 >> libraries.
 >> Liliana Marie Prikler proposed 'with-atomic-json-file-replacement'.
 > Given that this is a fair amount of procedures that you're proposing, I
 > think a new file would be appropriate.  Perhaps (guix build json-
 > utils)?  Adding that should IIUC not cause a world rebuild, so we could
 > do that on master.
 >

I agree that these functions ultimately belong in their own file, and 
I'd even had the name (guix build json-utils) in mind.

I put them in (guix build node-build-system) for now because, if they 
were in (guix build json-utils), they would have to be exported, at 
which point their API would have to be relatively stable, and I didn't 
want designing them to block, or to be rushed by, the rest of this 
series. Now, maybe consensus on the json-utils will turn out to be the 
easy part! But my high-level question is, in your view, do any of the 
points I'm about to respond to block this patch series?

On 12/30/21 13:18, Liliana Marie Prikler wrote:
> Having argued for these procedures to be moved into their own file in a
> separate mail, now it's time to bikeshed stylistic choices.
> 
> Am Donnerstag, dem 30.12.2021 um 02:38 -0500 schrieb Philip McGrath:
>> +(define (jsobject-ref js key failure-result)
>> +  "Return the value assosciated with KEY in the json object JS.  If
>> KEY is not
>> +found and FAILURE-RESULT is a procedure, it is called in tail position
>> with
>> +zero arguments.  Otherwise, FAILURE-RESULT is returned."
>> +  ;; TODO: `failure-result` should be optional, but should the default
>> +  ;; `failure-result` be #f (like `assoc-ref`), a thunk raising an
>> exception,
>> +  ;; '(@), or something else?  Keep it mandatory until we discuss and
>> decide.
>> +  (match js
>> +    (('@ . alist)
>> +     (match (assoc key alist)
>> +       (#f
>> +        (if (procedure? failure-result)
>> +            (failure-result)
>> +            failure-result))
>> +       ((_ . value)
>> +        value)))))
> We can safely replace failure-result by Guile's DEFAULT and leave error
> handling to the user.

I don't care whether we call it DEFAULT or FAILURE-RESULT.

I agree that it should not raise an exception by default. My current 
thinking is that '(@) would be a good default DEFAULT: it is useful for 
the common pattern of traversing or transforming nested objects, and, as 
you point out at the end of this email, explicitly typing #f (the other 
useful possibility) looks much more like normal Scheme than explicitly 
typing '(@).

In my experience with [1] and [2] (the purely-functional dictionary 
libraries I use most often), the special case for a procedure as DEFAULT 
is useful. I feel less strongly about it because it's relatively easy to 
work around for JSON, since you can pick some non-JSON signal value, but 
it also seems to have especially little downside for JSON, since (guix 
build json) will never have a procedure in a valid JSON object. In 
addition to raising exceptions and other control flow, it's useful for 
default values that are expensive to produce.

[1]: https://docs.racket-lang.org/reference/hashtables.html
[2]: https://docs.racket-lang.org/reference/dicts.html

> 
>> +(define (alist-pop alist key)
>> +  "Return two values: the first pair in ALIST with the given KEY in
>> its
>> +'car' (or #f, if no such pair exists) and an assosciation list like
>> (and
>> +potentially sharing storage with) ALIST, but with no entry for KEY."
>> +  (match (assoc key alist)
>> +    ;; If key isn't present, we don't need to do any allocation
>> +    (#f
>> +     (values #f alist))
>> +    (found
>> +     (values found
>> +             ;; Because we have `found`, we can find it more
>> +             ;; efficiently this time with `eq?`. We avoid using
>> +             ;; `delq` because it would copy pairs in a shared
>> +             ;; tail. We assume a sufficiently smart compiler to
>> +             ;; handle "tail recursion modulo cons" (vid. e.g. Indiana
>> +             ;; University Technical Report No. 19, Friedman & Wise
>> +             ;; 1975) at least as efficiently as a hand-written
>> +             ;; tail-recursive implementation with an accumulator.
>> +             (let loop ((alist alist))
>> +               (match alist
>> +                 ;; We know that `found` is present,
>> +                 ;; so no need to check for '()
>> +                 ((this . alist)
>> +                  (if (eq? this found)
>> +                      alist
>> +                      (cons this (loop alist))))))))))
> I think this can be more efficiently be done in a "single" loop.
> 
>    (let loop ((rest alist)
>               (previous '()))
>      (match rest
>        (() (values #f alist))
>        ((first . rest)
>         (if (eq? (car first) key)
>             (values first (reverse! previous rest))
>             (loop rest (cons first previous))))))
> 

I'll admit to a Racket bias, but, having just eliminated the use of 
'assoc-set!', I'm loathe to start mutating pairs (even correctly). To 
quote a bit from the SRFI-1 spec for 'append-reverse!', "note that this 
pattern of iterative computation followed by a reverse can frequently be 
rewritten as a recursion, dispensing with the reverse and append-reverse 
steps, and shifting temporary, intermediate storage from the heap to the 
stack, which is typically a win for reasons of cache locality and eager 
storage reclamation." (See how 'set-cdr!' can crash safe Chez Scheme! 
<https://github.com/cisco/ChezScheme/issues/599>)

IIUC, using SRFI-1's 'span' would lead to the same situation.

> Also, I don't think your version is tail-recursive.  (loop alist) is
> not in tail position from what I can tell.

Yes, "tail recursion modulo cons" refers to a compiler optimization for 
functions which are _not_ tail recursive. For full details, see the 
Friedman & Wise 1975 tech report I cited at 
<https://legacy.cs.indiana.edu/ftp/techreports/TR19.pdf> (or various 
other articles), but, as briefly as I can: The optimization rests on the 
observation that many recursive functions, like the classic definition 
of 'map':

     (define (map f lst)
       (match lst
         (()
          '())
         ((this . lst)
          (cons (f this)
                (map f lst)))))

are nearly tail-recursive, and the only real work remaining to be done 
in the continuation of the recursive call is to fill in the cdr of the 
pair. Thus, a compiler can safely transform this code into a truly 
tail-recursive implementation:

     (define (map f lst)
       (match lst
         (()
          '())
         ((this . lst)
          (define ret (list (f this)))
          (let loop ((dest ret)
                     (lst lst))
            (match lst
              ((this . lst)
               (define new (list (f this)))
               (set-cdr! dest new)
               (loop new lst))
              (()
               ret))))))

Unlike the Proper Implementation of Tail Calls (so-called "tail-call 
optimization"), handling "tail recursion modulo cons" truly is an 
optimization: it does not change the space complexity of the function. 
But it can allow the compiler to generate whatever code it thinks will 
work best with its collector/allocator and continuation/"call stack" 
implementation.

(The optimizations applies to constructors in general, not just 'cons', 
and a compiler can safely apply it to values that are immutable from the 
perspective of the source language.)

> 
>> +;; Sadly, Guile's implementation of (@ (srfi srfi-1) alist-delete)
>> +;; performs unnecessary allocation, e.g. this currently evaluates to
>> #f:
>> +;;
>> +;;     (let ((alist `(("a" . 1)("b" . 2)("c" . 3))))
>> +;;       (eq? alist (alist-delete "x" alist)))
>> +;;
>> +;; These functions generally choose to allocate a new outer pair
>> (with the '@
>> +;; tag), even though in unusual cases the resulting object might not
>> have
>> +;; changed, for the sake of simplicity and to avoid retaining a
>> reference to
>> +;; the original alist longer than necessary. But that is O(1)
>> allocation that
>> +;; could only rarely be avoided: `alist-delete` would allocate O(n)
>> pairs,
>> +;; which would only be necessary in the worst case.
>> +(define (alist-delete* alist key)
>> +  "Return an assosciation list like (and potentially sharing storage
>> with)
>> +ALIST, but with no entry for KEY."
>> +  (define-values (_popped remaining)
>> +    (alist-pop alist key))
>> +  remaining)
> That's a pretty long comment around something that could be done with
> call-with-values or SRFI-71 let.  I think one of these two should be
> preferred.
> 
> Note that both our versions of alist-pop only pop the first key (as
> they should).  This means that alist-delete* should really be called
> alist-delete-1 as in "remove the first pair in ALIST belonging to KEY".
> For the larger JSON handling below, this makes no difference however.

Here I was using '*' to mean "a slightly altered version of", as with 
'letrec' and 'letrec*', but, yes, since the other functions defined here 
use '*' to mean "zero or more times", the name is confusing: I think I'd 
just call it 'alist-delete' and not import (srfi srfi-1)'s version.

The comment may be unnecessarily long ... the essence of what I was 
trying to explain is that, in all of these implementations, I've tried 
to avoid unnecessary allocation. Being able to rely on 'alist-delete', 
and more generally 'alist-pop', not to needlessly copy the "spine" of 
the list lets later functions use them unconditionally.

Why would you prefer 'call-with-values' or SRFI-71 over 'define-values'? 
The style guide against which I'm used to working [3] generally prefers 
internal definitions, to avoid rightward drift.

[3]: 
https://docs.racket-lang.org/style/Choosing_the_Right_Construct.html#%28part._.Definitions%29

>> +(define (alist-set alist key value)
>> +  "Return an assosciation list like ALIST, but with KEY mapped to
>> VALUE,
>> +replacing any existing mapping for KEY."
>> +  (acons key value (alist-delete* alist key)))
> Is order relevant here?  Because we could just as well reimplement our
> alist-delete* loop and cons the replacement onto the rest.  WDYT?

Relying on order for JSON objects is non-interoperable, per RFC 8259 § 
4. I'm not intending for these alist procedures to be exported, so I'm 
not trying to handle any more general case than that, as I explain in 
the comments at the top of the file.

I'm not sure what the advantage would be to reimplementing the 
'alist-delete' loop here.

> 
>> +(define (jsobject-set js key value)
>> +  "Return a json object like JS, but with KEY mapped to VALUE,
>> replacing any
>> +existing mapping for KEY."
>> +  (cons '@ (match js
>> +             (('@ . alist)
>> +              (alist-set alist key value)))))
> I think it'd be wiser to put the cons inside the match.
> 

I don't care very much either way.

>> +(define jsobject-set*
>> +  (case-lambda
>> +    "Return a json object like JS, but functionally extended by
>> mapping each
>> +KEY to each VALUE, replacing any existing mapping for each KEY.  The
>> update
>> +takes place from left to right, so later mappings overwrite earlier
>> mappings
>> +for the same KEY."
>> +    ((js)
>> +     js)
>> +    ((js key value)
>> +     (jsobject-set js key value))
>> +    ((js . args)
>> +     (cons '@ (match js
>> +                (('@ . alist)
>> +                 (let loop ((alist alist)
>> +                            (args args))
>> +                   (match args
>> +                     (()
>> +                     alist)
>> +                     ((key value . args)
>> +                      (loop (alist-set alist key value)
>> +                            args))))))))))
> I'm not sure if I like this "syntax".  I think I'd prefer
>    (jsobject-set* obj (FIELD1 VALUE1) (FIELD2 VALUE2) ...)
> with FIELD1, FIELD2 being identifiers
> WDYT?

So you would make 'jsobject-set*' a macro? When you say, "with FIELD1, 
FIELD2 being identifiers", do you mean that the macro should convert 
them to strings at compile-time? While, if I were designing a JSON 
representation, I'd much prefer to use symbols for the object keys, I 
think it would be confusing to use strings everywhere else but magic 
symbols here.

I based this function on 'hash-set*' [4], 'dict-set*' [5], and numerous 
similar functions in the Racket world, so I have a high degree of 
confidence in the usability of the interface.

[4]: 
https://docs.racket-lang.org/reference/hashtables.html#%28def._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._hash-set%2A%29%29
[5]: 
https://docs.racket-lang.org/reference/dicts.html#%28def._%28%28lib._racket%2Fdict..rkt%29._dict-set%2A%29%29


>> +(define (alist-update alist key failure-result updater)
>> +  "Return an assosciation list like ALIST, but with KEY mapped to
>> the result
>> +of applying UPDATER to the value to which KEY is mapped in ALIST.
>> When ALIST
>> +does not have an existing mapping for KEY, FAILURE-RESULT is used as
>> with
>> +'jsobject-ref' to obtain the argument for UPDATER."
>> +  ;; Often, `updater` will be a lambda expression, so making it the
>> last
>> +  ;; argument may help to makes the code legible, and the most
>> likely
>> +  ;; `failure-result` arguments are all shorter than the keyword
>> +  ;; `#:failure-result`.  Plus, making `failure-result` mandatory
>> helps make
>> +  ;; `alist-update` consistent with `alist-update*`.
> Which alist-update* are you referring to here?  Either way, the
> failure-result to default argument from above applies, but we could
> keyword it.

Ah, I guess read that as, "Plus, making 'default' mandatory helps make 
'jsobject-update' consistent with 'jsobject-update*'."

>> +  (define-values (popped tail-alist)
>> +    (alist-pop alist key))
>> +  (acons key
>> +         (updater (match popped
>> +                    (#f
>> +                     (if (procedure? failure-result)
>> +                         (failure-result)
>> +                         failure-result))
>> +                    ((_ . value)
>> +                     value)))
>> +         tail-alist))
> SRFI-71 let says hi.  Also the ordering question applies.  I'm starting
> to think we should implement alist-pop, alist-set and alist-update in
> terms of a single more powerful function producing three values (or
> SRFI-1 span).

Same question again re 'define-values'.

My intent in creating 'alist-pop' was to have a primitive that would 
work for both 'alist-update' and 'alist-delete', and thereby 
'alist-set'. Returning the prefix and the tail separately would involve 
either extra allocation or mutating pairs. Since order never matters in 
this context, why pay that price?

>> +(define* (jsobject-union #:key
>> +                         (combine (lambda (a b) b))
>> +                         (combine/key (lambda (k a b) (combine a
>> b)))
>> +                         #:rest json-objects)
>> +  "Combine the given JSON-OBJECTS into a single json object.  The
>> JSON-OBJECTS
>> +are merged from left to right by adding each key/value pair of each
>> object to
>> +the aggregate object in turn.  When one of the JSON-OBJECTS contains
>> a mapping
>> +from some key KEY to a value VAL such that the aggregate object
>> already
>> +contains a mapping from KEY to a value VAL0, the aggregate object is
>> +functionally updated to instead map KEY to the value of (COMBINE/KEY
>> KEY VAL0
>> +VAL).  The default COMBINE/KEY tail-calls (COMBINE VAL0 VAL), and
>> the default
>> +COMBINE simply returns its second argument, so, by default, mappings
>> in later
>> +JSON-OBJECTS supersede those in earlier ones."
>> +  (match (filter (lambda (v)
>> +                   (not (or (keyword? v)
>> +                            (procedure? v))))
>> +                 json-objects)
>> +    (()
>> +     '(@))
>> +    (((and js0 ('@ . _)))
>> +     js0)
>> +    ((('@ . alist0) ('@ . alist*) ...)
>> +     (cons '@ (fold (lambda (alist1 alist0)
>> +                      (if (null? alist0)
>> +                          alist1
>> +                          (fold (lambda (k+v alist0)
>> +                                  (match k+v
>> +                                    ((k . v)
>> +                                     (define-values (popped tail-
>> alist)
>> +                                       (alist-pop alist0 k))
>> +                                     (match popped
>> +                                       (#f
>> +                                        (cons k+v tail-alist))
>> +                                       ((_ . v0)
>> +                                        (acons k
>> +                                               (combine/key k v0 v)
>> +                                               tail-alist))))))
>> +                                alist0
>> +                                alist1)))
>> +                    alist0
>> +                    alist*)))))
> Same default argument.  Cons inside.
> I think having a single combine function taking (k a b) would be less
> confusing than having two.  Is there a rationale for the form you
> chose?

I based this function in particular on 'hash-union' from 'racket/hash' 
[6], which uses these keywords. (But in 'hash-union', collisions trigger 
an exception by default, and it requires at least one argument, because 
otherwise it would be unclear what key-comparison function the result 
should use.)

Having '#:combine' in addition to '#:combine/key' is ultimately just a 
convenience, but it is quite a nice convenience in practice. It is quite 
rare, in my experience, for a '#:combine' function to actually depend on 
the key: it might depend on the type of the value, but, very often, it 
unconditionally applies to all keys. Using '#:combine' is particularly 
nice when using a combination function that already exists, like 
'append' or '+'.

[6]: 
https://docs.racket-lang.org/reference/hashtables.html#%28def._%28%28lib._racket%2Fhash..rkt%29._hash-union%29%29

>> +  (with-atomic-json-file-replacement "package.json"
>> +    (lambda (pkg-meta)
>> +      (jsobject-update*
>> +       pkg-meta
>> +       "devDependencies" '(@) resolve-dependencies
>> +       "dependencies" '(@) (lambda (deps)
>> +                             (resolve-dependencies
>> +                              (jsobject-union
>> +                               (jsobject-ref pkg-meta
>> "peerDependencies" '(@))
>> +                               deps))))))
>>     #t)
> We should probably add a function to our js utils that "generates an
> empty object", because '(@) is quite confusing to see in these
> circumstances.  Otherwise LGTM with the aforementioned caveats.

I'm not sure what to call it: it would have to be short, or people (me, 
at least) might end up writing '(@) anyway. Also, IIUC Guile doesn't 
actually prevent you from mutating quoted constant pairs, so I function 
would have to allocate a fresh pair to be robust.

It's a somewhat odd idea, but how about this?

     (define-syntax |{}| (identifier-syntax '(@)))

It's as short as '(@), it looks like the JSON notation for the empty 
object, and IIUC people could only use it to mess up occurrences of '(@) 
within the same compilation unit, which we can't stop them from doing 
anyway.

Alternatively, if we give up the thunk special case for 'default' 
values, we could do:

     (define jsobject-update
       (case-lambda
         ((js key updater)
          (jsobject-update js key '(@) updater))
         ((js key default updater)
          ...)))
     (define jsobject-update*
       (case-lambda
         ...
         ((js . args)
          (match js
            (('@ . alist)
             (cons '@ (let loop ((alist alist)
                                 (args args))
                        (match args
                          (()
                           alist)
                          ((key (? procedure? updater) . args)
                           (loop (alist-update alist key '(@) updater)
                                 args))
                          ((key default updater . args)
                           (loop (alist-update alist key '(@) updater)
                                 args))))))))))

-Philip




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 03/41] guix: node-build-system: Add JSON utilities.
  2021-12-31  5:22                                                                               ` Philip McGrath
@ 2021-12-31 10:18                                                                                 ` Liliana Marie Prikler
  2022-01-08  4:13                                                                                   ` Philip McGrath
  0 siblings, 1 reply; 458+ messages in thread
From: Liliana Marie Prikler @ 2021-12-31 10:18 UTC (permalink / raw)
  To: Philip McGrath, 51838; +Cc: Timothy Sample, Pierre Langlois, Jelle Licht

Hi,

Am Freitag, dem 31.12.2021 um 00:22 -0500 schrieb Philip McGrath:
> I agree that these functions ultimately belong in their own file, and
> I'd even had the name (guix build json-utils) in mind.
> 
> I put them in (guix build node-build-system) for now because, if they
> were in (guix build json-utils), they would have to be exported, at 
> which point their API would have to be relatively stable, and I
> didn't  want designing them to block, or to be rushed by, the rest of
> this series. Now, maybe consensus on the json-utils will turn out to
> be the easy part! But my high-level question is, in your view, do any
> of the points I'm about to respond to block this patch series?
We can certainly do them inside node-build-system, but I'd much prefer
if they took up less vertical real-estate.  I hope we can agree on
that.

> On 12/30/21 13:18, Liliana Marie Prikler wrote:
> > Having argued for these procedures to be moved into their own file
> > in a separate mail, now it's time to bikeshed stylistic choices.
> > 
> > Am Donnerstag, dem 30.12.2021 um 02:38 -0500 schrieb Philip
> > McGrath:
> > > +(define (jsobject-ref js key failure-result)
> > > +  "Return the value assosciated with KEY in the json object JS. 
> > > If
> > > KEY is not
> > > +found and FAILURE-RESULT is a procedure, it is called in tail
> > > position
> > > with
> > > +zero arguments.  Otherwise, FAILURE-RESULT is returned."
> > > +  ;; TODO: `failure-result` should be optional, but should the
> > > default
> > > +  ;; `failure-result` be #f (like `assoc-ref`), a thunk raising
> > > an
> > > exception,
> > > +  ;; '(@), or something else?  Keep it mandatory until we
> > > discuss and
> > > decide.
> > > +  (match js
> > > +    (('@ . alist)
> > > +     (match (assoc key alist)
> > > +       (#f
> > > +        (if (procedure? failure-result)
> > > +            (failure-result)
> > > +            failure-result))
> > > +       ((_ . value)
> > > +        value)))))
> > We can safely replace failure-result by Guile's DEFAULT and leave
> > error handling to the user.
> 
> I don't care whether we call it DEFAULT or FAILURE-RESULT.
This is not just a question of naming, but also it doesn't really make
sense to call a thunk here.  Just take DEFAULT as a value.

> I agree that it should not raise an exception by default. My current 
> thinking is that '(@) would be a good default DEFAULT: it is useful
> for the common pattern of traversing or transforming nested objects,
> and, as you point out at the end of this email, explicitly typing #f
> (the other useful possibility) looks much more like normal Scheme
> than explicitly typing '(@).
The question here is whether '(@) is a good meaningful default or
whether we just want a different way of writing it, e.g. empty-object
or (empty-object).

> In my experience with [1] and [2] (the purely-functional dictionary 
> libraries I use most often), the special case for a procedure as
> DEFAULT is useful. I feel less strongly about it because it's
> relatively easy to work around for JSON, since you can pick some non-
> JSON signal value, but it also seems to have especially little
> downside for JSON, since (guix build json) will never have a
> procedure in a valid JSON object. In addition to raising exceptions
> and other control flow, it's useful for default values that are
> expensive to produce.
That's all nice and dandy, but given that a valued DEFAULT is simpler
both in terms of interface and implementation, I think it is The Right
Thing here.  For error handling purposes, the Guile way of doing things
is to produce a value outside of the expected range (such as #f,
*unspecified* or a locally defined gensym) and check against it.

> [1]: https://docs.racket-lang.org/reference/hashtables.html
> [2]: https://docs.racket-lang.org/reference/dicts.html
> 
> > 
> > > +(define (alist-pop alist key)
> > > +  "Return two values: the first pair in ALIST with the given KEY
> > > in its
> > > +'car' (or #f, if no such pair exists) and an assosciation list
> > > like (and
> > > +potentially sharing storage with) ALIST, but with no entry for
> > > KEY."
> > > +  (match (assoc key alist)
> > > +    ;; If key isn't present, we don't need to do any allocation
> > > +    (#f
> > > +     (values #f alist))
> > > +    (found
> > > +     (values found
> > > +             ;; Because we have `found`, we can find it more
> > > +             ;; efficiently this time with `eq?`. We avoid using
> > > +             ;; `delq` because it would copy pairs in a shared
> > > +             ;; tail. We assume a sufficiently smart compiler to
> > > +             ;; handle "tail recursion modulo cons" (vid. e.g.
> > > Indiana
> > > +             ;; University Technical Report No. 19, Friedman &
> > > Wise
> > > +             ;; 1975) at least as efficiently as a hand-written
> > > +             ;; tail-recursive implementation with an
> > > accumulator.
> > > +             (let loop ((alist alist))
> > > +               (match alist
> > > +                 ;; We know that `found` is present,
> > > +                 ;; so no need to check for '()
> > > +                 ((this . alist)
> > > +                  (if (eq? this found)
> > > +                      alist
> > > +                      (cons this (loop alist))))))))))
> > I think this can be more efficiently be done in a "single" loop.
> > 
> >    (let loop ((rest alist)
> >               (previous '()))
> >      (match rest
> >        (() (values #f alist))
> >        ((first . rest)
> >         (if (eq? (car first) key)
> >             (values first (reverse! previous rest))
> >             (loop rest (cons first previous))))))
> > 
> 
> I'll admit to a Racket bias, but, having just eliminated the use of 
> 'assoc-set!', I'm loathe to start mutating pairs (even correctly). To
> quote a bit from the SRFI-1 spec for 'append-reverse!', "note that
> this pattern of iterative computation followed by a reverse can
> frequently be rewritten as a recursion, dispensing with the reverse
> and append-reverse steps, and shifting temporary, intermediate
> storage from the heap to the stack, which is typically a win for
> reasons of cache locality and eager storage reclamation." (See how
> 'set-cdr!' can crash safe Chez Scheme! 
> <https://github.com/cisco/ChezScheme/issues/599>)
> 
> IIUC, using SRFI-1's 'span' would lead to the same situation.
For the record, we can use the non-destructive append and reverse here
at the expense of more copying.  If done in terms of SRFI-1 span, we
would not need reverse as far as I understand.

> > Also, I don't think your version is tail-recursive.  (loop alist)
> > is not in tail position from what I can tell.
> 
> Yes, "tail recursion modulo cons" refers to a compiler optimization
> for functions which are _not_ tail recursive. For full details, see
> the Friedman & Wise 1975 tech report I cited at 
> <https://legacy.cs.indiana.edu/ftp/techreports/TR19.pdf> (or various 
> other articles), but, as briefly as I can: The optimization rests on
> the observation that many recursive functions, like the classic
> definition of 'map':
> 
>      (define (map f lst)
>        (match lst
>          (()
>           '())
>          ((this . lst)
>           (cons (f this)
>                 (map f lst)))))
> 
> are nearly tail-recursive, and the only real work remaining to be
> done in the continuation of the recursive call is to fill in the cdr
> of the pair. Thus, a compiler can safely transform this code into a
> truly tail-recursive implementation:
> 
>      (define (map f lst)
>        (match lst
>          (()
>           '())
>          ((this . lst)
>           (define ret (list (f this)))
>           (let loop ((dest ret)
>                      (lst lst))
>             (match lst
>               ((this . lst)
>                (define new (list (f this)))
>                (set-cdr! dest new)
>                (loop new lst))
>               (()
>                ret))))))
> 
> Unlike the Proper Implementation of Tail Calls (so-called "tail-call 
> optimization"), handling "tail recursion modulo cons" truly is an 
> optimization: it does not change the space complexity of the
> function. But it can allow the compiler to generate whatever code it
> thinks will work best with its collector/allocator and
> continuation/"call stack" implementation.
> 
> (The optimizations applies to constructors in general, not just
> 'cons', and a compiler can safely apply it to values that are
> immutable from the perspective of the source language.)
I'm not aware to which extent Guile implements tail recursion modulo
cons and I'd argue neither are you until you dig down into disassembly.
I think it's better here to avoid patterns from Racket that would feel
foreign to Guilers, particularly if you have to explain them with
reference to a paper (we already get hate for referring to Wingo's fold
for XML handling).

In principle, what you're supposing is that a sufficiently smart
compiler could rewrite

  (let ((before after (span PRED mylist))) (append before after))

to (list-copy mylist), which as far as I'm aware Guile currently
doesn't.  It could be argued that it would start doing so once I cast
some magic incantations, but I wouldn't count on it without reading the
disassembly.

> > That's a pretty long comment around something that could be done
> > with call-with-values or SRFI-71 let.  I think one of these two
> > should be preferred.
> > 
> > Note that both our versions of alist-pop only pop the first key (as
> > they should).  This means that alist-delete* should really be
> > called alist-delete-1 as in "remove the first pair in ALIST
> > belonging to KEY".
> > For the larger JSON handling below, this makes no difference
> > however.
> 
> Here I was using '*' to mean "a slightly altered version of", as with
> 'letrec' and 'letrec*', but, yes, since the other functions defined
> here use '*' to mean "zero or more times", the name is confusing: I
> think I'd just call it 'alist-delete' and not import (srfi srfi-1)'s
> version.
That's not the issue here, the issue is that the behaviour also differs
from alist-delete!

> The comment may be unnecessarily long ... the essence of what I was 
> trying to explain is that, in all of these implementations, I've
> tried to avoid unnecessary allocation. Being able to rely on
> 'alist-delete', and more generally 'alist-pop', not to needlessly
> copy the "spine" of the list lets later functions use them
> unconditionally.
Which again would be simpler if we used SRFI-1 span or another
primitive that produced (head item spine) as three outputs.  WDYT?

> Why would you prefer 'call-with-values' or SRFI-71 over 'define-
> values'?  The style guide against which I'm used to working [3]
> generally prefers internal definitions, to avoid rightward drift.
> 
> [3]: 
> https://docs.racket-lang.org/style/Choosing_the_Right_Construct.html#%28part._.Definitions%29
Again, that's a racketism.  To avoid rightward drift, we either
carefully choose where to indent or simplify our definitions to no
longer drift.  A single let in a function spanning three lines is
hardly an issue w.r.t. rightward drift.
+(define (alist-set alist key value)

> > Is order relevant here?  Because we could just as well reimplement
> > our alist-delete* loop and cons the replacement onto the rest. 
> > WDYT?
> 
> Relying on order for JSON objects is non-interoperable, per RFC 8259
> §4. I'm not intending for these alist procedures to be exported, so
> I'm not trying to handle any more general case than that, as I
> explain in the comments at the top of the file.
> 
> I'm not sure what the advantage would be to reimplementing the 
> 'alist-delete' loop here.
Fair enough, the question was however not so much what is required per
RFC, but rather if there is a natural feel of order to package.json
that we ought not disturb.  Particularly, putting dependencies before
name and version could be confusing to whoever needs to debug a delete-
dependencies phase gone wrong.

> So you would make 'jsobject-set*' a macro? When you say, "with
> FIELD1, FIELD2 being identifiers", do you mean that the macro should
> convert them to strings at compile-time? 
Yes to both.

> While, if I were designing a JSON representation, I'd much prefer to
> use symbols for the object keys, I think it would be confusing to use
> strings everywhere else but magic symbols here.
I don't think I agree here.  Assuming that jsobject-set* is a primitive
we need at the moment to be defined (rather than the more generic
jsobject-update*), I think using identifiers for JSON keys in our
rewriters would be a good abstraction.  That being said, this is not
necessarily a blocker, just a weird interface imo.
> 

> > Which alist-update* are you referring to here?  Either way, the
> > failure-result to default argument from above applies, but we could
> > keyword it.
> 
> Ah, I guess read that as, "Plus, making 'default' mandatory helps
> make 'jsobject-update' consistent with 'jsobject-update*'."
Fair enough, it's okay to admit one's typos :)
> > 

> > SRFI-71 let says hi.  Also the ordering question applies.  I'm
> > starting to think we should implement alist-pop, alist-set and
> > alist-update in terms of a single more powerful function producing
> > three values (or SRFI-1 span).
> 
> Same question again re 'define-values'.
Same answer.

> My intent in creating 'alist-pop' was to have a primitive that would 
> work for both 'alist-update' and 'alist-delete', and thereby 
> 'alist-set'. Returning the prefix and the tail separately would
> involve either extra allocation or mutating pairs.  Since order never
> matters in this context, why pay that price?
Again, our consumers are not just machines, but also human readers who
might value that order.  It is nice that you're paying attention to
allocated objects, but I think you are blind to some allocations that
you are accustomed to being reasoned away by Racket.
> 

> > Same default argument.  Cons inside.
> > I think having a single combine function taking (k a b) would be
> > less confusing than having two.  Is there a rationale for the form
> > you chose?
> 
> I based this function in particular on 'hash-union' from
> 'racket/hash' [6], which uses these keywords. (But in 'hash-union',
> collisions trigger an exception by default, and it requires at least
> one argument, because otherwise it would be unclear what key-
> comparison function the result should use.)
> 
> Having '#:combine' in addition to '#:combine/key' is ultimately just
> a convenience, but it is quite a nice convenience in practice. It is
> quite rare, in my experience, for a '#:combine' function to actually
> depend on the key: it might depend on the type of the value, but,
> very often, it  unconditionally applies to all keys. Using
> '#:combine' is particularly nice when using a combination function
> that already exists, like 'append' or '+'.
Fair enough, but what about having #:combine be your #:combine/key and
#:default-combine be your #:combine in that keyword soup?  It takes up
more horizontal real-estate (not that we wouldn't write those
vertically anyway).

Alternatively, this would be a good place to use procedure generators
for once.  (ignore-key combinator) takes a procedure that takes two
arguments (such as 'append' or '+') and produces one that takes three
and ignores the initial key.  This would also help making the interface
and implementation simpler: (json-union combinator obj ...)
> > 

> > > +  (with-atomic-json-file-replacement "package.json"
> > > +    (lambda (pkg-meta)
> > > +      (jsobject-update*
> > > +       pkg-meta
> > > +       "devDependencies" '(@) resolve-dependencies
> > > +       "dependencies" '(@) (lambda (deps)
> > > +                             (resolve-dependencies
> > > +                              (jsobject-union
> > > +                               (jsobject-ref pkg-meta
> > > "peerDependencies" '(@))
> > > +                               deps))))))
> > >     #t)
> > We should probably add a function to our js utils that "generates
> > anempty object", because '(@) is quite confusing to see in these
> > circumstances.  Otherwise LGTM with the aforementioned caveats.
> 
> I'm not sure what to call it: it would have to be short, or people
> (me, at least) might end up writing '(@) anyway.
'none', 'epsilon', '@psilon' would be nice "short" ways of writing
"empty object".

> Also, IIUC Guile doesn't actually prevent you from mutating quoted
> constant pairs, so a function would have to allocate a fresh pair to
> be robust.
That is correct, so we do have to be careful with our other primitives
here.

> It's a somewhat odd idea, but how about this?
> 
>      (define-syntax |{}| (identifier-syntax '(@)))
We can currently do without the bar escapes, but I'd prefer not to do
either, since it'd appear as similar line noise to '(@).  Having a
readable name is in my opinion to be preferred.  That being said,
identifier-syntax is the right direction in general imo.

> Alternatively, if we give up the thunk special case for 'default' 
> values, we could do:
> 
>      (define jsobject-update
>        (case-lambda
>          ((js key updater)
>           (jsobject-update js key '(@) updater))
>          ((js key default updater)
>           ...)))
> [...]
For the record, I think the only JSON primitive we need here is

(rewrite-json-file "package.json"
  ((dependencies) [do stuff with dependencies bound])
  ((devDependencies) [do stuff with devDependencies bound])
  [...])

wherein we can convert dependencies and devDependencies to and from
alists using alist->json-object and json-object->alist.  The rest can
be done using [a]list stuff from Guile core and SRFI-1 with one or two
amendments of our own.  WDYT?

The delete-dependencies phase would then be defined as 
  (define (delete-dependencies . etc)
    (define (%delete-dependencies (obj)
              (let ((alist (json-object->alist obj)))
                (alist->json [actually delete the dependencies]))))
    (rewrite-json-file "package.json"
      ((dependencies) (%delete-dependencies dependencies))
      ((devDependencies) (%delete-dependencies devDependencies))))

Pardon me not writing out etc, but I think you get the idea.

As for what happens if a value is unbound, we could make it 
  ((key [default]) code)
so imagine writing (dependencies none) instead of (dependencies) for
safety.

Cheers 




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 05/41] guix: node-build-system: Add 'delete-dependencies' helper function.
  2021-12-31  2:46                                                                                 ` Liliana Marie Prikler
@ 2022-01-05 19:08                                                                                   ` Philip McGrath
  2022-01-05 20:02                                                                                     ` Leo Famulari
  2022-01-05 21:04                                                                                     ` Liliana Marie Prikler
  0 siblings, 2 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-05 19:08 UTC (permalink / raw)
  To: Liliana Marie Prikler, 51838; +Cc: Timothy Sample, Pierre Langlois, Jelle Licht

Hi,

On 12/30/21 21:46, Liliana Marie Prikler wrote:
> Am Donnerstag, dem 30.12.2021 um 20:09 -0500 schrieb Philip McGrath:
>> I still feel that there's something I'm fundamentally not
>> understanding about your objections to '#:make-absent-dependencies',
>> which is why, in v6, I tried to do exactly as you had proposed:
>>
>> On 12/20/21 17:00, Liliana Marie Prikler wrote:
>>   > Hi Timothy,
>>   >
>>   > Am Montag, dem 20.12.2021 um 15:15 -0500 schrieb Timothy Sample:
>>   >> Hi Philip,
>>   >>
>>   >> Philip McGrath <philip@philipmcgrath.com> writes:
>>   >>
>>   >>> If we took your final suggestion above, I think we'd have
>> something
>>   >>> like this:
>>   >>>
>>   >>> ```
>>   >>> #:phases
>>   >>> (modify-phases %standard-phases
>>   >>>    (add-after 'unpack 'delete-dependencies
>>   >>>      (make-delete-dependencies-phase '("node-tap"))))
>>   >>> ```
>>   >>
>>   >> I’m perfectly happy with this if it’s a compromise we all can
>> agree on.
>>   >> It is exactly what popped into my imagination when I read
>> Liliana’s
>>   >> suggestion.  I guess the one thing missing is that it would not
>>   >> necessarily be implemented on top of better “package.json”
>>   >> manipulation support.  That said, it doesn’t preclude providing
>> that
>>   >> support if/when the need arises.
>>   > In my personal opinion, we would write that support first and
>> perhaps
>>   > the shorthands later.  I.e.
>>   >
>>   > (add-after 'patch-dependencies 'drop-junk
>>   >    (lambda _
>>   >      (with-atomic-json-replacement "package.json"
>>   >        (lambda (json) (delete-dependencies json '("node-tap"))))))
> To be fair, finding the right sweet spot between being overly verbose
> and code golfing is difficult.

I will admit that I am more than a little frustrated that, having put 
aside my own reservations and implemented the compromise proposal it 
seemed everyone could live with, it now seems that the consensus was in 
fact illusory. Moreover, I still do not understand what specific changes 
I could send in a v8 that would get this patch series to a state where 
everyone would agree it could be applied.

> 
>> Certainly I do agree that it would be better to support code more
>> concise than that! But I think all of these variations are strictly
>> worse than '#:absent-dependencies'. It isn't just that they are more
>> typing: the require authors of package definitions to have some (not
>> very much, but some) procedural knowledge about _how_ 'node-build-
>> system' deals with the absence of dependencies, rather
>> than with '#:absent-dependencies', declaratively specifying _what_ is
>> to be done.
> Understanding build systems is for nerds.  We here at leftpad.org care
> about the things that are really important.
> 

I don't know what to make of this comment, and I especially don't 
understand what the notorious left-pad incident has to do with my views. 
Aside from its inflammatory nature, I think left-pad is a confusing way 
to make a point because many people have tried to make it "stand for" 
many different, perhaps even mutually contradictory, conclusions.

In case it helps at all to state my position more fully: with or without 
Guix, I think a major purpose, perhaps even the primary purpose, of 
_any_ build system is to relieve users (including ourselves) of the 
cognitive burden of lower-level details. Build systems are a means of 
abstraction and encapsulation.

We use './configure && make && make install' to avoid having to know 
about the intricacies of flags for gcc, ordering requirements for 
building sub-projects, and innumerable quirks of strange and venerable 
systems that Autotools supports so that most of us can ignore them. We 
use 'gnu-build-system' to avoid having to know, and constantly repeat, 
the details of invoking 'configure' and 'make' to find Guix inputs and 
build to Guix outputs, along with further details of what files need to 
be patched when. Sometimes we nonetheless need to drop down to a lower 
level of abstraction, and Guix makes it convenient to do so, but the 
goal is to provide useful abstractions.

For a personal example, I've never written so much as "Hello, world" in 
Go, but I've been able to contribute packages to Guix for software I use 
that happens to be written in Go, which was much easier to do because 
'go-build-system' offers useful high-level abstractions like 
'#:unpack-path' and '#:import-path'. I didn't need to know _how_ 
'go-build-system' arranges the build environment based on those values, 
or even anything beyond the most superficial understanding of _what_ 
those values are, in order to build a Go package.

>> which would have avoided my earlier reservations about making the
>> JSON representation part of the build system's public API for the
>> first time.
>>
>> So I'm not feeling very confident in my ability to predict what
>> changes would or would not block consensus.
> Adding a gratuitous keyword is an immediate blocker as we've discussed
> at length ;)

Even when I have disagreed with your point of view, I have been trying 
my best to understand it, and I don't doubt that it is offered in good 
faith. I hope this is just a matter of some nuance in the connotation of 
the word "gratuitous" not coming across properly, but I would appreciate 
the same consideration being extended to my perspective.

Almost tautologically, I don't think adding '#:absent-dependencies' 
would be gratuitous, or I wouldn't have proposed it.

I don't want to speak for anyone but myself, but I haven't heard anyone 
else share these objections. And again, I also agreed to v6 of this 
series, in which I removed the keyword.

I don't have time right now to go through the latest comments point by 
point: I will try to do so later. From my perspective, though, the 
substance of these patches has been ready to go for something like six 
weeks now, and the few enhancements since then could easily have been 
small follow-on patches. I would consider it very regrettable if this 
patch series were to continue to be blocked by stylistic considerations 
in the implementation of unexported helper functions.

-Philip




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 05/41] guix: node-build-system: Add 'delete-dependencies' helper function.
  2022-01-05 19:08                                                                                   ` Philip McGrath
@ 2022-01-05 20:02                                                                                     ` Leo Famulari
  2022-01-06 16:50                                                                                       ` Liliana Marie Prikler
  2022-01-05 21:04                                                                                     ` Liliana Marie Prikler
  1 sibling, 1 reply; 458+ messages in thread
From: Leo Famulari @ 2022-01-05 20:02 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht,
	Liliana Marie Prikler

On Wed, Jan 05, 2022 at 02:08:30PM -0500, Philip McGrath wrote:
> I would consider it very regrettable if this patch series were to
> continue to be blocked by stylistic considerations in the implementation of
> unexported helper functions.

Agreed.

Is there a concrete problem with these patches? Or will they work as
specified for Guix packagers?

Let's remember that the primary goal of code review is to bring a
contribution into the codebase.

We have added suboptimal code to Guix many times, because it worked well
enough. Later we can refine things.

You mention go-build-system as being useful for you. That's very
gratifying, because it was a lot of hard work for me to help finalize
those patches, and they were quite far from ideal even when they were
committed. But the build system allowed Guix users to add Go packages,
which later attracted more contributions, and the go-build-system keeps
improving as a result.




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 05/41] guix: node-build-system: Add 'delete-dependencies' helper function.
  2022-01-05 19:08                                                                                   ` Philip McGrath
  2022-01-05 20:02                                                                                     ` Leo Famulari
@ 2022-01-05 21:04                                                                                     ` Liliana Marie Prikler
  2022-01-05 22:58                                                                                       ` Liliana Marie Prikler
  2022-01-08  4:14                                                                                       ` Philip McGrath
  1 sibling, 2 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2022-01-05 21:04 UTC (permalink / raw)
  To: Philip McGrath, 51838; +Cc: Timothy Sample, Pierre Langlois, Jelle Licht

Hi,

Am Mittwoch, dem 05.01.2022 um 14:08 -0500 schrieb Philip McGrath:
> I will admit that I am more than a little frustrated that, having put
> aside my own reservations and implemented the compromise proposal it 
> seemed everyone could live with, it now seems that the consensus was
> in fact illusory. Moreover, I still do not understand what specific
> changes I could send in a v8 that would get this patch series to a
> state where everyone would agree it could be applied.
To be honest, I should do part of my job as well here and apply some of
my own suggestions as I push if you deem them reasonable.  I think
that'd get us to consensus in one iteration.

> 
> I don't know what to make of this comment, and I especially don't 
> understand what the notorious left-pad incident has to do with my
> views.  Aside from its inflammatory nature, I think left-pad is a
> confusing way to make a point because many people have tried to make
> it "stand for" many different, perhaps even mutually contradictory,
> conclusions.
Point taken, I'll try to dedent my Javascript jokes.

> In case it helps at all to state my position more fully: with or
> without Guix, I think a major purpose, perhaps even the primary
> purpose, of _any_ build system is to relieve users (including
> ourselves) of the cognitive burden of lower-level details. Build
> systems are a means of abstraction and encapsulation.
> 
> [...]
I agree with you that abstractions ought to help, but we do have some
disagreements about the amount by which certain abstractions help. 
Those are gut feeling value judgements, they're not all entirely
rational.

> I hope this is just a matter of some nuance in the connotation of 
> the word "gratuitous" not coming across properly, but I would
> appreciate the same consideration being extended to my perspective.
> 
> Almost tautologically, I don't think adding '#:absent-dependencies' 
> would be gratuitous, or I wouldn't have proposed it.
Generally, keywords are reserved for a few special operations.  I don't
currently have the time to write them all up, but suffice it to say I
don't believe the way #:absent-dependencies would be used fits into any
of those.  I can write that up in a later message if you feel it's
imporant enough.

> From my perspective, though, the substance of these patches has been
> ready to go for something like six weeks now, and the few
> enhancements since then could easily have been small follow-on
> patches. I would consider it very regrettable if this patch series
> were to continue to be blocked by stylistic considerations 
> in the implementation of unexported helper functions.
That's not at all my intention.  I'll write up a checklist as a follow-
up.  We can go over these shortly and I'll have v6 with minor
adjustments land hopefully soon (if it can't be done tomorrow I'll
shoot for Sunday).  Would that be acceptable?




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 05/41] guix: node-build-system: Add 'delete-dependencies' helper function.
  2022-01-05 21:04                                                                                     ` Liliana Marie Prikler
@ 2022-01-05 22:58                                                                                       ` Liliana Marie Prikler
  2022-01-08  4:14                                                                                       ` Philip McGrath
  1 sibling, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2022-01-05 22:58 UTC (permalink / raw)
  To: Philip McGrath, 51838; +Cc: Timothy Sample, Pierre Langlois, Jelle Licht

Am Mittwoch, dem 05.01.2022 um 22:04 +0100 schrieb Liliana Marie
Prikler:
> That's not at all my intention.  I'll write up a checklist as a
> follow-up.  We can go over these shortly and I'll have v6 with minor
> adjustments land hopefully soon (if it can't be done tomorrow I'll
> shoot for Sunday).  Would that be acceptable?
Okay, here's my checklist.  I'll denote discussion points with numbers
and actionable tasks with square brackets.  Send me a reply in which
you mark either the ones you want to have or the ones you don't (give a
short reason for each) and I'll make it work.  The entries marked with
a forward slash would require an additional round of review to ensure I
don't fuck any of this up (pardon my lack of a better term), so it's
probably better to open up separate bugs for those if we want to be
quick.  I feel rather confident about the rest, however.

1. Move alist/json primitives to new file or shrink them in vertical
size.  Since you raised valid points against moving them, that'd be
shrinking them in vertical size.  To this end:
[ ] Use SRFI-71 wherever applicable.
[ ] Implement them in terms of SRFI-1 span.
[ ] For the json-side only define json-update* as it appears to be the
only one used later on (need confirmation on that one)

2. Reduce Racketisms
[ ] Use DEFAULT instead of FAILURE_RESULT.
[/] Define json-update* as syntax.

3. Generic style stuff
[ ] Move conses inside match.
[/] Merge with-atomic-json-file-replacement and json-update into a
single syntax (rewrite-json-file).
[ ] Simplify delete-dependencies so that we can directly write 
(lambda args (delete-dependencies DEPS).
[ ] Use identifier-syntax for the empty JSON object (how do we name
it?)

If I omitted anything and it's simple enough to fit this mold, do add
it and I'll see if I can tack it on or we would need to go through
another round for that.  Sorry this all took so long.




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 05/41] guix: node-build-system: Add 'delete-dependencies' helper function.
  2022-01-05 20:02                                                                                     ` Leo Famulari
@ 2022-01-06 16:50                                                                                       ` Liliana Marie Prikler
  2022-01-06 17:28                                                                                         ` Leo Famulari
  0 siblings, 1 reply; 458+ messages in thread
From: Liliana Marie Prikler @ 2022-01-06 16:50 UTC (permalink / raw)
  To: Leo Famulari, Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht

[-- Attachment #1: Type: text/plain, Size: 1279 bytes --]

Hi Leo,

Am Mittwoch, dem 05.01.2022 um 15:02 -0500 schrieb Leo Famulari:
> On Wed, Jan 05, 2022 at 02:08:30PM -0500, Philip McGrath wrote:
> > I would consider it very regrettable if this patch series were to
> > continue to be blocked by stylistic considerations in the
> > implementation of
> > unexported helper functions.
> 
> Agreed.
> 
> Is there a concrete problem with these patches? Or will they work as
> specified for Guix packagers?
> 
> Let's remember that the primary goal of code review is to bring a
> contribution into the codebase.
I'm currently in the process of applying my own checklist, see
<https://issues.guix.gnu.org/issue/51838/raw/352>

Each of my fixup commits is a change on top of Philip's corresponding
commit (or at least I hope so, I haven't squashed them yet) and delete-
dependencies.patch shows the savings in the rest of the series.  I so
far successfully built node-irc and node-serialport with these changes
applied on top.

It'll take some time to check the rest of the toplevel packages and
thereafter I'll squash and cleanup commit messages.

So from my position, everything is about to be done.  Should I resend
this as v8 for a complete check that I'm not doing anything harmful or
should I go ahead and commit once I'm done?

Cheers

[-- Attachment #2: 0001-Fixup-03-41.patch --]
[-- Type: text/x-patch, Size: 15899 bytes --]

From 280dd782003075444037297a4a5dd5723ff1f459 Mon Sep 17 00:00:00 2001
From: Liliana Marie Prikler <liliana.prikler@gmail.com>
Date: Thu, 6 Jan 2022 15:08:24 +0100
Subject: [PATCH 1/3] Fixup 03/41.

This commit adds several utility functions for non-destructive
transformation of the JSON representation used by (guix build json),
particularly for purely functional update of JSON objects.  They ought
to eventually be exported from their own module, but for now are kept
private to allow experimentation.

* guix/build/node-build-system.scm (assoc-ref*, jsobject-ref, alist-pop)
(alist-update, jsobject-update*, jsobject-union): New variables.
(with-atomic-json-file-replacement): New public variable.
(module-name, build, patch-dependencies): Use them.  Do not resort to
unsafe alist primitives from Guile core.
---
 guix/build/node-build-system.scm | 313 +++++++++----------------------
 1 file changed, 85 insertions(+), 228 deletions(-)

diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
index 9967223b86..d695424e50 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -25,35 +25,12 @@ (define-module (guix build node-build-system)
   #:use-module (ice-9 ftw)
   #:use-module (ice-9 match)
   #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-71)
   #:export (%standard-phases
             with-atomic-json-file-replacement
             delete-dependencies
             node-build))
 
-;; Commentary:
-;;
-;; Builder-side code of the standard Node/NPM package install procedure.
-;;
-;; Code:
-
-;;;
-;;; JSON utilities.
-;;;
-;;; The following procedures facilitate transforming JSON values using the
-;;; representation from (guix build json), particularly purely functional
-;;; update of JSON objects.  If we decide to make more of them public, we
-;;; might instead put them in their own file or, eventually, add them to
-;;; (guix build json).
-;;;
-;;; JSON objects with duplicate keys are not interoperable: see RFC 8259 § 4.
-;;; These procedures assume, but generally do not check, that JSON objects
-;;; given to them as arguments do not have duplicate keys.  As long as that
-;;; precondition is satisfied, they will produce JSON objects without
-;;; duplicate keys.  Procedures that operate on unwrapped assosciation lists
-;;; may do likewise, which should be considered before exporting them for
-;;; general use.
-;;;
-
 (define (with-atomic-json-file-replacement file proc)
   "Like 'with-atomic-file-replacement', but PROC is called with a single
 argument---the result of parsing FILE's contents as json---and should a value
@@ -62,205 +39,83 @@ (define (with-atomic-json-file-replacement file proc)
     (lambda (in out)
       (write-json (proc (read-json in)) out))))
 
-(define (jsobject-ref js key failure-result)
-  "Return the value assosciated with KEY in the json object JS.  If KEY is not
-found and FAILURE-RESULT is a procedure, it is called in tail position with
-zero arguments.  Otherwise, FAILURE-RESULT is returned."
-  ;; TODO: `failure-result` should be optional, but should the default
-  ;; `failure-result` be #f (like `assoc-ref`), a thunk raising an exception,
-  ;; '(@), or something else?  Keep it mandatory until we discuss and decide.
+(define* (assoc-ref* alist key #:optional default)
+  "Like assoc-ref, but return DEFAULT instead of #f if no value exists."
+  (match (assoc key alist)
+    (#f default)
+    ((_ . value) value)))
+
+(define* (jsobject-ref obj key #:optional default)
+  (match obj
+    (('@ . alist) (assoc-ref* alist key default))))
+
+(define* (alist-pop alist key #:optional (= equal?))
+  "Return two values, the first pair in ALIST with key KEY, and the other
+elements.  Equality calls are made as (= KEY ALISTCAR)."
+  (define (found? pair)
+    (= key (car pair)))
+
+  (let ((before after (break found? alist)))
+    (if (pair? after)
+        (values (car after) (append before (cdr after)))
+        (values #f before))))
+
+(define* (alist-update alist key proc #:optional default (= equal?))
+  "Return an association list like ALIST, but with KEY mapped to the result of
+PROC applied to the first value found under the comparison (= KEY ALISTCAR).
+If no such value exists, use DEFAULT instead.
+Unlike acons, this removes the previous association of KEY (assuming it is
+unique), but the result may still share storage with ALIST."
+  (let ((pair rest (alist-pop alist key =)))
+    (acons key
+           (proc (if (pair? pair)
+                     (cdr pair)
+                     default))
+           rest)))
+
+(define (jsobject-update* js . updates)
+  "Return a json object like JS, but with all UPDATES applied.  Each update
+is a list (KEY PROC [DEFAULT]), so that KEY is mapped to the result of
+PROC applied to the value found for it, or DEFAULT otherwise."
   (match js
     (('@ . alist)
-     (match (assoc key alist)
-       (#f
-        (if (procedure? failure-result)
-            (failure-result)
-            failure-result))
-       ((_ . value)
-        value)))))
-
-(define (alist-pop alist key)
-  "Return two values: the first pair in ALIST with the given KEY in its
-'car' (or #f, if no such pair exists) and an assosciation list like (and
-potentially sharing storage with) ALIST, but with no entry for KEY."
-  (match (assoc key alist)
-    ;; If key isn't present, we don't need to do any allocation
-    (#f
-     (values #f alist))
-    (found
-     (values found
-             ;; Because we have `found`, we can find it more
-             ;; efficiently this time with `eq?`. We avoid using
-             ;; `delq` because it would copy pairs in a shared
-             ;; tail. We assume a sufficiently smart compiler to
-             ;; handle "tail recursion modulo cons" (vid. e.g. Indiana
-             ;; University Technical Report No. 19, Friedman & Wise
-             ;; 1975) at least as efficiently as a hand-written
-             ;; tail-recursive implementation with an accumulator.
-             (let loop ((alist alist))
-               (match alist
-                 ;; We know that `found` is present,
-                 ;; so no need to check for '()
-                 ((this . alist)
-                  (if (eq? this found)
-                      alist
-                      (cons this (loop alist))))))))))
-
-;; Sadly, Guile's implementation of (@ (srfi srfi-1) alist-delete)
-;; performs unnecessary allocation, e.g. this currently evaluates to #f:
-;;
-;;     (let ((alist `(("a" . 1)("b" . 2)("c" . 3))))
-;;       (eq? alist (alist-delete "x" alist)))
-;;
-;; These functions generally choose to allocate a new outer pair (with the '@
-;; tag), even though in unusual cases the resulting object might not have
-;; changed, for the sake of simplicity and to avoid retaining a reference to
-;; the original alist longer than necessary. But that is O(1) allocation that
-;; could only rarely be avoided: `alist-delete` would allocate O(n) pairs,
-;; which would only be necessary in the worst case.
-(define (alist-delete* alist key)
-  "Return an assosciation list like (and potentially sharing storage with)
-ALIST, but with no entry for KEY."
-  (define-values (_popped remaining)
-    (alist-pop alist key))
-  remaining)
-
-(define (jsobject-delete js key)
-  "Return a json object like JS, but with no entry for KEY."
-  (cons '@ (match js
-             (('@ . alist)
-              (alist-delete* alist key)))))
-
-(define (alist-set alist key value)
-  "Return an assosciation list like ALIST, but with KEY mapped to VALUE,
-replacing any existing mapping for KEY."
-  (acons key value (alist-delete* alist key)))
-
-(define (jsobject-set js key value)
-  "Return a json object like JS, but with KEY mapped to VALUE, replacing any
-existing mapping for KEY."
-  (cons '@ (match js
-             (('@ . alist)
-              (alist-set alist key value)))))
-
-(define jsobject-set*
-  (case-lambda
-    "Return a json object like JS, but functionally extended by mapping each
-KEY to each VALUE, replacing any existing mapping for each KEY.  The update
-takes place from left to right, so later mappings overwrite earlier mappings
-for the same KEY."
-    ((js)
-     js)
-    ((js key value)
-     (jsobject-set js key value))
-    ((js . args)
-     (cons '@ (match js
-                (('@ . alist)
-                 (let loop ((alist alist)
-                            (args args))
-                   (match args
-                     (()
-                     alist)
-                     ((key value . args)
-                      (loop (alist-set alist key value)
-                            args))))))))))
-
-(define (alist-update alist key failure-result updater)
-  "Return an assosciation list like ALIST, but with KEY mapped to the result
-of applying UPDATER to the value to which KEY is mapped in ALIST.  When ALIST
-does not have an existing mapping for KEY, FAILURE-RESULT is used as with
-'jsobject-ref' to obtain the argument for UPDATER."
-  ;; Often, `updater` will be a lambda expression, so making it the last
-  ;; argument may help to makes the code legible, and the most likely
-  ;; `failure-result` arguments are all shorter than the keyword
-  ;; `#:failure-result`.  Plus, making `failure-result` mandatory helps make
-  ;; `alist-update` consistent with `alist-update*`.
-  (define-values (popped tail-alist)
-    (alist-pop alist key))
-  (acons key
-         (updater (match popped
-                    (#f
-                     (if (procedure? failure-result)
-                         (failure-result)
-                         failure-result))
-                    ((_ . value)
-                     value)))
-         tail-alist))
-
-(define (jsobject-update js key failure-result updater)
-  "Return a json object like JS, but with KEY mapped to the result of applying
-UPDATER to the value to which KEY is mapped in JS.  When JS does not have an
-existing mapping for KEY, FAILURE-RESULT is used as with 'jsobject-ref' to
-obtain the argument for UPDATER."
-  (cons '@ (match js
-             (('@ . alist)
-              (alist-update alist key failure-result updater)))))
-
-(define jsobject-update*
-  (case-lambda
-    "Return a json object like JS, but functionally extended by replacing the
-mapping for each KEY with the result of applying the corresponding UPDATER to
-the value to which that KEY is mapped in JS---or, if no such mapping exists,
-to a value based on the corresponding FAILURE-RESULT as with 'jsobject-ref'.
-The update takes place from left to right, so later UPDATERs will receive the
-values returned by earlier UPDATERs for the same KEY."
-    ((js)
-     js)
-    ((js key failure-result updater)
-     (jsobject-update js key failure-result updater))
-    ((js . args)
-     (cons '@ (match js
-                (('@ . alist)
-                 (let loop ((alist alist)
-                            (args args))
-                   (match args
-                     (()
-                     alist)
-                     ((key failure-result updater . args)
-                      (loop (alist-update alist key failure-result updater)
-                            args))))))))))
-
-(define* (jsobject-union #:key
-                         (combine (lambda (a b) b))
-                         (combine/key (lambda (k a b) (combine a b)))
-                         #:rest json-objects)
-  "Combine the given JSON-OBJECTS into a single json object.  The JSON-OBJECTS
-are merged from left to right by adding each key/value pair of each object to
-the aggregate object in turn.  When one of the JSON-OBJECTS contains a mapping
-from some key KEY to a value VAL such that the aggregate object already
-contains a mapping from KEY to a value VAL0, the aggregate object is
-functionally updated to instead map KEY to the value of (COMBINE/KEY KEY VAL0
-VAL).  The default COMBINE/KEY tail-calls (COMBINE VAL0 VAL), and the default
-COMBINE simply returns its second argument, so, by default, mappings in later
-JSON-OBJECTS supersede those in earlier ones."
-  (match (filter (lambda (v)
-                   (not (or (keyword? v)
-                            (procedure? v))))
-                 json-objects)
-    (()
-     '(@))
-    (((and js0 ('@ . _)))
-     js0)
-    ((('@ . alist0) ('@ . alist*) ...)
-     (cons '@ (fold (lambda (alist1 alist0)
-                      (if (null? alist0)
-                          alist1
-                          (fold (lambda (k+v alist0)
-                                  (match k+v
-                                    ((k . v)
-                                     (define-values (popped tail-alist)
-                                       (alist-pop alist0 k))
-                                     (match popped
-                                       (#f
-                                        (cons k+v tail-alist))
-                                       ((_ . v0)
-                                        (acons k
-                                               (combine/key k v0 v)
-                                               tail-alist))))))
-                                alist0
-                                alist1)))
-                    alist0
-                    alist*)))))
+     (let loop ((alist alist)
+                (updates updates))
+       (match updates
+         (() (cons '@ alist))
+         (((key proc) . updates)
+          (loop (alist-update alist key proc #f equal?) updates))
+         (((key proc default) . updates)
+          (loop (alist-update alist key proc default equal?) updates)))))))
+
+(define (jsobject-union combine seed . objects)
+  "Merge OBJECTS into SEED by applying (COMBINE KEY VAL0 VAL), where VAL0
+is the value found in the (possibly updated) SEED and VAL is the new value
+found in one of the OBJECTS."
+  (match seed
+    (('@ . aseed)
+     (match objects
+       (() seed)
+       ((('@ . alists) ...)
+        (cons
+         '@
+         (fold (lambda (alist aseed)
+                 (if (null? aseed) alist
+                     (fold
+                      (match-lambda*
+                        (((k . v) aseed)
+                         (let ((pair tail (alist-pop alist k)))
+                           (match pair
+                             (#f (acons k v aseed))
+                             ((_ . v0) (acons k (combine k v0 v) aseed))))))
+                      aseed
+                      alist)))
+               aseed
+               alists)))))))
+
+;; Possibly useful helper functions:
+;; (define (newest key val0 val) val)
+;; (define (unkeyed->keyed proc) (lambda (_key val0 val) (proc val0 val)))
 
 \f
 ;;;
@@ -282,7 +137,7 @@ (define (set-home . _)
 (define (module-name module)
   (let* ((package.json (string-append module "/package.json"))
          (package-meta (call-with-input-file package.json read-json)))
-    (jsobject-ref package-meta "name" #f)))
+    (jsobject-ref package-meta "name")))
 
 (define (index-modules input-paths)
   (define (list-modules directory)
@@ -318,12 +173,14 @@ (define resolve-dependencies
     (lambda (pkg-meta)
       (jsobject-update*
        pkg-meta
-       "devDependencies" '(@) resolve-dependencies
-       "dependencies" '(@) (lambda (deps)
-                             (resolve-dependencies
-                              (jsobject-union
-                               (jsobject-ref pkg-meta "peerDependencies" '(@))
-                               deps))))))
+       `("devDependencies" ,resolve-dependencies (@))
+       `("dependencies" ,(lambda (deps)
+                           (resolve-dependencies
+                            (jsobject-union
+                             (lambda (k a b) b)
+                             (jsobject-ref pkg-meta "peerDependencies" '(@))
+                             deps)))
+         (@)))))
   #t)
 
 (define (delete-dependencies pkg-meta absent-dependencies)
-- 
2.34.0


[-- Attachment #3: 0002-Fixup-04-41.patch --]
[-- Type: text/x-patch, Size: 1799 bytes --]

From 41819ee4536ca36bfcb8e87b29503cf1791b056f Mon Sep 17 00:00:00 2001
From: Liliana Marie Prikler <liliana.prikler@gmail.com>
Date: Thu, 6 Jan 2022 15:31:48 +0100
Subject: [PATCH 2/3] Fixup 04/41.

Packages with native addons currently try to write to store paths
when used as dependecies.  This patch adds a phase to replace that
behaviour with a no-op.

* guix/build/node-build-system.scm (avoid-node-gyp-rebuild): New
variable.
(%standard-phases): Add 'avoid-node-gyp-rebuild' after 'install'.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 guix/build/node-build-system.scm | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
index d695424e50..1a0e187028 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -285,12 +285,16 @@ (define installed-package.json
     (search-input-file outputs (string-append "/lib/node_modules/"
                                               (module-name ".")
                                               "/package.json")))
-  ;; not with-atomic-json-file-replacement, because we usually don't
-  ;; want or need to overwrite it
+  ;; 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 read-json))
   (define scripts
     (jsobject-ref pkg-meta "scripts" '(@)))
+  (define (jsobject-set js key val)
+    (jsobject-update* js (list key (const val))))
+
   (when (equal? "node-gyp rebuild" (jsobject-ref scripts "install" #f))
     (call-with-output-file installed-package.json
       (lambda (out)
-- 
2.34.0


[-- Attachment #4: 0003-Fixup-05-41.patch --]
[-- Type: text/x-patch, Size: 2943 bytes --]

From 0b839bf89df5188447275f960e9bbff3935afea4 Mon Sep 17 00:00:00 2001
From: Liliana Marie Prikler <liliana.prikler@gmail.com>
Date: Thu, 6 Jan 2022 15:35:35 +0100
Subject: [PATCH 3/3] Fixup 05/41.

Many node packages currently skip the configure phase, because they lack
both dependencies and a convenient way to build without all of them, e.g.
for the purposes of bootstrapping.  This patch adds a big hammer to flatten
these nails.

* guix/build/node-build-system.scm (delete-dependencies): New variable.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 guix/build/node-build-system.scm | 30 +++++++++++++++++++-----------
 1 file changed, 19 insertions(+), 11 deletions(-)

diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
index 1a0e187028..76aa51c52f 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -23,6 +23,7 @@ (define-module (guix build node-build-system)
   #:use-module (guix build utils)
   #:use-module (guix build json)
   #:use-module (ice-9 ftw)
+  #:use-module (ice-9 regex)
   #:use-module (ice-9 match)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-71)
@@ -183,22 +184,29 @@ (define resolve-dependencies
          (@)))))
   #t)
 
-(define (delete-dependencies pkg-meta absent-dependencies)
-  "Functionally update PKG-META, a json object corresponding to a
-'package.json' file, to allow building without the ABSENT-DEPENDENCIES.  To
-avoid reintroducing the ABSENT-DEPENDENCIES, only use this procedure after the
-'patch-dependencies' phase."
-  (define delete-fom-jsobject
+(define (delete-dependencies unwanted)
+  "Rewrite package.json to remove UNWANTED dependencies.  Unwanted dependencies
+can be specified as regular expressions to exclude a range of related
+dependencies, e.g. \"tap\" excludes all dependencies including \"tap\" in their
+name, but \"^tap$\" explicitly excludes \"tap\"."
+  (define delete-from-jsobject
     (match-lambda
       (('@ . alist)
        (cons '@ (filter (match-lambda
                           ((k . v)
-                           (not (member k absent-dependencies))))
+                           (not (any
+                                 (lambda (pattern)
+                                   (string-match pattern k))
+                                 unwanted))))
                         alist)))))
-  (jsobject-update*
-   pkg-meta
-   "devDependencies" '(@) delete-fom-jsobject
-   "dependencies" '(@) delete-fom-jsobject))
+
+  (with-atomic-json-file-replacement "package.json"
+    (lambda (pkg-meta)
+      (jsobject-update*
+       pkg-meta
+       `("peerDependencies" ,delete-from-jsobject (@))
+       `("devDependencies" ,delete-from-jsobject (@))
+       `("dependencies" ,delete-from-jsobject (@))))))
 
 (define* (delete-lockfiles #:key inputs #:allow-other-keys)
   "Delete 'package-lock.json', 'yarn.lock', and 'npm-shrinkwrap.json', if they
-- 
2.34.0


[-- Attachment #5: delete-dependencies.patch --]
[-- Type: text/x-patch, Size: 25985 bytes --]

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 1f51c0d636..990b26a689 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -297,9 +297,7 @@ (define-public node-semver
        (modify-phases %standard-phases
          (add-after 'patch-dependencies 'delete-dependencies
            (lambda args
-             (with-atomic-json-file-replacement "package.json"
-               (lambda (pkg-meta)
-                 (delete-dependencies pkg-meta '("tap")))))))
+             (delete-dependencies '("^tap$")))))
        ;; FIXME: Tests depend on node-tap
        #:tests? #f))
     (home-page "https://github.com/npm/node-semver")
@@ -329,9 +327,7 @@ (define-public node-wrappy
        (modify-phases %standard-phases
          (add-after 'patch-dependencies 'delete-dependencies
            (lambda args
-             (with-atomic-json-file-replacement "package.json"
-               (lambda (pkg-meta)
-                 (delete-dependencies pkg-meta '("tap")))))))))
+             (delete-dependencies '("^tap$")))))))
     (home-page "https://github.com/npm/wrappy")
     (synopsis "Callback wrapping utility")
     (description "@code{wrappy} is a utility for Node.js to wrap callbacks.")
@@ -356,9 +352,7 @@ (define-public node-once
        (modify-phases %standard-phases
          (add-after 'patch-dependencies 'delete-dependencies
            (lambda args
-             (with-atomic-json-file-replacement "package.json"
-               (lambda (pkg-meta)
-                 (delete-dependencies pkg-meta '("tap")))))))
+             (delete-dependencies '("^tap$")))))
        ;; FIXME: Tests depend on node-tap
        #:tests? #f))
     (inputs
@@ -391,9 +385,7 @@ (define-public node-inherits
        (modify-phases %standard-phases
          (add-after 'patch-dependencies 'delete-dependencies
            (lambda args
-             (with-atomic-json-file-replacement "package.json"
-               (lambda (pkg-meta)
-                 (delete-dependencies pkg-meta '("tap")))))))
+             (delete-dependencies '("^tap$")))))
        ;; FIXME: Tests depend on node-tap
        #:tests? #f))
     (home-page
@@ -425,10 +417,7 @@ (define-public node-safe-buffer
        (modify-phases %standard-phases
          (add-after 'patch-dependencies 'delete-dependencies
            (lambda args
-             (with-atomic-json-file-replacement "package.json"
-               (lambda (pkg-meta)
-                 (delete-dependencies pkg-meta  '("tape"
-                                                  "standard")))))))
+             (delete-dependencies '("^tape$" "^standard$")))))
        #:tests? #f))
     (home-page
      "https://github.com/feross/safe-buffer")
@@ -458,12 +447,8 @@ (define-public node-string-decoder
        (modify-phases %standard-phases
          (add-after 'patch-dependencies 'delete-dependencies
            (lambda args
-             (with-atomic-json-file-replacement "package.json"
-               (lambda (pkg-meta)
-                 (delete-dependencies pkg-meta
-                                      '("tap"
-                                        "core-util-is"
-                                        "babel-polyfill")))))))
+             (delete-dependencies
+              '("^tap$" "^core-util-is$" "^babel-polyfill$")))))
        ;; FIXME: Tests depend on node-tap
        #:tests? #f))
     (inputs
@@ -497,29 +482,22 @@ (define-public node-readable-stream
        (modify-phases %standard-phases
          (add-after 'patch-dependencies 'delete-dependencies
            (lambda args
-             (with-atomic-json-file-replacement "package.json"
-               (lambda (pkg-meta)
-                 (delete-dependencies pkg-meta
-                                      `("@babel/cli"
-                                        "@babel/core"
-                                        "@babel/polyfill"
-                                        "@babel/preset-env"
-                                        "airtap"
-                                        "assert"
-                                        "bl"
-                                        "deep-strict-equal"
-                                        "events.once"
-                                        "glob"
-                                        "gunzip-maybe"
-                                        "hyperquest"
-                                        "lolex"
-                                        "nyc"
-                                        "pump"
-                                        "rimraf"
-                                        "tap"
-                                        "tape"
-                                        "tar-fs"
-                                        "util-promisify")))))))
+             (delete-dependencies `("^@babel/"
+                                    "^airtap$"
+                                    "^assert$"
+                                    "^bl$"
+                                    "^deep-strict-equal$"
+                                    "^events\\.once$"
+                                    "^glob$"
+                                    "^gunzip-maybe$"
+                                    "^hyperquest$"
+                                    "^lolex$"
+                                    "^nyc$"
+                                    "^pump$"
+                                    "^rimraf$"
+                                    "^tape?$"
+                                    "^tar-fs$"
+                                    "^util-promisify$")))))
        #:tests? #f))
     (inputs
      (list node-util-deprecate node-string-decoder node-inherits))
@@ -554,10 +532,7 @@ (define-public node-irc-colors
        (modify-phases %standard-phases
          (add-after 'patch-dependencies 'delete-dependencies
            (lambda args
-             (with-atomic-json-file-replacement "package.json"
-               (lambda (pkg-meta)
-                 (delete-dependencies pkg-meta `("istanbul"
-                                                 "vows")))))))
+             (delete-dependencies `("^istanbul$" "^vows$")))))
        #:tests? #f))
     (home-page "https://github.com/fent/irc-colors.js")
     (synopsis "Node.js module providing color and formatting for IRC")
@@ -586,12 +561,8 @@ (define-public node-irc
        (modify-phases %standard-phases
          (add-after 'patch-dependencies 'delete-dependencies
            (lambda args
-             (with-atomic-json-file-replacement "package.json"
-               (lambda (pkg-meta)
-                 (delete-dependencies pkg-meta `("ansi-color"
-                                                 "faucet"
-                                                 "jscs"
-                                                 "tape")))))))
+             (delete-dependencies
+              `("^ansi-color$" "^faucet$" "^jscs$" "^tape$")))))
        #:tests? #f))
     (inputs
      (list node-irc-colors))
@@ -620,17 +591,14 @@ (define-public node-nan
        (modify-phases %standard-phases
          (add-after 'patch-dependencies 'delete-dependencies
            (lambda args
-             (with-atomic-json-file-replacement "package.json"
-               (lambda (pkg-meta)
-                 (delete-dependencies
-                  pkg-meta
-                  '("bindings"
-                    "commander"
-                    "glob"
-                    "request"
-                    "node-gyp" ;; would be needed for tests
-                    "tap"
-                    "xtend")))))))
+             (delete-dependencies
+              '("^bindings$"
+                "^commander$"
+                "^glob$"
+                "^request$"
+                "^node-gyp$" ;; would be needed for tests
+                "^tap$"
+                "^xtend$")))))
        ;; tests need tap and other dependencies
        #:tests? #f))
     (inputs
@@ -673,21 +641,11 @@ (define-public node-addon-api
        (modify-phases %standard-phases
          (add-after 'patch-dependencies 'delete-dependencies
            (lambda args
-             (with-atomic-json-file-replacement "package.json"
-               (lambda (pkg-meta)
-                 (delete-dependencies pkg-meta
-                                      `("benchmark"
-                                        "bindings"
-                                        "clang-format"
-                                        "eslint"
-                                        "eslint-config-semistandard"
-                                        "eslint-config-standard"
-                                        "eslint-plugin-import"
-                                        "eslint-plugin-node"
-                                        "eslint-plugin-promise"
-                                        "fs-extra"
-                                        "path"
-                                        "pre-commit"))))))
+             (delete-dependencies
+              `("^benchmark$" "^bindings$" "^clang-format$"
+                "^eslint"
+                "^fs-extra$" "^path$" "^pre-commit$"))
+             ))
          (add-after 'unpack 'skip-js-tests
            ;; We can't run the js-based tests,
            ;; but we can still do the C++ parts
@@ -767,29 +725,26 @@ (define-public node-sqlite3
        (modify-phases %standard-phases
          (add-after 'patch-dependencies 'delete-dependencies
            (lambda args
-             (with-atomic-json-file-replacement "package.json"
-               (lambda (pkg-meta)
-                 (delete-dependencies
-                  pkg-meta
-                  `(;; Normally, this is "built" using @mapbox/node-pre-gyp,
-                    ;; which publishes or downloads pre-built binaries or
-                    ;; falls back to building from source.  Here, we patch out
-                    ;; all of that and just build directly.  It might be
-                    ;; better to patch a version of @mapbox/node-pre-gyp that
-                    ;; always builds from source, as Debian does, but there
-                    ;; are a number of dependencies that need to be packaged
-                    ;; or removed.
-                    "@mapbox/node-pre-gyp"
-                    "node-pre-gyp" ;; deprecated name still used in some places
-                    "aws-sdk"
-                    "@mapbox/cloudfriend"
-                    ;; Confusingly, this is only a dependency because of
-                    ;; @mapbox/node-pre-gyp: with that removed,
-                    ;; npm will use its own copy:
-                    "node-gyp"
-                    ;; These we'd like, we just don't have them yet:
-                    "eslint"
-                    "mocha"))))))
+             (delete-dependencies
+              `(;; Normally, this is "built" using @mapbox/node-pre-gyp,
+                ;; which publishes or downloads pre-built binaries or
+                ;; falls back to building from source.  Here, we patch out
+                ;; all of that and just build directly.  It might be
+                ;; better to patch a version of @mapbox/node-pre-gyp that
+                ;; always builds from source, as Debian does, but there
+                ;; are a number of dependencies that need to be packaged
+                ;; or removed.
+                "^@mapbox/node-pre-gyp$"
+                "^node-pre-gyp$" ;; deprecated name still used in some places
+                "^aws-sdk$"
+                "^@mapbox/cloudfriend$"
+                ;; Confusingly, this is only a dependency because of
+                ;; @mapbox/node-pre-gyp: with that removed,
+                ;; npm will use its own copy:
+                "^node-gyp$"
+                ;; These we'd like, we just don't have them yet:
+                "^eslint$"
+                "^mocha$"))))
          (add-before 'configure 'npm-config-sqlite
            ;; We need this step even if we do replace @mapbox/node-pre-gyp
            ;; because the package expects to build its bundled sqlite
@@ -885,24 +840,12 @@ (define-public node-file-uri-to-path
        (modify-phases %standard-phases
          (add-after 'patch-dependencies 'delete-dependencies
            (lambda args
-             (with-atomic-json-file-replacement "package.json"
-               (lambda (pkg-meta)
-                 (delete-dependencies pkg-meta
-                                      `("@types/mocha"
-                                        "@types/node"
-                                        "@typescript-eslint/eslint-plugin"
-                                        "@typescript-eslint/parser"
-                                        "cpy-cli"
-                                        "eslint"
-                                        "eslint-config-airbnb"
-                                        "eslint-config-prettier"
-                                        "eslint-import-resolver-typescript"
-                                        "eslint-plugin-import"
-                                        "eslint-plugin-jsx-a11y"
-                                        "eslint-plugin-react"
-                                        "mocha"
-                                        "rimraf"
-                                        "typescript"))))))
+             (delete-dependencies
+              `("^@types/mocha$" "^@types/node$"
+                "typescript"
+                "eslint"
+                "^cpy-cli$"
+                "^mocha$" "^rimraf$"))))
          (replace 'build
            (lambda* (#:key inputs native-inputs #:allow-other-keys)
              (copy-recursively "src" "dist")
@@ -995,14 +938,12 @@ (define-public node-ms
        (modify-phases %standard-phases
          (add-after 'patch-dependencies 'delete-dependencies
            (lambda args
-             (with-atomic-json-file-replacement "package.json"
-               (lambda (pkg-meta)
-                 (delete-dependencies pkg-meta `("eslint"
-                                                 "expect.js"
-                                                 "husky"
-                                                 "lint-staged"
-                                                 "mocha"
-                                                 "prettier")))))))
+             (delete-dependencies `("^eslint$"
+                                    "^expect\\.js$"
+                                    "^husky$"
+                                    "^lint-staged$"
+                                    "^mocha$"
+                                    "^prettier$")))))
        #:tests? #f))
     (home-page "https://github.com/vercel/ms")
     (synopsis "Tiny millisecond conversion utility")
@@ -1045,20 +986,15 @@ (define-public node-debug
        (modify-phases %standard-phases
          (add-after 'patch-dependencies 'delete-dependencies
            (lambda args
-             (with-atomic-json-file-replacement "package.json"
-               (lambda (pkg-meta)
-                 (delete-dependencies pkg-meta `("brfs"
-                                                 "browserify"
-                                                 "coveralls"
-                                                 "istanbul"
-                                                 "karma"
-                                                 "karma-browserify"
-                                                 "karma-chrome-launcher"
-                                                 "karma-mocha"
-                                                 "mocha"
-                                                 "mocha-lcov-reporter"
-                                                 "xo"
-                                                 "supports-color")))))))
+             (delete-dependencies
+              `("^brfs$"
+                "^browserify$"
+                "^coveralls$"
+                "^istanbul$"
+                "^karma"
+                "^mocha"
+                "^xo$"
+                "^supports-color$")))))
        #:tests? #f))
     (home-page "https://github.com/debug-js/debug")
     (synopsis "Lightweight debugging utility for Node.js and the browser")
@@ -1173,12 +1109,10 @@ (define-public node-serialport-bindings
              (chdir "packages/bindings")))
          (add-after 'patch-dependencies 'delete-dependencies
            (lambda args
-             (with-atomic-json-file-replacement "package.json"
-               (lambda (pkg-meta)
-                 (delete-dependencies pkg-meta `("prebuild-install"
-                                                 ;; devDependencies
-                                                 "@serialport/binding-mock"
-                                                 "node-abi"))))))
+             (delete-dependencies `("^prebuild-install$"
+                                    ;; devDependencies
+                                    "^@serialport/binding-mock$"
+                                    "^node-abi$"))))
          (add-after 'chdir 'avoid-prebuild-install
            (lambda args
              (with-atomic-json-file-replacement "package.json"
@@ -1330,11 +1264,8 @@ (define-public node-serialport-stream
        (modify-phases %standard-phases
          (add-after 'patch-dependencies 'delete-dependencies
            (lambda args
-             (with-atomic-json-file-replacement "package.json"
-               (lambda (pkg-meta)
-                 (delete-dependencies pkg-meta
-                                      `(;; devDependencies
-                                        "@serialport/binding-mock"))))))
+             (delete-dependencies `(;; devDependencies
+                                    "^@serialport/binding-mock$"))))
          (add-after 'unpack 'chdir
            (lambda args
              (chdir "packages/stream"))))
@@ -1370,10 +1301,8 @@ (define-public node-serialport
        (modify-phases %standard-phases
          (add-after 'patch-dependencies 'delete-dependencies
            (lambda args
-             (with-atomic-json-file-replacement "package.json"
-               (lambda (pkg-meta)
-                 (delete-dependencies pkg-meta
-                                      `("@serialport/binding-mock"))))))
+             (delete-dependencies `("^@serialport/binding-mock$"))
+             ))
          (add-after 'unpack 'chdir
            (lambda args
              (chdir "packages/serialport"))))
diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 5a4401e779..49e6323a9d 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -348,9 +348,7 @@ (define-public node-semver-bootstrap
        (modify-phases %standard-phases
          (add-after 'patch-dependencies 'delete-dependencies
            (lambda args
-             (with-atomic-json-file-replacement "package.json"
-               (lambda (pkg-meta)
-                 (delete-dependencies pkg-meta '("tap")))))))))
+             (delete-dependencies '("^tap$")))))))
     (home-page "https://github.com/npm/node-semver")
     (properties '((hidden? . #t)))
     (synopsis "Parses semantic versions strings")
@@ -381,13 +379,11 @@ (define-public node-ms-bootstrap
        (modify-phases %standard-phases
          (add-after 'patch-dependencies 'delete-dependencies
            (lambda args
-             (with-atomic-json-file-replacement "package.json"
-               (lambda (pkg-meta)
-                 (delete-dependencies pkg-meta '("eslint"
-                                                 "expect.js"
-                                                 "husky"
-                                                 "lint-staged"
-                                                 "mocha")))))))))
+             (delete-dependencies '("^eslint$"
+                                    "^expect\\.js$"
+                                    "^husky$"
+                                    "^lint-staged$"
+                                    "^mocha$")))))))
     (home-page "https://github.com/zeit/ms#readme")
     (properties '((hidden? . #t)))
     (synopsis "Tiny millisecond conversion utility")
@@ -417,10 +413,7 @@ (define-public node-binary-search-bootstrap
        (modify-phases %standard-phases
          (add-after 'patch-dependencies 'delete-dependencies
            (lambda args
-             (with-atomic-json-file-replacement "package.json"
-               (lambda (pkg-meta)
-                 (delete-dependencies pkg-meta `("chai"
-                                                 "mocha")))))))))
+             (delete-dependencies `("^(chai\|mocha)$")))))))
     (home-page "https://github.com/darkskyapp/binary-search#readme")
     (properties '((hidden? . #t)))
     (synopsis "Tiny binary search function with comparators")
@@ -449,20 +442,13 @@ (define-public node-debug-bootstrap
        (modify-phases %standard-phases
          (add-after 'patch-dependencies 'delete-dependencies
            (lambda args
-             (with-atomic-json-file-replacement "package.json"
-               (lambda (pkg-meta)
-                 (delete-dependencies pkg-meta
-                                      `("brfs"
-                                        "browserify"
-                                        "coveralls"
-                                        "istanbul"
-                                        "karma"
-                                        "karma-browserify"
-                                        "karma-chrome-launcher"
-                                        "karma-mocha"
-                                        "mocha"
-                                        "mocha-lcov-reporter"
-                                        "xo")))))))))
+             (delete-dependencies `("^brfs$"
+                                    "^browserify$"
+                                    "^coveralls$"
+                                    "^istanbul$"
+                                    "^karma"
+                                    "^mocha"
+                                    "^xo$")))))))
     (inputs (list node-ms-bootstrap))
     (home-page "https://github.com/visionmedia/debug#readme")
     (properties '((hidden? . #t)))
@@ -517,15 +503,12 @@ (define-public node-llparse-builder-bootstrap
        #:phases
        (modify-phases %standard-phases
          (add-after 'patch-dependencies 'delete-dependencies
-           (lambda args
-             (with-atomic-json-file-replacement "package.json"
-               (lambda (pkg-meta)
-                 (delete-dependencies pkg-meta `("@types/mocha"
-                                                 "@types/node"
-                                                 "mocha"
-                                                 "ts-node"
-                                                 "tslint"
-                                                 "typescript"))))))
+           (lambda _
+             (delete-dependencies `("^@types/node$"
+                                    "mocha$"
+                                    "^ts-node$"
+                                    "^tslint$"
+                                    "^typescript$"))))
          (replace 'build
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((esbuild (search-input-file inputs "/bin/esbuild")))
@@ -581,15 +564,13 @@ (define-public node-llparse-frontend-bootstrap
        (modify-phases %standard-phases
          (add-after 'patch-dependencies 'delete-dependencies
            (lambda args
-             (with-atomic-json-file-replacement "package.json"
-               (lambda (pkg-meta)
-                 (delete-dependencies pkg-meta `("@types/debug"
-                                                 "@types/mocha"
-                                                 "@types/node"
-                                                 "mocha"
-                                                 "ts-node"
-                                                 "tslint"
-                                                 "typescript"))))))
+             (delete-dependencies `("^@types/debug$"
+                                    "^@types/mocha$"
+                                    "^@types/node$"
+                                    "^mocha$"
+                                    "^ts-node$"
+                                    "^tslint$"
+                                    "^typescript$"))))
          (replace 'build
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((esbuild (search-input-file inputs "/bin/esbuild")))
@@ -644,18 +625,15 @@ (define-public node-llparse-bootstrap
        (modify-phases %standard-phases
          (add-after 'patch-dependencies 'delete-dependencies
            (lambda args
-             (with-atomic-json-file-replacement "package.json"
-               (lambda (pkg-meta)
-                 (delete-dependencies pkg-meta
-                                      `("@types/debug"
-                                        "@types/mocha"
-                                        "@types/node"
-                                        "esm"
-                                        "llparse-test-fixture"
-                                        "mocha"
-                                        "ts-node"
-                                        "tslint"
-                                        "typescript"))))))
+             (delete-dependencies `("^@types/debug$"
+                                    "^@types/mocha$"
+                                    "^@types/node$"
+                                    "^esm$"
+                                    "^llparse-test-fixture$"
+                                    "^mocha$"
+                                    "^ts-node$"
+                                    "^tslint$"
+                                    "^typescript$"))))
          (replace 'build
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((esbuild (search-input-file inputs "/bin/esbuild")))

^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 05/41] guix: node-build-system: Add 'delete-dependencies' helper function.
  2022-01-06 16:50                                                                                       ` Liliana Marie Prikler
@ 2022-01-06 17:28                                                                                         ` Leo Famulari
  0 siblings, 0 replies; 458+ messages in thread
From: Leo Famulari @ 2022-01-06 17:28 UTC (permalink / raw)
  To: Liliana Marie Prikler
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht,
	Philip McGrath

On Thu, Jan 06, 2022 at 05:50:08PM +0100, Liliana Marie Prikler wrote:
> So from my position, everything is about to be done.  Should I resend
> this as v8 for a complete check that I'm not doing anything harmful or
> should I go ahead and commit once I'm done?

I think we should wait to see what Philip thinks about the revisions.

I don't have specific feedback about the patches. Instead, I wanted to
give a nudge towards resolution of the "ticket", which I think is
important in terms of how contributors feel about their work with Guix.




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 00/41] guix: node-build-system: Support compiling add-ons with node-gyp.
  2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
                   ` (45 preceding siblings ...)
  2021-12-30  7:39 ` [bug#51838] [PATCH v8 41/41] gnu: Add node-serialport Liliana Marie Prikler
@ 2022-01-06 17:45 ` Liliana Marie Prikler
  2022-01-07 16:49   ` Timothy Sample
  2022-01-07 22:11   ` Philip McGrath
  46 siblings, 2 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2022-01-06 17:45 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

Hi Philip,

Please pardon the large flood of messages in a short enough of time
without waiting for a reply.  I tried my best to come up with a v8 that
addresses my personal concerns quickly.  

My main changes were to patches 3-5, but note how deleting dependencies
became significantly easier in 6pp.  To list the main differences:
1. I've implemented the alist/JSON utilities in terms of SRFI-1 and SRFI-71.
2. I shortened the additional JSON API to jsobject-ref and jsobject-update*.
   I still believe alist->json-object and json-object->alist would be more
   useful (in particular, the main operation of jsobject-union is actually
   alist-flatten), but I digress.
3. I made it so that delete-dependencies also acts on peerDependencies.
   That way, we don't have to dance around ordering.
4. Regexps :)

If there's anything you'd like to say about this v8, feel free to do so.
As always, there's the waiting time of at least 14 days, which I plan to
adhere to.

Cheers,
Liliana

PS: If someone else wants to push these in my absence, please adjust the
signoffs.  Also, if those mail headers are broken, don't forget to reset
Philip as author.

Philip McGrath (41):
  guix: node-build-system: Add delete-lockfiles phase.
  guix: node-build-system: Add implicit libuv input.
  guix: node-build-system: Add JSON utilities.
  guix: node-build-system: Add avoid-node-gyp-rebuild phase.
  guix: node-build-system: Add 'delete-dependencies' helper function.
  gnu: node-semver-bootstrap: Use 'delete-dependencies'.
  gnu: node-ms-bootstrap: Use 'delete-dependencies'.
  gnu: node-binary-search-bootstrap: Use 'delete-dependencies'.
  gnu: node-debug-bootstrap: Use 'delete-dependencies'.
  gnu: node-llparse-builder-bootstrap: Use 'delete-dependencies'.
  gnu: node-llparse-frontend-bootstrap: Use 'delete-dependencies'.
  gnu: node-llparse-bootstrap: Use 'delete-dependencies'.
  gnu: node-semver: Use 'delete-dependencies'.
  gnu: node-wrappy: Use 'delete-dependencies'.
  gnu: node-once: Use 'delete-dependencies'.
  gnu: node-irc-colors: Use 'delete-dependencies'.
  gnu: node-irc: Use 'delete-dependencies'.
  gnu: Add node-inherits.
  gnu: Add node-safe-buffer.
  gnu: Add node-string-decoder.
  gnu: Add node-readable-stream.
  gnu: Add node-nan.
  gnu: Add node-openzwave-shared.
  gnu: Add node-addon-api.
  gnu: Add node-sqlite3.
  gnu: Add node-file-uri-to-path.
  gnu: Add node-bindings.
  gnu: Add node-segfault-handler.
  gnu: Add node-ms.
  gnu: Add node-debug.
  gnu: Add node-serialport-binding-abstract.
  gnu: Add node-serialport-parser-delimiter.
  gnu: Add node-serialport-parser-readline.
  gnu: Add node-serialport-bindings.
  gnu: Add node-serialport-parser-regex.
  gnu: Add node-serialport-parser-ready.
  gnu: Add node-serialport-parser-inter-byte-timeout.
  gnu: Add node-serialport-parser-cctalk.
  gnu: Add node-serialport-parser-byte-length.
  gnu: Add node-serialport-stream.
  gnu: Add node-serialport.

 gnu/packages/node-xyz.scm        | 942 ++++++++++++++++++++++++++++++-
 gnu/packages/node.scm            |  56 +-
 gnu/packages/zwave.scm           |  64 +++
 guix/build-system/node.scm       |   9 +-
 guix/build/node-build-system.scm | 236 +++++++-
 5 files changed, 1247 insertions(+), 60 deletions(-)

-- 
2.34.0





^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 00/41] guix: node-build-system: Support compiling add-ons with node-gyp.
  2022-01-06 17:45 ` [bug#51838] [PATCH v8 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Liliana Marie Prikler
@ 2022-01-07 16:49   ` Timothy Sample
  2022-01-07 19:43     ` Liliana Marie Prikler
  2022-01-07 22:11   ` Philip McGrath
  1 sibling, 1 reply; 458+ messages in thread
From: Timothy Sample @ 2022-01-07 16:49 UTC (permalink / raw)
  To: Liliana Marie Prikler
  Cc: 51838, Pierre Langlois, Jelle Licht, Philip McGrath, Leo Famulari

Hi Liliana,

Thanks for putting this together!  I’m starting to think that we might
actually land this series pretty soon.  :)

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

> 4. Regexps :)

I doubt regex support will be broadly useful here.  Putting the anchors
in every package name (e.g., "^tap$") makes for a lot of noise.  My
(wild) guess would be that regexes will save us listing two dependencies
for one out of every ten Node packages.  Given that, my preference would
be to not bother with regex support.

You wrote this in another message:

> I think it'd be beneficial if delete-dependencies could delete
> dependencies based on their name matching a regexp rather than a
> string exactly.  This would make some of your lists shorter
> (e.g. "karma.*"), but there might be a debate on whether to use
> "^karma.*$" or whether to only consider regexps that match the
> dependency fully.

If nothing else, I’m certainly on the other side of this debate!  :)
If every string is going to be treated as a pattern, we should have it
match fully by default.  That is, the anchors should be implicit.  For
the very rare (never?) case where you want to avoid anything that so
much as has “foo” in the name, it’s pretty easy to write ".*foo.*".


-- Tim




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 00/41] guix: node-build-system: Support compiling add-ons with node-gyp.
  2022-01-07 16:49   ` Timothy Sample
@ 2022-01-07 19:43     ` Liliana Marie Prikler
  2022-01-07 21:02       ` Jelle Licht
  2022-01-07 21:07       ` Philip McGrath
  0 siblings, 2 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2022-01-07 19:43 UTC (permalink / raw)
  To: Timothy Sample
  Cc: 51838, Pierre Langlois, Jelle Licht, Philip McGrath, Leo Famulari

Hi,

Am Freitag, dem 07.01.2022 um 11:49 -0500 schrieb Timothy Sample:
> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
> > 4. Regexps :)
> 
> I doubt regex support will be broadly useful here.  Putting the
> anchors in every package name (e.g., "^tap$") makes for a lot of
> noise.  My (wild) guess would be that regexes will save us listing
> two dependencies for one out of every ten Node packages.  Given that,
> my preference would be to not bother with regex support.
My reason to include them is that we can already see a number of
packages requiring typescript(.*) for a number of (.*) -- similarly
karma and mocha -- in the patch set given by Philip.  I do think
regexps will be less useful later on and could very well become
obsolete by the time we have a full bootstrap of everything, but we
don't have an ETA on that, so for now I'd like to have that capability.

I see two potential solutions here.  First is matching the whole string
as you suggested and discussed below.  Second is opting in to regexp in
general (there are some ".js" things, that would otherwise require
escaping).  This would take the form of the user writing
'("foo" "bar" (regexp "^baz$")) as UNWANTED, and it'd be interpreted as
the predicates
(equal? S "foo") ; alternatively string=?
(equal? S "bar")
(string-match S "^baz$")
WDYT?

> > I think it'd be beneficial if delete-dependencies could delete
> > dependencies based on their name matching a regexp rather than a
> > string exactly.  This would make some of your lists shorter
> > (e.g. "karma.*"), but there might be a debate on whether to use
> > "^karma.*$" or whether to only consider regexps that match the
> > dependency fully.
> 
> If nothing else, I’m certainly on the other side of this debate!  :)
> If every string is going to be treated as a pattern, we should have
> it match fully by default.  That is, the anchors should be implicit. 
> For the very rare (never?) case where you want to avoid anything that
> so much as has “foo” in the name, it’s pretty easy to write
> ".*foo.*".
Full string matches are my preference too, but I only found the
function that does partial match.  Is there an easier solution than
checking whether the matched string equals the input to string-match?

Cheers




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 00/41] guix: node-build-system: Support compiling add-ons with node-gyp.
  2022-01-07 19:43     ` Liliana Marie Prikler
@ 2022-01-07 21:02       ` Jelle Licht
  2022-01-07 22:20         ` Liliana Marie Prikler
  2022-01-07 21:07       ` Philip McGrath
  1 sibling, 1 reply; 458+ messages in thread
From: Jelle Licht @ 2022-01-07 21:02 UTC (permalink / raw)
  To: Liliana Marie Prikler, Timothy Sample
  Cc: 51838, Pierre Langlois, Philip McGrath, Leo Famulari

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

> Hi,
>
> Am Freitag, dem 07.01.2022 um 11:49 -0500 schrieb Timothy Sample:
>> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
>> > 4. Regexps :)
>> 
>> I doubt regex support will be broadly useful here.  Putting the
>> anchors in every package name (e.g., "^tap$") makes for a lot of
>> noise.  My (wild) guess would be that regexes will save us listing
>> two dependencies for one out of every ten Node packages.  Given that,
>> my preference would be to not bother with regex support.
> My reason to include them is that we can already see a number of
> packages requiring typescript(.*) for a number of (.*) -- similarly
> karma and mocha -- in the patch set given by Philip.  I do think
> regexps will be less useful later on and could very well become
> obsolete by the time we have a full bootstrap of everything, but we
> don't have an ETA on that, so for now I'd like to have that capability.
>
> I see two potential solutions here.  First is matching the whole string
> as you suggested and discussed below.  Second is opting in to regexp in
> general (there are some ".js" things, that would otherwise require
> escaping).  This would take the form of the user writing
> '("foo" "bar" (regexp "^baz$")) as UNWANTED, and it'd be interpreted as
> the predicates
> (equal? S "foo") ; alternatively string=?
> (equal? S "bar")
> (string-match S "^baz$")
> WDYT?

Or option three, which is the simplest one; no regex (regexen?), just a
big bag of boring strings. To be honest, the current set of packages
don't convince me of a need for such a facility yet. 

>> > I think it'd be beneficial if delete-dependencies could delete
>> > dependencies based on their name matching a regexp rather than a
>> > string exactly.  This would make some of your lists shorter
>> > (e.g. "karma.*"), but there might be a debate on whether to use
>> > "^karma.*$" or whether to only consider regexps that match the
>> > dependency fully.
>> 
>> If nothing else, I’m certainly on the other side of this debate!  :)
>> If every string is going to be treated as a pattern, we should have
>> it match fully by default.  That is, the anchors should be implicit. 
>> For the very rare (never?) case where you want to avoid anything that
>> so much as has “foo” in the name, it’s pretty easy to write
>> ".*foo.*".
> Full string matches are my preference too, but I only found the
> function that does partial match.  Is there an easier solution than
> checking whether the matched string equals the input to string-match?
>

To put it another way: a package that has to delete about 50
dependencies before it can be packaged in guix proper is allowed to look
ugly! It can serve as a very unambigous list of things to possibly
improve in a package, while being easy to review as well if changes are
later proposed (e.g., you see 'node-karma-runner' being added to inputs,
as well as the "karma-runner" string being removed from the list of
dependencies to patch out). With regex you always need to hunt down if
what is actually happening is what was intended to happen.

In addition, since the things-that-can-be-matched by the regex w.r.t. a
particular package.json file are already known and clearly enumerated,
the only advantage regex brings us here is brevity. The biggest
advantage of not using regex is that after a later package update, you
can't inadvertently patch out a dependency that was added by upstream.

Before the DRY brigade comes to take my guix REPL, I'd argue that any
duplication here is incidental. What happens if we want to patch out
"karma" and "karma-chrome-launcher", but for some reason want to keep
"karma-browserify"?[1] Either way, the reviewer has to do a double take
to see whether a change from "karma.*" to the two specifications
"karma-chrome-launcher" and "karma" actually gives the expected output
w.r.t. the package.json file that is being patched.

I appreciate that this patch series is being dragged to the finish line
and give my gratitude to everyone involved.

 - Jelle

[1] I know this particular example is ridiculous, but the fact that you
have to know what these karma things are and how they relate to
eachother to be able to properly review this makes never getting into
such a situation all the more worth it to me.




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 00/41] guix: node-build-system: Support compiling add-ons with node-gyp.
  2022-01-07 19:43     ` Liliana Marie Prikler
  2022-01-07 21:02       ` Jelle Licht
@ 2022-01-07 21:07       ` Philip McGrath
  2022-01-07 23:06         ` Liliana Marie Prikler
  1 sibling, 1 reply; 458+ messages in thread
From: Philip McGrath @ 2022-01-07 21:07 UTC (permalink / raw)
  To: Liliana Marie Prikler, Timothy Sample
  Cc: 51838, Pierre Langlois, Jelle Licht, Leo Famulari

Hi,

I'm excited to take a look at this!

On 1/7/22 14:43, Liliana Marie Prikler wrote:
> Hi,
> 
> Am Freitag, dem 07.01.2022 um 11:49 -0500 schrieb Timothy Sample:
>> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
>>> 4. Regexps :)
>>
>> I doubt regex support will be broadly useful here.  Putting the
>> anchors in every package name (e.g., "^tap$") makes for a lot of
>> noise.  My (wild) guess would be that regexes will save us listing
>> two dependencies for one out of every ten Node packages.  Given that,
>> my preference would be to not bother with regex support.
> My reason to include them is that we can already see a number of
> packages requiring typescript(.*) for a number of (.*) -- similarly
> karma and mocha -- in the patch set given by Philip.  I do think
> regexps will be less useful later on and could very well become
> obsolete by the time we have a full bootstrap of everything, but we
> don't have an ETA on that, so for now I'd like to have that capability.

I think I agree with both of you, with all of the countervailing 
considerations.

My base position is that regexps should not be mandatory or default. It 
was very convenient to be able to just copy--paste package names from 
"package.json" into '#:absent-dependencies' (or whatever). I can imagine 
it being useful for tooling, too, to be able to find just from the 
package definition the dependencies which are being deleted, rather than 
having to either download the origins or try to reconstruct names from 
regexps.

But I do know that there are some families of Node.js tools we don't 
have packaged that come as a bunch of related "devDependencies", and I 
can see the convenience of being able to remove, say, "@types/.*", 
"eslint-.*", and ".*-webpack-plugin" succinctly.

Ultimately, I agree with Liliana that the right solution to those 
missing tools is to package them for Guix! My experience so far with 
workarounds like esbuild is that they are very useful for bootstrapping 
and pragmatically producing usable packages, but that trying to replace 
the build tooling of the entire Node.js universe by hand is not a viable 
solution. (To be slightly more specific, I've encountered some problems 
with conflicting expectations about whether to consume and/or produce 
ES6 vs CommonJS modules, for packages that are more like "libraries" 
than "applications".)

I think it would be fine to remove the regexp support, at least for now.

Alternatively, I would also be ok with ...

> 
> I see two potential solutions here.  First is matching the whole string
> as you suggested and discussed below.  Second is opting in to regexp in
> general (there are some ".js" things, that would otherwise require
> escaping).  This would take the form of the user writing
> '("foo" "bar" (regexp "^baz$")) as UNWANTED, and it'd be interpreted as
> the predicates
> (equal? S "foo") ; alternatively string=?
> (equal? S "bar")
> (string-match S "^baz$")
> WDYT?

the second proposal, or a slight variant on it in which the user would 
write:

     `("foo" "bar" ,(make-regexp "baz"))

Since this (either variant) would not change the interpretation of 
strings in the list of dependencies to delete, it could also be added 
later without breaking compatibility.

> 
>>> I think it'd be beneficial if delete-dependencies could delete
>>> dependencies based on their name matching a regexp rather than a
>>> string exactly.  This would make some of your lists shorter
>>> (e.g. "karma.*"), but there might be a debate on whether to use
>>> "^karma.*$" or whether to only consider regexps that match the
>>> dependency fully.
>>
>> If nothing else, I’m certainly on the other side of this debate!  :)
>> If every string is going to be treated as a pattern, we should have
>> it match fully by default.  That is, the anchors should be implicit.
>> For the very rare (never?) case where you want to avoid anything that
>> so much as has “foo” in the name, it’s pretty easy to write
>> ".*foo.*".
> Full string matches are my preference too, but I only found the
> function that does partial match.  Is there an easier solution than
> checking whether the matched string equals the input to string-match?

I also think full string matches are better, regardless of any of the 
above. Here's an implementation that avoids unneeded copies and string 
comparison:

     (define (regexp-match-exact? rx str)
       (define m (regexp-exec rx str))
       (and m
            (= (match:start m) 0)
            (= (match:end m) (string-length str))))

(This should also avoid repeatedly compiling the regexp, as 
'string-match' would do.)

More soon, I hope!

-Philip




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 00/41] guix: node-build-system: Support compiling add-ons with node-gyp.
  2022-01-06 17:45 ` [bug#51838] [PATCH v8 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Liliana Marie Prikler
  2022-01-07 16:49   ` Timothy Sample
@ 2022-01-07 22:11   ` Philip McGrath
  2022-01-07 23:47     ` Liliana Marie Prikler
  1 sibling, 1 reply; 458+ messages in thread
From: Philip McGrath @ 2022-01-07 22:11 UTC (permalink / raw)
  To: Liliana Marie Prikler
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

Hi,

On 1/6/22 12:45, Liliana Marie Prikler wrote:
> Hi Philip,
> 
> Please pardon the large flood of messages in a short enough of time
> without waiting for a reply.  I tried my best to come up with a v8 that
> addresses my personal concerns quickly.
> 
> My main changes were to patches 3-5, but note how deleting dependencies
> became significantly easier in 6pp.  To list the main differences:
> 1. I've implemented the alist/JSON utilities in terms of SRFI-1 and SRFI- > 2. I shortened the additional JSON API to jsobject-ref and 
jsobject-update*.
>     I still believe alist->json-object and json-object->alist would be more
>     useful (in particular, the main operation of jsobject-union is actually
>     alist-flatten), but I digress.

While some of these changes are not to my taste, there's nothing I can't 
live with for the sake of getting this patch series applied, finally.

> 3. I made it so that delete-dependencies also acts on peerDependencies.
>     That way, we don't have to dance around ordering.

I think this is not quite correct.

(Actually, I suspect more broadly that node-build-system's handling of 
peerDependencies is not quite correct, but wrapping my head around the 
semantics of peerDependencies is on my to-do list for after these 
patches are applied. Here's one thing I want to read and understand: 
https://pnpm.io/how-peers-are-resolved)

NPM does not try to install packages in "peerDependencis" during 'npm 
install' (out 'configure' phase). The problem arises because because our 
'patch-dependencies' phase adds the "peerDependencies" as additional 
"dependencies". (Why? I don't fully understand, but I guess because it 
wants them to be installed.) We want absent "peerDependencies" to not be 
listed in "dependencies", but I don't think we want to delete them from 
"peerDependencies": at a minimum, we do not need to, and it seems like 
it might cause problems that I don't fully understand.

(This is one of the reasons I preferred to handle absent dependencies in 
the 'patch-dependencies' phase.)

> 4. Regexps :)

Hopefully addressed in my previous email :) Jelle makes good arguments 
for the no-regexps side. I'm genuinely on the fence, which suggests to 
me the best course might be to leave it as a possible future extension 
(as we're doing with '#:absent-dependencies').

 > PS: If someone else wants to push these in my absence, please adjust the
 > signoffs.  Also, if those mail headers are broken, don't forget to reset
 > Philip as author.

For the patches where you've made substantive changes to the 
implementation or the commit message, maybe there should be more of an 
annotation than just "Signed-off-by". I'm not super familiar with the 
Git etiquette here, but one suggestion I've seen is something like:

     Signed-off-by: Random J Developer <random@developer.example.org>
     [lucky@maintainer.example.org: struct foo moved from foo.c to foo.h]
     Signed-off-by: Lucky K Maintainer <lucky@maintainer.example.org>

It's not a big deal, I could just imagine getting confused some months 
or years from now about what exactly I wrote or didn't write. (TBH the 
numerous versions of this series are already a bit unwieldy.)

Time permitting, I'll send some more comments, but the only things I 
think need to be addressed before merging are peerDependencies and regexps.

Thanks for helping to keep things moving!

-Philip




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 00/41] guix: node-build-system: Support compiling add-ons with node-gyp.
  2022-01-07 21:02       ` Jelle Licht
@ 2022-01-07 22:20         ` Liliana Marie Prikler
  2022-01-07 23:07           ` Jelle Licht
  0 siblings, 1 reply; 458+ messages in thread
From: Liliana Marie Prikler @ 2022-01-07 22:20 UTC (permalink / raw)
  To: Jelle Licht, Timothy Sample
  Cc: 51838, Pierre Langlois, Philip McGrath, Leo Famulari

Am Freitag, dem 07.01.2022 um 22:02 +0100 schrieb Jelle Licht:
> To put it another way: a package that has to delete about 50
> dependencies before it can be packaged in guix proper is allowed to
> look ugly!  It can serve as a very unambigous list of things to
> possibly improve in a package, while being easy to review as well if
> changes are later proposed (e.g., you see 'node-karma-runner' being
> added to inputs, as well as the "karma-runner" string being removed
> from the list of dependencies to patch out).  With regex you always
> need to hunt down if what is actually happening is what was intended
> to happen.
> 
> In addition, since the things-that-can-be-matched by the regex w.r.t.
> a particular package.json file are already known and clearly
> enumerated, the only advantage regex brings us here is brevity. The
> biggest advantage of not using regex is that after a later package
> update, you can't inadvertently patch out a dependency that was added
> by upstream.
I'm not sure this is a good argument.  Even with a huge ass list (put
the hyphen where you want to), upstreams can strengthen and weaken
coupling with an update, both incidentally and purposefully.  So let's
say we decided to delete node-karma for version 0.2.0 of a package and
that worked fine until 0.6.5, but it's a requirement in 0.7.0 -- not
that we'd run tests or anything, because those require tap -- I don't
think either form is particularly helpful and in fact, I'd urge
reviewers to take a close look at the package.json before and after
regardless form.

> Before the DRY brigade comes to take my guix REPL, I'd argue that any
> duplication here is incidental. What happens if we want to patch out
> "karma" and "karma-chrome-launcher", but for some reason want to keep
> "karma-browserify"?[1] Either way, the reviewer has to do a double
> take to see whether a change from "karma.*" to the two specifications
> "karma-chrome-launcher" and "karma" actually gives the expected
> output w.r.t. the package.json file that is being patched.
I think node packages do generally follow a pattern here, but let's
assume they don't and your example works that way.  In that case, I'd
argue to make that regexp "karma(-browserify)?".  And if later on
karma-chrome-launcher is to be added to that list, but karma-icecat is
allowed, "karma(-(browserify|chrome-launcher))?"  In other words, we
can as a community discourage the usage of ".*" without condemning all
regexp.

Now I'm personally not convinced that disallowing "karma.*" altogether
is useful if we don't even have a karma package to go with -- and I'm
very sure we'd notice karma being packaged and check our karma dropping
packages -- but I'm willing to accept de gustibus here.

Cheers




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 00/41] guix: node-build-system: Support compiling add-ons with node-gyp.
  2022-01-07 21:07       ` Philip McGrath
@ 2022-01-07 23:06         ` Liliana Marie Prikler
  0 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2022-01-07 23:06 UTC (permalink / raw)
  To: Philip McGrath, Timothy Sample
  Cc: 51838, Pierre Langlois, Jelle Licht, Leo Famulari

Hi,

Am Freitag, dem 07.01.2022 um 16:07 -0500 schrieb Philip McGrath:
> My base position is that regexps should not be mandatory or default.
> It was very convenient to be able to just copy--paste package names
> from "package.json" into '#:absent-dependencies' (or whatever). I can
> imagine it being useful for tooling, too, to be able to find just
> from the package definition the dependencies which are being deleted,
> rather than  having to either download the origins or try to
> reconstruct names from regexps.
I don't think tooling should be too big of an issue, since you could
teach your tool to support regexp.  I.e. instead of checking whether a
newly added package has the name, you check whether it fits the
pattern.  That might generate false positive in some cases, perhaps
even many, but we can (and should) refine regexps that are too generic.


> Alternatively, I would also be ok with [...] a slight variant on it
> in which the user would write:
> 
>      `("foo" "bar" ,(make-regexp "baz"))
> 
> Since this (either variant) would not change the interpretation of 
> strings in the list of dependencies to delete, it could also be added
> later without breaking compatibility.
That's true, but the main reason to add it from my perspective is that
we don't need to change how regexps are interpreted from the rest of
Guix to make basic strings match fully.  For the fun of it, we could
also extend this to procedures of a single value so that one can
finally supply (const #t) :D

> I also think full string matches are better, regardless of any of the
> above. Here's an implementation that avoids unneeded copies and
> string comparison:
> 
>      (define (regexp-match-exact? rx str)
>        (define m (regexp-exec rx str))
>        (and m
>             (= (match:start m) 0)
>             (= (match:end m) (string-length str))))
I can't say this is more beautiful than 
(equal? (and=> (regexp-exec rx str) match:substring) str), but there's
only that many ways of making a partial match a full one and Guile core
has none of them...




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 00/41] guix: node-build-system: Support compiling add-ons with node-gyp.
  2022-01-07 22:20         ` Liliana Marie Prikler
@ 2022-01-07 23:07           ` Jelle Licht
  2022-01-08  0:20             ` Liliana Marie Prikler
  0 siblings, 1 reply; 458+ messages in thread
From: Jelle Licht @ 2022-01-07 23:07 UTC (permalink / raw)
  To: Liliana Marie Prikler, Timothy Sample
  Cc: 51838, Pierre Langlois, Philip McGrath, Leo Famulari

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

> Am Freitag, dem 07.01.2022 um 22:02 +0100 schrieb Jelle Licht:
>> To put it another way: a package that has to delete about 50
>> dependencies before it can be packaged in guix proper is allowed to
>> look ugly!  It can serve as a very unambigous list of things to
>> possibly improve in a package, while being easy to review as well if
>> changes are later proposed (e.g., you see 'node-karma-runner' being
>> added to inputs, as well as the "karma-runner" string being removed
>> from the list of dependencies to patch out).  With regex you always
>> need to hunt down if what is actually happening is what was intended
>> to happen.
>> 
>> In addition, since the things-that-can-be-matched by the regex w.r.t.
>> a particular package.json file are already known and clearly
>> enumerated, the only advantage regex brings us here is brevity. The
>> biggest advantage of not using regex is that after a later package
>> update, you can't inadvertently patch out a dependency that was added
>> by upstream.
> I'm not sure this is a good argument.  Even with a huge ass list (put
> the hyphen where you want to), upstreams can strengthen and weaken
> coupling with an update, both incidentally and purposefully.  So let's
> say we decided to delete node-karma for version 0.2.0 of a package and
> that worked fine until 0.6.5, but it's a requirement in 0.7.0 -- not
> that we'd run tests or anything, because those require tap -- I don't
> think either form is particularly helpful and in fact, I'd urge
> reviewers to take a close look at the package.json before and after
> regardless form.

Rather the other way around; if we do not allow regex, we will see that
there is a new dependency that we are currently neither patching nor
adding to the inputs. We should celebrate any accurate build time
failures we can make happen!

>> Before the DRY brigade comes to take my guix REPL, I'd argue that any
>> duplication here is incidental. What happens if we want to patch out
>> "karma" and "karma-chrome-launcher", but for some reason want to keep
>> "karma-browserify"?[1] Either way, the reviewer has to do a double
>> take to see whether a change from "karma.*" to the two specifications
>> "karma-chrome-launcher" and "karma" actually gives the expected
>> output w.r.t. the package.json file that is being patched.
> I think node packages do generally follow a pattern here, but let's
> assume they don't and your example works that way.  In that case, I'd
> argue to make that regexp "karma(-browserify)?".  And if later on
> karma-chrome-launcher is to be added to that list, but karma-icecat is
> allowed, "karma(-(browserify|chrome-launcher))?"  In other words, we
            ^
            I would object to this (constructed example) in a patch
review, fwiw.

At this stage, we expect the author to determine which dependencies to
leave in and out, then correctly encode these choices as a regex, which
is then decoded again by a reviewer who then must manually verify that
this decoded intent makes sense with regards to both the listed inputs
and the actual unpatched contents of package.json.

Without regex, there's just a few details that need to be kept in mind
for each step, for both author and reviewer(s).

Adding something to the deleted dependencies can either:
- fix a (newly) broken build
- remove an optional dependency, and can most likely be removed from
  existing inputs.

Removing something from the deleted dependencies can either:
- be a no-op: so the existing deleted dependency was (made) redundant
- enable an optional dependency, which should most likely be added to
  the inputs.

That's it! Some creative types can put this in fancy decision graph and
we have our "You Too Can Review Node Packages" campaign!

This all just to clarify my position, but perhaps also demonstrate that
it's a subjective preference, so 'agree to disagree' is a fine position
to take here.

> can as a community discourage the usage of ".*" without condemning all
> regexp.
>
> Now I'm personally not convinced that disallowing "karma.*" altogether
> is useful if we don't even have a karma package to go with -- and I'm
> very sure we'd notice karma being packaged and check our karma dropping
> packages -- but I'm willing to accept de gustibus here.

This is a very pragmatic example indeed! If some other folks could still
weigh in, I'd be okay with the resulting decision either way.

- Jelle




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 00/41] guix: node-build-system: Support compiling add-ons with node-gyp.
  2022-01-07 22:11   ` Philip McGrath
@ 2022-01-07 23:47     ` Liliana Marie Prikler
  2022-01-08  4:14       ` Philip McGrath
  0 siblings, 1 reply; 458+ messages in thread
From: Liliana Marie Prikler @ 2022-01-07 23:47 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

Hi,

Am Freitag, dem 07.01.2022 um 17:11 -0500 schrieb Philip McGrath:
> I think this is not quite correct.
> 
> (Actually, I suspect more broadly that node-build-system's handling
> of peerDependencies is not quite correct, but wrapping my head around
> the semantics of peerDependencies is on my to-do list for after these
> patches are applied. Here's one thing I want to read and understand: 
> https://pnpm.io/how-peers-are-resolved)
> 
> NPM does not try to install packages in "peerDependencis" during 'npm
> install' (out 'configure' phase). The problem arises because because
> our 'patch-dependencies' phase adds the "peerDependencies" as
> additional "dependencies". (Why? I don't fully understand, but I
> guess because it wants them to be installed.) We want absent
> "peerDependencies" to not be listed in "dependencies", but I don't
> think we want to delete them from "peerDependencies": at a minimum,
> we do not need to, and it seems like it might cause problems that I
> don't fully understand.
> 
> (This is one of the reasons I preferred to handle absent dependencies
> in the 'patch-dependencies' phase.)
I'd like to be able to understand that too, but npm still boggles my
mind.  I think node-build-system's implementation is a rather pragmatic
one; it forces you to use just a single combination of versions for all
of those rather than relying on node trickery (on a related note,
perhaps we ought to make inputs in node-build-system propagated-inputs
to be on the safe side).

> > 4. Regexps :)
> 
> Hopefully addressed in my previous email :) Jelle makes good
> arguments  for the no-regexps side. I'm genuinely on the fence, which
> suggests to me the best course might be to leave it as a possible
> future extension (as we're doing with '#:absent-dependencies').
We do already have threads on the regexp thing, so I'm not going to
respond here to keep it manageable.  The change is a rather small one
inside node-build-system itself, but you have to expand those strings
again ;)

> For the patches where you've made substantive changes to the 
> implementation or the commit message, maybe there should be more of
> an annotation than just "Signed-off-by". I'm not super familiar with
> the Git etiquette here, but one suggestion I've seen is something
> like:
> 
>      Signed-off-by: Random J Developer <random@developer.example.org>
>      [lucky@maintainer.example.org: struct foo moved from foo.c to
> foo.h]
>      Signed-off-by: Lucky K Maintainer <lucky@maintainer.example.org>
> 
> It's not a big deal, I could just imagine getting confused some
> months or years from now about what exactly I wrote or didn't write.
> (TBH the numerous versions of this series are already a bit
> unwieldy.)
If you don't like my phrasing in a particular message, you are free to
change it for v9 (or if you don't want a v9 to be reviewed, just reply
to the individual one with how you'd reword it and I'll try to keep my
changes to your version minimal).  I simply tried to adapt your
messages to the generally accepted style, which means moving long-form
discussions out of the ChangeLog into the message body and correcting
every variable to variable.

Now I do admit that I used some more flowery parts for 3-5 and that's
completely on me, but 3 already has me as Co-Author anyway.

> Time permitting, I'll send some more comments, but the only things I 
> think need to be addressed before merging are peerDependencies and
> regexps.
Cool.  Let's just not forget to send a v9 once we have what looks like
to be a reasonable action (assuming it's not a do-nothing, in which
case I just need to reword some of your commit messages again).  In my
personal experience, patches help a stalled discussion tremendously.

Cheers




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 00/41] guix: node-build-system: Support compiling add-ons with node-gyp.
  2022-01-07 23:07           ` Jelle Licht
@ 2022-01-08  0:20             ` Liliana Marie Prikler
  0 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2022-01-08  0:20 UTC (permalink / raw)
  To: Jelle Licht, Timothy Sample
  Cc: 51838, Pierre Langlois, Philip McGrath, Leo Famulari

Hi Jelle,

Am Samstag, dem 08.01.2022 um 00:07 +0100 schrieb Jelle Licht:
> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
> > [...]
> > I don't think either form is particularly helpful and in fact, I'd
> > urge reviewers to take a close look at the package.json before and
> > after regardless form.
> 
> Rather the other way around; if we do not allow regex, we will see
> that there is a new dependency that we are currently neither patching
> nor adding to the inputs. We should celebrate any accurate build time
> failures we can make happen!
We're arguing past each other.  What I'm saying is that with neither
you can assure your exclude list is actually reasonable in any sense of
the word.
> > 

> At this stage, we expect the author to determine which dependencies
> to leave in and out, then correctly encode these choices as a regex,
> which is then decoded again by a reviewer who then must manually
> verify that this decoded intent makes sense with regards to both the
> listed inputs and the actual unpatched contents of package.json.
Again de gustibus, but I'd rather read one very well thought out
"typescript.*" than dozens of lines excluding typescript-something.
Also, with longer/well-known prefixes, it typically becomes easier to
reason about a single regexp rather than seeing again 3+ lines of any
given package family and missing the forest for the trees. 

> Without regex, there's just a few details that need to be kept in
> mind for each step, for both author and reviewer(s).
> 
> Adding something to the deleted dependencies can either:
> - fix a (newly) broken build
> - remove an optional dependency, and can most likely be removed from
>   existing inputs.
> 
> Removing something from the deleted dependencies can either:
> - be a no-op: so the existing deleted dependency was (made) redundant
> - enable an optional dependency, which should most likely be added to
>   the inputs.
> 
> That's it! Some creative types can put this in fancy decision graph
> and we have our "You Too Can Review Node Packages" campaign!
That's not at all the complete list of possibilities for node packages.
Unless you define "optional" in the loosest sense, meaning "yeah, you
can build it, but try calling a simple function and you'll get an
import error of doom", which is possible because node doesn't
statically verify zilch (*).  That's the main reason Philip rejected my
"just restrict ourselves to what we find in inputs" suggestion.

Cheers

> 
> 
(*) double negative meant as actual negative




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 03/41] guix: node-build-system: Add JSON utilities.
  2021-12-30  7:38 ` [bug#51838] [PATCH v8 03/41] guix: node-build-system: Add JSON utilities Liliana Marie Prikler
@ 2022-01-08  4:13   ` Philip McGrath
  2022-01-08  7:00     ` Liliana Marie Prikler
  0 siblings, 1 reply; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  4:13 UTC (permalink / raw)
  To: Liliana Marie Prikler
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

Hi,

(None of the comments in this email should block these patches, IMO. I 
wouldn't change any of them until we move the functions to (guix build 
json-utils).)

On 12/30/21 02:38, Liliana Marie Prikler wrote:
> This commit adds several utility functions for non-destructive
> transformation of the JSON representation used by (guix build json),
> particularly for purely functional update of JSON objects.  They ought
> to eventually be exported from their own module, but for now are kept
> private to allow experimentation.
> 
> * guix/build/node-build-system.scm (assoc-ref*, jsobject-ref, alist-pop)
> (alist-update, jsobject-update*, jsobject-union): New variables.
> (with-atomic-json-file-replacement): New public variable.
> (module-name, build, patch-dependencies): Use them.  Do not resort to
> unsafe alist primitives from Guile core.
> 
> Co-authored-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
> ---
>   guix/build/node-build-system.scm | 145 ++++++++++++++++++++++++-------
>   1 file changed, 115 insertions(+), 30 deletions(-)
> 
> diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
> index 2d7a3bdc67..c6602b876b 100644
> --- a/guix/build/node-build-system.scm
> +++ b/guix/build/node-build-system.scm
> @@ -3,6 +3,7 @@
>   ;;; Copyright © 2016, 2020 Jelle Licht <jlicht@fsfe.org>
>   ;;; Copyright © 2019, 2021 Timothy Sample <samplet@ngyro.com>
>   ;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
> +;;; Copyright © 2021 Liliana Marie Prikler <liliana.prikler@gmail.com>
>   ;;;
>   ;;; This file is part of GNU Guix.
>   ;;;
> @@ -26,14 +27,101 @@ (define-module (guix build node-build-system)
>     #:use-module (ice-9 ftw)
>     #:use-module (ice-9 match)
>     #:use-module (srfi srfi-1)
> +  #:use-module (srfi srfi-71)
>     #:export (%standard-phases
> +            with-atomic-json-file-replacement
>               node-build))
>   
> -;; Commentary:
> -;;
> -;; Builder-side code of the standard Node/NPM package install procedure.
> -;;
> -;; Code:
> +(define (with-atomic-json-file-replacement file proc)
> +  "Like 'with-atomic-file-replacement', but PROC is called with a single
> +argument---the result of parsing FILE's contents as json---and should a value
> +to be written as json to the replacement FILE."
> +  (with-atomic-file-replacement file
> +    (lambda (in out)
> +      (write-json (proc (read-json in)) out))))
> +
> +(define* (assoc-ref* alist key #:optional default)
> +  "Like assoc-ref, but return DEFAULT instead of #f if no value exists."
> +  (match (assoc key alist)
> +    (#f default)
> +    ((_ . value) value)))
> +
> +(define* (jsobject-ref obj key #:optional default)
> +  (match obj
> +    (('@ . alist) (assoc-ref* alist key default))))
> +
> +(define* (alist-pop alist key #:optional (= equal?))
> +  "Return two values, the first pair in ALIST with key KEY, and the other
> +elements.  Equality calls are made as (= KEY ALISTCAR)."
> +  (define (found? pair)
> +    (= key (car pair)))
> +
> +  (let ((before after (break found? alist)))
> +    (if (pair? after)
> +        (values (car after) (append before (cdr after)))
> +        (values #f before))))

FWIW, while I don't feel strongly about `let` vs. `define` in general, I 
find SRFI-71's overloaded `let` less clear than internal definitions and 
`define-values`, which are supported by core Guile.

> +
> +(define* (alist-update alist key proc #:optional default (= equal?))
> +  "Return an association list like ALIST, but with KEY mapped to the result of
> +PROC applied to the first value found under the comparison (= KEY ALISTCAR).
> +If no such value exists, use DEFAULT instead.
> +Unlike acons, this removes the previous association of KEY (assuming it is
> +unique), but the result may still share storage with ALIST."
> +  (let ((pair rest (alist-pop alist key =)))
> +    (acons key
> +           (proc (if (pair? pair)
> +                     (cdr pair)
> +                     default))
> +           rest)))
> +
> +(define (jsobject-update* js . updates)
> +  "Return a json object like JS, but with all UPDATES applied.  Each update
> +is a list (KEY PROC [DEFAULT]), so that KEY is mapped to the result of
> +PROC applied to the value found for it, or DEFAULT otherwise."
> +  (match js
> +    (('@ . alist)
> +     (let loop ((alist alist)
> +                (updates updates))
> +       (match updates
> +         (() (cons '@ alist))
> +         (((key proc) . updates)
> +          (loop (alist-update alist key proc #f equal?) updates))
> +         (((key proc default) . updates)
> +          (loop (alist-update alist key proc default equal?) updates)))))))

I would prefer (KEY [DEFAULT] PROC). In my experience, DEFAULT is often 
something simple like #f, and writing it after a multi-line lambda 
expression is not very pleasant. As a reader, you often want to know 
what DEFAULT is while reading the body of PROC, whereas putting DEFAULT 
last can look like a dangling afterthought. Plus, I think indentation 
tends to work out better with PROC at the end of a clause.

The docstring no longer specifies left-to-right evaluation or that the 
default DEFAULT is #f. (And I still think '(@) is a better default DEFAULT.)

I don't especially like all of the explicit quasiquotation of lists in 
the rest argument.

> +
> +(define (jsobject-union combine seed . objects)
> +  "Merge OBJECTS into SEED by applying (COMBINE KEY VAL0 VAL), where VAL0
> +is the value found in the (possibly updated) SEED and VAL is the new value
> +found in one of the OBJECTS."
> +  (match seed
> +    (('@ . aseed)
> +     (match objects
> +       (() seed)
> +       ((('@ . alists) ...)
> +        (cons
> +         '@
> +         (fold (lambda (alist aseed)
> +                 (if (null? aseed) alist
> +                     (fold
> +                      (match-lambda*
> +                        (((k . v) aseed)
> +                         (let ((pair tail (alist-pop alist k)))
> +                           (match pair
> +                             (#f (acons k v aseed))
> +                             ((_ . v0) (acons k (combine k v0 v) aseed))))))
> +                      aseed
> +                      alist)))
> +               aseed
> +               alists)))))))
> +
> +;; Possibly useful helper functions:
> +;; (define (newest key val0 val) val)
> +;; (define (unkeyed->keyed proc) (lambda (_key val0 val) (proc val0 val)))

I much prefer a keyword argument #:combine, and I still think the 
key-agnostic case is so much more common that the separation of 
#:combine/key is useful.

-Philip




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 03/41] guix: node-build-system: Add JSON utilities.
  2021-12-31 10:18                                                                                 ` Liliana Marie Prikler
@ 2022-01-08  4:13                                                                                   ` Philip McGrath
  0 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  4:13 UTC (permalink / raw)
  To: Liliana Marie Prikler, 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

Hi,

On 12/31/21 05:18, Liliana Marie Prikler wrote:
> Am Freitag, dem 31.12.2021 um 00:22 -0500 schrieb Philip McGrath:
>>>> +(define (alist-pop alist key)
>>>> +  "Return two values: the first pair in ALIST with the given KEY
>>>> in its
>>>> +'car' (or #f, if no such pair exists) and an assosciation list
>>>> like (and
>>>> +potentially sharing storage with) ALIST, but with no entry for
>>>> KEY."
>>>> +  (match (assoc key alist)
>>>> +    ;; If key isn't present, we don't need to do any allocation
>>>> +    (#f
>>>> +     (values #f alist))
>>>> +    (found
>>>> +     (values found
>>>> +             ;; Because we have `found`, we can find it more
>>>> +             ;; efficiently this time with `eq?`. We avoid using
>>>> +             ;; `delq` because it would copy pairs in a shared
>>>> +             ;; tail. We assume a sufficiently smart compiler to
>>>> +             ;; handle "tail recursion modulo cons" (vid. e.g.
>>>> Indiana
>>>> +             ;; University Technical Report No. 19, Friedman &
>>>> Wise
>>>> +             ;; 1975) at least as efficiently as a hand-written
>>>> +             ;; tail-recursive implementation with an
>>>> accumulator.
>>>> +             (let loop ((alist alist))
>>>> +               (match alist
>>>> +                 ;; We know that `found` is present,
>>>> +                 ;; so no need to check for '()
>>>> +                 ((this . alist)
>>>> +                  (if (eq? this found)
>>>> +                      alist
>>>> +                      (cons this (loop alist))))))))))
>>> I think this can be more efficiently be done in a "single" loop.
>>>
>>>     (let loop ((rest alist)
>>>                (previous '()))
>>>       (match rest
>>>         (() (values #f alist))
>>>         ((first . rest)
>>>          (if (eq? (car first) key)
>>>              (values first (reverse! previous rest))
>>>              (loop rest (cons first previous))))))
>>>
>>
>> I'll admit to a Racket bias, but, having just eliminated the use of
>> 'assoc-set!', I'm loathe to start mutating pairs (even correctly). To
>> quote a bit from the SRFI-1 spec for 'append-reverse!', "note that
>> this pattern of iterative computation followed by a reverse can
>> frequently be rewritten as a recursion, dispensing with the reverse
>> and append-reverse steps, and shifting temporary, intermediate
>> storage from the heap to the stack, which is typically a win for
>> reasons of cache locality and eager storage reclamation." (See how
>> 'set-cdr!' can crash safe Chez Scheme!
>> <https://github.com/cisco/ChezScheme/issues/599>)
>>
>> IIUC, using SRFI-1's 'span' would lead to the same situation.
> For the record, we can use the non-destructive append and reverse here
> at the expense of more copying.  If done in terms of SRFI-1 span, we
> would not need reverse as far as I understand.
> 
>>> Also, I don't think your version is tail-recursive.  (loop alist)
>>> is not in tail position from what I can tell.
>>
>> Yes, "tail recursion modulo cons" refers to a compiler optimization
>> for functions which are _not_ tail recursive. For full details, see
>> the Friedman & Wise 1975 tech report I cited at
>> <https://legacy.cs.indiana.edu/ftp/techreports/TR19.pdf> (or various
>> other articles), but, as briefly as I can: The optimization rests on
>> the observation that many recursive functions, like the classic
>> definition of 'map':
>>
>>       (define (map f lst)
>>         (match lst
>>           (()
>>            '())
>>           ((this . lst)
>>            (cons (f this)
>>                  (map f lst)))))
>>
>> are nearly tail-recursive, and the only real work remaining to be
>> done in the continuation of the recursive call is to fill in the cdr
>> of the pair. Thus, a compiler can safely transform this code into a
>> truly tail-recursive implementation:
>>
>>       (define (map f lst)
>>         (match lst
>>           (()
>>            '())
>>           ((this . lst)
>>            (define ret (list (f this)))
>>            (let loop ((dest ret)
>>                       (lst lst))
>>              (match lst
>>                ((this . lst)
>>                 (define new (list (f this)))
>>                 (set-cdr! dest new)
>>                 (loop new lst))
>>                (()
>>                 ret))))))
>>
>> Unlike the Proper Implementation of Tail Calls (so-called "tail-call
>> optimization"), handling "tail recursion modulo cons" truly is an
>> optimization: it does not change the space complexity of the
>> function. But it can allow the compiler to generate whatever code it
>> thinks will work best with its collector/allocator and
>> continuation/"call stack" implementation.
>>
>> (The optimizations applies to constructors in general, not just
>> 'cons', and a compiler can safely apply it to values that are
>> immutable from the perspective of the source language.)
> I'm not aware to which extent Guile implements tail recursion modulo
> cons and I'd argue neither are you until you dig down into disassembly.
> I think it's better here to avoid patterns from Racket that would feel
> foreign to Guilers, particularly if you have to explain them with
> reference to a paper (we already get hate for referring to Wingo's fold
> for XML handling).

In a sense, "tail recursion modulo cons" was a red herring here. The 
essential requirement for implementing 'alist-pop' or 'map' as I did is 
that the language implementation be "safe for space", i.e. not have 
"stack overflow"s: Guile meets that requirement. [1]

In a safe-for-space language, the naturally recursive implementations 
and the implementations with explicit, non-destructive accumulators both 
allocate O(n) temporary storage. The difference is that the explicit 
accumulator versions allocate temporary pairs on the heap, while the 
naturally recursive version allocates its temporary space on the "stack" 
(i.e. additional frames of the (non-reified) continuation), which is 
generally, and specifically for Guile per [1], much better (though a 
sufficiently smart generational garbage collector with bump-pointer 
allocation in the nursery could mitigate the difference somewhat).

All of that relies just on the guarantees of Guile as a safe-for-space 
language. The optimization in "tail recursion modulo cons" is that a 
compiler could, if it chose to expend its effort this way, make the 
naturally recursive implementations work without the O(n) temporary 
"stack" storage by transforming transforming the non-tail recursion into 
tail recursion. In essence, it could achieve a similar effect to an 
explicit accumulator plus 'reverse!' without the many downsides (some of 
which [1] discusses).

But the naturally recursive implementation is preferable even if the 
optimization does not apply.

> 
> In principle, what you're supposing is that a sufficiently smart
> compiler could rewrite
> 
>    (let ((before after (span PRED mylist))) (append before after))
> 
> to (list-copy mylist), which as far as I'm aware Guile currently
> doesn't.  It could be argued that it would start doing so once I cast
> some magic incantations, but I wouldn't count on it without reading the
> disassembly.

In some sense that's true, but your example would require a lot of 
interprocedural analysis, not just a directly visible pattern with 
well-known primitives using analysis that has been well known since the 
'70s. But, again, the optimization isn't really relevant.
>>> Is order relevant here?  Because we could just as well reimplement
>>> our alist-delete* loop and cons the replacement onto the rest.
>>> WDYT?
>>
>> Relying on order for JSON objects is non-interoperable, per RFC 8259
>> §4. I'm not intending for these alist procedures to be exported, so
>> I'm not trying to handle any more general case than that, as I
>> explain in the comments at the top of the file.
>>
>> I'm not sure what the advantage would be to reimplementing the
>> 'alist-delete' loop here.
> Fair enough, the question was however not so much what is required per
> RFC, but rather if there is a natural feel of order to package.json
> that we ought not disturb.  Particularly, putting dependencies before
> name and version could be confusing to whoever needs to debug a delete-
> dependencies phase gone wrong.

I haven't noticed a consistent convention in "package.json" files (which 
IIUC may not be entirely hand-written).

For debugging, the biggest problem is that (guix build json) doesn't add 
any linebreaks or indentation.

If I were changing it, I'd want it to write object keys in 'string<?' 
order and to raise an exception if given duplicate keys.

-Philip

[1]: 
https://www.gnu.org/software/guile/docs/docs-2.2/guile-ref/Stack-Overflow.html




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 05/41] guix: node-build-system: Add 'delete-dependencies' helper function.
  2022-01-05 21:04                                                                                     ` Liliana Marie Prikler
  2022-01-05 22:58                                                                                       ` Liliana Marie Prikler
@ 2022-01-08  4:14                                                                                       ` Philip McGrath
  2022-01-08  7:59                                                                                         ` Liliana Marie Prikler
  1 sibling, 1 reply; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  4:14 UTC (permalink / raw)
  To: Liliana Marie Prikler, 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

Hi,

On 1/5/22 16:04, Liliana Marie Prikler wrote:
> Am Mittwoch, dem 05.01.2022 um 14:08 -0500 schrieb Philip McGrath:
>> In case it helps at all to state my position more fully: with or
>> without Guix, I think a major purpose, perhaps even the primary
>> purpose, of _any_ build system is to relieve users (including
>> ourselves) of the cognitive burden of lower-level details. Build
>> systems are a means of abstraction and encapsulation.
>>
>> [...]
> I agree with you that abstractions ought to help, but we do have some
> disagreements about the amount by which certain abstractions help.
> Those are gut feeling value judgements, they're not all entirely
> rational.
> 
>> I hope this is just a matter of some nuance in the connotation of
>> the word "gratuitous" not coming across properly, but I would
>> appreciate the same consideration being extended to my perspective.
>>
>> Almost tautologically, I don't think adding '#:absent-dependencies'
>> would be gratuitous, or I wouldn't have proposed it.
> Generally, keywords are reserved for a few special operations.  I don't
> currently have the time to write them all up, but suffice it to say I
> don't believe the way #:absent-dependencies would be used fits into any
> of those.  I can write that up in a later message if you feel it's
> imporant enough.

It isn't needed right now, since we've agreed to go ahead without 
'#:absent-dependencies', but, since I do intend to propose 
'#:absent-dependencies' immediately thereafter, I think it would be 
useful: this seems to get close to the core of the disagreement we've 
been having for the last ... couple months?

I don't see a reason why we should hesitate to use keywords when they 
enable especially nice code. Actually, I've sometimes wished build 
systems would '#:allow-other-keys'.

I'd expect '#:absent-dependencies' to be more common for 
'node-build-system' packages than '#:tests?', since I'd expect almost 
every package that would use '#:tests? #f', plus a significant number 
that wouldn't, to use '#:absent-dependencies'.

Jumping back to an earlier email:

On 12/30/21 21:46, Liliana Marie Prikler wrote:
 > Am Donnerstag, dem 30.12.2021 um 20:09 -0500 schrieb Philip McGrath:
 >> In my view, the high-level purpose of 'delete-dependencies',
 >> '#:absent-dependencies', or whatever is to gather our collective
 >> procedural knowledge about how to modify a "package.json" file to
 >> build a package without some of the dependencies its developers have
 >> declared and to encode that knowledge in a single, abstracted point
 >> of control in 'node-build-system', so that authors of Node.js package
 >> definitions can simply specify which declared dependencies are absent
 >> and leave it to 'node-build-system' to act accordingly. (I don't
 >> think it matters _why_ the dependencies are absent, i.e. whether we
 >> don't want the them or merely don't have them.)
 > For the record, you can delete present dependencies as well, which is
 > one shortcoming in the "absent dependencies" metaphor.
[...]

 >> It is unnecessarily flexible because, if a package author ever passes
 >> some other value for '#:json-keys', that would seem to indicate that
 >> there's some procedural knowledge missing from 'node-build-system',
 >> and it should be added there.
 > The reason I have it as such is that a packager might decide in the
 > future to e.g. only drop a peer dependency, that might share a name
 > with a dev dependency or something along those lines.

Since I don't think I've written it down before, my hope in describing 
them as "absent" dependencies was to state that they are absent from the 
build environment, while being as neutral as I could about _why_ they 
might be absent. In particular, I wanted to avoid the implications of 
"missing", which can have implications of "we don't know where X is" and 
"it would be better if we found X". One day, it would probably be nice 
to have 'node-aws-sdk' packaged for Guix, but, even if we knew the 
precise line number in "node-xyz.scm" where it we could find its 
definition, we would not want to use it while building 'node-sqlite3'.

So, having established that the adjectives are a little fuzzy, I don't 
understand what it would mean to "delete present dependencies". If they 
are present in the build environment, why delete them? If the issue is 
that they only are needed at build time, the 'install' phase of 
'node-build-system' should already handle this by passing '--production' 
to 'npm install'.

If a "peerDependency" and a "devDependency" share a name, then they 
refer to the same package. I believe it would be an error (logically, 
that is: I do know npm would not raise an exception) to have a 
"peerDependency" that is also a "devDependency" or a "dependency": as I 
understand it (poorly!), peer dependencies are meant to be some weaker 
kind of relationship.

But again, none of this needs to stand in the way of merging this patch 
series.

-Philip




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 00/41] guix: node-build-system: Support compiling add-ons with node-gyp.
  2022-01-07 23:47     ` Liliana Marie Prikler
@ 2022-01-08  4:14       ` Philip McGrath
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
  0 siblings, 1 reply; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  4:14 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht,
	Liliana Marie Prikler, Leo Famulari

Hi,

On 1/7/22 18:47, Liliana Marie Prikler wrote:
> Hi,
> 
> Am Freitag, dem 07.01.2022 um 17:11 -0500 schrieb Philip McGrath:
>> I think this is not quite correct.
>>
>> (Actually, I suspect more broadly that node-build-system's handling
>> of peerDependencies is not quite correct, but wrapping my head around
>> the semantics of peerDependencies is on my to-do list for after these
>> patches are applied. Here's one thing I want to read and understand:
>> https://pnpm.io/how-peers-are-resolved)
>>
>> NPM does not try to install packages in "peerDependencis" during 'npm
>> install' (out 'configure' phase). The problem arises because because
>> our 'patch-dependencies' phase adds the "peerDependencies" as
>> additional "dependencies". (Why? I don't fully understand, but I
>> guess because it wants them to be installed.) We want absent
>> "peerDependencies" to not be listed in "dependencies", but I don't
>> think we want to delete them from "peerDependencies": at a minimum,
>> we do not need to, and it seems like it might cause problems that I
>> don't fully understand.
>>
>> (This is one of the reasons I preferred to handle absent dependencies
>> in the 'patch-dependencies' phase.)
> I'd like to be able to understand that too, but npm still boggles my
> mind.

I mean, I did start writing this patch series because I find it more 
understandable than just using npm :)

> I think node-build-system's implementation is a rather pragmatic
> one; it forces you to use just a single combination of versions for all
> of those rather than relying on node trickery

I will send a v9 that doesn't delete "peerDependencies" and just rely on 
doing the ordering properly. Hopefully, we can improve the situation 
later, once we understand how "peerDependencies" are actually supposed 
to work (and/or adopt '#:absent-dependencies' :) ). I don't know of any 
concrete problems that would be caused by overzealously deleting 
"peerDependencies", but I wouldn't know of them, since that's not the 
behavior I've been testing all this time.

> (on a related note,
> perhaps we ought to make inputs in node-build-system propagated-inputs
> to be on the safe side).

I think that might not actually lead Node.js to find all of the modules, 
and some things I've been reading with interest (but not yet fully 
understanding) suggests that the opposite, i.e. creating a more strict 
"node_modules", is actually useful. [1] [2]

> 
>>> 4. Regexps :)
>>
>> Hopefully addressed in my previous email :) Jelle makes good
>> arguments  for the no-regexps side. I'm genuinely on the fence, which
>> suggests to me the best course might be to leave it as a possible
>> future extension (as we're doing with '#:absent-dependencies').
> We do already have threads on the regexp thing, so I'm not going to
> respond here to keep it manageable.  The change is a rather small one
> inside node-build-system itself, but you have to expand those strings
> again ;)

I am not 100% clear---if I'm wrong, please speak up!---but my sense from 
the previous thread is that:

  1. some people have reservations about some regexp proposals;

  2. everyone who has liked any of the regexp proposals has been ok
     with one of the options for distinguishing regexps from non-regexp
     strings, either '(regexp "foo") or (make-regexp "foo"), with another
     dimension being whether or not to require full matches; and

  3. with either of the options from #2---as long as regexps are using
     some representation that answers #f to 'string?'---regexp support
     could be added as a fully compatible future extension.

So I think---I hope!---a version without regex support could get 
everyone's assent. Unless someone tells me otherwise first, that's what 
I'll do in v9.

>> Time permitting, I'll send some more comments, but the only things I
>> think need to be addressed before merging are peerDependencies and
>> regexps.
> Cool.  Let's just not forget to send a v9 once we have what looks like
> to be a reasonable action (assuming it's not a do-nothing, in which
> case I just need to reword some of your commit messages again).  In my
> personal experience, patches help a stalled discussion tremendously.

Ok!

-Philip

[1]: https://pnpm.io/blog/2020/05/27/flat-node-modules-is-not-the-only-way
[2]: 
https://medium.com/pnpm/pnpms-strictness-helps-to-avoid-silly-bugs-9a15fb306308




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v8 03/41] guix: node-build-system: Add JSON utilities.
  2022-01-08  4:13   ` Philip McGrath
@ 2022-01-08  7:00     ` Liliana Marie Prikler
  0 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2022-01-08  7:00 UTC (permalink / raw)
  To: Philip McGrath
  Cc: 51838, Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

Hi,

Am Freitag, dem 07.01.2022 um 23:13 -0500 schrieb Philip McGrath:
> FWIW, while I don't feel strongly about `let` vs. `define` in
> general, I find SRFI-71's overloaded `let` less clear than internal
> definitions and `define-values`, which are supported by core Guile.
Internal definitions are an implicit letrec, which might be useful to
have, but I prefer explicit let-binding.  It has the added benefit of
being shorter to write and having clearer scope.


> I would prefer (KEY [DEFAULT] PROC). In my experience, DEFAULT is
> often something simple like #f, and writing it after a multi-line
> lambda expression is not very pleasant. 
The reason to have DEFAULT be an optional final argument is imo
symmetry with how you'd call the underlying alist functions.  It makes
the code a little easier to grok, but you're right that inline DEFAULT
looks nicer.

> The docstring no longer specifies left-to-right evaluation or that
> the default DEFAULT is #f.
That's a bug.

>  (And I still think '(@) is a better default DEFAULT.)
I don't think so.  Values could be of any type, not necessarily object
type (e.g. suppose you're updating a key:string mapping).  So explicit
'(@) is preferred in my opinion.

> I don't especially like all of the explicit quasiquotation of lists
> in the rest argument.
Two things: First it makes it easier to understand where each update
begins and where each update ends.  Second, I'm not satisfied with
quasi-quote either (I'd like to have substitute-json* syntax ideally),
but it's a fair middle ground between my ideal solution and what I
could do on top of your submission in a short time.

> > +(define (jsobject-union combine seed . objects)
> > +  "Merge OBJECTS into SEED by applying (COMBINE KEY VAL0 VAL),
> > where VAL0
> > +is the value found in the (possibly updated) SEED and VAL is the
> > new value
> > +found in one of the OBJECTS."
> > +  (match seed
> > +    (('@ . aseed)
> > +     (match objects
> > +       (() seed)
> > +       ((('@ . alists) ...)
> > +        (cons
> > +         '@
> > +         (fold (lambda (alist aseed)
> > +                 (if (null? aseed) alist
> > +                     (fold
> > +                      (match-lambda*
> > +                        (((k . v) aseed)
> > +                         (let ((pair tail (alist-pop alist k)))
> > +                           (match pair
> > +                             (#f (acons k v aseed))
> > +                             ((_ . v0) (acons k (combine k v0 v)
> > aseed))))))
> > +                      aseed
> > +                      alist)))
> > +               aseed
> > +               alists)))))))
> > +
> > +;; Possibly useful helper functions:
> > +;; (define (newest key val0 val) val)
> > +;; (define (unkeyed->keyed proc) (lambda (_key val0 val) (proc
> > val0 val)))
> 
> I much prefer a keyword argument #:combine, and I still think the 
> key-agnostic case is so much more common that the separation of 
> #:combine/key is useful.
I think we could define an (alist-flatten alist #:key combine default-
combine), where again combine is your combine/key and default-combine
is your combine.  Then we could define (json-object-union objs ...)
as (alist-flatten (append-map json-object->alist objs) #:combine ...).
Explicit conversion of json-object to alist and back seems to be the
wiser option to me than defining everything twice.  WDYT? 




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v6 05/41] guix: node-build-system: Add 'delete-dependencies' helper function.
  2022-01-08  4:14                                                                                       ` Philip McGrath
@ 2022-01-08  7:59                                                                                         ` Liliana Marie Prikler
  0 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2022-01-08  7:59 UTC (permalink / raw)
  To: Philip McGrath, 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

Hi,

Am Freitag, dem 07.01.2022 um 23:14 -0500 schrieb Philip McGrath:
> I do intend to propose  '#:absent-dependencies' immediately
> thereafter.
And I do intend to reject that proposal immediately thereafter. 
Nothing personal, but I think I've made a clear enough case against it,
although I could go into even more detail if you want me to.

> I don't see a reason why we should hesitate to use keywords when they
> enable especially nice code. Actually, I've sometimes wished build 
> systems would '#:allow-other-keys'.
The reason to e.g. use #:tests? over (delete 'check) is not because the
code looks nicer (although it does).  As Jelle pointed out, code that
does ugly things should be allowed to look ugly, and in terms of node-
build-system needing to delete dependencies *at all* is already an ugly
thing.  There's no need for a convenience keyword, much less a reason
to implement one for the sake of nicer-looking code.

> Since I don't think I've written it down before, my hope in
> describing them as "absent" dependencies was to state that they are
> absent from the build environment, while being as neutral as I could
> about _why_ they might be absent. 
The word absent is not neutral.  It implies it's not there when it
should be.  My use of unwanted does the opposite.  It implies it should
not be there when upstream claims it should.  The obvious middle ground
is good old "exclude", but I think it'd be hard to make an argument
even for #:excluded-dependencies.

> In particular, I wanted to avoid the implications of
> "missing", which can have implications of "we don't know where X is"
> and "it would be better if we found X". 
You just substituted missing for another spelling of it.  That doesn't
really help here.

> So, having established that the adjectives are a little fuzzy, I
> don't understand what it would mean to "delete present dependencies".
> If they are present in the build environment, why delete them? 
It would mean committing the error of specifying a dependency both as
input and as absent.  This is for the lack of a better word UB.


> If a "peerDependency" and a "devDependency" share a name, then they 
> refer to the same package. I believe it would be an error (logically,
> that is: I do know npm would not raise an exception) to have a 
> "peerDependency" that is also a "devDependency" or a "dependency": as
> I understand it (poorly!), peer dependencies are meant to be some
> weaker kind of relationship.
Even then, much of our other discussion revolves around the question of
what the implications of those are.  If we, the experts, can't be
trusted to have a clear enough understanding, how should we trust non-
expert users on the matter?  That's why I wanted to encode the
dependency key in delete-dependencies.  That way, one could specify
"delete X from dependencies after it was introduced by Guix" or "no, I
really don't want it to be a peer dependency either".  And until we
have a clearer image, we could accept both forms and see what problems
they'd cause later on, then reject one in favour of the other by
patching them out over time.

None of that would be possible with a keyword, at least one with a nice
value encoding.  You either change all node packages at a time,
potentially causing a c-u-worthy rebuild, or you don't and you're
stuck.

Cheers




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 00/41] guix: node-build-system: Support compiling add-ons with node-gyp.
  2022-01-08  4:14       ` Philip McGrath
@ 2022-01-08  8:41         ` Philip McGrath
  2022-01-08  8:41           ` [bug#51838] [PATCH v9 01/41] guix: node-build-system: Add delete-lockfiles phase Philip McGrath
                             ` (41 more replies)
  0 siblings, 42 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:41 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

Ninth time's the charm? I hope so!

The only changes from v8 are:

  - In 03/41, I revised the docstring for 'jsonobject-update*' as discussed
    in <https://issues.guix.gnu.org/51838#411>;

  - In 05/41, I changed 'delete-dependencies' to accept strings, rather than
    regexps, and not to delete "peerDependencies", as discussed in
    <https://issues.guix.gnu.org/51838#410>;

  - In 06/41 through 41/41, I changed the arguments to 'delete-dependencies'
    accordingly, where applicable.

Liliana, I removed your "Signed-off-by" so as not to imply that you'd seen
these changes. I also added you as a co-author to 05/41, which seemed
appropriate. Of course, feel free to adjust as you like.

 -Philip

Philip McGrath (41):
  guix: node-build-system: Add delete-lockfiles phase.
  guix: node-build-system: Add implicit libuv input.
  guix: node-build-system: Add JSON utilities.
  guix: node-build-system: Add avoid-node-gyp-rebuild phase.
  guix: node-build-system: Add 'delete-dependencies' helper function.
  gnu: node-semver-bootstrap: Use 'delete-dependencies'.
  gnu: node-ms-bootstrap: Use 'delete-dependencies'.
  gnu: node-binary-search-bootstrap: Use 'delete-dependencies'.
  gnu: node-debug-bootstrap: Use 'delete-dependencies'.
  gnu: node-llparse-builder-bootstrap: Use 'delete-dependencies'.
  gnu: node-llparse-frontend-bootstrap: Use 'delete-dependencies'.
  gnu: node-llparse-bootstrap: Use 'delete-dependencies'.
  gnu: node-semver: Use 'delete-dependencies'.
  gnu: node-wrappy: Use 'delete-dependencies'.
  gnu: node-once: Use 'delete-dependencies'.
  gnu: node-irc-colors: Use 'delete-dependencies'.
  gnu: node-irc: Use 'delete-dependencies'.
  gnu: Add node-inherits.
  gnu: Add node-safe-buffer.
  gnu: Add node-string-decoder.
  gnu: Add node-readable-stream.
  gnu: Add node-nan.
  gnu: Add node-openzwave-shared.
  gnu: Add node-addon-api.
  gnu: Add node-sqlite3.
  gnu: Add node-file-uri-to-path.
  gnu: Add node-bindings.
  gnu: Add node-segfault-handler.
  gnu: Add node-ms.
  gnu: Add node-debug.
  gnu: Add node-serialport-binding-abstract.
  gnu: Add node-serialport-parser-delimiter.
  gnu: Add node-serialport-parser-readline.
  gnu: Add node-serialport-bindings.
  gnu: Add node-serialport-parser-regex.
  gnu: Add node-serialport-parser-ready.
  gnu: Add node-serialport-parser-inter-byte-timeout.
  gnu: Add node-serialport-parser-cctalk.
  gnu: Add node-serialport-parser-byte-length.
  gnu: Add node-serialport-stream.
  gnu: Add node-serialport.

 gnu/packages/node-xyz.scm        | 966 ++++++++++++++++++++++++++++++-
 gnu/packages/node.scm            |  63 +-
 gnu/packages/zwave.scm           |  64 ++
 guix/build-system/node.scm       |   9 +-
 guix/build/node-build-system.scm | 236 +++++++-
 5 files changed, 1277 insertions(+), 61 deletions(-)

-- 
2.32.0





^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 01/41] guix: node-build-system: Add delete-lockfiles phase.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
@ 2022-01-08  8:41           ` Philip McGrath
  2022-01-08  8:41           ` [bug#51838] [PATCH v9 02/41] guix: node-build-system: Add implicit libuv input Philip McGrath
                             ` (40 subsequent siblings)
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:41 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

Guix does not use any of these lock files to determine the package versions
used during the build, so they only serve to cause problems.

* guix/build/node-build-system.scm (delete-lockfiles): New variable.
(%standard-phases): Add 'delete-lockfiles' after 'patch-dependencies'.
---
 guix/build/node-build-system.scm | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
index 70a367618e..2d7a3bdc67 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2015 David Thompson <davet@gnu.org>
 ;;; Copyright © 2016, 2020 Jelle Licht <jlicht@fsfe.org>
 ;;; Copyright © 2019, 2021 Timothy Sample <samplet@ngyro.com>
+;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -96,6 +97,17 @@ (define (resolve-dependencies package-meta meta-key)
         (write-json package-meta out))))
   #t)
 
+(define* (delete-lockfiles #:key inputs #:allow-other-keys)
+  "Delete 'package-lock.json', 'yarn.lock', and 'npm-shrinkwrap.json', if they
+exist."
+  (for-each (lambda (pth)
+              (when (file-exists? pth)
+                (delete-file pth)))
+            '("package-lock.json"
+              "yarn.lock"
+              "npm-shrinkwrap.json"))
+  #t)
+
 (define* (configure #:key outputs inputs #:allow-other-keys)
   (let ((npm (string-append (assoc-ref inputs "node") "/bin/npm")))
     (invoke npm "--offline" "--ignore-scripts" "install")
@@ -146,6 +158,7 @@ (define %standard-phases
   (modify-phases gnu:%standard-phases
     (add-after 'unpack 'set-home set-home)
     (add-before 'configure 'patch-dependencies patch-dependencies)
+    (add-after 'patch-dependencies 'delete-lockfiles delete-lockfiles)
     (replace 'configure configure)
     (replace 'build build)
     (replace 'check check)
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 02/41] guix: node-build-system: Add implicit libuv input.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
  2022-01-08  8:41           ` [bug#51838] [PATCH v9 01/41] guix: node-build-system: Add delete-lockfiles phase Philip McGrath
@ 2022-01-08  8:41           ` Philip McGrath
  2022-01-08  8:41           ` [bug#51838] [PATCH v9 03/41] guix: node-build-system: Add JSON utilities Philip McGrath
                             ` (39 subsequent siblings)
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:41 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

* guix/build-system/node.scm (lower): Add the version of libuv
used as an input to the #:node package as an additional implicit
input, so that packages needing libuv always get the correct version.
---
 guix/build-system/node.scm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/guix/build-system/node.scm b/guix/build-system/node.scm
index 735f8dd06e..24bd677bfc 100644
--- a/guix/build-system/node.scm
+++ b/guix/build-system/node.scm
@@ -2,6 +2,8 @@
 ;;; Copyright © 2016 Jelle Licht <jlicht@fsfe.org>
 ;;; Copyright © 2019 Timothy Sample <samplet@ngyro.com>
 ;;; Copyright © 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2021 Pierre Langlois <pierre.langlois@gmx.com>
+;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -61,10 +63,15 @@ (define private-keywords
                               `(("source" ,source))
                               '())
                         ,@inputs
-
                         ;; Keep the standard inputs of 'gnu-build-system'.
                         ,@(standard-packages)))
          (build-inputs `(("node" ,node)
+                         ;; Many packages with native addons need
+                         ;; libuv headers. The libuv version must
+                         ;; be exactly the same as for the node
+                         ;; package we are adding implicitly,
+                         ;; so we take care of adding libuv, too.
+                         ("libuv" ,@(assoc-ref (package-inputs node) "libuv"))
                          ,@native-inputs))
          (outputs outputs)
          (build node-build)
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 03/41] guix: node-build-system: Add JSON utilities.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
  2022-01-08  8:41           ` [bug#51838] [PATCH v9 01/41] guix: node-build-system: Add delete-lockfiles phase Philip McGrath
  2022-01-08  8:41           ` [bug#51838] [PATCH v9 02/41] guix: node-build-system: Add implicit libuv input Philip McGrath
@ 2022-01-08  8:41           ` Philip McGrath
  2022-01-08  8:41           ` [bug#51838] [PATCH v9 04/41] guix: node-build-system: Add avoid-node-gyp-rebuild phase Philip McGrath
                             ` (38 subsequent siblings)
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:41 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

This commit adds several utility functions for non-destructive
transformation of the JSON representation used by (guix build json),
particularly for purely functional update of JSON objects.  They ought
to eventually be exported from their own module, but for now are kept
private to allow experimentation.

* guix/build/node-build-system.scm (assoc-ref*, jsobject-ref, alist-pop)
(alist-update, jsobject-update*, jsobject-union): New variables.
(with-atomic-json-file-replacement): New public variable.
(module-name, build, patch-dependencies): Use them.  Do not resort to
unsafe alist primitives from Guile core.

Co-authored-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 guix/build/node-build-system.scm | 146 +++++++++++++++++++++++++------
 1 file changed, 117 insertions(+), 29 deletions(-)

diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
index 2d7a3bdc67..60c75dc85d 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2016, 2020 Jelle Licht <jlicht@fsfe.org>
 ;;; Copyright © 2019, 2021 Timothy Sample <samplet@ngyro.com>
 ;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
+;;; Copyright © 2021 Liliana Marie Prikler <liliana.prikler@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -26,14 +27,104 @@ (define-module (guix build node-build-system)
   #:use-module (ice-9 ftw)
   #:use-module (ice-9 match)
   #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-71)
   #:export (%standard-phases
+            with-atomic-json-file-replacement
             node-build))
 
-;; Commentary:
-;;
-;; Builder-side code of the standard Node/NPM package install procedure.
-;;
-;; Code:
+(define (with-atomic-json-file-replacement file proc)
+  "Like 'with-atomic-file-replacement', but PROC is called with a single
+argument---the result of parsing FILE's contents as json---and should a value
+to be written as json to the replacement FILE."
+  (with-atomic-file-replacement file
+    (lambda (in out)
+      (write-json (proc (read-json in)) out))))
+
+(define* (assoc-ref* alist key #:optional default)
+  "Like assoc-ref, but return DEFAULT instead of #f if no value exists."
+  (match (assoc key alist)
+    (#f default)
+    ((_ . value) value)))
+
+(define* (jsobject-ref obj key #:optional default)
+  (match obj
+    (('@ . alist) (assoc-ref* alist key default))))
+
+(define* (alist-pop alist key #:optional (= equal?))
+  "Return two values, the first pair in ALIST with key KEY, and the other
+elements.  Equality calls are made as (= KEY ALISTCAR)."
+  (define (found? pair)
+    (= key (car pair)))
+
+  (let ((before after (break found? alist)))
+    (if (pair? after)
+        (values (car after) (append before (cdr after)))
+        (values #f before))))
+
+(define* (alist-update alist key proc #:optional default (= equal?))
+  "Return an association list like ALIST, but with KEY mapped to the result of
+PROC applied to the first value found under the comparison (= KEY ALISTCAR).
+If no such value exists, use DEFAULT instead.
+Unlike acons, this removes the previous association of KEY (assuming it is
+unique), but the result may still share storage with ALIST."
+  (let ((pair rest (alist-pop alist key =)))
+    (acons key
+           (proc (if (pair? pair)
+                     (cdr pair)
+                     default))
+           rest)))
+
+(define (jsobject-update* js . updates)
+  "Return a json object like JS, but with all UPDATES applied.  Each update is
+a list (KEY PROC [DEFAULT]), so that KEY is mapped to the result of PROC
+applied to the value to which KEY is mapped in JS.  If no such mapping exists,
+PROC is instead applied to DEFAULT, or to '#f' is no DEFAULT is specified.
+The update takes place from left to right, so later UPDATERs will receive the
+values returned by earlier UPDATERs for the same KEY."
+  (match js
+    (('@ . alist)
+     (let loop ((alist alist)
+                (updates updates))
+       (match updates
+         (() (cons '@ alist))
+         (((key proc) . updates)
+          (loop (alist-update alist key proc #f equal?) updates))
+         (((key proc default) . updates)
+          (loop (alist-update alist key proc default equal?) updates)))))))
+
+(define (jsobject-union combine seed . objects)
+  "Merge OBJECTS into SEED by applying (COMBINE KEY VAL0 VAL), where VAL0
+is the value found in the (possibly updated) SEED and VAL is the new value
+found in one of the OBJECTS."
+  (match seed
+    (('@ . aseed)
+     (match objects
+       (() seed)
+       ((('@ . alists) ...)
+        (cons
+         '@
+         (fold (lambda (alist aseed)
+                 (if (null? aseed) alist
+                     (fold
+                      (match-lambda*
+                        (((k . v) aseed)
+                         (let ((pair tail (alist-pop alist k)))
+                           (match pair
+                             (#f (acons k v aseed))
+                             ((_ . v0) (acons k (combine k v0 v) aseed))))))
+                      aseed
+                      alist)))
+               aseed
+               alists)))))))
+
+;; Possibly useful helper functions:
+;; (define (newest key val0 val) val)
+;; (define (unkeyed->keyed proc) (lambda (_key val0 val) (proc val0 val)))
+
+\f
+;;;
+;;; Phases.
+;;;
 
 (define (set-home . _)
   (with-directory-excursion ".."
@@ -50,7 +141,7 @@ (define (set-home . _)
 (define (module-name module)
   (let* ((package.json (string-append module "/package.json"))
          (package-meta (call-with-input-file package.json read-json)))
-    (assoc-ref package-meta "name")))
+    (jsobject-ref package-meta "name")))
 
 (define (index-modules input-paths)
   (define (list-modules directory)
@@ -74,27 +165,26 @@ (define* (patch-dependencies #:key inputs #:allow-other-keys)
 
   (define index (index-modules (map cdr inputs)))
 
-  (define (resolve-dependencies package-meta meta-key)
-    (fold (lambda (key+value acc)
-            (match key+value
-              ('@ acc)
-              ((key . value) (acons key (hash-ref index key value) acc))))
-          '()
-          (or (assoc-ref package-meta meta-key) '())))
+  (define resolve-dependencies
+    (match-lambda
+      (('@ . alist)
+       (cons '@ (map (match-lambda
+                       ((key . value)
+                        (cons key (hash-ref index key value))))
+                     alist)))))
 
-  (with-atomic-file-replacement "package.json"
-    (lambda (in out)
-      (let ((package-meta (read-json in)))
-        (assoc-set! package-meta "dependencies"
-                    (append
-                     '(@)
-                     (resolve-dependencies package-meta "dependencies")
-                     (resolve-dependencies package-meta "peerDependencies")))
-        (assoc-set! package-meta "devDependencies"
-                    (append
-                     '(@)
-                     (resolve-dependencies package-meta "devDependencies")))
-        (write-json package-meta out))))
+  (with-atomic-json-file-replacement "package.json"
+    (lambda (pkg-meta)
+      (jsobject-update*
+       pkg-meta
+       `("devDependencies" ,resolve-dependencies (@))
+       `("dependencies" ,(lambda (deps)
+                           (resolve-dependencies
+                            (jsobject-union
+                             (lambda (k a b) b)
+                             (jsobject-ref pkg-meta "peerDependencies" '(@))
+                             deps)))
+         (@)))))
   #t)
 
 (define* (delete-lockfiles #:key inputs #:allow-other-keys)
@@ -115,9 +205,7 @@ (define* (configure #:key outputs inputs #:allow-other-keys)
 
 (define* (build #:key inputs #:allow-other-keys)
   (let ((package-meta (call-with-input-file "package.json" read-json)))
-    (if (and=> (assoc-ref package-meta "scripts")
-               (lambda (scripts)
-                 (assoc-ref scripts "build")))
+    (if (jsobject-ref (jsobject-ref package-meta "scripts" '(@)) "build" #f)
         (let ((npm (string-append (assoc-ref inputs "node") "/bin/npm")))
           (invoke npm "run" "build"))
         (format #t "there is no build script to run~%"))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 04/41] guix: node-build-system: Add avoid-node-gyp-rebuild phase.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
                             ` (2 preceding siblings ...)
  2022-01-08  8:41           ` [bug#51838] [PATCH v9 03/41] guix: node-build-system: Add JSON utilities Philip McGrath
@ 2022-01-08  8:41           ` Philip McGrath
  2022-01-08  8:41           ` [bug#51838] [PATCH v9 05/41] guix: node-build-system: Add 'delete-dependencies' helper function Philip McGrath
                             ` (37 subsequent siblings)
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:41 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

Packages with native addons currently try to write to store paths
when used as dependecies.  This patch adds a phase to replace that
behaviour with a no-op.

* guix/build/node-build-system.scm (avoid-node-gyp-rebuild): New
variable.
(%standard-phases): Add 'avoid-node-gyp-rebuild' after 'install'.
---
 guix/build/node-build-system.scm | 54 +++++++++++++++++++++++++++++++-
 1 file changed, 53 insertions(+), 1 deletion(-)

diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
index 60c75dc85d..ee3442e9e4 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -242,6 +242,57 @@ (define* (install #:key outputs inputs #:allow-other-keys)
             "install" "../package.tgz")
     #t))
 
+(define* (avoid-node-gyp-rebuild #:key outputs #:allow-other-keys)
+  "Adjust the installed 'package.json' to remove an 'install' script that
+would try to run 'node-gyp rebuild'."
+  ;; We want to take advantage of `npm install`'s automatic support for
+  ;; building native addons with node-gyp: in particular, it helps us avoid
+  ;; hard-coding the specifics of how npm's internal copy of node-gyp is
+  ;; currently packaged. However, the mechanism by which the automatic support
+  ;; is implemented causes problems for us.
+  ;;
+  ;; If a package contains a 'binding.gyp' file and does not define an
+  ;; 'install' or 'preinstall' script, 'npm install' runs a default install
+  ;; script consisting of 'node-gyp rebuild'. In our 'install' phase, this
+  ;; implicit 'install' script, if it is applicable, is explicitly added to
+  ;; the "package.json" file. However, if another Guix package were to use a
+  ;; Node.js package with such an 'install' script, the dependent package's
+  ;; build process would fail, because 'node-gyp rebuild' would try to write
+  ;; to the store.
+  ;;
+  ;; Here, if the installed "package.json" defines scripts.install as
+  ;; "node-gyp rebuild", we replace it with a no-op. Importantly, deleting the
+  ;; install script definition would not be enough, because the default
+  ;; install script would cause the same problem.
+  ;;
+  ;; 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 read-json))
+  (define scripts
+    (jsobject-ref pkg-meta "scripts" '(@)))
+  (define (jsobject-set js key val)
+    (jsobject-update* js (list key (const val))))
+
+  (when (equal? "node-gyp rebuild" (jsobject-ref scripts "install" #f))
+    (call-with-output-file installed-package.json
+      (lambda (out)
+        (write-json
+         (jsobject-set pkg-meta
+                       "scripts"
+                       (jsobject-set scripts
+                                     "install"
+                                     "echo Guix: avoiding node-gyp rebuild"))
+         out)))))
+
 (define %standard-phases
   (modify-phases gnu:%standard-phases
     (add-after 'unpack 'set-home set-home)
@@ -251,7 +302,8 @@ (define %standard-phases
     (replace 'build build)
     (replace 'check check)
     (add-before 'install 'repack repack)
-    (replace 'install install)))
+    (replace 'install install)
+    (add-after 'install 'avoid-node-gyp-rebuild avoid-node-gyp-rebuild)))
 
 (define* (node-build #:key inputs (phases %standard-phases)
                      #:allow-other-keys #:rest args)
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 05/41] guix: node-build-system: Add 'delete-dependencies' helper function.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
                             ` (3 preceding siblings ...)
  2022-01-08  8:41           ` [bug#51838] [PATCH v9 04/41] guix: node-build-system: Add avoid-node-gyp-rebuild phase Philip McGrath
@ 2022-01-08  8:41           ` Philip McGrath
  2022-01-08  8:41           ` [bug#51838] [PATCH v9 06/41] gnu: node-semver-bootstrap: Use 'delete-dependencies' Philip McGrath
                             ` (36 subsequent siblings)
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:41 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

Many node packages currently skip the configure phase, because they lack
both dependencies and a convenient way to build without all of them, e.g.
for the purposes of bootstrapping.  This patch adds a big hammer to flatten
these nails.

* guix/build/node-build-system.scm (delete-dependencies): New variable.

Co-authored-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
---
 guix/build/node-build-system.scm | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/guix/build/node-build-system.scm b/guix/build/node-build-system.scm
index ee3442e9e4..e37a0f7b44 100644
--- a/guix/build/node-build-system.scm
+++ b/guix/build/node-build-system.scm
@@ -2,7 +2,7 @@
 ;;; Copyright © 2015 David Thompson <davet@gnu.org>
 ;;; Copyright © 2016, 2020 Jelle Licht <jlicht@fsfe.org>
 ;;; Copyright © 2019, 2021 Timothy Sample <samplet@ngyro.com>
-;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
+;;; Copyright © 2021, 2022 Philip McGrath <philip@philipmcgrath.com>
 ;;; Copyright © 2021 Liliana Marie Prikler <liliana.prikler@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -25,11 +25,13 @@ (define-module (guix build node-build-system)
   #:use-module (guix build utils)
   #:use-module (guix build json)
   #:use-module (ice-9 ftw)
+  #:use-module (ice-9 regex)
   #:use-module (ice-9 match)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-71)
   #:export (%standard-phases
             with-atomic-json-file-replacement
+            delete-dependencies
             node-build))
 
 (define (with-atomic-json-file-replacement file proc)
@@ -187,6 +189,27 @@ (define resolve-dependencies
          (@)))))
   #t)
 
+(define (delete-dependencies absent)
+  "Rewrite 'package.json' to allow the build to proceed without packages
+listed in ABSENT, a list of strings naming npm packages.
+
+To prevent the deleted dependencies from being reintroduced, use this function
+only after the 'patch-dependencies' phase."
+  (define delete-from-jsobject
+    (match-lambda
+      (('@ . alist)
+       (cons '@ (filter (match-lambda
+                          ((k . _)
+                           (not (member k absent))))
+                        alist)))))
+
+  (with-atomic-json-file-replacement "package.json"
+    (lambda (pkg-meta)
+      (jsobject-update*
+       pkg-meta
+       `("devDependencies" ,delete-from-jsobject (@))
+       `("dependencies" ,delete-from-jsobject (@))))))
+
 (define* (delete-lockfiles #:key inputs #:allow-other-keys)
   "Delete 'package-lock.json', 'yarn.lock', and 'npm-shrinkwrap.json', if they
 exist."
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 06/41] gnu: node-semver-bootstrap: Use 'delete-dependencies'.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
                             ` (4 preceding siblings ...)
  2022-01-08  8:41           ` [bug#51838] [PATCH v9 05/41] guix: node-build-system: Add 'delete-dependencies' helper function Philip McGrath
@ 2022-01-08  8:41           ` Philip McGrath
  2022-01-08  8:41           ` [bug#51838] [PATCH v9 07/41] gnu: node-ms-bootstrap: " Philip McGrath
                             ` (35 subsequent siblings)
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:41 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

gnu/packages/node.scm (node-semver-bootstrap)[arguments]: Use
'delete-dependencies'.  Stop deleting the 'configure' phase.
---
 gnu/packages/node.scm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 51a393caab..fb21054fe7 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -10,7 +10,7 @@
 ;;; Copyright © 2020 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
 ;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
-;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
+;;; Copyright © 2021, 2022 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -346,7 +346,9 @@ (define-public node-semver-bootstrap
        #:tests? #f
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure))))
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies '("tap")))))))
     (home-page "https://github.com/npm/node-semver")
     (properties '((hidden? . #t)))
     (synopsis "Parses semantic versions strings")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 07/41] gnu: node-ms-bootstrap: Use 'delete-dependencies'.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
                             ` (5 preceding siblings ...)
  2022-01-08  8:41           ` [bug#51838] [PATCH v9 06/41] gnu: node-semver-bootstrap: Use 'delete-dependencies' Philip McGrath
@ 2022-01-08  8:41           ` Philip McGrath
  2022-01-08  8:41           ` [bug#51838] [PATCH v9 08/41] gnu: node-binary-search-bootstrap: " Philip McGrath
                             ` (34 subsequent siblings)
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:41 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

gnu/packages/node.scm (node-ms-bootstrap)[arguments]: Use
'delete-dependencies'.  Stop deleting the 'configure' phase.
---
 gnu/packages/node.scm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index fb21054fe7..495ae95dc3 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -377,7 +377,13 @@ (define-public node-ms-bootstrap
        #:tests? #f
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure))))
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies '("eslint"
+                                    "expect.js"
+                                    "husky"
+                                    "lint-staged"
+                                    "mocha")))))))
     (home-page "https://github.com/zeit/ms#readme")
     (properties '((hidden? . #t)))
     (synopsis "Tiny millisecond conversion utility")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 08/41] gnu: node-binary-search-bootstrap: Use 'delete-dependencies'.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
                             ` (6 preceding siblings ...)
  2022-01-08  8:41           ` [bug#51838] [PATCH v9 07/41] gnu: node-ms-bootstrap: " Philip McGrath
@ 2022-01-08  8:41           ` Philip McGrath
  2022-01-08  8:41           ` [bug#51838] [PATCH v9 09/41] gnu: node-debug-bootstrap: " Philip McGrath
                             ` (33 subsequent siblings)
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:41 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

gnu/packages/node.scm (node-binary-search-bootstrap)[arguments]: Use
'delete-dependencies'.  Stop deleting the 'configure' phase.
---
 gnu/packages/node.scm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 495ae95dc3..2594b6d518 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -411,7 +411,9 @@ (define-public node-binary-search-bootstrap
        #:tests? #f
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure))))
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies `("chai" "mocha")))))))
     (home-page "https://github.com/darkskyapp/binary-search#readme")
     (properties '((hidden? . #t)))
     (synopsis "Tiny binary search function with comparators")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 09/41] gnu: node-debug-bootstrap: Use 'delete-dependencies'.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
                             ` (7 preceding siblings ...)
  2022-01-08  8:41           ` [bug#51838] [PATCH v9 08/41] gnu: node-binary-search-bootstrap: " Philip McGrath
@ 2022-01-08  8:41           ` Philip McGrath
  2022-01-08  8:41           ` [bug#51838] [PATCH v9 10/41] gnu: node-llparse-builder-bootstrap: " Philip McGrath
                             ` (32 subsequent siblings)
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:41 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

gnu/packages/node.scm (node-debug-bootstrap)[arguments]: Use
'delete-dependencies'.  Stop deleting the 'configure' phase.
---
 gnu/packages/node.scm | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 2594b6d518..bb4f54809a 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -440,7 +440,19 @@ (define-public node-debug-bootstrap
        #:tests? #f
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure))))
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies `("brfs"
+                                    "browserify"
+                                    "coveralls"
+                                    "istanbul"
+                                    "karma"
+                                    "karma-browserify"
+                                    "karma-chrome-launcher"
+                                    "karma-mocha"
+                                    "mocha"
+                                    "mocha-lcov-reporter"
+                                    "xo")))))))
     (inputs (list node-ms-bootstrap))
     (home-page "https://github.com/visionmedia/debug#readme")
     (properties '((hidden? . #t)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 10/41] gnu: node-llparse-builder-bootstrap: Use 'delete-dependencies'.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
                             ` (8 preceding siblings ...)
  2022-01-08  8:41           ` [bug#51838] [PATCH v9 09/41] gnu: node-debug-bootstrap: " Philip McGrath
@ 2022-01-08  8:41           ` Philip McGrath
  2022-01-08  8:41           ` [bug#51838] [PATCH v9 11/41] gnu: node-llparse-frontend-bootstrap: " Philip McGrath
                             ` (31 subsequent siblings)
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:41 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

gnu/packages/node.scm (node-llparse-builder-bootstrap)[arguments]: Use
'delete-dependencies'.  Stop deleting the 'configure' phase.
---
 gnu/packages/node.scm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index bb4f54809a..cff2b39dd6 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -506,7 +506,14 @@ (define-public node-llparse-builder-bootstrap
        #:tests? #f
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure)
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda _
+             (delete-dependencies `("@types/mocha"
+                                    "@types/node"
+                                    "mocha"
+                                    "ts-node"
+                                    "tslint"
+                                    "typescript"))))
          (replace 'build
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((esbuild (search-input-file inputs "/bin/esbuild")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 11/41] gnu: node-llparse-frontend-bootstrap: Use 'delete-dependencies'.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
                             ` (9 preceding siblings ...)
  2022-01-08  8:41           ` [bug#51838] [PATCH v9 10/41] gnu: node-llparse-builder-bootstrap: " Philip McGrath
@ 2022-01-08  8:41           ` Philip McGrath
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 12/41] gnu: node-llparse-bootstrap: " Philip McGrath
                             ` (30 subsequent siblings)
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:41 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

gnu/packages/node.scm (node-llparse-frontend-bootstrap)[arguments]:  Use
'delete-dependencies'.  Stop deleting the 'configure' phase.
---
 gnu/packages/node.scm | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index cff2b39dd6..55bca7c006 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -567,7 +567,15 @@ (define-public node-llparse-frontend-bootstrap
        #:tests? #f
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure)
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies `("@types/debug"
+                                    "@types/mocha"
+                                    "@types/node"
+                                    "mocha"
+                                    "ts-node"
+                                    "tslint"
+                                    "typescript"))))
          (replace 'build
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((esbuild (search-input-file inputs "/bin/esbuild")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 12/41] gnu: node-llparse-bootstrap: Use 'delete-dependencies'.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
                             ` (10 preceding siblings ...)
  2022-01-08  8:41           ` [bug#51838] [PATCH v9 11/41] gnu: node-llparse-frontend-bootstrap: " Philip McGrath
@ 2022-01-08  8:42           ` Philip McGrath
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 13/41] gnu: node-semver: " Philip McGrath
                             ` (29 subsequent siblings)
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:42 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

gnu/packages/node.scm (node-llparse-bootstrap)[arguments]: Use
'delete-dependencies'.  Stop deleting the 'configure' phase.
---
 gnu/packages/node.scm | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 55bca7c006..5ec54b52eb 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -628,7 +628,17 @@ (define-public node-llparse-bootstrap
        #:tests? #f
        #:phases
        (modify-phases %standard-phases
-         (delete 'configure)
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies `("@types/debug"
+                                    "@types/mocha"
+                                    "@types/node"
+                                    "esm"
+                                    "llparse-test-fixture"
+                                    "mocha"
+                                    "ts-node"
+                                    "tslint"
+                                    "typescript"))))
          (replace 'build
            (lambda* (#:key inputs #:allow-other-keys)
              (let ((esbuild (search-input-file inputs "/bin/esbuild")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 13/41] gnu: node-semver: Use 'delete-dependencies'.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
                             ` (11 preceding siblings ...)
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 12/41] gnu: node-llparse-bootstrap: " Philip McGrath
@ 2022-01-08  8:42           ` Philip McGrath
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 14/41] gnu: node-wrappy: " Philip McGrath
                             ` (28 subsequent siblings)
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:42 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

gnu/packages/node-xyz.scm (node-semver)[arguments]: Use
'delete-dependencies'.  Stop deleting the 'configure' phase.
---
 gnu/packages/node-xyz.scm | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 9a0be96852..e99cd27a14 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -288,11 +288,13 @@ (define-public node-semver
                 "06biknqb05r9xsmcflm3ygh50pjvdk84x6r79w43kmck4fn3qn5p"))))
     (build-system node-build-system)
     (arguments
-     '(#:tests? #f ; FIXME: Tests depend on node-tap
-       #:phases
+     '(#:phases
        (modify-phases %standard-phases
-         ;; The only dependency to check for is tap, which we don't have.
-         (delete 'configure))))
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies '("tap")))))
+       ;; FIXME: Tests depend on node-tap
+       #:tests? #f))
     (home-page "https://github.com/npm/node-semver")
     (synopsis "Parses semantic versions strings")
     (description
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 14/41] gnu: node-wrappy: Use 'delete-dependencies'.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
                             ` (12 preceding siblings ...)
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 13/41] gnu: node-semver: " Philip McGrath
@ 2022-01-08  8:42           ` Philip McGrath
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 15/41] gnu: node-once: " Philip McGrath
                             ` (27 subsequent siblings)
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:42 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

gnu/packages/node-xyz.scm (node-wrappy)[arguments]: Use
'delete-dependencies'.  Stop deleting the 'configure' phase.
---
 gnu/packages/node-xyz.scm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index e99cd27a14..e1ffdf978c 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -320,8 +320,9 @@ (define-public node-wrappy
      '(#:tests? #f ; FIXME: Tests depend on node-tap
        #:phases
        (modify-phases %standard-phases
-         ;; The only dependency to check for is tap, which we don't have.
-         (delete 'configure))))
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies '("tap")))))))
     (home-page "https://github.com/npm/wrappy")
     (synopsis "Callback wrapping utility")
     (description "@code{wrappy} is a utility for Node.js to wrap callbacks.")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 15/41] gnu: node-once: Use 'delete-dependencies'.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
                             ` (13 preceding siblings ...)
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 14/41] gnu: node-wrappy: " Philip McGrath
@ 2022-01-08  8:42           ` Philip McGrath
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 16/41] gnu: node-irc-colors: " Philip McGrath
                             ` (26 subsequent siblings)
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:42 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

gnu/packages/node-xyz.scm (node-once)[arguments]: Use
'delete-dependencies'.  Stop deleting the 'configure' phase.
---
 gnu/packages/node-xyz.scm | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index e1ffdf978c..607877d677 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -343,13 +343,13 @@ (define-public node-once
                 "1z8dcbf28dqdcp4wb0c53wrs90a07nkrax2c9kk26dsk1dhrnxav"))))
     (build-system node-build-system)
     (arguments
-     '(#:tests? #f                      ; FIXME: tests depend on node-tap
-       #:phases
+     '(#:phases
        (modify-phases %standard-phases
-         ;; The default configure phase fails due to tap being missing, as we do
-         ;; not have tap packaged yet.  It is used only for tests.  This package
-         ;; still works as a dependency of node-glob and node-inflight.
-         (delete 'configure))))
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies '("tap")))))
+       ;; FIXME: Tests depend on node-tap
+       #:tests? #f))
     (inputs
      (list node-wrappy))
     (home-page "https://github.com/isaacs/once")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 16/41] gnu: node-irc-colors: Use 'delete-dependencies'.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
                             ` (14 preceding siblings ...)
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 15/41] gnu: node-once: " Philip McGrath
@ 2022-01-08  8:42           ` Philip McGrath
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 17/41] gnu: node-irc: " Philip McGrath
                             ` (25 subsequent siblings)
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:42 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

gnu/packages/node-xyz.scm (node-irc-colors)[arguments]: Use
'delete-dependencies'.  Stop deleting the 'configure' phase.
---
 gnu/packages/node-xyz.scm | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 607877d677..4da4166465 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -375,12 +375,12 @@ (define-public node-irc-colors
                 "0q3y34rbnlc55jcakmdxkicwazyvyph9r6gaf6hi8k7wj2nfwfli"))))
     (build-system node-build-system)
     (arguments
-     '(#:tests? #f                      ; FIXME: tests depend on node-istanbul
-       #:phases
+     '(#:phases
        (modify-phases %standard-phases
-         ;; The default configure phase fails due to various packages
-         ;; being missing, as we don't have them packaged yet.
-         (delete 'configure))))
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies `("istanbul" "vows")))))
+       #:tests? #f))
     (home-page "https://github.com/fent/irc-colors.js")
     (synopsis "Node.js module providing color and formatting for IRC")
     (description "@code{node-irc-colors} is a Node.js module that
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 17/41] gnu: node-irc: Use 'delete-dependencies'.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
                             ` (15 preceding siblings ...)
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 16/41] gnu: node-irc-colors: " Philip McGrath
@ 2022-01-08  8:42           ` Philip McGrath
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 18/41] gnu: Add node-inherits Philip McGrath
                             ` (24 subsequent siblings)
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:42 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

gnu/packages/node-xyz.scm (node-irc)[arguments]: Use
'delete-dependencies'.  Stop deleting the 'configure' phase.
---
 gnu/packages/node-xyz.scm | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 4da4166465..80495cacf4 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -404,12 +404,13 @@ (define-public node-irc
                 "1ln4qfx20jbwg4cp8lp0vf27m5281z2sz16d15xd6150n26cbi4x"))))
     (build-system node-build-system)
     (arguments
-     '(#:tests? #f                      ; FIXME: tests depend on node-faucet
-       #:phases
+     '(#:phases
        (modify-phases %standard-phases
-         ;; The default configure phase fails due to various packages
-         ;; being missing, as we don't have them packaged yet.
-         (delete 'configure))))
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies
+              `("ansi-color" "faucet" "jscs" "tape")))))
+       #:tests? #f))
     (inputs
      (list node-irc-colors))
     (home-page "https://github.com/martynsmith/node-irc")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 18/41] gnu: Add node-inherits.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
                             ` (16 preceding siblings ...)
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 17/41] gnu: node-irc: " Philip McGrath
@ 2022-01-08  8:42           ` Philip McGrath
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 19/41] gnu: Add node-safe-buffer Philip McGrath
                             ` (23 subsequent siblings)
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:42 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

* gnu/packages/node-xyz.scm (node-inherits): New variable.
---
 gnu/packages/node-xyz.scm | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 80495cacf4..e12849b0a6 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2020 Giacomo Leidi <goodoldpaul@autistici.org>
 ;;; Copyright © 2021 Noisytoot <noisytoot@disroot.org>
 ;;; Copyright © 2021 Charles <charles.b.jackson@protonmail.com>
+;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -360,6 +361,38 @@ (define-public node-once
 if desired.")
     (license license:isc)))
 
+(define-public node-inherits
+  (package
+    (name "node-inherits")
+    (version "2.0.4")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/isaacs/inherits")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0cpsr5yqwkxpbbbbl0rwk4mcby6zbx841k2zb4c3gb1579i5wq9p"))))
+    (build-system node-build-system)
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies '("tap")))))
+       ;; FIXME: Tests depend on node-tap
+       #:tests? #f))
+    (home-page
+     "https://github.com/isaacs/inherits")
+    (synopsis
+     "Browser-friendly inheritance Node.js")
+    (description
+     "Browser-friendly inheritance fully compatible with standard Node.js
+@code{inherits()}.")
+    (license license:isc)))
+
 (define-public node-irc-colors
   (package
     (name "node-irc-colors")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 19/41] gnu: Add node-safe-buffer.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
                             ` (17 preceding siblings ...)
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 18/41] gnu: Add node-inherits Philip McGrath
@ 2022-01-08  8:42           ` Philip McGrath
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 20/41] gnu: Add node-string-decoder Philip McGrath
                             ` (22 subsequent siblings)
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:42 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

* gnu/packages/node-xyz.scm (node-safe-buffer): New variable.
---
 gnu/packages/node-xyz.scm | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index e12849b0a6..9c524fec5e 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -393,6 +393,36 @@ (define-public node-inherits
 @code{inherits()}.")
     (license license:isc)))
 
+(define-public node-safe-buffer
+  (package
+    (name "node-safe-buffer")
+    (version "5.2.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/feross/safe-buffer")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0r26m0nl41h90ihnl2xf0cqs6z9z7jb87dl5j8yqb7887r9jlbpi"))))
+    (build-system node-build-system)
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies '("tape" "standard")))))
+       #:tests? #f))
+    (home-page
+     "https://github.com/feross/safe-buffer")
+    (synopsis "Safer Node.js Buffer API")
+    (description "A safe drop-in replacement the Node.js @code{Buffer} API
+that works in all versions of Node.js, using the built-in implementation when
+available.")
+    (license license:expat)))
+
 (define-public node-irc-colors
   (package
     (name "node-irc-colors")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 20/41] gnu: Add node-string-decoder.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
                             ` (18 preceding siblings ...)
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 19/41] gnu: Add node-safe-buffer Philip McGrath
@ 2022-01-08  8:42           ` Philip McGrath
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 21/41] gnu: Add node-readable-stream Philip McGrath
                             ` (21 subsequent siblings)
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:42 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

* gnu/packages/node-xyz.scm (node-string-decoder): New variable.
---
 gnu/packages/node-xyz.scm | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 9c524fec5e..8c5cd33c80 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -423,6 +423,41 @@ (define-public node-safe-buffer
 available.")
     (license license:expat)))
 
+(define-public node-string-decoder
+  (package
+    (name "node-string-decoder")
+    (version "1.3.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nodejs/string_decoder")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0xxvyya9fl9rlkqwmxzqzbz4rdr3jgw4vf37hff7cgscxkhg266k"))))
+    (build-system node-build-system)
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies
+              '("tap" "core-util-is" "babel-polyfill")))))
+       ;; FIXME: Tests depend on node-tap
+       #:tests? #f))
+    (inputs
+     (list node-safe-buffer node-inherits))
+    (home-page
+     "https://github.com/nodejs/string_decoder")
+    (synopsis
+     "Node.js core @code{string_decoder} for userland")
+    (description
+     "This package is a mirror of the @code{string_decoder} implementation in
+Node-core.")
+    (license license:expat)))
+
 (define-public node-irc-colors
   (package
     (name "node-irc-colors")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 21/41] gnu: Add node-readable-stream.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
                             ` (19 preceding siblings ...)
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 20/41] gnu: Add node-string-decoder Philip McGrath
@ 2022-01-08  8:42           ` Philip McGrath
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 22/41] gnu: Add node-nan Philip McGrath
                             ` (20 subsequent siblings)
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:42 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

* gnu/packages/node-xyz.scm (node-readable-stream): New variable.
---
 gnu/packages/node-xyz.scm | 55 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 8c5cd33c80..b08609e8b0 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -458,6 +458,61 @@ (define-public node-string-decoder
 Node-core.")
     (license license:expat)))
 
+(define-public node-readable-stream
+  (package
+    (name "node-readable-stream")
+    (version "3.6.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nodejs/readable-stream")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0ybl4cdgsm9c5jq3xq8s01201jk8w0yakh63hlclsfbcdfqhd9ri"))))
+    (build-system node-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies `("@babel/cli"
+                                    "@babel/core"
+                                    "@babel/polyfill"
+                                    "@babel/preset-env"
+                                    "airtap"
+                                    "assert"
+                                    "bl"
+                                    "deep-strict-equal"
+                                    "events.once"
+                                    "glob"
+                                    "gunzip-maybe"
+                                    "hyperquest"
+                                    "lolex"
+                                    "nyc"
+                                    "pump"
+                                    "rimraf"
+                                    "tap"
+                                    "tape"
+                                    "tar-fs"
+                                    "util-promisify")))))
+       #:tests? #f))
+    (inputs
+     (list node-util-deprecate node-string-decoder node-inherits))
+    (home-page
+     "https://github.com/nodejs/readable-stream")
+    (synopsis
+     "Node.js core streams for userland")
+    (description
+     "This package is a mirror of the streams implementations in Node.js.
+
+If you want to guarantee a stable streams base, regardless of what version of
+Node you (or the users of your libraries) are using, use
+@code{readable-stream} only and avoid the @code{stream} module in Node-core.")
+    (license license:expat)))
+
 (define-public node-irc-colors
   (package
     (name "node-irc-colors")
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 22/41] gnu: Add node-nan.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
                             ` (20 preceding siblings ...)
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 21/41] gnu: Add node-readable-stream Philip McGrath
@ 2022-01-08  8:42           ` Philip McGrath
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 23/41] gnu: Add node-openzwave-shared Philip McGrath
                             ` (19 subsequent siblings)
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:42 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

* gnu/packages/node-xyz.scm (node-nan): New variable.
---
 gnu/packages/node-xyz.scm | 43 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index b08609e8b0..0e05e938bf 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -571,3 +571,46 @@ (define-public node-irc
     (description "@code{node-irc} is an IRC client library for Node.js.
 It has functions for joining, parting, talking, and many other IRC commands.")
     (license license:gpl3+)))
+
+(define-public node-nan
+  (package
+    (name "node-nan")
+    (version "2.15.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nodejs/nan")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "18xslh9va5ld872scrp5y4251ax9s3c6qh0lnl1200lpzbsxy7yd"))))
+    (build-system node-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies
+              '("bindings"
+                "commander"
+                "glob"
+                "request"
+                "node-gyp" ;; would be needed for tests
+                "tap"
+                "xtend")))))
+       ;; tests need tap and other dependencies
+       #:tests? #f))
+    (inputs
+     (list node-readable-stream))
+    (home-page "https://github.com/nodejs/nan")
+    (synopsis "Native Abstractions for Node.js")
+    (description "Native Abstractions for Node.js (``NaN'') provides a header
+file filled with macro and utility goodness for making add-on development for
+Node.js easier across versions.  The goal of this project is to store all logic
+necessary to develop native Node.js addons without having to inspect
+@code{NODE_MODULE_VERSION} and get yourself into a macro-tangle.
+
+This project also contains some helper utilities that make addon development a
+bit more pleasant.")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 23/41] gnu: Add node-openzwave-shared.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
                             ` (21 preceding siblings ...)
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 22/41] gnu: Add node-nan Philip McGrath
@ 2022-01-08  8:42           ` Philip McGrath
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 24/41] gnu: Add node-addon-api Philip McGrath
                             ` (18 subsequent siblings)
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:42 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

* gnu/packages/zwave.scm (node-openzwave-shared): New variable.
---
 gnu/packages/zwave.scm | 64 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)

diff --git a/gnu/packages/zwave.scm b/gnu/packages/zwave.scm
index 4d8286e334..3e99bd7687 100644
--- a/gnu/packages/zwave.scm
+++ b/gnu/packages/zwave.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2019 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -21,11 +22,14 @@ (define-module (gnu packages zwave)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix git-download)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system node)
   #:use-module (gnu packages)
   #:use-module (gnu packages base)
+  #:use-module (gnu packages node-xyz)
   #:use-module (gnu packages libusb)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages perl)
+  #:use-module (gnu packages python)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages xml))
 
@@ -85,3 +89,63 @@ (define-public open-zwave
 and respond to devices on a Z-Wave network, without requiring in-depth
 knowledge of the Z-Wave protocol.")
     (license license:lgpl3+)))
+
+(define-public node-openzwave-shared
+  (package
+    (name "node-openzwave-shared")
+    (version "1.7.2")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/OpenZWave/node-openzwave-shared")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "1bqqy12dzqj05j9wsh50dmn84dddmhz0gjzvd3y20z4hpy1v8rsc"))))
+    (inputs
+     (list open-zwave node-nan))
+    (native-inputs
+     (list which python pkg-config))
+    (build-system node-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (replace 'build
+           ;; For some reason, `npm install` doesn't build
+           ;; the addon automatically, so we do it explicitly here.
+           ;; We go through `npx` so the npmrc file sets the
+           ;; configuration up properly.
+           (lambda* (#:key native-inputs inputs #:allow-other-keys)
+             (invoke (search-input-file (or native-inputs inputs) "/bin/npx")
+                     "--call"
+                     (string-append
+                      (search-input-file
+                       (or native-inputs inputs)
+                       "/lib/node_modules/npm/bin/node-gyp-bin/node-gyp")
+                      " rebuild")))))))
+    (home-page "https://github.com/OpenZWave/node-openzwave-shared")
+    (synopsis "Node.js bindings for OpenZWave")
+    (description
+     "With the @code{node-openzwave-shared} package, you can easily control
+and manage your Z-Wave devices (lights, dimmers, blinds, you name it) from
+within Node.js applications.  This library also supports secure
+devices (e.g. door locks) that require encryption.  All widely used Node.js
+versions are supported with the help of @code{node-nan}.
+
+This library is currently able to:
+@itemize @bullet
+@item
+scan a Z-Wave network and report on connected devices;
+@item
+write values to Z-Wave nodes;
+@item
+monitor the network for changes;
+@item
+heal nodes and/or the network; and
+@item
+perform management tasks: add or remove nodes, replace failed nodes,
+manage their group associations, etc.
+@end itemize")
+    (license license:isc)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 24/41] gnu: Add node-addon-api.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
                             ` (22 preceding siblings ...)
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 23/41] gnu: Add node-openzwave-shared Philip McGrath
@ 2022-01-08  8:42           ` Philip McGrath
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 25/41] gnu: Add node-sqlite3 Philip McGrath
                             ` (17 subsequent siblings)
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:42 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

* gnu/packages/node-xyz.scm (node-addon-api): New variable.
---
 gnu/packages/node-xyz.scm | 85 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 0e05e938bf..637f116c3d 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -22,6 +22,9 @@
 
 (define-module (gnu packages node-xyz)
   #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (gnu packages sqlite)
+  #:use-module (gnu packages python)
+  #:use-module (guix gexp)
   #:use-module (guix packages)
   #:use-module (guix git-download)
   #:use-module (guix build-system node))
@@ -614,3 +617,85 @@ (define-public node-nan
 This project also contains some helper utilities that make addon development a
 bit more pleasant.")
     (license license:expat)))
+
+(define-public node-addon-api
+  (package
+    (name "node-addon-api")
+    (version "4.2.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/nodejs/node-addon-api")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1bhvfi2m9nxfz418s619914vmidcnrzbjv6l9nid476c3zlpazch"))))
+    (inputs
+     (list python node-safe-buffer))
+    (build-system node-build-system)
+    (arguments
+     `(#:modules
+       ((guix build node-build-system)
+        (srfi srfi-1)
+        (ice-9 match)
+        (guix build utils))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies
+              `("benchmark"
+                "bindings"
+                "clang-format"
+                "eslint"
+                "eslint-config-semistandard"
+                "eslint-config-standard"
+                "eslint-plugin-import"
+                "eslint-plugin-node"
+                "eslint-plugin-promise"
+                "fs-extra"
+                "path"
+                "pre-commit"))))
+         (add-after 'unpack 'skip-js-tests
+           ;; We can't run the js-based tests,
+           ;; but we can still do the C++ parts
+           (lambda args
+             (define new-test-script
+               "echo stopping after pretest on Guix")
+             (with-atomic-json-file-replacement "package.json"
+               (match-lambda
+                 (('@ . pkg-meta-alist)
+                  (cons
+                   '@
+                   (map (match-lambda
+                          (("scripts" '@ . scripts-alist)
+                           `("scripts" @ ,@(map (match-lambda
+                                                  (("test" . _)
+                                                   (cons "test"
+                                                         new-test-script))
+                                                  (other
+                                                   other))
+                                                scripts-alist)))
+                          (other
+                           other))
+                        pkg-meta-alist))))))))))
+    (home-page "https://github.com/nodejs/node-addon-api")
+    (synopsis "Node.js API (Node-API) header-only C++ wrappers")
+    (description "This module contains header-only C++ wrapper classes which
+simplify the use of the C based Node-API provided by Node.js when using C++.
+It provides a C++ object model and exception handling semantics with low
+overhead.
+
+Node-API is an ABI stable C interface provided by Node.js for building native
+addons.  It is intended to insulate native addons from changes in the
+underlying JavaScript engine and allow modules compiled for one version to run
+on later versions of Node.js without recompilation.  The @code{node-addon-api}
+module, which is not part of Node.js, preserves the benefits of the Node-API
+as it consists only of inline code that depends only on the stable API
+provided by Node-API.
+
+It is important to remember that @emph{other} Node.js interfaces such as
+@code{libuv} (included in a project via @code{#include <uv.h>}) are not
+ABI-stable across Node.js major versions.")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 25/41] gnu: Add node-sqlite3.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
                             ` (23 preceding siblings ...)
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 24/41] gnu: Add node-addon-api Philip McGrath
@ 2022-01-08  8:42           ` Philip McGrath
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 26/41] gnu: Add node-file-uri-to-path Philip McGrath
                             ` (16 subsequent siblings)
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:42 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

* gnu/packages/node-xyz.scm (node-sqlite3): New variable.
---
 gnu/packages/node-xyz.scm | 130 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 130 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 637f116c3d..9682582eec 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -699,3 +699,133 @@ (define new-test-script
 @code{libuv} (included in a project via @code{#include <uv.h>}) are not
 ABI-stable across Node.js major versions.")
     (license license:expat)))
+
+(define-public node-sqlite3
+  (package
+    (name "node-sqlite3")
+    (version "5.0.2")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/mapbox/node-sqlite3")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0sbbzzli282nxyfha10zx0k5m8hdp0sf3ipl59khjb7wm449j86h"))
+       (snippet
+        (with-imported-modules '((guix build utils))
+          #~(begin
+              (use-modules (guix build utils))
+              ;; unbundle sqlite
+              (for-each delete-file-recursively
+                        (find-files "deps"
+                                    (lambda (pth stat)
+                                      (gzip-file? pth)))))))))
+    (inputs
+     (list node-addon-api python sqlite))
+    (build-system node-build-system)
+    (arguments
+     `(#:modules
+       ((guix build node-build-system)
+        (srfi srfi-1)
+        (ice-9 match)
+        (guix build utils))
+       #:tests? #f ; FIXME: tests depend on node-mocha
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies
+              `(;; Normally, this is "built" using @mapbox/node-pre-gyp,
+                ;; which publishes or downloads pre-built binaries or
+                ;; falls back to building from source.  Here, we patch out
+                ;; all of that and just build directly.  It might be
+                ;; better to patch a version of @mapbox/node-pre-gyp that
+                ;; always builds from source, as Debian does, but there
+                ;; are a number of dependencies that need to be packaged
+                ;; or removed.
+                "@mapbox/node-pre-gyp"
+                "node-pre-gyp" ;; deprecated name still used in some places
+                "aws-sdk"
+                "@mapbox/cloudfriend"
+                ;; Confusingly, this is only a dependency because of
+                ;; @mapbox/node-pre-gyp: with that removed,
+                ;; npm will use its own copy:
+                "node-gyp"
+                ;; These we'd like, we just don't have them yet:
+                "eslint"
+                "mocha"))))
+         (add-before 'configure 'npm-config-sqlite
+           ;; We need this step even if we do replace @mapbox/node-pre-gyp
+           ;; because the package expects to build its bundled sqlite
+           (lambda* (#:key inputs #:allow-other-keys)
+             (setenv "npm_config_sqlite" (assoc-ref inputs "sqlite"))))
+         (add-after 'install 'patch-binding-path
+           ;; We replace a file that dynamic searches for the addon using
+           ;; node-pre-gyp (which we don't have) with a version that
+           ;; simply uses the path to the addon we built directly.
+           ;; The exact path is supposed to depend on things like the
+           ;; architecture and napi_build_version, so, to avoid having
+           ;; hard-code the details accurately, we do this after the addon
+           ;; has been built so we can just find where it ended up.
+           (lambda* (#:key outputs #:allow-other-keys)
+             (with-directory-excursion
+                 (search-input-directory outputs
+                                         "lib/node_modules/sqlite3/lib")
+               (match (find-files "binding" "\\.node$")
+                 ((rel-path)
+                  (with-atomic-file-replacement "sqlite3-binding.js"
+                    (lambda (in out)
+                      (format out "var binding = require('./~a');\n" rel-path)
+                      (display "module.exports = exports = binding;\n"
+                               out))))))))
+         (add-after 'patch-dependencies 'avoid-node-pre-gyp
+           (lambda args
+             ;; We need to patch .npmignore before the 'repack phase
+             ;; so that the built addon is installed with in the package.
+             ;; (Upstream assumes node-pre-gyp will download a pre-built
+             ;; version when this package is installed.)
+             (substitute* ".npmignore"
+               (("lib/binding")
+                "#lib/binding # <- patched for Guix"))
+             (with-atomic-json-file-replacement "package.json"
+               (match-lambda
+                 (('@ . pkg-meta-alist)
+                  (match (assoc-ref pkg-meta-alist "binary")
+                    (('@ . binary-alist)
+                     ;; When it builds from source, node-pre-gyp supplies
+                     ;; module_name and module_path based on the entries under
+                     ;; "binary" from "package.json", so this package's
+                     ;; "binding.gyp" doesn't define them. Thus, we also need
+                     ;; to supply them. The GYP_DEFINES environment variable
+                     ;; turns out to be the easiest way to make sure they are
+                     ;; propagated from npm to node-gyp to gyp.
+                     (setenv "GYP_DEFINES"
+                             (string-append
+                              "module_name="
+                              (assoc-ref binary-alist "module_name")
+                              " "
+                              "module_path="
+                              (assoc-ref binary-alist "module_path")))))
+                  ;; We need to remove the install script from "package.json",
+                  ;; as it would try to use node-pre-gyp and would block the
+                  ;; automatic building performed by `npm install`.
+                  (cons '@ (map (match-lambda
+                                  (("scripts" @ . scripts-alist)
+                                   `("scripts" @ ,@(filter (match-lambda
+                                                             (("install" . _)
+                                                              #f)
+                                                             (_
+                                                              #t))
+                                                           scripts-alist)))
+                                  (other
+                                   other))
+                                pkg-meta-alist))))))))))
+    (home-page "https://github.com/mapbox/node-sqlite3")
+    (synopsis "Asynchronous, non-blocking SQLite3 bindings for Node.js")
+    (description
+     "The Node.js add-on @code{node-sqlite3} provides a set of a asynchronous,
+non-blocking bindings for SQLite3, written in modern C++ and tested for memory
+leaks.")
+     (license license:bsd-3)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 26/41] gnu: Add node-file-uri-to-path.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
                             ` (24 preceding siblings ...)
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 25/41] gnu: Add node-sqlite3 Philip McGrath
@ 2022-01-08  8:42           ` Philip McGrath
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 27/41] gnu: Add node-bindings Philip McGrath
                             ` (15 subsequent siblings)
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:42 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

* gnu/packages/node-xyz.scm (node-file-uri-to-path): New variable.
---
 gnu/packages/node-xyz.scm | 55 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 9682582eec..c35ae10990 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -24,6 +24,7 @@ (define-module (gnu packages node-xyz)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (gnu packages sqlite)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages web)
   #:use-module (guix gexp)
   #:use-module (guix packages)
   #:use-module (guix git-download)
@@ -829,3 +830,57 @@ (define-public node-sqlite3
 non-blocking bindings for SQLite3, written in modern C++ and tested for memory
 leaks.")
      (license license:bsd-3)))
+
+(define-public node-file-uri-to-path
+  (package
+    (name "node-file-uri-to-path")
+    (version "2.0.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/TooTallNate/file-uri-to-path")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "08l779az44czm12xdhgcrnzpqw34s59hbrlfphs7g9y2k26drqav"))))
+    (native-inputs
+     (list esbuild))
+    (build-system node-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies `("@types/mocha"
+                                    "@types/node"
+                                    "@typescript-eslint/eslint-plugin"
+                                    "@typescript-eslint/parser"
+                                    "cpy-cli"
+                                    "eslint"
+                                    "eslint-config-airbnb"
+                                    "eslint-config-prettier"
+                                    "eslint-import-resolver-typescript"
+                                    "eslint-plugin-import"
+                                    "eslint-plugin-jsx-a11y"
+                                    "eslint-plugin-react"
+                                    "mocha"
+                                    "rimraf"
+                                    "typescript"))))
+         (replace 'build
+           (lambda* (#:key inputs native-inputs #:allow-other-keys)
+             (copy-recursively "src" "dist")
+             (invoke (search-input-file (or native-inputs inputs)
+                                        "/bin/esbuild")
+                     "dist/index.ts"
+                     "--outfile=dist/src/index.js"
+                     "--format=cjs"
+                     "--sourcemap"
+                     "--platform=node"))))
+       #:tests? #f))
+    (home-page "https://github.com/TooTallNate/file-uri-to-path")
+    (synopsis "Convert a @code{file:} URI to a file path")
+    (description "This package provides a function to convert a @code{file:}
+URI to a file path.  It accepts a @code{file:} URI and returns a file path
+suitable for use with the @code{fs} module functions.")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 27/41] gnu: Add node-bindings.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
                             ` (25 preceding siblings ...)
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 26/41] gnu: Add node-file-uri-to-path Philip McGrath
@ 2022-01-08  8:42           ` Philip McGrath
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 28/41] gnu: Add node-segfault-handler Philip McGrath
                             ` (14 subsequent siblings)
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:42 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

* gnu/packages/node-xyz.scm (node-bindings): New variable.
---
 gnu/packages/node-xyz.scm | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index c35ae10990..70dc08debe 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -884,3 +884,29 @@ (define-public node-file-uri-to-path
 URI to a file path.  It accepts a @code{file:} URI and returns a file path
 suitable for use with the @code{fs} module functions.")
     (license license:expat)))
+
+(define-public node-bindings
+  (package
+    (name "node-bindings")
+    (version "1.5.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/TooTallNate/node-bindings")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "100gp6kpjvd4j1dqnp0sbjr1hqx5mz7r61q9qy527jyhk9mj47wk"))))
+    (inputs
+     (list node-file-uri-to-path))
+    (build-system node-build-system)
+    (arguments
+     ;; there are no tests
+     `(#:tests? #f))
+    (home-page "https://github.com/TooTallNate/node-bindings")
+    (synopsis "Help for loading your native module's @code{.node} file")
+    (description "This is a helper module for authors of Node.js native addon
+modules.  It is basically the ``swiss army knife'' of @code{require()}ing your
+native module's @code{.node} file.")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 28/41] gnu: Add node-segfault-handler.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
                             ` (26 preceding siblings ...)
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 27/41] gnu: Add node-bindings Philip McGrath
@ 2022-01-08  8:42           ` Philip McGrath
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 29/41] gnu: Add node-ms Philip McGrath
                             ` (13 subsequent siblings)
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:42 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

* gnu/packages/node-xyz.scm (node-segfault-handler): New variable.
---
 gnu/packages/node-xyz.scm | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 70dc08debe..6352f63688 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -910,3 +910,32 @@ (define-public node-bindings
 modules.  It is basically the ``swiss army knife'' of @code{require()}ing your
 native module's @code{.node} file.")
     (license license:expat)))
+
+(define-public node-segfault-handler
+  (package
+    (name "node-segfault-handler")
+    (version "1.3.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/ddopson/node-segfault-handler")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "07nbw35wvrr18kmh8f388v4k5mpjgyy0260bx0xzjdv795i3xvfv"))))
+    (native-inputs
+     (list python))
+    (inputs
+     (list node-bindings node-nan))
+    (build-system node-build-system)
+    (arguments
+     ;; there are no tests
+     `(#:tests? #f))
+    (home-page "https://github.com/ddopson/node-segfault-handler")
+    (synopsis "Catches @code{SIGSEGV} and prints diagnostic information")
+    (description "This package is a tool for debugging Node.js C/C++ native
+code modules and getting stack traces when things go wrong.  If a
+@code{SIGSEGV} signal is raised, the module will print a native stack trace to
+both @code{STDERR} and to a timestamped file.")
+    (license license:bsd-3)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 29/41] gnu: Add node-ms.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
                             ` (27 preceding siblings ...)
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 28/41] gnu: Add node-segfault-handler Philip McGrath
@ 2022-01-08  8:42           ` Philip McGrath
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 30/41] gnu: Add node-debug Philip McGrath
                             ` (12 subsequent siblings)
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:42 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

* gnu/packages/node-xyz.scm (node-ms): New variable.
---
 gnu/packages/node-xyz.scm | 46 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 6352f63688..6142254c35 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -939,3 +939,49 @@ (define-public node-segfault-handler
 @code{SIGSEGV} signal is raised, the module will print a native stack trace to
 both @code{STDERR} and to a timestamped file.")
     (license license:bsd-3)))
+
+(define-public node-ms
+  (package
+    (name "node-ms")
+    (version "2.1.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/vercel/ms")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1l74kmmwffmzdz38lli0v5mdb9p9jmsjxpb48ncknqw2n74cgf08"))))
+    (build-system node-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies `("eslint"
+                                    "expect.js"
+                                    "husky"
+                                    "lint-staged"
+                                    "mocha"
+                                    "prettier")))))
+       #:tests? #f))
+    (home-page "https://github.com/vercel/ms")
+    (synopsis "Tiny millisecond conversion utility")
+    (description "Use this package to easily convert various time formats to
+milliseconds.
+
+Features:
+@itemize @bullet
+@item
+Works both in Node.js and in the browser.
+@item
+If a number is supplied to @code{ms}, a string with a unit is returned.
+@item
+If a string that contains the number is supplied, it returns it as a
+number (e.g. it returns @code{100} for @code{'100'}).
+@item
+If you pass a string with a number and a valid unit, the number of
+equivalent milliseconds is returned.
+@end itemize")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 30/41] gnu: Add node-debug.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
                             ` (28 preceding siblings ...)
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 29/41] gnu: Add node-ms Philip McGrath
@ 2022-01-08  8:42           ` Philip McGrath
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 31/41] gnu: Add node-serialport-binding-abstract Philip McGrath
                             ` (11 subsequent siblings)
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:42 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

* gnu/packages/node-xyz.scm (node-debug): New variable.
---
 gnu/packages/node-xyz.scm | 45 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 6142254c35..3be2b93b31 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -985,3 +985,48 @@ (define-public node-ms
 equivalent milliseconds is returned.
 @end itemize")
     (license license:expat)))
+
+(define-public node-debug
+  (package
+    (name "node-debug")
+    (version "4.3.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/debug-js/debug")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0ji0dmdl2xkgxqxvd6xjy7k3mmknmhvqjgc40vyly9ka1mpf20vb"))))
+    (inputs
+     (list node-ms))
+    (build-system node-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies `("brfs"
+                                    "browserify"
+                                    "coveralls"
+                                    "istanbul"
+                                    "karma"
+                                    "karma-browserify"
+                                    "karma-chrome-launcher"
+                                    "karma-mocha"
+                                    "mocha"
+                                    "mocha-lcov-reporter"
+                                    "xo"
+                                    "supports-color")))))
+       #:tests? #f))
+    (home-page "https://github.com/debug-js/debug")
+    (synopsis "Lightweight debugging utility for Node.js and the browser")
+    (description "A tiny JavaScript debugging utility modelled after Node.js
+core's debugging technique.  orks in Node.js and web browsers.
+
+The @code{debug} module exposes a function; simply pass this function the name
+of your module, and it will return a decorated version of @code{console.error}
+for you to pass debug statements to.  This will allow you to toggle the debug
+output for different parts of your module as well as the module as a whole.")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 31/41] gnu: Add node-serialport-binding-abstract.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
                             ` (29 preceding siblings ...)
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 30/41] gnu: Add node-debug Philip McGrath
@ 2022-01-08  8:42           ` Philip McGrath
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 32/41] gnu: Add node-serialport-parser-delimiter Philip McGrath
                             ` (10 subsequent siblings)
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:42 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

* gnu/packages/node-xyz.scm (node-serialport-binding-abstract): New
variable.
---
 gnu/packages/node-xyz.scm | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 3be2b93b31..4c79716d08 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1030,3 +1030,37 @@ (define-public node-debug
 for you to pass debug statements to.  This will allow you to toggle the debug
 output for different parts of your module as well as the module as a whole.")
     (license license:expat)))
+
+(define-public node-serialport-binding-abstract
+  (package
+    (name "node-serialport-binding-abstract")
+    (version "9.2.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/serialport/node-serialport")
+             (commit "v9.2.7")))
+       (file-name (git-file-name "serialport-monorepo" version))
+       (sha256
+        (base32 "0x7zm59a5ff5yygjyw15xs3r5m3rb8av1yfrh4snn44mrwq87yg8"))))
+    (inputs
+     (list node-debug))
+    (build-system node-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/binding-abstract"))))
+       #:tests? #f))
+    (home-page "https://serialport.io")
+    (synopsis "Abstract base class for Node SerialPort bindings")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+This package provides the @code{AbstractBinding} class, the base for all Node
+SerialPort bindings.  You wouldn't use this class directly, but instead extend
+it to make a new binding for a different platform or underling technology.")
+    (license license:expat)))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 32/41] gnu: Add node-serialport-parser-delimiter.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
                             ` (30 preceding siblings ...)
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 31/41] gnu: Add node-serialport-binding-abstract Philip McGrath
@ 2022-01-08  8:42           ` Philip McGrath
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 33/41] gnu: Add node-serialport-parser-readline Philip McGrath
                             ` (9 subsequent siblings)
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:42 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

* gnu/packages/node-xyz.scm (node-serialport-parser-delimiter): New
variable.
---
 gnu/packages/node-xyz.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 4c79716d08..d35e4c6ba6 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1064,3 +1064,25 @@ (define-public node-serialport-binding-abstract
 SerialPort bindings.  You wouldn't use this class directly, but instead extend
 it to make a new binding for a different platform or underling technology.")
     (license license:expat)))
+
+(define-public node-serialport-parser-delimiter
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-delimiter")
+    (version "9.2.4")
+    (inputs `())
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-delimiter"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser to split data on a delimiter")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{Delimiter}, a parser that emits data
+each time a specified byte sequence is received.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 33/41] gnu: Add node-serialport-parser-readline.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
                             ` (31 preceding siblings ...)
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 32/41] gnu: Add node-serialport-parser-delimiter Philip McGrath
@ 2022-01-08  8:42           ` Philip McGrath
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 34/41] gnu: Add node-serialport-bindings Philip McGrath
                             ` (8 subsequent siblings)
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:42 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

* gnu/packages/node-xyz.scm (node-serialport-parser-readline): New
variable.
---
 gnu/packages/node-xyz.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index d35e4c6ba6..8e70afb71c 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1086,3 +1086,26 @@ (define-public node-serialport-parser-delimiter
 Parsers are used to take raw binary data and transform them into usable
 messages.  This package provides @code{Delimiter}, a parser that emits data
 each time a specified byte sequence is received.")))
+
+(define-public node-serialport-parser-readline
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-readline")
+    (version "9.2.4")
+    (inputs
+     (list node-serialport-parser-delimiter))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-readline"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser to split data on newlines")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{Readline}, a parser that emits data
+after a (configurable) newline delimiter is received.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 34/41] gnu: Add node-serialport-bindings.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
                             ` (32 preceding siblings ...)
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 33/41] gnu: Add node-serialport-parser-readline Philip McGrath
@ 2022-01-08  8:42           ` Philip McGrath
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 35/41] gnu: Add node-serialport-parser-regex Philip McGrath
                             ` (7 subsequent siblings)
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:42 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

* gnu/packages/node-xyz.scm (node-serialport-bindings): New variable.
---
 gnu/packages/node-xyz.scm | 54 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 8e70afb71c..305fdda69c 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1109,3 +1109,57 @@ (define-public node-serialport-parser-readline
 Parsers are used to take raw binary data and transform them into usable
 messages.  This package provides @code{Readline}, a parser that emits data
 after a (configurable) newline delimiter is received.")))
+
+(define-public node-serialport-bindings
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-bindings")
+    (version "9.2.7")
+    (native-inputs
+     (list python))
+    (inputs
+     (list node-nan node-bindings node-serialport-binding-abstract
+           node-serialport-parser-readline node-debug))
+    (arguments
+     `(#:modules
+       ((guix build node-build-system)
+        (srfi srfi-1)
+        (ice-9 match)
+        (guix build utils))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/bindings")))
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies `("prebuild-install"
+                                    ;; devDependencies
+                                    "@serialport/binding-mock"
+                                    "node-abi"))))
+         (add-after 'chdir 'avoid-prebuild-install
+           (lambda args
+             (with-atomic-json-file-replacement "package.json"
+               (match-lambda
+                 (('@ . pkg-meta-alist)
+                  (cons '@ (map (match-lambda
+                                  (("scripts" @ . scripts-alist)
+                                   `("scripts" @ ,@(filter (match-lambda
+                                                             (("install" . _)
+                                                              #f)
+                                                             (_
+                                                              #t))
+                                                           scripts-alist)))
+                                  (other
+                                   other))
+                                pkg-meta-alist))))))))
+       #:tests? #f))
+    (synopsis "Abstract base class for Node SerialPort bindings")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+This package provides the @code{Binding} class, which uses a native addon to
+talk to the underlying system.  You never have to use @code{Binding} objects
+directly.  There is also a @code{MockBinding} available (but not yet packaged
+for Guix) to assist with testing.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 35/41] gnu: Add node-serialport-parser-regex.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
                             ` (33 preceding siblings ...)
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 34/41] gnu: Add node-serialport-bindings Philip McGrath
@ 2022-01-08  8:42           ` Philip McGrath
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 36/41] gnu: Add node-serialport-parser-ready Philip McGrath
                             ` (6 subsequent siblings)
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:42 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

* gnu/packages/node-xyz.scm (node-serialport-parser-regex): New variable.
---
 gnu/packages/node-xyz.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 305fdda69c..783befa3fe 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1163,3 +1163,25 @@ (define-public node-serialport-bindings
 talk to the underlying system.  You never have to use @code{Binding} objects
 directly.  There is also a @code{MockBinding} available (but not yet packaged
 for Guix) to assist with testing.")))
+
+(define-public node-serialport-parser-regex
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-regex")
+    (version "9.2.4")
+    (inputs `())
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-regex"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser to split data on a regular expression")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{Regex}, a parser that uses a regular
+expression to split the incoming text.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 36/41] gnu: Add node-serialport-parser-ready.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
                             ` (34 preceding siblings ...)
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 35/41] gnu: Add node-serialport-parser-regex Philip McGrath
@ 2022-01-08  8:42           ` Philip McGrath
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 37/41] gnu: Add node-serialport-parser-inter-byte-timeout Philip McGrath
                             ` (5 subsequent siblings)
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:42 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

* gnu/packages/node-xyz.scm (node-serialport-parser-ready): New variable.
---
 gnu/packages/node-xyz.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 783befa3fe..3d172e13b8 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1185,3 +1185,26 @@ (define-public node-serialport-parser-regex
 Parsers are used to take raw binary data and transform them into usable
 messages.  This package provides @code{Regex}, a parser that uses a regular
 expression to split the incoming text.")))
+
+(define-public node-serialport-parser-ready
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-ready")
+    (version "9.2.4")
+    (inputs `())
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-ready"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser to wait for specified byte sequence")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{Ready}, a parser that waits for a
+specified sequence of ``ready'' bytes before emitting a ready event and
+emitting data events.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 37/41] gnu: Add node-serialport-parser-inter-byte-timeout.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
                             ` (35 preceding siblings ...)
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 36/41] gnu: Add node-serialport-parser-ready Philip McGrath
@ 2022-01-08  8:42           ` Philip McGrath
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 38/41] gnu: Add node-serialport-parser-cctalk Philip McGrath
                             ` (4 subsequent siblings)
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:42 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

* gnu/packages/node-xyz.scm
(node-serialport-parser-inter-byte-timeout): New variable.
---
 gnu/packages/node-xyz.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 3d172e13b8..4384cd7326 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1208,3 +1208,25 @@ (define-public node-serialport-parser-ready
 messages.  This package provides @code{Ready}, a parser that waits for a
 specified sequence of ``ready'' bytes before emitting a ready event and
 emitting data events.")))
+
+(define-public node-serialport-parser-inter-byte-timeout
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-inter-byte-timeout")
+    (version "9.2.4")
+    (inputs `())
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-inter-byte-timeout"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser to detect pauses in data")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{InterByteTimeout}, a parser that emits
+data if there is a pause between packets for the specified amount of time.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 38/41] gnu: Add node-serialport-parser-cctalk.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
                             ` (36 preceding siblings ...)
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 37/41] gnu: Add node-serialport-parser-inter-byte-timeout Philip McGrath
@ 2022-01-08  8:42           ` Philip McGrath
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 39/41] gnu: Add node-serialport-parser-byte-length Philip McGrath
                             ` (3 subsequent siblings)
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:42 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

* gnu/packages/node-xyz.scm (node-serialport-parser-cctalk): New variable.
---
 gnu/packages/node-xyz.scm | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 4384cd7326..c34e86e393 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1230,3 +1230,26 @@ (define-public node-serialport-parser-inter-byte-timeout
 Parsers are used to take raw binary data and transform them into usable
 messages.  This package provides @code{InterByteTimeout}, a parser that emits
 data if there is a pause between packets for the specified amount of time.")))
+
+(define-public node-serialport-parser-cctalk
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-cctalk")
+    (version "9.2.4")
+    (inputs `())
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-cctalk"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser for the ccTalk protocol")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{CCTalk}, which emits packets for the
+ccTalk protocol (an open standard for currency detectors) as they are
+received.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 39/41] gnu: Add node-serialport-parser-byte-length.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
                             ` (37 preceding siblings ...)
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 38/41] gnu: Add node-serialport-parser-cctalk Philip McGrath
@ 2022-01-08  8:42           ` Philip McGrath
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 40/41] gnu: Add node-serialport-stream Philip McGrath
                             ` (2 subsequent siblings)
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:42 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

* gnu/packages/node-xyz.scm (node-serialport-parser-byte-length): New
variable.
---
 gnu/packages/node-xyz.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index c34e86e393..e38e2031e0 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1253,3 +1253,25 @@ (define-public node-serialport-parser-cctalk
 messages.  This package provides @code{CCTalk}, which emits packets for the
 ccTalk protocol (an open standard for currency detectors) as they are
 received.")))
+
+(define-public node-serialport-parser-byte-length
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-parser-byte-length")
+    (version "9.2.4")
+    (inputs `())
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/parser-byte-length"))))
+       #:tests? #f))
+    (synopsis "Node SerialPort parser for fixed-length buffers")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+Parsers are used to take raw binary data and transform them into usable
+messages.  This package provides @code{ByteLength}, a parser that emits data
+as a buffer every time a specified number of bytes are received.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 40/41] gnu: Add node-serialport-stream.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
                             ` (38 preceding siblings ...)
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 39/41] gnu: Add node-serialport-parser-byte-length Philip McGrath
@ 2022-01-08  8:42           ` Philip McGrath
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 41/41] gnu: Add node-serialport Philip McGrath
  2022-01-08 11:19           ` [bug#51838] [PATCH v9 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Liliana Marie Prikler
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:42 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

* gnu/packages/node-xyz.scm (node-serialport-stream): New variable.
---
 gnu/packages/node-xyz.scm | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index e38e2031e0..9b6457dee5 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1275,3 +1275,31 @@ (define-public node-serialport-parser-byte-length
 Parsers are used to take raw binary data and transform them into usable
 messages.  This package provides @code{ByteLength}, a parser that emits data
 as a buffer every time a specified number of bytes are received.")))
+
+(define-public node-serialport-stream
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport-stream")
+    (version "9.2.4")
+    (inputs
+     (list node-debug))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies `(;; devDependencies
+                                    "@serialport/binding-mock"))))
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/stream"))))
+       #:tests? #f))
+    (synopsis "Node.js stream interface for Node SerialPort")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  The Guix package @code{node-serialport} provides the
+recommended high-level interface.
+
+This package provides an interface for using Node SerialPort bindings via the
+Node.js Stream API.  The stream is a duplex stream, allowing for reading and
+writing.  It has additional methods for managing the SerialPort
+connection.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 41/41] gnu: Add node-serialport.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
                             ` (39 preceding siblings ...)
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 40/41] gnu: Add node-serialport-stream Philip McGrath
@ 2022-01-08  8:42           ` Philip McGrath
  2022-01-08 11:19           ` [bug#51838] [PATCH v9 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Liliana Marie Prikler
  41 siblings, 0 replies; 458+ messages in thread
From: Philip McGrath @ 2022-01-08  8:42 UTC (permalink / raw)
  To: 51838
  Cc: Timothy Sample, Philip McGrath, Pierre Langlois,
	Liliana Marie Prikler, Leo Famulari, Jelle Licht

* gnu/packages/node-xyz.scm (node-serialport): New variable.
---
 gnu/packages/node-xyz.scm | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
index 9b6457dee5..837856be9d 100644
--- a/gnu/packages/node-xyz.scm
+++ b/gnu/packages/node-xyz.scm
@@ -1303,3 +1303,36 @@ (define-public node-serialport-stream
 Node.js Stream API.  The stream is a duplex stream, allowing for reading and
 writing.  It has additional methods for managing the SerialPort
 connection.")))
+
+(define-public node-serialport
+  (package
+    (inherit node-serialport-binding-abstract)
+    (name "node-serialport")
+    (version "9.2.7")
+    (inputs
+     (list node-serialport-bindings
+           node-serialport-parser-delimiter
+           node-serialport-parser-readline
+           node-serialport-parser-regex
+           node-serialport-parser-ready
+           node-serialport-parser-inter-byte-timeout
+           node-serialport-parser-cctalk
+           node-serialport-parser-byte-length
+           node-serialport-stream
+           node-debug))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'patch-dependencies 'delete-dependencies
+           (lambda args
+             (delete-dependencies `("@serialport/binding-mock"))
+             ))
+         (add-after 'unpack 'chdir
+           (lambda args
+             (chdir "packages/serialport"))))
+       #:tests? #f))
+    (synopsis "Node.js package to access serial ports")
+    (description "Node SerialPort is a modular suite of Node.js packages for
+accessing serial ports.  This package is the recommended entry point for most
+projects.  It combines a high-level Node.js stream interface with a useful
+default set of parsers and bindings.")))
-- 
2.32.0





^ permalink raw reply related	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 00/41] guix: node-build-system: Support compiling add-ons with node-gyp.
  2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
                             ` (40 preceding siblings ...)
  2022-01-08  8:42           ` [bug#51838] [PATCH v9 41/41] gnu: Add node-serialport Philip McGrath
@ 2022-01-08 11:19           ` Liliana Marie Prikler
  2022-01-08 15:33             ` Philip McGrath
  41 siblings, 1 reply; 458+ messages in thread
From: Liliana Marie Prikler @ 2022-01-08 11:19 UTC (permalink / raw)
  To: Philip McGrath, 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

Am Samstag, dem 08.01.2022 um 03:41 -0500 schrieb Philip McGrath:
> Ninth time's the charm? I hope so!
> 
> The only changes from v8 are:
> 
>   - In 03/41, I revised the docstring for 'jsonobject-update*' as
> discussed
>     in <https://issues.guix.gnu.org/51838#411>;
Misspelled UPDATES as UPDATERs, but otherwise fine.

>   - In 05/41, I changed 'delete-dependencies' to accept strings,
> rather than
>     regexps, and not to delete "peerDependencies", as discussed in
>     <https://issues.guix.gnu.org/51838#410>;
> 
>   - In 06/41 through 41/41, I changed the arguments to 'delete-
> dependencies' accordingly, where applicable.
Fair enough, I can live without regexps for now.

> Liliana, I removed your "Signed-off-by" so as not to imply that you'd
> seen these changes. I also added you as a co-author to 05/41, which
> seemed appropriate. Of course, feel free to adjust as you like.
As far as I can see 05/41 carries none of my intellectual property. 
All I did was adjust it to my changes in 03.

I'll look over the changes more closely later and apply them once I've
confirmed that that's everything.

Cheers




^ permalink raw reply	[flat|nested] 458+ messages in thread

* [bug#51838] [PATCH v9 00/41] guix: node-build-system: Support compiling add-ons with node-gyp.
  2022-01-08 11:19           ` [bug#51838] [PATCH v9 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Liliana Marie Prikler
@ 2022-01-08 15:33             ` Philip McGrath
  2022-01-09  1:19               ` bug#51838: " Liliana Marie Prikler
  0 siblings, 1 reply; 458+ messages in thread
From: Philip McGrath @ 2022-01-08 15:33 UTC (permalink / raw)
  To: Liliana Marie Prikler, 51838
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

Hi,

On 1/8/22 06:19, Liliana Marie Prikler wrote:
> Am Samstag, dem 08.01.2022 um 03:41 -0500 schrieb Philip McGrath:
>> Liliana, I removed your "Signed-off-by" so as not to imply that you'd
>> seen these changes. I also added you as a co-author to 05/41, which
>> seemed appropriate. Of course, feel free to adjust as you like.
> As far as I can see 05/41 carries none of my intellectual property.
> All I did was adjust it to my changes in 03.

My intention was to acknowledge that the basic approach of 
'delete-dependencies' was your idea. But, again, whatever you like!

-Philip




^ permalink raw reply	[flat|nested] 458+ messages in thread

* bug#51838: [PATCH v9 00/41] guix: node-build-system: Support compiling add-ons with node-gyp.
  2022-01-08 15:33             ` Philip McGrath
@ 2022-01-09  1:19               ` Liliana Marie Prikler
  0 siblings, 0 replies; 458+ messages in thread
From: Liliana Marie Prikler @ 2022-01-09  1:19 UTC (permalink / raw)
  To: Philip McGrath, 51838-done
  Cc: Timothy Sample, Pierre Langlois, Jelle Licht, Leo Famulari

Am Samstag, dem 08.01.2022 um 10:33 -0500 schrieb Philip McGrath:
> My intention was to acknowledge that the basic approach of 
> 'delete-dependencies' was your idea. But, again, whatever you like!
That hardly counts as intellectual property in my opinion, it's not
like I revolutionized anything in the scope of Guix.

The new node-build-system is live now, so you can rewrite JSON and
delete dependencies as much as you want on master.  Please allow for
other users to actually make use of it before writing up your next
proposal.  We'll only be able to see our shortcomings by having a large
number of people try it in the real world.

Thanks and good night :)




^ permalink raw reply	[flat|nested] 458+ messages in thread

end of thread, other threads:[~2022-01-09  1:21 UTC | newest]

Thread overview: 458+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-14 12:41 [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
2021-11-14 12:58 ` [bug#51838] [PATCH 01/11] gnu: node: Avoid duplicating build phases Philip McGrath
2021-11-14 13:04   ` [bug#51838] [PATCH 02/11] gnu: node: Update to 10.24.1 for bootstrapping Philip McGrath
2021-11-14 13:04     ` [bug#51838] [PATCH 03/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
2021-11-14 20:44       ` Liliana Marie Prikler
2021-11-20  4:26         ` Philip McGrath
2021-11-20  4:33           ` [bug#51838] [PATCH v2 01/26] gnu: node: Avoid duplicating build phases Philip McGrath
2021-11-20  4:33             ` [bug#51838] [PATCH v2 02/26] gnu: node: Update to 10.24.1 for bootstrapping Philip McGrath
2021-11-20  4:33             ` [bug#51838] [PATCH v2 03/26] gnu: node: Patch shebangs in node_modules Philip McGrath
2021-11-20  4:33             ` [bug#51838] [PATCH v2 04/26] gnu: node: Add an npmrc file to set nodedir Philip McGrath
2021-11-20  4:33             ` [bug#51838] [PATCH v2 05/26] guix: node-build-system: Add #:absent-dependencies argument Philip McGrath
2021-11-20  7:41               ` Liliana Marie Prikler
2021-11-20 17:04                 ` Philip McGrath
2021-11-20 20:24                   ` Liliana Marie Prikler
2021-11-28 19:27               ` [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Timothy Sample
2021-12-02 21:50                 ` Philip McGrath
2021-11-20  4:33             ` [bug#51838] [PATCH v2 06/26] gnu: node-semver-bootstrap: Use #:absent-dependencies Philip McGrath
2021-11-20  7:43               ` Liliana Marie Prikler
2021-11-20  4:33             ` [bug#51838] [PATCH v2 07/26] gnu: node-ms-bootstrap: " Philip McGrath
2021-11-20  4:33             ` [bug#51838] [PATCH v2 08/26] gnu: node-binary-search-bootstrap: " Philip McGrath
2021-11-20  4:33             ` [bug#51838] [PATCH v2 09/26] gnu: node-debug-bootstrap: " Philip McGrath
2021-11-20  4:33             ` [bug#51838] [PATCH v2 10/26] gnu: node-llparse-builder-bootstrap: " Philip McGrath
2021-11-20  7:44               ` Liliana Marie Prikler
2021-11-20 17:09                 ` Philip McGrath
2021-11-23 11:04               ` Jelle Licht
2021-11-28 19:35                 ` [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Timothy Sample
2021-12-02 21:18                   ` Philip McGrath
2021-12-03  5:17                     ` Liliana Marie Prikler
2021-12-08 20:27                       ` [bug#51838] [PATCH v3 00/43] " Philip McGrath
2021-12-08 20:27                         ` [bug#51838] [PATCH v3 01/43] gnu: node: Avoid duplicating build phases Philip McGrath
2021-12-08 20:27                         ` [bug#51838] [PATCH v3 02/43] gnu: node: Update to 10.24.1 for bootstrapping Philip McGrath
2021-12-08 20:27                         ` [bug#51838] [PATCH v3 03/43] gnu: node: Patch shebangs in node_modules Philip McGrath
2021-12-08 20:27                         ` [bug#51838] [PATCH v3 04/43] gnu: node: Add an npmrc file to set nodedir Philip McGrath
2021-12-12 15:19                           ` Pierre Langlois
2021-12-12 20:19                             ` Philip McGrath
2021-12-13  6:00                               ` [bug#51838] [PATCH v4 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 01/45] gnu: node: Avoid duplicating build phases Philip McGrath
2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 02/45] gnu: node: Update to 10.24.1 for bootstrapping Philip McGrath
2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 03/45] gnu: node: Patch shebangs in node_modules Philip McGrath
2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 04/45] gnu: node: Add an npmrc file to set nodedir Philip McGrath
2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 05/45] guix: node-build-system: Add delete-lockfiles phase Philip McGrath
2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 06/45] guix: node-build-system: Refactor patch-dependencies phase Philip McGrath
2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 07/45] guix: node-build-system: Add #:absent-dependencies argument Philip McGrath
2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 08/45] gnu: node-semver-bootstrap: Use #:absent-dependencies Philip McGrath
2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 09/45] gnu: node-ms-bootstrap: " Philip McGrath
2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 10/45] gnu: node-binary-search-bootstrap: " Philip McGrath
2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 11/45] gnu: node-debug-bootstrap: " Philip McGrath
2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 12/45] gnu: node-llparse-builder-bootstrap: " Philip McGrath
2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 13/45] gnu: node-llparse-frontend-bootstrap: " Philip McGrath
2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 14/45] gnu: node-llparse-bootstrap: " Philip McGrath
2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 15/45] gnu: node-semver: " Philip McGrath
2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 16/45] gnu: node-wrappy: " Philip McGrath
2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 17/45] gnu: node-once: " Philip McGrath
2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 18/45] gnu: node-irc-colors: " Philip McGrath
2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 19/45] gnu: node-irc: " Philip McGrath
2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 20/45] guix: node-build-system: Add implicit libuv input Philip McGrath
2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 21/45] guix: node-build-system: Add avoid-node-gyp-rebuild phase Philip McGrath
2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 22/45] gnu: Add node-inherits Philip McGrath
2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 23/45] gnu: Add node-safe-buffer Philip McGrath
2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 24/45] gnu: Add node-string-decoder Philip McGrath
2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 25/45] gnu: Add node-readable-stream Philip McGrath
2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 26/45] gnu: Add node-nan Philip McGrath
2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 27/45] gnu: Add node-openzwave-shared Philip McGrath
2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 28/45] gnu: Add node-addon-api Philip McGrath
2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 29/45] gnu: Add node-sqlite3 Philip McGrath
2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 30/45] gnu: Add node-file-uri-to-path Philip McGrath
2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 31/45] gnu: Add node-bindings Philip McGrath
2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 32/45] gnu: Add node-segfault-handler Philip McGrath
2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 33/45] gnu: Add node-ms Philip McGrath
2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 34/45] gnu: Add node-debug Philip McGrath
2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 35/45] gnu: Add node-serialport-binding-abstract Philip McGrath
2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 36/45] gnu: Add node-serialport-parser-delimiter Philip McGrath
2021-12-13  6:00                                 ` [bug#51838] [PATCH v4 37/45] gnu: Add node-serialport-parser-readling Philip McGrath
2021-12-13  6:01                                 ` [bug#51838] [PATCH v4 38/45] gnu: Add node-serialport-bindings Philip McGrath
2021-12-13  6:01                                 ` [bug#51838] [PATCH v4 39/45] gnu: Add node-serialport-parser-regex Philip McGrath
2021-12-13  6:01                                 ` [bug#51838] [PATCH v4 40/45] gnu: Add node-serialport-parser-ready Philip McGrath
2021-12-13  6:01                                 ` [bug#51838] [PATCH v4 41/45] gnu: Add node-serialport-parser-inter-byte-timeout Philip McGrath
2021-12-13  6:01                                 ` [bug#51838] [PATCH v4 42/45] gnu: Add node-serialport-parser-cctalk Philip McGrath
2021-12-13  6:01                                 ` [bug#51838] [PATCH v4 43/45] gnu: Add node-serialport-parser-byte-length Philip McGrath
2021-12-13  6:01                                 ` [bug#51838] [PATCH v4 44/45] gnu: Add node-serialport-stream Philip McGrath
2021-12-13  6:01                                 ` [bug#51838] [PATCH v4 45/45] gnu: Add node-serialport Philip McGrath
2021-12-17  2:02                                 ` [bug#51838] [PATCH v5 00/45] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 01/45] gnu: node: Avoid duplicating build phases Philip McGrath
2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 02/45] gnu: node: Update to 10.24.1 for bootstrapping Philip McGrath
2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 03/45] gnu: node: Patch shebangs in node_modules Philip McGrath
2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 04/45] gnu: node: Add an npmrc file to set nodedir Philip McGrath
2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 05/45] guix: node-build-system: Add delete-lockfiles phase Philip McGrath
2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 06/45] guix: node-build-system: Refactor patch-dependencies phase Philip McGrath
2021-12-17  4:29                                     ` Liliana Marie Prikler
2021-12-18 17:03                                       ` Philip McGrath
2021-12-18 17:52                                         ` Liliana Marie Prikler
2021-12-18 18:59                                           ` Timothy Sample
2021-12-20 18:03                                           ` Philip McGrath
2021-12-20 19:54                                             ` Liliana Marie Prikler
2021-12-21  3:40                                               ` Philip McGrath
2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 07/45] guix: node-build-system: Add #:absent-dependencies argument Philip McGrath
2021-12-17  4:43                                     ` Liliana Marie Prikler
2021-12-17 15:46                                       ` Timothy Sample
2021-12-17 19:40                                         ` Liliana Marie Prikler
2021-12-18  2:48                                           ` Timothy Sample
2021-12-18  8:30                                             ` Liliana Marie Prikler
2021-12-18 18:31                                               ` Philip McGrath
2021-12-18 20:49                                                 ` Liliana Marie Prikler
2021-12-18 22:55                                                   ` Philip McGrath
2021-12-19  1:02                                                     ` Liliana Marie Prikler
2021-12-20 19:33                                                       ` Philip McGrath
2021-12-20 20:15                                                         ` Timothy Sample
2021-12-20 22:00                                                           ` Liliana Marie Prikler
2021-12-21  3:59                                                             ` Philip McGrath
2021-12-21  5:20                                                               ` Liliana Marie Prikler
2021-12-21 18:25                                                                 ` Philip McGrath
2021-12-21 20:44                                                                   ` Liliana Marie Prikler
2021-12-23  4:41                                                                     ` Philip McGrath
2021-12-23  5:19                                                                     ` Philip McGrath
2021-12-23 18:12                                                                       ` Liliana Marie Prikler
2021-12-30  7:38                                                                         ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 01/41] guix: node-build-system: Add delete-lockfiles phase Philip McGrath
2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 02/41] guix: node-build-system: Add implicit libuv input Philip McGrath
2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 03/41] guix: node-build-system: Add JSON utilities Philip McGrath
2021-12-30 16:56                                                                             ` Liliana Marie Prikler
2021-12-30 18:18                                                                             ` Liliana Marie Prikler
2021-12-31  5:22                                                                               ` Philip McGrath
2021-12-31 10:18                                                                                 ` Liliana Marie Prikler
2022-01-08  4:13                                                                                   ` Philip McGrath
2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 04/41] guix: node-build-system: Add avoid-node-gyp-rebuild phase Philip McGrath
2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 05/41] guix: node-build-system: Add 'delete-dependencies' helper function Philip McGrath
2021-12-30 17:29                                                                             ` Liliana Marie Prikler
2021-12-31  1:09                                                                               ` Philip McGrath
2021-12-31  2:46                                                                                 ` Liliana Marie Prikler
2022-01-05 19:08                                                                                   ` Philip McGrath
2022-01-05 20:02                                                                                     ` Leo Famulari
2022-01-06 16:50                                                                                       ` Liliana Marie Prikler
2022-01-06 17:28                                                                                         ` Leo Famulari
2022-01-05 21:04                                                                                     ` Liliana Marie Prikler
2022-01-05 22:58                                                                                       ` Liliana Marie Prikler
2022-01-08  4:14                                                                                       ` Philip McGrath
2022-01-08  7:59                                                                                         ` Liliana Marie Prikler
2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 06/41] gnu: node-semver-bootstrap: Use 'delete-dependencies' Philip McGrath
2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 07/41] gnu: node-ms-bootstrap: " Philip McGrath
2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 08/41] gnu: node-binary-search-bootstrap: " Philip McGrath
2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 09/41] gnu: node-debug-bootstrap: " Philip McGrath
2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 10/41] gnu: node-llparse-builder-bootstrap: " Philip McGrath
2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 11/41] gnu: node-llparse-frontend-bootstrap: " Philip McGrath
2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 12/41] gnu: node-llparse-bootstrap: " Philip McGrath
2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 13/41] gnu: node-semver: " Philip McGrath
2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 14/41] gnu: node-wrappy: " Philip McGrath
2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 15/41] gnu: node-once: " Philip McGrath
2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 16/41] gnu: node-irc-colors: " Philip McGrath
2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 17/41] gnu: node-irc: " Philip McGrath
2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 18/41] gnu: Add node-inherits Philip McGrath
2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 19/41] gnu: Add node-safe-buffer Philip McGrath
2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 20/41] gnu: Add node-string-decoder Philip McGrath
2021-12-30  7:38                                                                           ` [bug#51838] [PATCH v6 21/41] gnu: Add node-readable-stream Philip McGrath
2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 22/41] gnu: Add node-nan Philip McGrath
2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 23/41] gnu: Add node-openzwave-shared Philip McGrath
2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 24/41] gnu: Add node-addon-api Philip McGrath
2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 25/41] gnu: Add node-sqlite3 Philip McGrath
2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 26/41] gnu: Add node-file-uri-to-path Philip McGrath
2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 27/41] gnu: Add node-bindings Philip McGrath
2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 28/41] gnu: Add node-segfault-handler Philip McGrath
2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 29/41] gnu: Add node-ms Philip McGrath
2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 30/41] gnu: Add node-debug Philip McGrath
2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 31/41] gnu: Add node-serialport-binding-abstract Philip McGrath
2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 32/41] gnu: Add node-serialport-parser-delimiter Philip McGrath
2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 33/41] gnu: Add node-serialport-parser-readline Philip McGrath
2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 34/41] gnu: Add node-serialport-bindings Philip McGrath
2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 35/41] gnu: Add node-serialport-parser-regex Philip McGrath
2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 36/41] gnu: Add node-serialport-parser-ready Philip McGrath
2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 37/41] gnu: Add node-serialport-parser-inter-byte-timeout Philip McGrath
2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 38/41] gnu: Add node-serialport-parser-cctalk Philip McGrath
2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 39/41] gnu: Add node-serialport-parser-byte-length Philip McGrath
2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 40/41] gnu: Add node-serialport-stream Philip McGrath
2021-12-30  7:39                                                                           ` [bug#51838] [PATCH v6 41/41] gnu: Add node-serialport Philip McGrath
2021-12-30  7:44                                                                           ` [bug#51838] [PATCH v7 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 01/41] guix: node-build-system: Add delete-lockfiles phase Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 02/41] guix: node-build-system: Add implicit libuv input Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 03/41] guix: node-build-system: Add JSON utilities Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 04/41] guix: node-build-system: Add avoid-node-gyp-rebuild phase Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 05/41] guix: node-build-system: Add #:absent-dependencies argument Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 06/41] gnu: node-semver-bootstrap: Use #:absent-dependencies Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 07/41] gnu: node-ms-bootstrap: " Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 08/41] gnu: node-binary-search-bootstrap: " Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 09/41] gnu: node-debug-bootstrap: " Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 10/41] gnu: node-llparse-builder-bootstrap: " Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 11/41] gnu: node-llparse-frontend-bootstrap: " Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 12/41] gnu: node-llparse-bootstrap: " Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 13/41] gnu: node-semver: " Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 14/41] gnu: node-wrappy: " Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 15/41] gnu: node-once: " Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 16/41] gnu: node-irc-colors: " Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 17/41] gnu: node-irc: " Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 18/41] gnu: Add node-inherits Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 19/41] gnu: Add node-safe-buffer Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 20/41] gnu: Add node-string-decoder Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 21/41] gnu: Add node-readable-stream Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 22/41] gnu: Add node-nan Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 23/41] gnu: Add node-openzwave-shared Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 24/41] gnu: Add node-addon-api Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 25/41] gnu: Add node-sqlite3 Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 26/41] gnu: Add node-file-uri-to-path Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 27/41] gnu: Add node-bindings Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 28/41] gnu: Add node-segfault-handler Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 29/41] gnu: Add node-ms Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 30/41] gnu: Add node-debug Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 31/41] gnu: Add node-serialport-binding-abstract Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 32/41] gnu: Add node-serialport-parser-delimiter Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 33/41] gnu: Add node-serialport-parser-readline Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 34/41] gnu: Add node-serialport-bindings Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 35/41] gnu: Add node-serialport-parser-regex Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 36/41] gnu: Add node-serialport-parser-ready Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 37/41] gnu: Add node-serialport-parser-inter-byte-timeout Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 38/41] gnu: Add node-serialport-parser-cctalk Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 39/41] gnu: Add node-serialport-parser-byte-length Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 40/41] gnu: Add node-serialport-stream Philip McGrath
2021-12-30  7:44                                                                             ` [bug#51838] [PATCH v7 41/41] gnu: Add node-serialport Philip McGrath
2021-12-30 20:03                                                                           ` [bug#51838] [PATCH v6 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Ryan Sundberg via Guix-patches via
2021-12-20 21:50                                                         ` [bug#51838] [PATCH v5 07/45] guix: node-build-system: Add #:absent-dependencies argument Liliana Marie Prikler
2021-12-20 23:10                                                           ` Jelle Licht
2021-12-20 23:33                                                             ` Philip McGrath
2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 08/45] gnu: node-semver-bootstrap: Use #:absent-dependencies Philip McGrath
2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 09/45] gnu: node-ms-bootstrap: " Philip McGrath
2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 10/45] gnu: node-binary-search-bootstrap: " Philip McGrath
2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 11/45] gnu: node-debug-bootstrap: " Philip McGrath
2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 12/45] gnu: node-llparse-builder-bootstrap: " Philip McGrath
2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 13/45] gnu: node-llparse-frontend-bootstrap: " Philip McGrath
2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 14/45] gnu: node-llparse-bootstrap: " Philip McGrath
2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 15/45] gnu: node-semver: " Philip McGrath
2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 16/45] gnu: node-wrappy: " Philip McGrath
2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 17/45] gnu: node-once: " Philip McGrath
2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 18/45] gnu: node-irc-colors: " Philip McGrath
2021-12-17  2:02                                   ` [bug#51838] [PATCH v5 19/45] gnu: node-irc: " Philip McGrath
2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 20/45] guix: node-build-system: Add implicit libuv input Philip McGrath
2021-12-17  5:08                                     ` Liliana Marie Prikler
2021-12-18 16:16                                       ` Philip McGrath
2021-12-18 17:01                                         ` Liliana Marie Prikler
2021-12-19 20:34                                           ` Jelle Licht
2021-12-18 17:07                                       ` Philip McGrath
2021-12-19 20:41                                         ` Jelle Licht
2021-12-19 20:54                                           ` Liliana Marie Prikler
2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 21/45] guix: node-build-system: Add avoid-node-gyp-rebuild phase Philip McGrath
2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 22/45] gnu: Add node-inherits Philip McGrath
2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 23/45] gnu: Add node-safe-buffer Philip McGrath
2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 24/45] gnu: Add node-string-decoder Philip McGrath
2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 25/45] gnu: Add node-readable-stream Philip McGrath
2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 26/45] gnu: Add node-nan Philip McGrath
2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 27/45] gnu: Add node-openzwave-shared Philip McGrath
2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 28/45] gnu: Add node-addon-api Philip McGrath
2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 29/45] gnu: Add node-sqlite3 Philip McGrath
2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 30/45] gnu: Add node-file-uri-to-path Philip McGrath
2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 31/45] gnu: Add node-bindings Philip McGrath
2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 32/45] gnu: Add node-segfault-handler Philip McGrath
2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 33/45] gnu: Add node-ms Philip McGrath
2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 34/45] gnu: Add node-debug Philip McGrath
2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 35/45] gnu: Add node-serialport-binding-abstract Philip McGrath
2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 36/45] gnu: Add node-serialport-parser-delimiter Philip McGrath
2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 37/45] gnu: Add node-serialport-parser-readline Philip McGrath
2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 38/45] gnu: Add node-serialport-bindings Philip McGrath
2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 39/45] gnu: Add node-serialport-parser-regex Philip McGrath
2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 40/45] gnu: Add node-serialport-parser-ready Philip McGrath
2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 41/45] gnu: Add node-serialport-parser-inter-byte-timeout Philip McGrath
2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 42/45] gnu: Add node-serialport-parser-cctalk Philip McGrath
2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 43/45] gnu: Add node-serialport-parser-byte-length Philip McGrath
2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 44/45] gnu: Add node-serialport-stream Philip McGrath
2021-12-17  2:03                                   ` [bug#51838] [PATCH v5 45/45] gnu: Add node-serialport Philip McGrath
2021-12-08 20:28                         ` [bug#51838] [PATCH v3 05/43] guix: node-build-system: Refactor patch-dependencies phase Philip McGrath
2021-12-08 20:28                         ` [bug#51838] [PATCH v3 06/43] guix: node-build-system: Add #:absent-dependencies argument Philip McGrath
2021-12-12 15:31                           ` Pierre Langlois
2021-12-12 20:22                             ` Philip McGrath
2021-12-08 20:28                         ` [bug#51838] [PATCH v3 07/43] gnu: node-semver-bootstrap: Use #:absent-dependencies Philip McGrath
2021-12-08 20:28                         ` [bug#51838] [PATCH v3 08/43] gnu: node-ms-bootstrap: " Philip McGrath
2021-12-08 20:28                         ` [bug#51838] [PATCH v3 09/43] gnu: node-binary-search-bootstrap: " Philip McGrath
2021-12-08 20:28                         ` [bug#51838] [PATCH v3 10/43] gnu: node-debug-bootstrap: " Philip McGrath
2021-12-08 20:28                         ` [bug#51838] [PATCH v3 11/43] gnu: node-llparse-builder-bootstrap: " Philip McGrath
2021-12-08 20:28                         ` [bug#51838] [PATCH v3 12/43] gnu: node-llparse-frontend-bootstrap: " Philip McGrath
2021-12-08 20:28                         ` [bug#51838] [PATCH v3 13/43] gnu: node-llparse-bootstrap: " Philip McGrath
2021-12-08 20:28                         ` [bug#51838] [PATCH v3 14/43] gnu: node-semver: " Philip McGrath
2021-12-08 20:28                         ` [bug#51838] [PATCH v3 15/43] gnu: node-wrappy: " Philip McGrath
2021-12-08 20:28                         ` [bug#51838] [PATCH v3 16/43] gnu: node-once: " Philip McGrath
2021-12-08 20:28                         ` [bug#51838] [PATCH v3 17/43] gnu: node-irc-colors: " Philip McGrath
2021-12-08 20:28                         ` [bug#51838] [PATCH v3 18/43] gnu: node-irc: " Philip McGrath
2021-12-08 20:28                         ` [bug#51838] [PATCH v3 19/43] guix: node-build-system: Add implicit libuv input Philip McGrath
2021-12-08 20:28                         ` [bug#51838] [PATCH v3 20/43] guix: node-build-system: Add delete-lockfiles phase Philip McGrath
2021-12-12 16:09                           ` Pierre Langlois
2021-12-12 21:26                             ` Philip McGrath
2021-12-08 20:28                         ` [bug#51838] [PATCH v3 21/43] guix: node-build-system: Add avoid-node-gyp-rebuild phase Philip McGrath
2021-12-08 20:28                         ` [bug#51838] [PATCH v3 22/43] gnu: Add node-inherits Philip McGrath
2021-12-08 20:28                         ` [bug#51838] [PATCH v3 23/43] gnu: Add node-safe-buffer Philip McGrath
2021-12-08 20:28                         ` [bug#51838] [PATCH v3 24/43] gnu: Add node-string-decoder Philip McGrath
2021-12-08 20:28                         ` [bug#51838] [PATCH v3 25/43] gnu: Add node-readable-stream Philip McGrath
2021-12-08 20:28                         ` [bug#51838] [PATCH v3 26/43] gnu: Add node-nan Philip McGrath
2021-12-12 16:17                           ` Pierre Langlois
2021-12-12 21:33                             ` Philip McGrath
2021-12-08 20:28                         ` [bug#51838] [PATCH v3 27/43] gnu: Add node-openzwave-shared Philip McGrath
2021-12-08 20:28                         ` [bug#51838] [PATCH v3 28/43] gnu: Add node-addon-api Philip McGrath
2021-12-08 20:28                         ` [bug#51838] [PATCH v3 29/43] gnu: Add node-sqlite3 Philip McGrath
2021-12-12 15:42                           ` Pierre Langlois
2021-12-12 21:18                             ` Philip McGrath
2021-12-08 20:28                         ` [bug#51838] [PATCH v3 30/43] gnu: Add node-file-uri-to-path Philip McGrath
2021-12-12 16:26                           ` Pierre Langlois
2021-12-12 21:34                             ` Philip McGrath
2021-12-08 20:28                         ` [bug#51838] [PATCH v3 31/43] gnu: Add node-bindings Philip McGrath
2021-12-12 15:57                           ` Pierre Langlois
2021-12-12 21:20                             ` Philip McGrath
2021-12-08 20:28                         ` [bug#51838] [PATCH v3 32/43] gnu: Add node-segfault-handler Philip McGrath
2021-12-12 16:31                           ` Pierre Langlois
2021-12-12 21:38                             ` Philip McGrath
2021-12-08 20:28                         ` [bug#51838] [PATCH v3 33/43] gnu: Add node-serialport-binding-abstract Philip McGrath
2021-12-08 20:28                         ` [bug#51838] [PATCH v3 34/43] gnu: Add node-serialport-parser-delimiter Philip McGrath
2021-12-08 20:28                         ` [bug#51838] [PATCH v3 35/43] gnu: Add node-serialport-parser-readling Philip McGrath
2021-12-08 20:28                         ` [bug#51838] [PATCH v3 36/43] gnu: Add node-serialport-bindings Philip McGrath
2021-12-08 20:28                         ` [bug#51838] [PATCH v3 37/43] gnu: Add node-serialport-parser-regex Philip McGrath
2021-12-08 20:28                         ` [bug#51838] [PATCH v3 38/43] gnu: Add node-serialport-parser-ready Philip McGrath
2021-12-08 20:28                         ` [bug#51838] [PATCH v3 39/43] gnu: Add node-serialport-parser-inter-byte-timeout Philip McGrath
2021-12-08 20:28                         ` [bug#51838] [PATCH v3 40/43] gnu: Add node-serialport-parser-cctalk Philip McGrath
2021-12-08 20:28                         ` [bug#51838] [PATCH v3 41/43] gnu: Add node-serialport-parser-byte-length Philip McGrath
2021-12-08 20:28                         ` [bug#51838] [PATCH v3 42/43] gnu: Add node-serialport-stream Philip McGrath
2021-12-08 20:28                         ` [bug#51838] [PATCH v3 43/43] gnu: Add node-serialport Philip McGrath
2021-12-12 16:01                         ` [bug#51838] [PATCH v3 00/43] guix: node-build-system: Support compiling add-ons with node-gyp Pierre Langlois
2021-12-12 16:36                           ` Pierre Langlois
2021-12-12 21:45                             ` Philip McGrath
2021-11-20  4:33             ` [bug#51838] [PATCH v2 11/26] gnu: node-llparse-frontend-bootstrap: Use #:absent-dependencies Philip McGrath
2021-11-20  4:33             ` [bug#51838] [PATCH v2 12/26] gnu: node-llparse-bootstrap: " Philip McGrath
2021-11-20  4:33             ` [bug#51838] [PATCH v2 13/26] gnu: node-semver: " Philip McGrath
2021-11-20  4:33             ` [bug#51838] [PATCH v2 14/26] gnu: node-wrappy: " Philip McGrath
2021-11-20  4:33             ` [bug#51838] [PATCH v2 15/26] gnu: node-once: " Philip McGrath
2021-11-20  4:33             ` [bug#51838] [PATCH v2 16/26] gnu: node-irc-colors: " Philip McGrath
2021-11-20  4:33             ` [bug#51838] [PATCH v2 17/26] gnu: node-irc: " Philip McGrath
2021-11-20  4:33             ` [bug#51838] [PATCH v2 18/26] guix: node-build-system: Add optional #:libuv? argument Philip McGrath
2021-11-20  7:46               ` Liliana Marie Prikler
2021-11-20 17:16                 ` Philip McGrath
2021-11-20  4:33             ` [bug#51838] [PATCH v2 19/26] gnu: Add node-inherits Philip McGrath
2021-11-20  4:34             ` [bug#51838] [PATCH v2 20/26] gnu: Add node-safe-buffer Philip McGrath
2021-11-20  4:34             ` [bug#51838] [PATCH v2 21/26] gnu: Add node-string-decoder Philip McGrath
2021-11-20  4:34             ` [bug#51838] [PATCH v2 22/26] gnu: Add node-readable-stream Philip McGrath
2021-11-20  4:34             ` [bug#51838] [PATCH v2 23/26] gnu: Add node-nan Philip McGrath
2021-11-20  4:34             ` [bug#51838] [PATCH v2 24/26] gnu: Add node-openzwave-shared Philip McGrath
2021-11-20  4:34             ` [bug#51838] [PATCH v2 25/26] gnu: Add node-addon-api Philip McGrath
2021-11-20  4:34             ` [bug#51838] [PATCH v2 26/26] gnu: Add node-sqlite3 Philip McGrath
2021-11-20  7:48               ` Liliana Marie Prikler
2021-11-20  5:10           ` [bug#51838] [PATCH 03/11] guix: node-build-system: Support compiling add-ons with node-gyp Philip McGrath
2021-11-20  7:28             ` Liliana Marie Prikler
2021-11-14 13:04     ` [bug#51838] [PATCH 04/11] gnu: Add node-inherits Philip McGrath
2021-11-14 13:04     ` [bug#51838] [PATCH 05/11] gnu: Add node-safe-buffer Philip McGrath
2021-11-14 13:04     ` [bug#51838] [PATCH 06/11] gnu: Add node-string-decoder Philip McGrath
2021-11-14 13:04     ` [bug#51838] [PATCH 07/11] gnu: Add node-readable-stream Philip McGrath
2021-11-14 13:04     ` [bug#51838] [PATCH 08/11] gnu: Add node-nan Philip McGrath
2021-11-14 13:04     ` [bug#51838] [PATCH 09/11] gnu: Add node-openzwave-shared Philip McGrath
2021-11-14 13:04     ` [bug#51838] [PATCH 10/11] gnu: Add node-addon-api Philip McGrath
2021-11-14 13:04     ` [bug#51838] [PATCH 11/11] gnu: Add node-sqlite3 Philip McGrath
2021-11-20 17:38 ` [bug#51838] [PATCH v2 04/26] gnu: node: Add an npmrc file to set nodedir Timothy Sample
2021-11-20 19:55 ` [bug#51838] [PATCH 00/11] guix: node-build-system: Support compiling add-ons with node-gyp Timothy Sample
2021-12-02 21:52   ` Philip McGrath
2021-11-20 20:04 ` Timothy Sample
2021-12-02 22:02   ` Philip McGrath
2021-11-20 20:08 ` Timothy Sample
2021-11-23 20:54   ` Pierre Langlois
2021-11-28 19:59     ` Timothy Sample
2021-12-02 22:22       ` Philip McGrath
2021-12-30  7:38 ` [bug#51838] [PATCH v8 01/41] guix: node-build-system: Add delete-lockfiles phase Liliana Marie Prikler
2021-12-30  7:38 ` [bug#51838] [PATCH v8 02/41] guix: node-build-system: Add implicit libuv input Liliana Marie Prikler
2021-12-30  7:38 ` [bug#51838] [PATCH v8 03/41] guix: node-build-system: Add JSON utilities Liliana Marie Prikler
2022-01-08  4:13   ` Philip McGrath
2022-01-08  7:00     ` Liliana Marie Prikler
2021-12-30  7:38 ` [bug#51838] [PATCH v8 04/41] guix: node-build-system: Add avoid-node-gyp-rebuild phase Liliana Marie Prikler
2021-12-30  7:38 ` [bug#51838] [PATCH v8 05/41] guix: node-build-system: Add 'delete-dependencies' helper function Liliana Marie Prikler
2021-12-30  7:38 ` [bug#51838] [PATCH v8 06/41] gnu: node-semver-bootstrap: Use 'delete-dependencies' Liliana Marie Prikler
2021-12-30  7:38 ` [bug#51838] [PATCH v8 07/41] gnu: node-ms-bootstrap: " Liliana Marie Prikler
2021-12-30  7:38 ` [bug#51838] [PATCH v8 08/41] gnu: node-binary-search-bootstrap: " Liliana Marie Prikler
2021-12-30  7:38 ` [bug#51838] [PATCH v8 09/41] gnu: node-debug-bootstrap: " Liliana Marie Prikler
2021-12-30  7:38 ` [bug#51838] [PATCH v8 10/41] gnu: node-llparse-builder-bootstrap: " Liliana Marie Prikler
2021-12-30  7:38 ` [bug#51838] [PATCH v8 11/41] gnu: node-llparse-frontend-bootstrap: " Liliana Marie Prikler
2021-12-30  7:38 ` [bug#51838] [PATCH v8 12/41] gnu: node-llparse-bootstrap: " Liliana Marie Prikler
2021-12-30  7:38 ` [bug#51838] [PATCH v8 13/41] gnu: node-semver: " Liliana Marie Prikler
2021-12-30  7:38 ` [bug#51838] [PATCH v8 14/41] gnu: node-wrappy: " Liliana Marie Prikler
2021-12-30  7:38 ` [bug#51838] [PATCH v8 15/41] gnu: node-once: " Liliana Marie Prikler
2021-12-30  7:38 ` [bug#51838] [PATCH v8 16/41] gnu: node-irc-colors: " Liliana Marie Prikler
2021-12-30  7:38 ` [bug#51838] [PATCH v8 17/41] gnu: node-irc: " Liliana Marie Prikler
2021-12-30  7:38 ` [bug#51838] [PATCH v8 18/41] gnu: Add node-inherits Liliana Marie Prikler
2021-12-30  7:38 ` [bug#51838] [PATCH v8 19/41] gnu: Add node-safe-buffer Liliana Marie Prikler
2021-12-30  7:38 ` [bug#51838] [PATCH v8 20/41] gnu: Add node-string-decoder Liliana Marie Prikler
2021-12-30  7:38 ` [bug#51838] [PATCH v8 21/41] gnu: Add node-readable-stream Liliana Marie Prikler
2021-12-30  7:39 ` [bug#51838] [PATCH v8 22/41] gnu: Add node-nan Liliana Marie Prikler
2021-12-30  7:39 ` [bug#51838] [PATCH v8 23/41] gnu: Add node-openzwave-shared Liliana Marie Prikler
2021-12-30  7:39 ` [bug#51838] [PATCH v8 24/41] gnu: Add node-addon-api Liliana Marie Prikler
2021-12-30  7:39 ` [bug#51838] [PATCH v8 25/41] gnu: Add node-sqlite3 Liliana Marie Prikler
2021-12-30  7:39 ` [bug#51838] [PATCH v8 26/41] gnu: Add node-file-uri-to-path Liliana Marie Prikler
2021-12-30  7:39 ` [bug#51838] [PATCH v8 27/41] gnu: Add node-bindings Liliana Marie Prikler
2021-12-30  7:39 ` [bug#51838] [PATCH v8 28/41] gnu: Add node-segfault-handler Liliana Marie Prikler
2021-12-30  7:39 ` [bug#51838] [PATCH v8 29/41] gnu: Add node-ms Liliana Marie Prikler
2021-12-30  7:39 ` [bug#51838] [PATCH v8 30/41] gnu: Add node-debug Liliana Marie Prikler
2021-12-30  7:39 ` [bug#51838] [PATCH v8 31/41] gnu: Add node-serialport-binding-abstract Liliana Marie Prikler
2021-12-30  7:39 ` [bug#51838] [PATCH v8 32/41] gnu: Add node-serialport-parser-delimiter Liliana Marie Prikler
2021-12-30  7:39 ` [bug#51838] [PATCH v8 33/41] gnu: Add node-serialport-parser-readline Liliana Marie Prikler
2021-12-30  7:39 ` [bug#51838] [PATCH v8 34/41] gnu: Add node-serialport-bindings Liliana Marie Prikler
2021-12-30  7:39 ` [bug#51838] [PATCH v8 35/41] gnu: Add node-serialport-parser-regex Liliana Marie Prikler
2021-12-30  7:39 ` [bug#51838] [PATCH v8 36/41] gnu: Add node-serialport-parser-ready Liliana Marie Prikler
2021-12-30  7:39 ` [bug#51838] [PATCH v8 37/41] gnu: Add node-serialport-parser-inter-byte-timeout Liliana Marie Prikler
2021-12-30  7:39 ` [bug#51838] [PATCH v8 38/41] gnu: Add node-serialport-parser-cctalk Liliana Marie Prikler
2021-12-30  7:39 ` [bug#51838] [PATCH v8 39/41] gnu: Add node-serialport-parser-byte-length Liliana Marie Prikler
2021-12-30  7:39 ` [bug#51838] [PATCH v8 40/41] gnu: Add node-serialport-stream Liliana Marie Prikler
2021-12-30  7:39 ` [bug#51838] [PATCH v8 41/41] gnu: Add node-serialport Liliana Marie Prikler
2022-01-06 17:45 ` [bug#51838] [PATCH v8 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Liliana Marie Prikler
2022-01-07 16:49   ` Timothy Sample
2022-01-07 19:43     ` Liliana Marie Prikler
2022-01-07 21:02       ` Jelle Licht
2022-01-07 22:20         ` Liliana Marie Prikler
2022-01-07 23:07           ` Jelle Licht
2022-01-08  0:20             ` Liliana Marie Prikler
2022-01-07 21:07       ` Philip McGrath
2022-01-07 23:06         ` Liliana Marie Prikler
2022-01-07 22:11   ` Philip McGrath
2022-01-07 23:47     ` Liliana Marie Prikler
2022-01-08  4:14       ` Philip McGrath
2022-01-08  8:41         ` [bug#51838] [PATCH v9 " Philip McGrath
2022-01-08  8:41           ` [bug#51838] [PATCH v9 01/41] guix: node-build-system: Add delete-lockfiles phase Philip McGrath
2022-01-08  8:41           ` [bug#51838] [PATCH v9 02/41] guix: node-build-system: Add implicit libuv input Philip McGrath
2022-01-08  8:41           ` [bug#51838] [PATCH v9 03/41] guix: node-build-system: Add JSON utilities Philip McGrath
2022-01-08  8:41           ` [bug#51838] [PATCH v9 04/41] guix: node-build-system: Add avoid-node-gyp-rebuild phase Philip McGrath
2022-01-08  8:41           ` [bug#51838] [PATCH v9 05/41] guix: node-build-system: Add 'delete-dependencies' helper function Philip McGrath
2022-01-08  8:41           ` [bug#51838] [PATCH v9 06/41] gnu: node-semver-bootstrap: Use 'delete-dependencies' Philip McGrath
2022-01-08  8:41           ` [bug#51838] [PATCH v9 07/41] gnu: node-ms-bootstrap: " Philip McGrath
2022-01-08  8:41           ` [bug#51838] [PATCH v9 08/41] gnu: node-binary-search-bootstrap: " Philip McGrath
2022-01-08  8:41           ` [bug#51838] [PATCH v9 09/41] gnu: node-debug-bootstrap: " Philip McGrath
2022-01-08  8:41           ` [bug#51838] [PATCH v9 10/41] gnu: node-llparse-builder-bootstrap: " Philip McGrath
2022-01-08  8:41           ` [bug#51838] [PATCH v9 11/41] gnu: node-llparse-frontend-bootstrap: " Philip McGrath
2022-01-08  8:42           ` [bug#51838] [PATCH v9 12/41] gnu: node-llparse-bootstrap: " Philip McGrath
2022-01-08  8:42           ` [bug#51838] [PATCH v9 13/41] gnu: node-semver: " Philip McGrath
2022-01-08  8:42           ` [bug#51838] [PATCH v9 14/41] gnu: node-wrappy: " Philip McGrath
2022-01-08  8:42           ` [bug#51838] [PATCH v9 15/41] gnu: node-once: " Philip McGrath
2022-01-08  8:42           ` [bug#51838] [PATCH v9 16/41] gnu: node-irc-colors: " Philip McGrath
2022-01-08  8:42           ` [bug#51838] [PATCH v9 17/41] gnu: node-irc: " Philip McGrath
2022-01-08  8:42           ` [bug#51838] [PATCH v9 18/41] gnu: Add node-inherits Philip McGrath
2022-01-08  8:42           ` [bug#51838] [PATCH v9 19/41] gnu: Add node-safe-buffer Philip McGrath
2022-01-08  8:42           ` [bug#51838] [PATCH v9 20/41] gnu: Add node-string-decoder Philip McGrath
2022-01-08  8:42           ` [bug#51838] [PATCH v9 21/41] gnu: Add node-readable-stream Philip McGrath
2022-01-08  8:42           ` [bug#51838] [PATCH v9 22/41] gnu: Add node-nan Philip McGrath
2022-01-08  8:42           ` [bug#51838] [PATCH v9 23/41] gnu: Add node-openzwave-shared Philip McGrath
2022-01-08  8:42           ` [bug#51838] [PATCH v9 24/41] gnu: Add node-addon-api Philip McGrath
2022-01-08  8:42           ` [bug#51838] [PATCH v9 25/41] gnu: Add node-sqlite3 Philip McGrath
2022-01-08  8:42           ` [bug#51838] [PATCH v9 26/41] gnu: Add node-file-uri-to-path Philip McGrath
2022-01-08  8:42           ` [bug#51838] [PATCH v9 27/41] gnu: Add node-bindings Philip McGrath
2022-01-08  8:42           ` [bug#51838] [PATCH v9 28/41] gnu: Add node-segfault-handler Philip McGrath
2022-01-08  8:42           ` [bug#51838] [PATCH v9 29/41] gnu: Add node-ms Philip McGrath
2022-01-08  8:42           ` [bug#51838] [PATCH v9 30/41] gnu: Add node-debug Philip McGrath
2022-01-08  8:42           ` [bug#51838] [PATCH v9 31/41] gnu: Add node-serialport-binding-abstract Philip McGrath
2022-01-08  8:42           ` [bug#51838] [PATCH v9 32/41] gnu: Add node-serialport-parser-delimiter Philip McGrath
2022-01-08  8:42           ` [bug#51838] [PATCH v9 33/41] gnu: Add node-serialport-parser-readline Philip McGrath
2022-01-08  8:42           ` [bug#51838] [PATCH v9 34/41] gnu: Add node-serialport-bindings Philip McGrath
2022-01-08  8:42           ` [bug#51838] [PATCH v9 35/41] gnu: Add node-serialport-parser-regex Philip McGrath
2022-01-08  8:42           ` [bug#51838] [PATCH v9 36/41] gnu: Add node-serialport-parser-ready Philip McGrath
2022-01-08  8:42           ` [bug#51838] [PATCH v9 37/41] gnu: Add node-serialport-parser-inter-byte-timeout Philip McGrath
2022-01-08  8:42           ` [bug#51838] [PATCH v9 38/41] gnu: Add node-serialport-parser-cctalk Philip McGrath
2022-01-08  8:42           ` [bug#51838] [PATCH v9 39/41] gnu: Add node-serialport-parser-byte-length Philip McGrath
2022-01-08  8:42           ` [bug#51838] [PATCH v9 40/41] gnu: Add node-serialport-stream Philip McGrath
2022-01-08  8:42           ` [bug#51838] [PATCH v9 41/41] gnu: Add node-serialport Philip McGrath
2022-01-08 11:19           ` [bug#51838] [PATCH v9 00/41] guix: node-build-system: Support compiling add-ons with node-gyp Liliana Marie Prikler
2022-01-08 15:33             ` Philip McGrath
2022-01-09  1:19               ` bug#51838: " Liliana Marie Prikler

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.