Skip to contentSkip to conversation

Nodejs: Upgrade to 18.12.1

PATCH In review Archana Polampalli 2 participants 2 messages Jan 24, 2023 – Mar 2, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Nodejs: Upgrade to 18.12.1

Node-18 is the current LTS release, node-19 is a development release and node-20 is scheduled to be released until 2023-04-18 which is too late for YP-4.2
https://github.com/nodejs/release

* Refresh below two patches
- 0001-Using-native-binaries.patch
- 0001-liftoff-Correct-function-signatures.patch

* Copy openssl.cnf from sysroot_native to nodejs-openssl.cnf otherwise do_compile failed:
make[1]: *** No rule to make target '../deps/openssl/nodejs-openssl.cnf', needed by 'Release/obj.target/deps/openssl/openssl.cnf'. Stop.

* Add initial ptest support using ctest only, it covered 20% of the nodejs tests. There are some more tests exist to add but will require additional work.

---
 .../oe-npm-cache                              |  0
 ....18.bb => nodejs-oe-cache-native_18.12.bb} |  0
 .../nodejs/0001-Using-native-binaries.patch   | 24 +++++---------
 ...-liftoff-Correct-function-signatures.patch | 32 +++++++++++++------
 .../{nodejs_16.18.1.bb => nodejs_18.12.1.bb}  | 15 ++++++---
 5 files changed, 42 insertions(+), 29 deletions(-)
 rename meta-oe/recipes-devtools/nodejs/{nodejs-oe-cache-16.18 => nodejs-oe-cache-18.12}/oe-npm-cache (100%)
 rename meta-oe/recipes-devtools/nodejs/{nodejs-oe-cache-native_16.18.bb => nodejs-oe-cache-native_18.12.bb} (100%)
 rename meta-oe/recipes-devtools/nodejs/{nodejs_16.18.1.bb => nodejs_18.12.1.bb} (93%)
meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-18.12/oe-npm-cache renamed from meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-16.18/oe-npm-cache +0 -0
similarity index 100%
rename from meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-16.18/oe-npm-cache
rename to meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-18.12/oe-npm-cache
meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-native_18.12.bb renamed from meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-native_16.18.bb +0 -0
similarity index 100%
rename from meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-native_16.18.bb
rename to meta-oe/recipes-devtools/nodejs/nodejs-oe-cache-native_18.12.bb
meta-oe/recipes-devtools/nodejs/nodejs/0001-Using-native-binaries.patch +8 -16
index 445aaf839..feafe38fd 100644
@@ -5,32 +5,24 @@ Subject: [PATCH] Using native binaries
 
 Signed-off-by: Archana Polampalli <[email protected]>
 ---
- node.gyp                 | 2 ++
+ node.gyp                 | 1 +
  tools/v8_gypfiles/v8.gyp | 5 +++++
- 2 files changed, 7 insertions(+)
+ 2 files changed, 6 insertions(+)
 
 diff --git a/node.gyp b/node.gyp
-index 24505da7ba..7d41bd52db 100644
+index e8e1d9f9..e60ccc10 100644
 --- a/node.gyp
 +++ b/node.gyp
