diff mbox series

[bug#59188,v2,3/4] gnu: node-lts: Update to 18.12.1.

Message ID y76o7tec8m8.wl-hako@ultrarare.space
State New
Headers show
Series gnu: node-lts: Update to 18.12.1. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git-branch success View Git branch
cbaines/applying patch success
cbaines/issue success View issue

Commit Message

Hilton Chain Nov. 11, 2022, 6:23 a.m. UTC
* gnu/packages/node.scm (node-lts): Update to 18.12.1.
[snippet]: Keep file deps/openssl/nodejs-openssl.cnf.
[arguments]<#:phases>: Adjust problematic tests to delete accordingly.
Patch additional file with hardcoded references to /bin/sh.
[native-inputs,inputs]: Replace openssl-1.1 with openssl.
---
 gnu/packages/node.scm | 35 ++++++++++++++++++++++++-----------
 1 file changed, 24 insertions(+), 11 deletions(-)

Comments

Mekeor Melire Nov. 16, 2022, 11:31 p.m. UTC | #1
2022-11-11 / 14:23 / hako@ultrarare.space:

> * gnu/packages/node.scm (node-lts): Update to 18.12.1.
> [snippet]: Keep file deps/openssl/nodejs-openssl.cnf.
> [arguments]<#:phases>: Adjust problematic tests to delete accordingly.
> Patch additional file with hardcoded references to /bin/sh.
> [native-inputs,inputs]: Replace openssl-1.1 with openssl.

Thank you for this submission.

As I said in the other thread, I'd suggest to decline the 53414 (which
updates node to version 16.x) in favor of this patch-series (which
updates to 18.x). That is because it'll save us work since there'll only
be a single package-breaking upgrade (instead of two).

For this submission to be merged, I'd guess we should:

1. Check if we want to adapt some patches from Debian, listed here:
   https://sources.debian.org/patches/nodejs/18.12.1+dfsg-2/
   E.g. the "dfsg/privacy_breach.patch" looks good.

2. Make sure that packages, which depend on node, still build (and run)
   fine. I'm not sure how to do this. Do we need a branch for this?


Kindly,
Mekeor


