Subject: [PATCH] update Node LTS to 16.13.2

From: zamfofex <[email-masked]>
Date: Fri, 21 Jan 2022 12:11:25 -0300 (BRT)

Hello, everyone! In case this might be useful, I spent some time updating the Node LTS package to version 16.13.2, which is currently the latest LTS.

I hope this patch is sensible! Please let me know if there is anything I should work on regarding it.

From 63d2976a063da9c710ec09f7ebf7158777c134d6 Mon Sep 17 00:00:00 2001
From: zamfofex <[email-masked]>
Date: Fri, 21 Jan 2022 12:06:08 -0300
Subject: [PATCH] gnu: node-lts: Update to 16.13.2 * gnu/packages/node.scm
 (node-lts): Update to 16.13.2.

---
 gnu/packages/node.scm | 42 ++++++++++++++++++++----------------------
 1 file changed, 20 insertions(+), 22 deletions(-)

diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index 6b543ac..941174e 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -10,6 +10,7 @@
 ;;; Copyright © 2020 Ricardo Wurmus <[email-masked]>
 ;;; Copyright © 2021 Simon Tournier <[email-masked]>
 ;;; Copyright © 2021 Guillaume Le Vaillant <[email-masked]>
+;;; Copyright © 2022 zamfofex <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -570,7 +571,7 @@ (define-public node-llparse-bootstrap
 (define-public llhttp-bootstrap
   (package
     (name "llhttp")
-    (version "2.1.4")
+    (version "6.0.6")
     (source (origin
               (method git-fetch)
               (uri (git-reference
@@ -579,8 +580,7 @@ (define-public llhttp-bootstrap
               (file-name (git-file-name name version))
               (sha256
                (base32
-                "115mwyds9655p76lhglxg2blc1ksgrix6zhigaxnc2q6syy3pa6x"))
-              (patches (search-patches "llhttp-bootstrap-CVE-2020-8287.patch"))
+                "1c1p39m46frpslm5yx13hj58r7s0cila03yvqp6caip5dbizpfmr"))
               (modules '((guix build utils)))
               (snippet
                '(begin
@@ -618,10 +618,13 @@ (define-public llhttp-bootstrap
          (add-after 'install 'install-src
            (lambda* (#:key outputs #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out"))
-                    (src-dir (string-append out "/src")))
-               (install-file "build/c/llhttp.c" src-dir)
-               (install-file "src/native/api.c" src-dir)
-               (install-file "src/native/http.c" src-dir)
+                    (src-dir (string-append out "/src"))
+                    (src-src-dir (string-append src-dir "/src")))
+               (install-file "src/llhttp.gyp" src-dir)
+               (install-file "src/common.gypi" src-dir)
+               (install-file "build/c/llhttp.c" src-src-dir)
+               (install-file "src/native/http.c" src-src-dir)
+               (install-file "src/native/api.c" src-src-dir)
                #t))))))
     (native-inputs
      `(("esbuild" ,esbuild)
@@ -640,14 +643,14 @@ (define-public llhttp-bootstrap
 (define-public node-lts
   (package
     (inherit node)
-    (version "14.18.1")
+    (version "16.13.2")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://nodejs.org/dist/v" version
                                   "/node-v" version ".tar.xz"))
               (sha256
                (base32
-                "1vc9rypkgr5i5y946jnyr9jjpydxvm74p1s17rg2zayzvlddg89z"))
+                "185lm13q0kwz0qimc38c7mxn8ml6m713pjdjsa9jna9az4gxxccq"))
               (modules '((guix build utils)))
               (snippet
                `(begin
@@ -751,6 +754,7 @@ (define-public node-lts
                               "lib/internal/v8_prof_polyfill.js"
                               "test/parallel/test-child-process-spawnsync-shell.js"
                               "test/parallel/test-fs-write-sigxfsz.js"
+                              "test/parallel/test-stdin-from-file-spawn.js"
                               "test/parallel/test-stdio-closed.js"
                               "test/sequential/test-child-process-emfile.js")
                  (("'/bin/sh'")
@@ -767,8 +771,8 @@ (define-public node-lts
                ;; 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
@@ -805,20 +809,14 @@ (define-public node-lts
                            "test/parallel/test-tls-server-verify.js"))
 
                ;; Replace pre-generated llhttp sources
-               (let ((llhttp (assoc-ref inputs "llhttp")))
-                 (copy-file (string-append llhttp "/src/llhttp.c")
-                            "deps/llhttp/src/llhttp.c")
-                 (copy-file (string-append llhttp "/src/api.c")
-                            "deps/llhttp/src/api.c")
-                 (copy-file (string-append llhttp "/src/http.c")
-                            "deps/llhttp/src/http.c")
-                 (copy-file (string-append llhttp "/include/llhttp.h")
-                            "deps/llhttp/include/llhttp.h"))))))))
+               (delete-file-recursively "deps/llhttp")
+               (copy-recursively (string-append (assoc-ref inputs "llhttp") "/src")
+                                 "deps/llhttp")))))))
     (native-inputs
      (list ;; Runtime dependencies for binaries used as a bootstrap.
            c-ares-for-node
            brotli
-           icu4c-67
+           icu4c
            libuv-for-node
            `(,nghttp2 "lib")
            openssl
@@ -833,7 +831,7 @@ (define-public node-lts
      (list bash
            coreutils
            c-ares-for-node
-           icu4c-67
+           icu4c
            libuv-for-node
            llhttp-bootstrap
            brotli

base-commit: 80194d9e47f9f50602a5a97ecd33fb9a95dfe03d
-- 
2.34.0