-@@ -319,6 +319,7 @@
-               'action_name': 'run_mkcodecache',
-               'process_outputs_as_sources': 1,
-               'inputs': [
-+                '<(PRODUCT_DIR)/v8-qemu-wrapper.sh',
-                 '<(mkcodecache_exec)',
-               ],
-               'outputs': [
-@@ -366,6 +367,7 @@
+@@ -320,6 +320,7 @@
                    'action_name': 'node_mksnapshot',
                    'process_outputs_as_sources': 1,
                    'inputs': [
 +                    '<(PRODUCT_DIR)/v8-qemu-wrapper.sh',
                      '<(node_mksnapshot_exec)',
+                     '<(node_snapshot_main)',
                    ],
-                   'outputs': [
 diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp
-index ed042f8829..371b8e02c2 100644
+index 42e26cd9..bc721991 100644
 --- a/tools/v8_gypfiles/v8.gyp
 +++ b/tools/v8_gypfiles/v8.gyp
 @@ -68,6 +68,7 @@
@@ -57,7 +49,7 @@ index ed042f8829..371b8e02c2 100644
              '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)bytecode_builtins_list_generator<(EXECUTABLE_SUFFIX)',
            ],
            'outputs': [
-@@ -395,6 +398,7 @@
+@@ -400,6 +403,7 @@
              ],
            },
            'inputs': [
@@ -65,7 +57,7 @@ index ed042f8829..371b8e02c2 100644
              '<(mksnapshot_exec)',
            ],
            'outputs': [
-@@ -1513,6 +1517,7 @@
+@@ -1539,6 +1543,7 @@
          {
            'action_name': 'run_gen-regexp-special-case_action',
            'inputs': [
meta-oe/recipes-devtools/nodejs/nodejs/0001-liftoff-Correct-function-signatures.patch +23 -9
index d7005ae97..c9a522d2e 100644
@@ -9,14 +9,20 @@ Fixes builds on mips where clang reports an error
     ^~~~
 
 Upstream-Status: Submitted [https://chromium-review.googlesource.com/c/v8/v8/+/3235674]
-Signed-off-by: Khem Raj <[email protected]>
+
+Signed-off-by: Archana Polampalli <[email protected]>
 ---
- src/wasm/baseline/liftoff-assembler.h | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
+ deps/v8/src/wasm/baseline/liftoff-assembler.h               | 6 +++---
+ deps/v8/src/wasm/baseline/mips/liftoff-assembler-mips.h     | 2 +-
+ deps/v8/src/wasm/baseline/mips64/liftoff-assembler-mips64.h | 2 +-
+ .../src/wasm/baseline/riscv64/liftoff-assembler-riscv64.h   | 2 +-
+ 4 files changed, 6 insertions(+), 6 deletions(-)
 
+diff --git a/deps/v8/src/wasm/baseline/liftoff-assembler.h b/deps/v8/src/wasm/baseline/liftoff-assembler.h
+index 22c7f73a..db4cb168 100644
 --- a/deps/v8/src/wasm/baseline/liftoff-assembler.h
 +++ b/deps/v8/src/wasm/baseline/liftoff-assembler.h
-@@ -613,7 +613,7 @@ class LiftoffAssembler : public TurboAss
+@@ -646,7 +646,7 @@ class LiftoffAssembler : public TurboAssembler {
    void FinishCall(const ValueKindSig*, compiler::CallDescriptor*);
  
    // Move {src} into {dst}. {src} and {dst} must be different.
@@ -25,7 +31,7 @@ Signed-off-by: Khem Raj <[email protected]>
  
    // Parallel register move: For a list of tuples <dst, src, kind>, move the
    // {src} register of kind {kind} into {dst}. If {src} equals {dst}, ignore
-@@ -759,8 +759,8 @@ class LiftoffAssembler : public TurboAss
+@@ -795,8 +795,8 @@ class LiftoffAssembler : public TurboAssembler {
    inline void MoveStackValue(uint32_t dst_offset, uint32_t src_offset,
                               ValueKind);
  
@@ -36,10 +42,12 @@ Signed-off-by: Khem Raj <[email protected]>
  
    inline void Spill(int offset, LiftoffRegister, ValueKind);
    inline void Spill(int offset, WasmValue);
+diff --git a/deps/v8/src/wasm/baseline/mips/liftoff-assembler-mips.h b/deps/v8/src/wasm/baseline/mips/liftoff-assembler-mips.h
+index c76fd2f4..0fffe231 100644
 --- a/deps/v8/src/wasm/baseline/mips/liftoff-assembler-mips.h
 +++ b/deps/v8/src/wasm/baseline/mips/liftoff-assembler-mips.h
-@@ -658,7 +658,7 @@ void LiftoffAssembler::Store(Register ds
-     pinned = pinned | LiftoffRegList::ForRegs(dst_op.rm(), src);
+@@ -661,7 +661,7 @@ void LiftoffAssembler::Store(Register dst_addr, Register offset_reg,
+     pinned = pinned | LiftoffRegList{dst_op.rm(), src};
      LiftoffRegister tmp = GetUnusedRegister(src.reg_class(), pinned);
      // Save original value.
 -    Move(tmp, src, type.value_type());
@@ -47,9 +55,11 @@ Signed-off-by: Khem Raj <[email protected]>
  
      src = tmp;
      pinned.set(tmp);
+diff --git a/deps/v8/src/wasm/baseline/mips64/liftoff-assembler-mips64.h b/deps/v8/src/wasm/baseline/mips64/liftoff-assembler-mips64.h
+index 36413545..48207337 100644
 --- a/deps/v8/src/wasm/baseline/mips64/liftoff-assembler-mips64.h
 +++ b/deps/v8/src/wasm/baseline/mips64/liftoff-assembler-mips64.h
-@@ -596,7 +596,7 @@ void LiftoffAssembler::Store(Register ds
+@@ -593,7 +593,7 @@ void LiftoffAssembler::Store(Register dst_addr, Register offset_reg,
      pinned.set(dst_op.rm());
      LiftoffRegister tmp = GetUnusedRegister(src.reg_class(), pinned);
      // Save original value.
@@ -58,9 +68,11 @@ Signed-off-by: Khem Raj <[email protected]>
  
      src = tmp;
      pinned.set(tmp);
+diff --git a/deps/v8/src/wasm/baseline/riscv64/liftoff-assembler-riscv64.h b/deps/v8/src/wasm/baseline/riscv64/liftoff-assembler-riscv64.h
+index 642a7d2a..56ffcc2a 100644
 --- a/deps/v8/src/wasm/baseline/riscv64/liftoff-assembler-riscv64.h
 +++ b/deps/v8/src/wasm/baseline/riscv64/liftoff-assembler-riscv64.h
-@@ -580,7 +580,7 @@ void LiftoffAssembler::Store(Register ds
+@@ -589,7 +589,7 @@ void LiftoffAssembler::Store(Register dst_addr, Register offset_reg,
      pinned.set(dst_op.rm());
      LiftoffRegister tmp = GetUnusedRegister(src.reg_class(), pinned);
      // Save original value.
@@ -69,3 +81,5 @@ Signed-off-by: Khem Raj <[email protected]>
  
      src = tmp;
      pinned.set(tmp);
+--
+2.34.1
meta-oe/recipes-devtools/nodejs/nodejs_18.12.1.bb renamed from meta-oe/recipes-devtools/nodejs/nodejs_16.18.1.bb +11 -4
similarity index 93%
rename from meta-oe/recipes-devtools/nodejs/nodejs_16.18.1.bb
rename to meta-oe/recipes-devtools/nodejs/nodejs_18.12.1.bb
index a67948320..e96913e56 100644
@@ -1,13 +1,13 @@
 DESCRIPTION = "nodeJS Evented I/O for V8 JavaScript"
 HOMEPAGE = "http://nodejs.org"
 LICENSE = "MIT & ISC & BSD-2-Clause & BSD-3-Clause & Artistic-2.0"
-LIC_FILES_CHKSUM = "file://LICENSE;md5=6e54852cd826c41e80c6d80f6db00a85"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=dfd7ae796baf5326016a3865ee1dc632"
 
 DEPENDS = "openssl"
 DEPENDS:append:class-target = " qemu-native"
 DEPENDS:append:class-native = " c-ares-native"
 
-inherit pkgconfig python3native qemu
+inherit pkgconfig python3native qemu ptest
 
 COMPATIBLE_MACHINE:armv4 = "(!.*armv4).*"
 COMPATIBLE_MACHINE:armv5 = "(!.*armv5).*"
@@ -26,6 +26,7 @@ SRC_URI = "http://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz \
            file://0001-liftoff-Correct-function-signatures.patch \
            file://0001-mips-Use-32bit-cast-for-operand-on-mips32.patch \
            "
+
 SRC_URI:append:class-target = " \
            file://0001-Using-native-binaries.patch \
            "
@@ -35,7 +36,7 @@ SRC_URI:append:toolchain-clang:x86 = " \
 SRC_URI:append:toolchain-clang:powerpc64le = " \
            file://0001-ppc64-Do-not-use-mminimal-toc-with-clang.patch \
            "
-SRC_URI[sha256sum] = "1f8051a88f86f42064f4415fe7a980e59b0a502ecc8def583f6303bc4d445238"
+SRC_URI[sha256sum] = "4fa406451bc52659a290e52cfdb2162a760bd549da4b8bbebe6a29f296d938df"
 
 S = "${WORKDIR}/node-v${PV}"
 
@@ -151,6 +152,7 @@ do_configure () {
 
 do_compile () {
     export LD="${CXX}"
+    install -D ${RECIPE_SYSROOT_NATIVE}/etc/ssl/openssl.cnf ${B}/deps/openssl/nodejs-openssl.cnf
     install -D ${B}/v8-qemu-wrapper.sh ${B}/out/Release/v8-qemu-wrapper.sh
     oe_runmake BUILDTYPE=Release
 }
@@ -159,10 +161,15 @@ do_install () {
     oe_runmake install DESTDIR=${D}
 }
 
+do_install_ptest () {
+    cp -r  ${B}/out/Release/cctest ${D}${PTEST_PATH}/
+    cp -r ${B}/test ${D}${PTEST_PATH}
+    chown -R root:root ${D}${PTEST_PATH}
+}
+
 BINARIES = " \
     bytecode_builtins_list_generator \
     ${@bb.utils.contains('PACKAGECONFIG', 'icu', 'gen-regexp-special-case', '', d)} \
-    mkcodecache \
     node_mksnapshot \
     torque \
 "
Signature · 1 line
2.34.1
#1 lore raw
Quoted 2 lines · Archana via lists.openembedded.org

* Add initial ptest support using ctest only, it covered 20% of the nodejs tests. There are some more tests exist to add but will require additional work.

Archana,

Can you fill people in on where we are with extending the ptest coverage?

I'm asking you to do this on the list because we've talked about it privately but decided that it isn't a short or even a medium-term priority for us.

We'd like to get the other ~80% working but it may be several months before we get back to this work. If anyone else is interested, please jump in!

From what I remember, at a high level, we need to add a few npm packages and building some test data files into the -ptest part of nodejs. If you can provide some but not exhaustive details, then maybe someone will pick up where we left off. Please provide any work-in-progress recipes changes also as a starting point for others.

Signature · 2 lines
# Randy MacLeod
# Wind River Linux