> --- gnu/packages/node.scm | 35 ++++++++++++++++++++++++----------- 1
> file changed, 24 insertions(+), 11 deletions(-)
>
> diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
> index 0af0158f45..cae7d3b0ca 100644
> --- a/gnu/packages/node.scm
> +++ b/gnu/packages/node.scm
> @@ -735,23 +735,28 @@ (define-public llhttp-bootstrap
>  (define-public node-lts
>    (package
>      (inherit node)
> -    (version "14.19.3")
> +    (version "18.12.1")
>      (source (origin
>                (method url-fetch)
>                (uri (string-append "https://nodejs.org/dist/v" version
> -                                  "/node-v" version ".tar.xz"))
> +                                  "/node-v" version ".tar.gz"))
>                (sha256
>                 (base32
> -                "15691j5zhiikyamiwwd7f282g6d9acfhq91nrwx54xya38gmpx2w"))
> +                "11n1h54wgh61inrlqjp0j4fqcz6kl60a3iip7ya90nqdl3fp90ds"))
>                (modules '((guix build utils)))
>                (snippet
>                 `(begin
> +                  ;; openssl.cnf is required for build.
> +                  (for-each delete-file-recursively
> +                            (find-files "deps/openssl"
> +                                        (lambda (file stat)
> +                                          (if (string-contains file "nodejs-openssl.cnf")
> +                                              #f #t))))
>                    ;; Remove bundled software, where possible
>                    (for-each delete-file-recursively
>                              '("deps/cares"
>                                "deps/icu-small"
>                                "deps/nghttp2"
> -                              "deps/openssl"
>                                "deps/zlib"))
>                    (substitute* "Makefile"
>                      ;; Remove references to bundled software.
> @@ -800,23 +805,31 @@ (define-public node-lts
>                                     libuv "/lib:"
>                                     zlib "/lib"
>                                     "'],"))))))
> +           (add-after 'patch-hardcoded-program-references
> +                      'patch-additional-hardcoded-program-references
> +             (lambda* (#:key inputs #:allow-other-keys)
> +               (substitute* "test/parallel/test-stdin-from-file-spawn.js"
> +                 (("'/bin/sh'") (string-append
> +                                 "'" (search-input-file inputs "/bin/sh")
> +                                 "'")))))
>             (replace '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.
>                 (for-each delete-file
> -                         '("test/parallel/test-cluster-master-error.js"
> -                           "test/parallel/test-cluster-master-kill.js"))
> +                         '("test/parallel/test-cluster-primary-error.js"
> +                           "test/parallel/test-cluster-primary-kill.js"))
>
>                 ;; These require a DNS resolver.
>                 (for-each delete-file
>                           '("test/parallel/test-dns.js"
> -                           "test/parallel/test-dns-lookupService-promises.js"))
> +                           "test/parallel/test-dns-lookupService-promises.js"
> +                           "test/parallel/test-net-socket-connect-without-cb.js"
> +                           "test/parallel/test-tcp-wrap-listen.js"))
>
>                 ;; These tests require networking.
>                 (for-each delete-file
> -                         '("test/parallel/test-https-agent-unref-socket.js"
> -                           "test/parallel/test-corepack-yarn-install.js"))
> +                         '("test/parallel/test-https-agent-unref-socket.js"))
>
>                 ;; This test is timing-sensitive, and fails sporadically on
>                 ;; slow, busy, or even very fast machines.
> @@ -866,7 +879,7 @@ (define-public node-lts
>             icu4c-71
>             libuv-for-node
>             `(,nghttp2 "lib")
> -           openssl-1.1
> +           openssl
>             zlib
>             ;; Regular build-time dependencies.
>             perl
> @@ -883,7 +896,7 @@ (define-public node-lts
>             llhttp-bootstrap
>             brotli
>             `(,nghttp2 "lib")
> -           openssl-1.1
> +           openssl
>             python-wrapper ;; for node-gyp (supports python3)
>             zlib))))
Ludovic Courtès Nov. 18, 2022, 2:12 p.m. UTC | #2
Hi,

Mekeor Melire <mekeor@posteo.de> skribis:

> As I said in the other thread, I'd suggest to decline the 53414 (which
> updates node to version 16.x) in favor of this patch-series (which
> updates to 18.x). That is because it'll save us work since there'll only
> be a single package-breaking upgrade (instead of two).

Sounds good to me.

> For this submission to be merged, I'd guess we should:
>
> 1. Check if we want to adapt some patches from Debian, listed here:
>    https://sources.debian.org/patches/nodejs/18.12.1+dfsg-2/
>    E.g. the "dfsg/privacy_breach.patch" looks good.

Yes, but that can be done separately I guess.

> 2. Make sure that packages, which depend on node, still build (and run)
>    fine. I'm not sure how to do this. Do we need a branch for this?

It depends.  Hilton, were you able to build everything returned by
‘guix refresh -l node’, except perhaps ungoogled-chromium?

For some reason <https://qa.guix.gnu.org/issue/59188> didn’t pick it
up.  Anything we should do to address that, Chris?

Otherwise we can indeed create a branch and tell ci.guix to build it,
for instance.

Thanks,
Ludo’.
Hilton Chain Nov. 19, 2022, 5:17 a.m. UTC | #3
node-acorn fails in check phase.
#+RESULTS:
: starting phase `check'
: npm ERR! Missing script: "test"
: npm ERR!
: npm ERR! To see a list of scripts, run:
: npm ERR!   npm run
:
: npm ERR! A complete log of this run can be found in:
: npm ERR!     /tmp/guix-build-node-acorn-8.4.1.drv-0/source/npm-home-0/.npm/_logs/2022-11-19T04_28_57_471Z-debug-0.log
: error: in phase 'check': uncaught exception:
: %exception #<&invoke-error program: "/gnu/store/l32l0i53ik9ja3fircdd89bgq6b1v6y5-node-18.12.1/bin/npm" arguments: ("test") exit-status: 1 term-signal: #f stop-signal: #f>
: phase `check' failed after 0.2 seconds
: command "/gnu/store/l32l0i53ik9ja3fircdd89bgq6b1v6y5-node-18.12.1/bin/npm" "test" failed with status 1

Then node-uglify-js
#+RESULTS:
: starting phase `configure'
: npm ERR! code 254
: npm ERR! path /gnu/store/969597ncg311d3kd8vbhdlniwqg4mr2k-node-acorn-8.4.1/lib/node_modules/acorn
: npm ERR! command failed
: npm ERR! command sh -c -- cd ..; npm run build:main && npm run build:bin
: npm ERR! npm ERR! code ENOENT
: npm ERR! npm ERR! syscall open
: npm ERR! npm ERR! path /gnu/store/969597ncg311d3kd8vbhdlniwqg4mr2k-node-acorn-8.4.1/lib/package.json
: npm ERR! npm ERR! errno -2
: npm ERR! npm ERR! enoent ENOENT: no such file or directory, open '/gnu/store/969597ncg311d3kd8vbhdlniwqg4mr2k-node-acorn-8.4.1/lib/package.json'
: npm ERR! npm ERR! enoent This is related to npm not being able to find a file.
: npm ERR! npm ERR! enoent
: npm ERR!
: npm ERR! npm ERR! A complete log of this run can be found in:
: npm ERR! npm ERR!     /tmp/guix-build-node-uglify-js-3.13.9.drv-0/npm-home-0/.npm/_logs/2022-11-19T04_54_25_643Z-debug-0.log
:
: npm ERR! A complete log of this run can be found in:
: npm ERR!     /tmp/guix-build-node-uglify-js-3.13.9.drv-0/npm-home-0/.npm/_logs/2022-11-19T04_54_25_343Z-debug-0.log
: error: in phase 'configure': uncaught exception:
: %exception #<&invoke-error program: "/gnu/store/l32l0i53ik9ja3fircdd89bgq6b1v6y5-node-18.12.1/bin/npm" arguments: ("--offline" "--ignore-scripts" "install") exit-status: 254 term-signal: #f stop-signal: #f>
: phase `configure' failed after 0.6 seconds
: command "/gnu/store/l32l0i53ik9ja3fircdd89bgq6b1v6y5-node-18.12.1/bin/npm" "--offline" "--ignore-scripts" "install" failed with status 254

One test failed after deleting node-uglify-js's configure phase.
#+RESULTS:
: 1 test(s) failed!
:
: test/reduce.js
:   1) Should reduce test case which differs only in Error.message
: AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
: + actual - expected
:
: + `try{null[function(){}]}catch(e){console.log(e)}\n// output: TypeError: Cannot read properties of null (reading 'function(){}')\n// \n// minify: TypeError: Cannot read properties of null (reading 'function() {}')\n// \n// options: {\n//   "compress": false,\n//   "mangle": false,\n//   "output": {\n//     "beautify": true\n//   }\n// }`
: - `try{null[function(){}]}catch(e){console.log(e)}\n// output: TypeError: Cannot read property 'function(){}' of null\n// \n// minify: TypeError: Cannot read property 'function() {}' of null\n// \n// options: {\n//   "compress": false,\n//   "mangle": false,\n//   "output": {\n//     "beautify": true\n//   }\n// }`
:     at Function.<anonymous> (/tmp/guix-build-node-uglify-js-3.13.9.drv-0/source/test/mocha/reduce.js:285:16)
:     at run (/tmp/guix-build-node-uglify-js-3.13.9.drv-0/source/test/mocha.js:79:18)
:     at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
: error: in phase 'check': uncaught exception:
: %exception #<&invoke-error program: "/gnu/store/l32l0i53ik9ja3fircdd89bgq6b1v6y5-node-18.12.1/bin/npm" arguments: ("test") exit-status: 1 term-signal: #f stop-signal: #f>
: phase `check' failed after 264.2 seconds
: command "/gnu/store/l32l0i53ik9ja3fircdd89bgq6b1v6y5-node-18.12.1/bin/npm" "test" failed with status 1

Then node-string-decoder fails to install, I have no idea how to continue...
#+RESULTS:
: starting phase `install'
: npm info using npm@8.19.2
: npm info using node@v18.12.1
: npm timing npm:load:whichnode Completed in 0ms
: npm timing config:load:defaults Completed in 1ms
: npm timing config:load:file:/gnu/store/l32l0i53ik9ja3fircdd89bgq6b1v6y5-node-18.12.1/lib/node_modules/npm/npmrc Completed in 2ms
: npm timing config:load:builtin Completed in 3ms
: npm WARN config production Use `--omit=dev` instead.
: npm timing config:load:cli Completed in 1ms
: npm timing config:load:env Completed in 1ms
: npm timing config:load:project Completed in 0ms
: npm timing config:load:file:/tmp/guix-build-node-string-decoder-1.3.0.drv-0/npm-home-0/.npmrc Completed in 0ms
: npm timing config:load:user Completed in 0ms
: npm timing config:load:file:/gnu/store/ansccgk9y8vzd5rwsx4iz7j2n0gp8ig8-node-string-decoder-1.3.0/etc/npmrc Completed in 2ms
: npm timing config:load:global Completed in 2ms
: npm timing config:load:validate Completed in 0ms
: npm timing config:load:credentials Completed in 1ms
: npm timing config:load:setEnvs Completed in 0ms
: npm timing config:load Completed in 9ms
: npm timing npm:load:configload Completed in 9ms
: npm timing npm:load:mkdirpcache Completed in 1ms
: npm timing npm:load:mkdirplogs Completed in 1ms
: npm timing npm:load:setTitle Completed in 0ms
: npm timing config:load:flatten Completed in 1ms
: npm timing npm:load:display Completed in 4ms
: npm timing npm:load:logFile Completed in 3ms
: npm timing npm:load:timers Completed in 0ms
: npm timing npm:load:configScope Completed in 0ms
: npm timing npm:load Completed in 19ms
: npm timing arborist:ctor Completed in 0ms
: npm timing idealTree:init Completed in 4ms
: npm timing idealTree:userRequests Completed in 30ms
: npm timing idealTree:#root Completed in 16ms
: npm timing idealTree:node_modules/string_decoder Completed in 3ms
: npm timing idealTree:node_modules/string_decoder/node_modules/safe-buffer Completed in 0ms
: npm timing idealTree:buildDeps Completed in 20ms
: npm timing idealTree:fixDepFlags Completed in 0ms
: npm timing idealTree Completed in 56ms
: npm timing reify:loadTrees Completed in 57ms
: npm timing reify:diffTrees Completed in 1ms
: npm timing reify:retireShallow Completed in 1ms
: npm timing reify:createSparse Completed in 0ms
: npm timing reify:trashOmits Completed in 0ms
: npm timing reify:loadBundles Completed in 0ms
: npm timing reify:audit Completed in 0ms
: npm timing reifyNode:node_modules/string_decoder/node_modules/safe-buffer Completed in 5ms
: npm timing reifyNode:node_modules/string_decoder Completed in 12ms
: npm timing reify:unpack Completed in 13ms
: npm timing reify:unretire Completed in 0ms
: npm timing build:queue Completed in 1ms
: npm timing build:deps Completed in 1ms
: npm timing build:queue Completed in 1ms
: npm timing build:links Completed in 1ms
: npm timing build Completed in 2ms
: npm timing reify:build Completed in 2ms
: npm timing reify:trash Completed in 0ms
: npm timing command:install Completed in 83ms
: npm ERR! Cannot set properties of null (setting 'dev')
: npm timing npm Completed in 163ms
:
: npm ERR! A complete log of this run can be found in:
: npm ERR!     /tmp/guix-build-node-string-decoder-1.3.0.drv-0/npm-home-0/.npm/_logs/2022-11-19T05_09_44_366Z-debug-0.log
: error: in phase 'install': uncaught exception:
: %exception #<&invoke-error program: "/gnu/store/l32l0i53ik9ja3fircdd89bgq6b1v6y5-node-18.12.1/bin/npm" arguments: ("--prefix" "/gnu/store/ansccgk9y8vzd5rwsx4iz7j2n0gp8ig8-node-string-decoder-1.3.0" "--global" "--offline" "--loglevel" "info" "--production" "install" "../package.tgz") exit-status: 1 term-signal: #f stop-signal: #f>
: phase `install' failed after 0.4 seconds
: command "/gnu/store/l32l0i53ik9ja3fircdd89bgq6b1v6y5-node-18.12.1/bin/npm" "--prefix" "/gnu/store/ansccgk9y8vzd5rwsx4iz7j2n0gp8ig8-node-string-decoder-1.3.0" "--global" "--offline" "--loglevel" "info" "--production" "install" "../package.tgz" failed with status 1
Christopher Baines Nov. 20, 2022, 9:40 a.m. UTC | #4
Ludovic Courtès <ludo@gnu.org> writes:

> It depends.  Hilton, were you able to build everything returned by
> ‘guix refresh -l node’, except perhaps ungoogled-chromium?
>
> For some reason <https://qa.guix.gnu.org/issue/59188> didn’t pick it
> up.  Anything we should do to address that, Chris?

For some reason, the branch existed, but the patchwork checks
didn't. I've got some ideas on how to avoid that being a possibility in
the future.

Thanks,

Chris
Jelle Licht Jan. 5, 2023, 1:10 p.m. UTC | #5
Hello Hilton, other folks,

Hilton Chain <hako@ultrarare.space> writes:

> node-acorn fails in check phase.
> #+RESULTS:
> : starting phase `check'
> : npm ERR! Missing script: "test"
> : npm ERR!
> : npm ERR! To see a list of scripts, run:
> : npm ERR!   npm run
> <snip>

This is due to a change in how npm treats the 'test' command; before,
having no "scripts.test" entry in package.json lead to a placeholder of 
"echo 'Error: no test specified'" (with a status code of 0).

More recently, npm was changed to make `npm test' like any other `npm
run XYZ' command. This means that all of the packages that fail like
this due to upgrading node/npm should be get a `#:tests? #f'.

> Then node-uglify-js
> #+RESULTS:
> : starting phase `configure'
> : npm ERR! code 254
> : npm ERR! path /gnu/store/969597ncg311d3kd8vbhdlniwqg4mr2k-node-acorn-8.4.1/lib/node_modules/acorn
> : npm ERR! command failed
> : npm ERR! command sh -c -- cd ..; npm run build:main && npm run build:bin
> <snip>

This is due to the fact that the `prepare' scripts is being run for our
installed node-acorn. Apparently, the fact that it previously did not
happen was a bug that was fixed somewhere between node 14 and 18 [1][2].

I do not know what the best approach is here. Consider patching the
"scripts.prepare" entry in node-acorn, and if we find we need to do this
often, we can introduce a convenience function similar to
`delete-dependencies' to streamline this.

> One test failed after deleting node-uglify-js's configure phase.
> #+RESULTS:
> : 1 test(s) failed!
> :
> : test/reduce.js
> :   1) Should reduce test case which differs only in Error.message
> : AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:
> : + actual - expected
> :
> : + `try{null[function(){}]}catch(e){console.log(e)}\n// output: TypeError: Cannot read properties of null (reading 'function(){}')\n// \n// minify: TypeError: Cannot read properties of null (reading 'function() {}')\n// \n// options: {\n//   "compress": false,\n//   "mangle": false,\n//   "output": {\n//     "beautify": true\n//   }\n// }`
> : - `try{null[function(){}]}catch(e){console.log(e)}\n// output: TypeError: Cannot read property 'function(){}' of null\n// \n// minify: TypeError: Cannot read property 'function() {}' of null\n// \n// options: {\n//   "compress": false,\n//   "mangle": false,\n//   "output": {\n//     "beautify": true\n//   }\n// }`
> :     at Function.<anonymous> (/tmp/guix-build-node-uglify-js-3.13.9.drv-0/source/test/mocha/reduce.js:285:16)
> :     at run (/tmp/guix-build-node-uglify-js-3.13.9.drv-0/source/test/mocha.js:79:18)
> :     at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
> : error: in phase 'check': uncaught exception:
> : %exception #<&invoke-error program: "/gnu/store/l32l0i53ik9ja3fircdd89bgq6b1v6y5-node-18.12.1/bin/npm" arguments: ("test") exit-status: 1 term-signal: #f stop-signal: #f>
> : phase `check' failed after 264.2 seconds
> : command "/gnu/store/l32l0i53ik9ja3fircdd89bgq6b1v6y5-node-18.12.1/bin/npm" "test" failed with status 1
>
> Then node-string-decoder fails to install, I have no idea how to continue...
> #+RESULTS:
> : starting phase `install'
> : npm info using npm@8.19.2
> : npm info using node@v18.12.1
> : npm timing npm:load:whichnode Completed in 0ms
> : npm timing config:load:defaults Completed in 1ms
> : npm timing config:load:file:/gnu/store/l32l0i53ik9ja3fircdd89bgq6b1v6y5-node-18.12.1/lib/node_modules/npm/npmrc Completed in 2ms
> : npm timing config:load:builtin Completed in 3ms
> : npm WARN config production Use `--omit=dev` instead.
> : npm timing config:load:cli Completed in 1ms
> : npm timing config:load:env Completed in 1ms
> : npm timing config:load:project Completed in 0ms
> : npm timing config:load:file:/tmp/guix-build-node-string-decoder-1.3.0.drv-0/npm-home-0/.npmrc Completed in 0ms
> : npm timing config:load:user Completed in 0ms
> : npm timing config:load:file:/gnu/store/ansccgk9y8vzd5rwsx4iz7j2n0gp8ig8-node-string-decoder-1.3.0/etc/npmrc Completed in 2ms
> : npm timing config:load:global Completed in 2ms
> : npm timing config:load:validate Completed in 0ms
> : npm timing config:load:credentials Completed in 1ms
> : npm timing config:load:setEnvs Completed in 0ms
> : npm timing config:load Completed in 9ms
> : npm timing npm:load:configload Completed in 9ms
> : npm timing npm:load:mkdirpcache Completed in 1ms
> : npm timing npm:load:mkdirplogs Completed in 1ms
> : npm timing npm:load:setTitle Completed in 0ms
> : npm timing config:load:flatten Completed in 1ms
> : npm timing npm:load:display Completed in 4ms
> : npm timing npm:load:logFile Completed in 3ms
> : npm timing npm:load:timers Completed in 0ms
> : npm timing npm:load:configScope Completed in 0ms
> : npm timing npm:load Completed in 19ms
> : npm timing arborist:ctor Completed in 0ms
> : npm timing idealTree:init Completed in 4ms
> : npm timing idealTree:userRequests Completed in 30ms
> : npm timing idealTree:#root Completed in 16ms
> : npm timing idealTree:node_modules/string_decoder Completed in 3ms
> : npm timing idealTree:node_modules/string_decoder/node_modules/safe-buffer Completed in 0ms
> : npm timing idealTree:buildDeps Completed in 20ms
> : npm timing idealTree:fixDepFlags Completed in 0ms
> : npm timing idealTree Completed in 56ms
> : npm timing reify:loadTrees Completed in 57ms
> : npm timing reify:diffTrees Completed in 1ms
> : npm timing reify:retireShallow Completed in 1ms
> : npm timing reify:createSparse Completed in 0ms
> : npm timing reify:trashOmits Completed in 0ms
> : npm timing reify:loadBundles Completed in 0ms
> : npm timing reify:audit Completed in 0ms
> : npm timing reifyNode:node_modules/string_decoder/node_modules/safe-buffer Completed in 5ms
> : npm timing reifyNode:node_modules/string_decoder Completed in 12ms
> : npm timing reify:unpack Completed in 13ms
> : npm timing reify:unretire Completed in 0ms
> : npm timing build:queue Completed in 1ms
> : npm timing build:deps Completed in 1ms
> : npm timing build:queue Completed in 1ms
> : npm timing build:links Completed in 1ms
> : npm timing build Completed in 2ms
> : npm timing reify:build Completed in 2ms
> : npm timing reify:trash Completed in 0ms
> : npm timing command:install Completed in 83ms
> : npm ERR! Cannot set properties of null (setting 'dev')

This is due to either a newly introducded bug, or perhaps more likely,
an unfortunate sequence of interactions in arborist. I've done some
bisecting, and got things to work with a hack.

Relevants parts of arborist were rewritten in version 6, whereas we are
stuck with 5.4.XYZ, making a proper backport highly unlikely.

--8<---------------cut here---------------start------------->8---
+           ;; TODO: Work around issue in that is fixed in arborist@6.0.0/npm@9.0.0/node@19+
+           (add-after 'patch-hardcoded-program-references
+                      'patch-broken-arborist
+             (lambda* (#:key inputs #:allow-other-keys)
+               (substitute* "deps/npm/node_modules/@npmcli/arborist/lib/calc-dep-flags.js"
+                 (("if \\(node\\.isLink\\)")
+                  "if (node.isLink && node.target)"))))
--8<---------------cut here---------------end--------------->8---


In addition it some of the packages in node-xyz.scm that involve
replacing the 'configure phase are also failing. For some reason, this
updated version of npm seems to want to have access to either some
cached metadata or the actual npm packages for each of the specified
devDependencies[3]. This can be worked around by introducing a
'patch-dependencies phase for impacted packages, and patching out all
devDependencies. AFAICS this applies for (at least) these packages:

- node-buffer-crc32
- node-crx3
- node-minimist
- node-pbf
- node-protocol-buffers-schema
- node-protobuf-schema
- node-ieee754
- node-yazl

HTH

You have my gratitude for working on this Hilton! 
 - Jelle


[1]: https://github.com/npm/cli/issues/459

[2]: https://docs.npmjs.com/cli/v9/commands/npm-install

[3]: My guess: npm wants to be able to construct a 'proper'
package-lock.json, for which it needs some metadata from the npm
registry. I've already checked if adding '--no-package-lock' fixes the
issue, but while it indeed ensures no package-lock.json is generated, it
sadly doesn't address the issue. IWBN if there were some magical
invocation(s) for npm that allow these packages to actually be packaged
by distributions...
diff mbox series

Patch

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 0af0158f45..cae7d3b0ca 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -735,23 +735,28 @@  (define-public llhttp-bootstrap
 (define-public node-lts
   (package
     (inherit node)
-    (version "14.19.3")
+    (version "18.12.1")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://nodejs.org/dist/v" version
-                                  "/node-v" version ".tar.xz"))
+                                  "/node-v" version ".tar.gz"))
               (sha256
                (base32
-                "15691j5zhiikyamiwwd7f282g6d9acfhq91nrwx54xya38gmpx2w"))
+                "11n1h54wgh61inrlqjp0j4fqcz6kl60a3iip7ya90nqdl3fp90ds"))
               (modules '((guix build utils)))
               (snippet
                `(begin
+                  ;; openssl.cnf is required for build.
+                  (for-each delete-file-recursively
+                            (find-files "deps/openssl"
+                                        (lambda (file stat)
+                                          (if (string-contains file "nodejs-openssl.cnf")
+                                              #f #t))))
                   ;; Remove bundled software, where possible
                   (for-each delete-file-recursively
                             '("deps/cares"
                               "deps/icu-small"
                               "deps/nghttp2"
-                              "deps/openssl"
                               "deps/zlib"))
                   (substitute* "Makefile"
                     ;; Remove references to bundled software.
@@ -800,23 +805,31 @@  (define-public node-lts
                                    libuv "/lib:"
                                    zlib "/lib"
                                    "'],"))))))
+           (add-after 'patch-hardcoded-program-references
+                      'patch-additional-hardcoded-program-references
+             (lambda* (#:key inputs #:allow-other-keys)
+               (substitute* "test/parallel/test-stdin-from-file-spawn.js"
+                 (("'/bin/sh'") (string-append
+                                 "'" (search-input-file inputs "/bin/sh")
+                                 "'")))))
            (replace '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.
                (for-each delete-file
-                         '("test/parallel/test-cluster-master-error.js"
-                           "test/parallel/test-cluster-master-kill.js"))
+                         '("test/parallel/test-cluster-primary-error.js"
+                           "test/parallel/test-cluster-primary-kill.js"))
 
                ;; These require a DNS resolver.
                (for-each delete-file
                          '("test/parallel/test-dns.js"
-                           "test/parallel/test-dns-lookupService-promises.js"))
+                           "test/parallel/test-dns-lookupService-promises.js"
+                           "test/parallel/test-net-socket-connect-without-cb.js"
+                           "test/parallel/test-tcp-wrap-listen.js"))
 
                ;; These tests require networking.
                (for-each delete-file
-                         '("test/parallel/test-https-agent-unref-socket.js"
-                           "test/parallel/test-corepack-yarn-install.js"))
+                         '("test/parallel/test-https-agent-unref-socket.js"))
 
                ;; This test is timing-sensitive, and fails sporadically on
                ;; slow, busy, or even very fast machines.
@@ -866,7 +879,7 @@  (define-public node-lts
            icu4c-71
            libuv-for-node
            `(,nghttp2 "lib")
-           openssl-1.1
+           openssl
            zlib
            ;; Regular build-time dependencies.
            perl
@@ -883,7 +896,7 @@  (define-public node-lts
            llhttp-bootstrap
            brotli
            `(,nghttp2 "lib")
-           openssl-1.1
+           openssl
            python-wrapper ;; for node-gyp (supports python3)
            zlib))))