buildroot.busybox.net archive mirror
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/4] package/nodejs: fixup qemu dependencies
@ 2022-09-25 17:19 Thomas Petazzoni
  2022-09-25 17:19 ` [Buildroot] [PATCH 2/4] package/nodejs: bump to v16.17.1 Thomas Petazzoni via buildroot
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Thomas Petazzoni @ 2022-09-25 17:19 UTC (permalink / raw)
  To: Buildroot List
  Cc: Alexandru Ardelean, Angelo Compagnucci, Martin Bark,
	Thomas Petazzoni, Daniel Price

Commit 1facb09b94bf806b301868539185c0ff9ddffee2 ("package/nodejs:
build host-nodejs only if we're installing modules with NPM") forgot
to account for the dependency on Qemu. Now that nodejs no longer
depends on host-nodejs, but needs host-qemu, we need to make sure that
nodejs selects the relevant BR2_PACKAGE_HOST_QEMU options.

So this patch:

 - Drops the dependency of BR2_PACKAGE_NODEJS_ARCH_SUPPORTS on
   BR2_PACKAGE_QEMU_ARCH_SUPPORTS_TARGET, which was incorrect: we
   don't care about running Qemu on the target. We care about
   host-qemu supporting the emulation of the target architecture,
   which is what BR2_PACKAGE_HOST_QEMU_ARCH_SUPPORTS is for.

 - Adds the dependency to the relevant BR2_PACKAGE_HOST_QEMU options
   to BR2_PACKAGE_NODEJS, so that host-qemu is built with the
   appropriate features needed to build the target nodejs.

 - Removes the qemu related dependencies from host-nodejs, which does
   not need Qemu at all.

Without this change the build of nodejs without npm enabled is broken
as the host-qemu that gets built does not have all the features that
are needed. There are no autobuild failures at this point, however.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 package/nodejs/Config.in      | 4 +++-
 package/nodejs/Config.in.host | 4 ----
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/package/nodejs/Config.in b/package/nodejs/Config.in
index 8d0bd8fd60..5375dfeacd 100644
--- a/package/nodejs/Config.in
+++ b/package/nodejs/Config.in
@@ -6,7 +6,7 @@ config BR2_PACKAGE_NODEJS_ARCH_SUPPORTS
 	default y if BR2_aarch64 || BR2_i386 || BR2_x86_64
 	# libuv
 	depends on BR2_TOOLCHAIN_HAS_SYNC_4
-	depends on BR2_PACKAGE_QEMU_ARCH_SUPPORTS_TARGET
+	depends on BR2_PACKAGE_HOST_QEMU_USER_ARCH_SUPPORTS
 
 comment "nodejs needs a toolchain w/ C++, dynamic library, NPTL, gcc >= 7, wchar, host gcc >= 8"
 	depends on BR2_USE_MMU
@@ -31,6 +31,8 @@ config BR2_PACKAGE_NODEJS
 	select BR2_PACKAGE_HOST_PYTHON3
 	select BR2_PACKAGE_HOST_PYTHON3_BZIP2
 	select BR2_PACKAGE_HOST_PYTHON3_SSL
+	select BR2_PACKAGE_HOST_QEMU
+	select BR2_PACKAGE_HOST_QEMU_LINUX_USER_MODE
 	select BR2_PACKAGE_C_ARES
 	select BR2_PACKAGE_LIBUV
 	select BR2_PACKAGE_ZLIB
diff --git a/package/nodejs/Config.in.host b/package/nodejs/Config.in.host
index 4ceaf0c73e..f7f2b80a9b 100644
--- a/package/nodejs/Config.in.host
+++ b/package/nodejs/Config.in.host
@@ -1,12 +1,9 @@
 config BR2_PACKAGE_HOST_NODEJS
 	bool "host nodejs"
-	depends on BR2_PACKAGE_HOST_QEMU_USER_ARCH_SUPPORTS
 	depends on BR2_HOST_GCC_AT_LEAST_8
 	select BR2_PACKAGE_HOST_PYTHON3
 	select BR2_PACKAGE_HOST_PYTHON3_BZIP2
 	select BR2_PACKAGE_HOST_PYTHON3_SSL
-	select BR2_PACKAGE_HOST_QEMU
-	select BR2_PACKAGE_HOST_QEMU_LINUX_USER_MODE
 	help
 	  Event-driven I/O server-side JavaScript environment based on
 	  V8.
@@ -14,5 +11,4 @@ config BR2_PACKAGE_HOST_NODEJS
 	  http://nodejs.org/
 
 comment "host nodejs needs a host gcc >= 8"
-	depends on BR2_PACKAGE_HOST_QEMU_USER_ARCH_SUPPORTS
 	depends on !BR2_HOST_GCC_AT_LEAST_8
-- 
2.37.3

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH 2/4] package/nodejs: bump to v16.17.1
  2022-09-25 17:19 [Buildroot] [PATCH 1/4] package/nodejs: fixup qemu dependencies Thomas Petazzoni
@ 2022-09-25 17:19 ` Thomas Petazzoni via buildroot
  2022-09-25 18:17   ` Yann E. MORIN
  2022-10-11 19:19   ` Peter Korsgaard
  2022-09-25 17:19 ` [Buildroot] [PATCH 3/4] package/nodejs: add patch to adjust default NodeJS search path Thomas Petazzoni
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 12+ messages in thread
From: Thomas Petazzoni via buildroot @ 2022-09-25 17:19 UTC (permalink / raw)
  To: Buildroot List
  Cc: Alexandru Ardelean, Angelo Compagnucci, Daniel Price,
	Thomas Petazzoni, Martin Bark

This is currently the latest version in the v16.x branch.

Patch 0001-add-qemu-wrapper-support.patch needs some minor adaptations
to resolve conflicts with other unrelated upstream changes. The other
patches are simply refreshed.

The license file is updates due to:

 - Reformatting changes

 - Addition of the mention of some files being under GPLv3, but it's
   only the autoconf machinery: aclocal.m4 and config.guess, so it's
   not relevant to add in our LICENSE variable.

 - Addition of the mention of another file being under the MIT
   license (install-sh), and MIT is already listed, and this file is
   anyway only part of the autoconf machinery.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 .../0001-add-qemu-wrapper-support.patch       | 28 +++++++++----------
 ...heck-if-uclibc-has-backtrace-support.patch |  6 ++--
 ...lude-obj-name-in-shared-intermediate.patch |  4 +--
 package/nodejs/nodejs.hash                    |  6 ++--
 package/nodejs/nodejs.mk                      |  2 +-
 5 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/package/nodejs/0001-add-qemu-wrapper-support.patch b/package/nodejs/0001-add-qemu-wrapper-support.patch
index 8d09601158..184f3d19b7 100644
--- a/package/nodejs/0001-add-qemu-wrapper-support.patch
+++ b/package/nodejs/0001-add-qemu-wrapper-support.patch
@@ -1,4 +1,4 @@
-From c6103ceab64b73c1a25ece3315ea8f52507c2bfe Mon Sep 17 00:00:00 2001
+From 1f6c55d7318e7075169004b4314708f4766ec193 Mon Sep 17 00:00:00 2001
 From: Adam Duskett <aduskett@gmail.com>
 Date: Mon, 27 Sep 2021 12:55:09 -0700
 Subject: [PATCH] add qemu-wrapper support
@@ -22,10 +22,10 @@ Signed-off-by: Adam Duskett <aduskett@gmail.com>
  2 files changed, 7 insertions(+), 7 deletions(-)
 
 diff --git a/node.gyp b/node.gyp
-index 74e9f9cc2e..c3eaab6c92 100644
+index 97cdbb531d..db5cf51ce6 100644
 --- a/node.gyp
 +++ b/node.gyp
-@@ -295,7 +295,7 @@
+@@ -319,7 +319,7 @@
                'action_name': 'run_mkcodecache',
                'process_outputs_as_sources': 1,
                'inputs': [
@@ -34,17 +34,17 @@ index 74e9f9cc2e..c3eaab6c92 100644
                ],
                'outputs': [
                  '<(SHARED_INTERMEDIATE_DIR)/node_code_cache.cc',
-@@ -320,7 +320,7 @@
-               'action_name': 'node_mksnapshot',
-               'process_outputs_as_sources': 1,
-               'inputs': [
--                '<(node_mksnapshot_exec)',
-+                @MAYBE_WRAPPER@ '<(node_mksnapshot_exec)',
-               ],
-               'outputs': [
-                 '<(SHARED_INTERMEDIATE_DIR)/node_snapshot.cc',
+@@ -346,7 +346,7 @@
+                   'action_name': 'node_mksnapshot',
+                   'process_outputs_as_sources': 1,
+                   'inputs': [
+-                    '<(node_mksnapshot_exec)',
++                    @MAYBE_WRAPPER@ '<(node_mksnapshot_exec)',
+                     '<(node_snapshot_main)',
+                   ],
+                   'outputs': [
 diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp
-index 39b96803c7..9321982ea4 100644
+index 73099a03e4..88ca91efb4 100644
 --- a/tools/v8_gypfiles/v8.gyp
 +++ b/tools/v8_gypfiles/v8.gyp
 @@ -68,7 +68,7 @@
@@ -83,7 +83,7 @@ index 39b96803c7..9321982ea4 100644
            ],
            'outputs': [
              '<(INTERMEDIATE_DIR)/snapshot.cc',
-@@ -1503,7 +1503,7 @@
+@@ -1505,7 +1505,7 @@
          {
            'action_name': 'run_gen-regexp-special-case_action',
            'inputs': [
diff --git a/package/nodejs/0002-check-if-uclibc-has-backtrace-support.patch b/package/nodejs/0002-check-if-uclibc-has-backtrace-support.patch
index 079bbb4366..367b9fb8d5 100644
--- a/package/nodejs/0002-check-if-uclibc-has-backtrace-support.patch
+++ b/package/nodejs/0002-check-if-uclibc-has-backtrace-support.patch
@@ -1,4 +1,4 @@
-From 7c69553d7275bbcaa88fada8ccd0d2d9f787e1ad Mon Sep 17 00:00:00 2001
+From f1a15cea9a47d0a9b0ae78fb22fef3a268e355ad Mon Sep 17 00:00:00 2001
 From: Martin Bark <martin@barkynet.com>
 Date: Sat, 4 Mar 2017 20:41:40 +0000
 Subject: [PATCH] check if uclibc has backtrace support
@@ -9,7 +9,7 @@ Signed-off-by: Martin Bark <martin@barkynet.com>
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/deps/v8/src/base/debug/stack_trace_posix.cc b/deps/v8/src/base/debug/stack_trace_posix.cc
-index 87c0a73..d2c182a 100644
+index 270f1ca4e0..5227e88671 100644
 --- a/deps/v8/src/base/debug/stack_trace_posix.cc
 +++ b/deps/v8/src/base/debug/stack_trace_posix.cc
 @@ -25,7 +25,7 @@
@@ -22,5 +22,5 @@ index 87c0a73..d2c182a 100644
  #endif
  
 -- 
-2.7.4
+2.37.3
 
diff --git a/package/nodejs/0003-include-obj-name-in-shared-intermediate.patch b/package/nodejs/0003-include-obj-name-in-shared-intermediate.patch
index b439c66a0c..5b44e6c400 100644
--- a/package/nodejs/0003-include-obj-name-in-shared-intermediate.patch
+++ b/package/nodejs/0003-include-obj-name-in-shared-intermediate.patch
@@ -1,4 +1,4 @@
-From e6e691d093de440e0f408d48971e2b7332a07d58 Mon Sep 17 00:00:00 2001
+From af47d317e5ae12978c1cdc40627008ada144f98b Mon Sep 17 00:00:00 2001
 From: Min RK <benjaminrk@gmail.com>
 Date: Fri, 19 Feb 2021 11:57:04 +0100
 Subject: [PATCH] include obj name in shared intermediate
@@ -12,7 +12,7 @@ Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
  1 file changed, 7 insertions(+), 1 deletion(-)
 
 diff --git a/tools/gyp/pylib/gyp/generator/ninja.py b/tools/gyp/pylib/gyp/generator/ninja.py
-index d173bf2299..efaeee53ef 100644
+index 3db3771ac9..2e0a021703 100644
 --- a/tools/gyp/pylib/gyp/generator/ninja.py
 +++ b/tools/gyp/pylib/gyp/generator/ninja.py
 @@ -42,7 +42,7 @@ generator_default_variables = {
diff --git a/package/nodejs/nodejs.hash b/package/nodejs/nodejs.hash
index 12ae449ab4..83e4c271ce 100644
--- a/package/nodejs/nodejs.hash
+++ b/package/nodejs/nodejs.hash
@@ -1,5 +1,5 @@
-# From https://nodejs.org/dist/v16.16.0/SHASUMS256.txt
-sha256  145151eff3b2aa5ebe73384009c52271a83740ae687a93c98c628cd7d52736eb  node-v16.16.0.tar.xz
+# From https://nodejs.org/dist/v16.17.1/SHASUMS256.txt
+sha256  6721feb4152d56d2c6b358ce397abd5a7f1daf09ee2e25c5021b9b4d3f86a330  node-v16.17.1.tar.xz
 
 # Hash for license file
-sha256  6211cc77f9ceaf365db12faf050775b3a1e6da7a1eff3577ba006c4918103c33  LICENSE
+sha256  69090e865afa7c62715b97f0712632d2923bd7a5faba91f94e4e75a2f9219d5e  LICENSE
diff --git a/package/nodejs/nodejs.mk b/package/nodejs/nodejs.mk
index e9fe96812f..05456e3443 100644
--- a/package/nodejs/nodejs.mk
+++ b/package/nodejs/nodejs.mk
@@ -4,7 +4,7 @@
 #
 ################################################################################
 
-NODEJS_VERSION = 16.16.0
+NODEJS_VERSION = 16.17.1
 NODEJS_SOURCE = node-v$(NODEJS_VERSION).tar.xz
 NODEJS_SITE = http://nodejs.org/dist/v$(NODEJS_VERSION)
 NODEJS_DEPENDENCIES = \
-- 
2.37.3

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH 3/4] package/nodejs: add patch to adjust default NodeJS search path
  2022-09-25 17:19 [Buildroot] [PATCH 1/4] package/nodejs: fixup qemu dependencies Thomas Petazzoni
  2022-09-25 17:19 ` [Buildroot] [PATCH 2/4] package/nodejs: bump to v16.17.1 Thomas Petazzoni via buildroot
@ 2022-09-25 17:19 ` Thomas Petazzoni
  2022-09-25 18:15   ` Yann E. MORIN
  2022-09-25 17:19 ` [Buildroot] [PATCH 4/4] support/testing/tests: add NodeJS tests Thomas Petazzoni
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Thomas Petazzoni @ 2022-09-25 17:19 UTC (permalink / raw)
  To: Buildroot List
  Cc: Alexandru Ardelean, Angelo Compagnucci, Daniel Price,
	Thomas Petazzoni, Martin Bark

By default, NodeJS searches global modules in /usr/lib/node, but NPM
installs them in /usr/lib/node_modules/. Therefore by default, if one
installs modules with BR2_PACKAGE_NODEJS_MODULES_ADDITIONAL, they are
not accessible by NodeJS, unless by passing a
NODE_PATH=/usr/lib/node_modules/ variable. Since this is not obvious,
and it's nicer when things work out of the box, we simply patch NodeJS
to look for modules at the right place.

See
https://stackoverflow.com/questions/15636367/nodejs-require-a-global-module-package
for some discussions on this topic.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
I am not 100% sure this is the correct approach, and I would
definitely like to get the feedback from some NodeJS people.
---
 ...ules-cjs-loader.js-adjust-default-pa.patch | 35 +++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 package/nodejs/0004-lib-internal-modules-cjs-loader.js-adjust-default-pa.patch

diff --git a/package/nodejs/0004-lib-internal-modules-cjs-loader.js-adjust-default-pa.patch b/package/nodejs/0004-lib-internal-modules-cjs-loader.js-adjust-default-pa.patch
new file mode 100644
index 0000000000..b4692a4e5f
--- /dev/null
+++ b/package/nodejs/0004-lib-internal-modules-cjs-loader.js-adjust-default-pa.patch
@@ -0,0 +1,35 @@
+From 4ed7de24fe18bb75b6e38922eb33141e2cec43dd Mon Sep 17 00:00:00 2001
+From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
+Date: Sun, 25 Sep 2022 11:10:06 +0200
+Subject: [PATCH] lib/internal/modules/cjs/loader.js: adjust default path to
+ search modules
+
+NPM installs modules in /usr/lib/node_modules/, but by default NodeJS
+searches for them in /usr/lib/node/. We could also set the NODE_PATH
+environment variable, but it is more convienient to have NodeJS
+configured by default to find modules where they are installed.
+
+This issue is discussed at
+https://stackoverflow.com/questions/15636367/nodejs-require-a-global-module-package.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
+---
+ lib/internal/modules/cjs/loader.js | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
+index f1971c40a4..52fcd56125 100644
+--- a/lib/internal/modules/cjs/loader.js
++++ b/lib/internal/modules/cjs/loader.js
+@@ -1261,7 +1261,7 @@ Module._initPaths = function() {
+     path.resolve(process.execPath, '..') :
+     path.resolve(process.execPath, '..', '..');
+ 
+-  const paths = [path.resolve(prefixDir, 'lib', 'node')];
++  const paths = [path.resolve(prefixDir, 'lib', 'node_modules')];
+ 
+   if (homeDir) {
+     ArrayPrototypeUnshift(paths, path.resolve(homeDir, '.node_libraries'));
+-- 
+2.37.3
+
-- 
2.37.3

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* [Buildroot] [PATCH 4/4] support/testing/tests: add NodeJS tests
  2022-09-25 17:19 [Buildroot] [PATCH 1/4] package/nodejs: fixup qemu dependencies Thomas Petazzoni
  2022-09-25 17:19 ` [Buildroot] [PATCH 2/4] package/nodejs: bump to v16.17.1 Thomas Petazzoni via buildroot
  2022-09-25 17:19 ` [Buildroot] [PATCH 3/4] package/nodejs: add patch to adjust default NodeJS search path Thomas Petazzoni
@ 2022-09-25 17:19 ` Thomas Petazzoni
  2022-09-25 18:16 ` [Buildroot] [PATCH 1/4] package/nodejs: fixup qemu dependencies Yann E. MORIN
  2022-10-11 18:53 ` Peter Korsgaard
  4 siblings, 0 replies; 12+ messages in thread
From: Thomas Petazzoni @ 2022-09-25 17:19 UTC (permalink / raw)
  To: Buildroot List; +Cc: Alexandru Ardelean, Angelo Compagnucci, Thomas Petazzoni

This commit adds two new test cases:

 - TestNodeJSBasic which builds a target configuration with just
   NodeJS enabled, and which runs a very simple NodeJS script on the
   target.

 - TestNodeJSModule, which builds a target configuration with NodeJS
   enabled + the installation of one extra module, which means npm on
   the host (from host-nodejs) is used, and which runs a very simple
   NodeJS script on the target that uses this extra module.

Having both tests separately allows to validate that both nodejs-only
and nodejs+host-nodejs configurations behave correctly, at least in
minimal scenarios.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 DEVELOPERS                                    |  3 ++
 .../tests/package/sample_nodejs_basic.js      |  3 ++
 .../tests/package/sample_nodejs_module.js     |  7 +++
 support/testing/tests/package/test_nodejs.py  | 52 +++++++++++++++++++
 4 files changed, 65 insertions(+)
 create mode 100644 support/testing/tests/package/sample_nodejs_basic.js
 create mode 100644 support/testing/tests/package/sample_nodejs_module.js
 create mode 100644 support/testing/tests/package/test_nodejs.py

diff --git a/DEVELOPERS b/DEVELOPERS
index 51d025173a..564149de0f 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2927,11 +2927,14 @@ F:	package/weston/
 F:	support/testing/tests/boot/test_grub.py
 F:	support/testing/tests/boot/test_grub/
 F:	support/testing/tests/boot/test_syslinux.py
+F:	support/testing/tests/package/sample_nodejs_basic.js
+F:	support/testing/tests/package/sample_nodejs_module.js
 F:	support/testing/tests/package/sample_python_augeas.py
 F:	support/testing/tests/package/sample_python_flask.py
 F:	support/testing/tests/package/sample_python_flask_expects_json.py
 F:	support/testing/tests/package/sample_python_git.py
 F:	support/testing/tests/package/sample_python_unittest_xml_reporting.py
+F:	support/testing/tests/package/test_nodejs.py
 F:	support/testing/tests/package/test_python_augeas.py
 F:	support/testing/tests/package/test_python_flask.py
 F:	support/testing/tests/package/test_python_flask_expects_json.py
diff --git a/support/testing/tests/package/sample_nodejs_basic.js b/support/testing/tests/package/sample_nodejs_basic.js
new file mode 100644
index 0000000000..7633173c64
--- /dev/null
+++ b/support/testing/tests/package/sample_nodejs_basic.js
@@ -0,0 +1,3 @@
+var assert = require('assert');
+assert.strictEqual(1, 1);
+console.log("Hello World");
diff --git a/support/testing/tests/package/sample_nodejs_module.js b/support/testing/tests/package/sample_nodejs_module.js
new file mode 100644
index 0000000000..57aee73408
--- /dev/null
+++ b/support/testing/tests/package/sample_nodejs_module.js
@@ -0,0 +1,7 @@
+var assert = require('assert');
+var lodash = require('lodash');
+result = lodash.chunk(['a', 'b', 'c', 'd'], 2);
+expected = [ [ 'a', 'b' ], [ 'c', 'd' ] ];
+assert.deepStrictEqual(result, expected)
+
+
diff --git a/support/testing/tests/package/test_nodejs.py b/support/testing/tests/package/test_nodejs.py
new file mode 100644
index 0000000000..9463c76b72
--- /dev/null
+++ b/support/testing/tests/package/test_nodejs.py
@@ -0,0 +1,52 @@
+import os
+
+import infra.basetest
+
+
+class TestNodeJSBasic(infra.basetest.BRTest):
+    config = \
+        """
+        BR2_arm=y
+        BR2_cortex_a9=y
+        BR2_ARM_ENABLE_VFP=y
+        BR2_TOOLCHAIN_EXTERNAL=y
+        BR2_PACKAGE_NODEJS=y
+        BR2_TARGET_ROOTFS_CPIO=y
+        # BR2_TARGET_ROOTFS_TAR is not set
+        BR2_ROOTFS_POST_BUILD_SCRIPT="{}"
+        BR2_ROOTFS_POST_SCRIPT_ARGS="{}"
+        """.format(infra.filepath("tests/package/copy-sample-script-to-target.sh"),
+                   infra.filepath("tests/package/sample_nodejs_basic.js"))
+
+    def test_run(self):
+        cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
+        self.emulator.boot(arch="armv7",
+                           kernel="builtin",
+                           options=["-initrd", cpio_file])
+        self.emulator.login()
+        self.assertRunOk("node sample_nodejs_basic.js")
+
+
+class TestNodeJSModule(infra.basetest.BRTest):
+    config = \
+        """
+        BR2_arm=y
+        BR2_cortex_a9=y
+        BR2_ARM_ENABLE_VFP=y
+        BR2_TOOLCHAIN_EXTERNAL=y
+        BR2_PACKAGE_NODEJS=y
+        BR2_PACKAGE_NODEJS_MODULES_ADDITIONAL="lodash"
+        BR2_TARGET_ROOTFS_CPIO=y
+        # BR2_TARGET_ROOTFS_TAR is not set
+        BR2_ROOTFS_POST_BUILD_SCRIPT="{}"
+        BR2_ROOTFS_POST_SCRIPT_ARGS="{}"
+        """.format(infra.filepath("tests/package/copy-sample-script-to-target.sh"),
+                   infra.filepath("tests/package/sample_nodejs_module.js"))
+
+    def test_run(self):
+        cpio_file = os.path.join(self.builddir, "images", "rootfs.cpio")
+        self.emulator.boot(arch="armv7",
+                           kernel="builtin",
+                           options=["-initrd", cpio_file])
+        self.emulator.login()
+        self.assertRunOk("node sample_nodejs_module.js")
-- 
2.37.3

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 3/4] package/nodejs: add patch to adjust default NodeJS search path
  2022-09-25 17:19 ` [Buildroot] [PATCH 3/4] package/nodejs: add patch to adjust default NodeJS search path Thomas Petazzoni
@ 2022-09-25 18:15   ` Yann E. MORIN
  2022-09-25 19:23     ` Thomas Petazzoni
  0 siblings, 1 reply; 12+ messages in thread
From: Yann E. MORIN @ 2022-09-25 18:15 UTC (permalink / raw)
  To: Thomas Petazzoni
  Cc: Alexandru Ardelean, Angelo Compagnucci, Martin Bark,
	Daniel Price, Buildroot List

On 2022-09-25 19:19 +0200, Thomas Petazzoni spake thusly:
> By default, NodeJS searches global modules in /usr/lib/node, but NPM
> installs them in /usr/lib/node_modules/. Therefore by default, if one
> installs modules with BR2_PACKAGE_NODEJS_MODULES_ADDITIONAL, they are
> not accessible by NodeJS, unless by passing a
> NODE_PATH=/usr/lib/node_modules/ variable. Since this is not obvious,
> and it's nicer when things work out of the box, we simply patch NodeJS
> to look for modules at the right place.
> 
> See
> https://stackoverflow.com/questions/15636367/nodejs-require-a-global-module-package
> for some discussions on this topic.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> ---
> I am not 100% sure this is the correct approach, and I would
> definitely like to get the feedback from some NodeJS people.
> ---
>  ...ules-cjs-loader.js-adjust-default-pa.patch | 35 +++++++++++++++++++
>  1 file changed, 35 insertions(+)
>  create mode 100644 package/nodejs/0004-lib-internal-modules-cjs-loader.js-adjust-default-pa.patch
> 
> diff --git a/package/nodejs/0004-lib-internal-modules-cjs-loader.js-adjust-default-pa.patch b/package/nodejs/0004-lib-internal-modules-cjs-loader.js-adjust-default-pa.patch
> new file mode 100644
> index 0000000000..b4692a4e5f
> --- /dev/null
> +++ b/package/nodejs/0004-lib-internal-modules-cjs-loader.js-adjust-default-pa.patch
> @@ -0,0 +1,35 @@
> +From 4ed7de24fe18bb75b6e38922eb33141e2cec43dd Mon Sep 17 00:00:00 2001
> +From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> +Date: Sun, 25 Sep 2022 11:10:06 +0200
> +Subject: [PATCH] lib/internal/modules/cjs/loader.js: adjust default path to
> + search modules
> +
> +NPM installs modules in /usr/lib/node_modules/, but by default NodeJS
> +searches for them in /usr/lib/node/. We could also set the NODE_PATH
> +environment variable, but it is more convienient to have NodeJS
> +configured by default to find modules where they are installed.
> +
> +This issue is discussed at
> +https://stackoverflow.com/questions/15636367/nodejs-require-a-global-module-package.
> +
> +Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> +---
> + lib/internal/modules/cjs/loader.js | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
> +index f1971c40a4..52fcd56125 100644
> +--- a/lib/internal/modules/cjs/loader.js
> ++++ b/lib/internal/modules/cjs/loader.js
> +@@ -1261,7 +1261,7 @@ Module._initPaths = function() {
> +     path.resolve(process.execPath, '..') :
> +     path.resolve(process.execPath, '..', '..');
> + 
> +-  const paths = [path.resolve(prefixDir, 'lib', 'node')];
> ++  const paths = [path.resolve(prefixDir, 'lib', 'node_modules')];

It looks like this is an array, so maybe we could keep the original
path, and add the npm installation path:

    const paths = [path.resolve(prefixDir, 'lib', 'node'),
                   path.resolve(prefixDir, 'lib', 'node_modules'),];

This, in case some ot-of-tree packages simply copy files into the
original .../node/ directory.

Alternatively, we could symlink node_modules to node.

Regards,
Yann E. MORIN.

> +   if (homeDir) {
> +     ArrayPrototypeUnshift(paths, path.resolve(homeDir, '.node_libraries'));
> +-- 
> +2.37.3
> +
> -- 
> 2.37.3
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/4] package/nodejs: fixup qemu dependencies
  2022-09-25 17:19 [Buildroot] [PATCH 1/4] package/nodejs: fixup qemu dependencies Thomas Petazzoni
                   ` (2 preceding siblings ...)
  2022-09-25 17:19 ` [Buildroot] [PATCH 4/4] support/testing/tests: add NodeJS tests Thomas Petazzoni
@ 2022-09-25 18:16 ` Yann E. MORIN
  2022-10-11 18:53 ` Peter Korsgaard
  4 siblings, 0 replies; 12+ messages in thread
From: Yann E. MORIN @ 2022-09-25 18:16 UTC (permalink / raw)
  To: Thomas Petazzoni
  Cc: Alexandru Ardelean, Angelo Compagnucci, Daniel Price,
	Martin Bark, Buildroot List

Tomas, All,

On 2022-09-25 19:19 +0200, Thomas Petazzoni spake thusly:
> Commit 1facb09b94bf806b301868539185c0ff9ddffee2 ("package/nodejs:
> build host-nodejs only if we're installing modules with NPM") forgot
> to account for the dependency on Qemu. Now that nodejs no longer
> depends on host-nodejs, but needs host-qemu, we need to make sure that
> nodejs selects the relevant BR2_PACKAGE_HOST_QEMU options.
> 
> So this patch:
> 
>  - Drops the dependency of BR2_PACKAGE_NODEJS_ARCH_SUPPORTS on
>    BR2_PACKAGE_QEMU_ARCH_SUPPORTS_TARGET, which was incorrect: we
>    don't care about running Qemu on the target. We care about
>    host-qemu supporting the emulation of the target architecture,
>    which is what BR2_PACKAGE_HOST_QEMU_ARCH_SUPPORTS is for.
> 
>  - Adds the dependency to the relevant BR2_PACKAGE_HOST_QEMU options
>    to BR2_PACKAGE_NODEJS, so that host-qemu is built with the
>    appropriate features needed to build the target nodejs.
> 
>  - Removes the qemu related dependencies from host-nodejs, which does
>    not need Qemu at all.
> 
> Without this change the build of nodejs without npm enabled is broken
> as the host-qemu that gets built does not have all the features that
> are needed. There are no autobuild failures at this point, however.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

Applied to master, thanks.

Regards,
Yann E. MORIN.

> ---
>  package/nodejs/Config.in      | 4 +++-
>  package/nodejs/Config.in.host | 4 ----
>  2 files changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/package/nodejs/Config.in b/package/nodejs/Config.in
> index 8d0bd8fd60..5375dfeacd 100644
> --- a/package/nodejs/Config.in
> +++ b/package/nodejs/Config.in
> @@ -6,7 +6,7 @@ config BR2_PACKAGE_NODEJS_ARCH_SUPPORTS
>  	default y if BR2_aarch64 || BR2_i386 || BR2_x86_64
>  	# libuv
>  	depends on BR2_TOOLCHAIN_HAS_SYNC_4
> -	depends on BR2_PACKAGE_QEMU_ARCH_SUPPORTS_TARGET
> +	depends on BR2_PACKAGE_HOST_QEMU_USER_ARCH_SUPPORTS
>  
>  comment "nodejs needs a toolchain w/ C++, dynamic library, NPTL, gcc >= 7, wchar, host gcc >= 8"
>  	depends on BR2_USE_MMU
> @@ -31,6 +31,8 @@ config BR2_PACKAGE_NODEJS
>  	select BR2_PACKAGE_HOST_PYTHON3
>  	select BR2_PACKAGE_HOST_PYTHON3_BZIP2
>  	select BR2_PACKAGE_HOST_PYTHON3_SSL
> +	select BR2_PACKAGE_HOST_QEMU
> +	select BR2_PACKAGE_HOST_QEMU_LINUX_USER_MODE
>  	select BR2_PACKAGE_C_ARES
>  	select BR2_PACKAGE_LIBUV
>  	select BR2_PACKAGE_ZLIB
> diff --git a/package/nodejs/Config.in.host b/package/nodejs/Config.in.host
> index 4ceaf0c73e..f7f2b80a9b 100644
> --- a/package/nodejs/Config.in.host
> +++ b/package/nodejs/Config.in.host
> @@ -1,12 +1,9 @@
>  config BR2_PACKAGE_HOST_NODEJS
>  	bool "host nodejs"
> -	depends on BR2_PACKAGE_HOST_QEMU_USER_ARCH_SUPPORTS
>  	depends on BR2_HOST_GCC_AT_LEAST_8
>  	select BR2_PACKAGE_HOST_PYTHON3
>  	select BR2_PACKAGE_HOST_PYTHON3_BZIP2
>  	select BR2_PACKAGE_HOST_PYTHON3_SSL
> -	select BR2_PACKAGE_HOST_QEMU
> -	select BR2_PACKAGE_HOST_QEMU_LINUX_USER_MODE
>  	help
>  	  Event-driven I/O server-side JavaScript environment based on
>  	  V8.
> @@ -14,5 +11,4 @@ config BR2_PACKAGE_HOST_NODEJS
>  	  http://nodejs.org/
>  
>  comment "host nodejs needs a host gcc >= 8"
> -	depends on BR2_PACKAGE_HOST_QEMU_USER_ARCH_SUPPORTS
>  	depends on !BR2_HOST_GCC_AT_LEAST_8
> -- 
> 2.37.3
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 2/4] package/nodejs: bump to v16.17.1
  2022-09-25 17:19 ` [Buildroot] [PATCH 2/4] package/nodejs: bump to v16.17.1 Thomas Petazzoni via buildroot
@ 2022-09-25 18:17   ` Yann E. MORIN
  2022-10-11 19:19   ` Peter Korsgaard
  1 sibling, 0 replies; 12+ messages in thread
From: Yann E. MORIN @ 2022-09-25 18:17 UTC (permalink / raw)
  To: Thomas Petazzoni
  Cc: Alexandru Ardelean, Angelo Compagnucci, Martin Bark,
	Daniel Price, Buildroot List

Thomas, All,

On 2022-09-25 19:19 +0200, Thomas Petazzoni via buildroot spake thusly:
> This is currently the latest version in the v16.x branch.
> 
> Patch 0001-add-qemu-wrapper-support.patch needs some minor adaptations
> to resolve conflicts with other unrelated upstream changes. The other
> patches are simply refreshed.
> 
> The license file is updates due to:
> 
>  - Reformatting changes
> 
>  - Addition of the mention of some files being under GPLv3, but it's
>    only the autoconf machinery: aclocal.m4 and config.guess, so it's
>    not relevant to add in our LICENSE variable.
> 
>  - Addition of the mention of another file being under the MIT
>    license (install-sh), and MIT is already listed, and this file is
>    anyway only part of the autoconf machinery.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

Applied to master, thanks.

Regards,
Yann E. MORIN.

> ---
>  .../0001-add-qemu-wrapper-support.patch       | 28 +++++++++----------
>  ...heck-if-uclibc-has-backtrace-support.patch |  6 ++--
>  ...lude-obj-name-in-shared-intermediate.patch |  4 +--
>  package/nodejs/nodejs.hash                    |  6 ++--
>  package/nodejs/nodejs.mk                      |  2 +-
>  5 files changed, 23 insertions(+), 23 deletions(-)
> 
> diff --git a/package/nodejs/0001-add-qemu-wrapper-support.patch b/package/nodejs/0001-add-qemu-wrapper-support.patch
> index 8d09601158..184f3d19b7 100644
> --- a/package/nodejs/0001-add-qemu-wrapper-support.patch
> +++ b/package/nodejs/0001-add-qemu-wrapper-support.patch
> @@ -1,4 +1,4 @@
> -From c6103ceab64b73c1a25ece3315ea8f52507c2bfe Mon Sep 17 00:00:00 2001
> +From 1f6c55d7318e7075169004b4314708f4766ec193 Mon Sep 17 00:00:00 2001
>  From: Adam Duskett <aduskett@gmail.com>
>  Date: Mon, 27 Sep 2021 12:55:09 -0700
>  Subject: [PATCH] add qemu-wrapper support
> @@ -22,10 +22,10 @@ Signed-off-by: Adam Duskett <aduskett@gmail.com>
>   2 files changed, 7 insertions(+), 7 deletions(-)
>  
>  diff --git a/node.gyp b/node.gyp
> -index 74e9f9cc2e..c3eaab6c92 100644
> +index 97cdbb531d..db5cf51ce6 100644
>  --- a/node.gyp
>  +++ b/node.gyp
> -@@ -295,7 +295,7 @@
> +@@ -319,7 +319,7 @@
>                 'action_name': 'run_mkcodecache',
>                 'process_outputs_as_sources': 1,
>                 'inputs': [
> @@ -34,17 +34,17 @@ index 74e9f9cc2e..c3eaab6c92 100644
>                 ],
>                 'outputs': [
>                   '<(SHARED_INTERMEDIATE_DIR)/node_code_cache.cc',
> -@@ -320,7 +320,7 @@
> -               'action_name': 'node_mksnapshot',
> -               'process_outputs_as_sources': 1,
> -               'inputs': [
> --                '<(node_mksnapshot_exec)',
> -+                @MAYBE_WRAPPER@ '<(node_mksnapshot_exec)',
> -               ],
> -               'outputs': [
> -                 '<(SHARED_INTERMEDIATE_DIR)/node_snapshot.cc',
> +@@ -346,7 +346,7 @@
> +                   'action_name': 'node_mksnapshot',
> +                   'process_outputs_as_sources': 1,
> +                   'inputs': [
> +-                    '<(node_mksnapshot_exec)',
> ++                    @MAYBE_WRAPPER@ '<(node_mksnapshot_exec)',
> +                     '<(node_snapshot_main)',
> +                   ],
> +                   'outputs': [
>  diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp
> -index 39b96803c7..9321982ea4 100644
> +index 73099a03e4..88ca91efb4 100644
>  --- a/tools/v8_gypfiles/v8.gyp
>  +++ b/tools/v8_gypfiles/v8.gyp
>  @@ -68,7 +68,7 @@
> @@ -83,7 +83,7 @@ index 39b96803c7..9321982ea4 100644
>             ],
>             'outputs': [
>               '<(INTERMEDIATE_DIR)/snapshot.cc',
> -@@ -1503,7 +1503,7 @@
> +@@ -1505,7 +1505,7 @@
>           {
>             'action_name': 'run_gen-regexp-special-case_action',
>             'inputs': [
> diff --git a/package/nodejs/0002-check-if-uclibc-has-backtrace-support.patch b/package/nodejs/0002-check-if-uclibc-has-backtrace-support.patch
> index 079bbb4366..367b9fb8d5 100644
> --- a/package/nodejs/0002-check-if-uclibc-has-backtrace-support.patch
> +++ b/package/nodejs/0002-check-if-uclibc-has-backtrace-support.patch
> @@ -1,4 +1,4 @@
> -From 7c69553d7275bbcaa88fada8ccd0d2d9f787e1ad Mon Sep 17 00:00:00 2001
> +From f1a15cea9a47d0a9b0ae78fb22fef3a268e355ad Mon Sep 17 00:00:00 2001
>  From: Martin Bark <martin@barkynet.com>
>  Date: Sat, 4 Mar 2017 20:41:40 +0000
>  Subject: [PATCH] check if uclibc has backtrace support
> @@ -9,7 +9,7 @@ Signed-off-by: Martin Bark <martin@barkynet.com>
>   1 file changed, 1 insertion(+), 1 deletion(-)
>  
>  diff --git a/deps/v8/src/base/debug/stack_trace_posix.cc b/deps/v8/src/base/debug/stack_trace_posix.cc
> -index 87c0a73..d2c182a 100644
> +index 270f1ca4e0..5227e88671 100644
>  --- a/deps/v8/src/base/debug/stack_trace_posix.cc
>  +++ b/deps/v8/src/base/debug/stack_trace_posix.cc
>  @@ -25,7 +25,7 @@
> @@ -22,5 +22,5 @@ index 87c0a73..d2c182a 100644
>   #endif
>   
>  -- 
> -2.7.4
> +2.37.3
>  
> diff --git a/package/nodejs/0003-include-obj-name-in-shared-intermediate.patch b/package/nodejs/0003-include-obj-name-in-shared-intermediate.patch
> index b439c66a0c..5b44e6c400 100644
> --- a/package/nodejs/0003-include-obj-name-in-shared-intermediate.patch
> +++ b/package/nodejs/0003-include-obj-name-in-shared-intermediate.patch
> @@ -1,4 +1,4 @@
> -From e6e691d093de440e0f408d48971e2b7332a07d58 Mon Sep 17 00:00:00 2001
> +From af47d317e5ae12978c1cdc40627008ada144f98b Mon Sep 17 00:00:00 2001
>  From: Min RK <benjaminrk@gmail.com>
>  Date: Fri, 19 Feb 2021 11:57:04 +0100
>  Subject: [PATCH] include obj name in shared intermediate
> @@ -12,7 +12,7 @@ Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
>   1 file changed, 7 insertions(+), 1 deletion(-)
>  
>  diff --git a/tools/gyp/pylib/gyp/generator/ninja.py b/tools/gyp/pylib/gyp/generator/ninja.py
> -index d173bf2299..efaeee53ef 100644
> +index 3db3771ac9..2e0a021703 100644
>  --- a/tools/gyp/pylib/gyp/generator/ninja.py
>  +++ b/tools/gyp/pylib/gyp/generator/ninja.py
>  @@ -42,7 +42,7 @@ generator_default_variables = {
> diff --git a/package/nodejs/nodejs.hash b/package/nodejs/nodejs.hash
> index 12ae449ab4..83e4c271ce 100644
> --- a/package/nodejs/nodejs.hash
> +++ b/package/nodejs/nodejs.hash
> @@ -1,5 +1,5 @@
> -# From https://nodejs.org/dist/v16.16.0/SHASUMS256.txt
> -sha256  145151eff3b2aa5ebe73384009c52271a83740ae687a93c98c628cd7d52736eb  node-v16.16.0.tar.xz
> +# From https://nodejs.org/dist/v16.17.1/SHASUMS256.txt
> +sha256  6721feb4152d56d2c6b358ce397abd5a7f1daf09ee2e25c5021b9b4d3f86a330  node-v16.17.1.tar.xz
>  
>  # Hash for license file
> -sha256  6211cc77f9ceaf365db12faf050775b3a1e6da7a1eff3577ba006c4918103c33  LICENSE
> +sha256  69090e865afa7c62715b97f0712632d2923bd7a5faba91f94e4e75a2f9219d5e  LICENSE
> diff --git a/package/nodejs/nodejs.mk b/package/nodejs/nodejs.mk
> index e9fe96812f..05456e3443 100644
> --- a/package/nodejs/nodejs.mk
> +++ b/package/nodejs/nodejs.mk
> @@ -4,7 +4,7 @@
>  #
>  ################################################################################
>  
> -NODEJS_VERSION = 16.16.0
> +NODEJS_VERSION = 16.17.1
>  NODEJS_SOURCE = node-v$(NODEJS_VERSION).tar.xz
>  NODEJS_SITE = http://nodejs.org/dist/v$(NODEJS_VERSION)
>  NODEJS_DEPENDENCIES = \
> -- 
> 2.37.3
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 3/4] package/nodejs: add patch to adjust default NodeJS search path
  2022-09-25 18:15   ` Yann E. MORIN
@ 2022-09-25 19:23     ` Thomas Petazzoni
  0 siblings, 0 replies; 12+ messages in thread
From: Thomas Petazzoni @ 2022-09-25 19:23 UTC (permalink / raw)
  To: Yann E. MORIN
  Cc: Alexandru Ardelean, Angelo Compagnucci, Martin Bark,
	Daniel Price, Buildroot List

On Sun, 25 Sep 2022 20:15:57 +0200
"Yann E. MORIN" <yann.morin.1998@free.fr> wrote:

> It looks like this is an array, so maybe we could keep the original
> path, and add the npm installation path:
> 
>     const paths = [path.resolve(prefixDir, 'lib', 'node'),
>                    path.resolve(prefixDir, 'lib', 'node_modules'),];
> 
> This, in case some ot-of-tree packages simply copy files into the
> original .../node/ directory.

Good point, I've sent a v2 which does exactly this.

> Alternatively, we could symlink node_modules to node.

I did consider the symlink solution as well, but I worried (perhaps
wrongly, or too conservatively) that it could get removed. Or it would
have to be the other way around: node -> node_modules, as npm installs
in node_modules and I would be worried of npm being unhappy with
installing inside a path that contains a symlink.

Overall, I found patching the search path to be safer, but if the
symlink solution is preferred, I can definitely implement it.

Best regards,

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 1/4] package/nodejs: fixup qemu dependencies
  2022-09-25 17:19 [Buildroot] [PATCH 1/4] package/nodejs: fixup qemu dependencies Thomas Petazzoni
                   ` (3 preceding siblings ...)
  2022-09-25 18:16 ` [Buildroot] [PATCH 1/4] package/nodejs: fixup qemu dependencies Yann E. MORIN
@ 2022-10-11 18:53 ` Peter Korsgaard
  4 siblings, 0 replies; 12+ messages in thread
From: Peter Korsgaard @ 2022-10-11 18:53 UTC (permalink / raw)
  To: Thomas Petazzoni
  Cc: Alexandru Ardelean, Angelo Compagnucci, Daniel Price,
	Martin Bark, Buildroot List

>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@bootlin.com> writes:

 > Commit 1facb09b94bf806b301868539185c0ff9ddffee2 ("package/nodejs:
 > build host-nodejs only if we're installing modules with NPM") forgot
 > to account for the dependency on Qemu. Now that nodejs no longer
 > depends on host-nodejs, but needs host-qemu, we need to make sure that
 > nodejs selects the relevant BR2_PACKAGE_HOST_QEMU options.

 > So this patch:

 >  - Drops the dependency of BR2_PACKAGE_NODEJS_ARCH_SUPPORTS on
 >    BR2_PACKAGE_QEMU_ARCH_SUPPORTS_TARGET, which was incorrect: we
 >    don't care about running Qemu on the target. We care about
 >    host-qemu supporting the emulation of the target architecture,
 >    which is what BR2_PACKAGE_HOST_QEMU_ARCH_SUPPORTS is for.

 >  - Adds the dependency to the relevant BR2_PACKAGE_HOST_QEMU options
 >    to BR2_PACKAGE_NODEJS, so that host-qemu is built with the
 >    appropriate features needed to build the target nodejs.

 >  - Removes the qemu related dependencies from host-nodejs, which does
 >    not need Qemu at all.

 > Without this change the build of nodejs without npm enabled is broken
 > as the host-qemu that gets built does not have all the features that
 > are needed. There are no autobuild failures at this point, however.

 > Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

Committed to 2022.08.x, thanks.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 2/4] package/nodejs: bump to v16.17.1
  2022-09-25 17:19 ` [Buildroot] [PATCH 2/4] package/nodejs: bump to v16.17.1 Thomas Petazzoni via buildroot
  2022-09-25 18:17   ` Yann E. MORIN
@ 2022-10-11 19:19   ` Peter Korsgaard
  2022-10-12  8:26     ` Peter Korsgaard
  1 sibling, 1 reply; 12+ messages in thread
From: Peter Korsgaard @ 2022-10-11 19:19 UTC (permalink / raw)
  To: Thomas Petazzoni via buildroot
  Cc: Alexandru Ardelean, Angelo Compagnucci, Daniel Price,
	Thomas Petazzoni, Martin Bark

>>>>> "Thomas" == Thomas Petazzoni via buildroot <buildroot@buildroot.org> writes:

 > This is currently the latest version in the v16.x branch.
 > Patch 0001-add-qemu-wrapper-support.patch needs some minor adaptations
 > to resolve conflicts with other unrelated upstream changes. The other
 > patches are simply refreshed.

 > The license file is updates due to:

 >  - Reformatting changes

 >  - Addition of the mention of some files being under GPLv3, but it's
 >    only the autoconf machinery: aclocal.m4 and config.guess, so it's
 >    not relevant to add in our LICENSE variable.

 >  - Addition of the mention of another file being under the MIT
 >    license (install-sh), and MIT is already listed, and this file is
 >    anyway only part of the autoconf machinery.

 > Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

Committed to 2022.08.x, thanks.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 2/4] package/nodejs: bump to v16.17.1
  2022-10-11 19:19   ` Peter Korsgaard
@ 2022-10-12  8:26     ` Peter Korsgaard
  2022-10-14 19:33       ` Yann E. MORIN
  0 siblings, 1 reply; 12+ messages in thread
From: Peter Korsgaard @ 2022-10-12  8:26 UTC (permalink / raw)
  To: Thomas Petazzoni via buildroot
  Cc: Alexandru Ardelean, Angelo Compagnucci, Daniel Price,
	Thomas Petazzoni, Martin Bark

>>>>> "Peter" == Peter Korsgaard <peter@korsgaard.com> writes:

>>>>> "Thomas" == Thomas Petazzoni via buildroot <buildroot@buildroot.org> writes:
 >> This is currently the latest version in the v16.x branch.
 >> Patch 0001-add-qemu-wrapper-support.patch needs some minor adaptations
 >> to resolve conflicts with other unrelated upstream changes. The other
 >> patches are simply refreshed.

 >> The license file is updates due to:

 >> - Reformatting changes

 >> - Addition of the mention of some files being under GPLv3, but it's
 >> only the autoconf machinery: aclocal.m4 and config.guess, so it's
 >> not relevant to add in our LICENSE variable.

 >> - Addition of the mention of another file being under the MIT
 >> license (install-sh), and MIT is already listed, and this file is
 >> anyway only part of the autoconf machinery.

 >> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

 > Committed to 2022.08.x, thanks.

I forgot to mention that this should have been marked as a security bump
given the security fixes it contains:

https://github.com/nodejs/node/blob/main/doc/changelogs/CHANGELOG_V16.md#16.17.1

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

* Re: [Buildroot] [PATCH 2/4] package/nodejs: bump to v16.17.1
  2022-10-12  8:26     ` Peter Korsgaard
@ 2022-10-14 19:33       ` Yann E. MORIN
  0 siblings, 0 replies; 12+ messages in thread
From: Yann E. MORIN @ 2022-10-14 19:33 UTC (permalink / raw)
  To: Peter Korsgaard
  Cc: Daniel Price, Alexandru Ardelean, Angelo Compagnucci,
	Thomas Petazzoni, Thomas Petazzoni via buildroot, Martin Bark

Peter, All,

On 2022-10-12 10:26 +0200, Peter Korsgaard spake thusly:
> >>>>> "Peter" == Peter Korsgaard <peter@korsgaard.com> writes:
> >>>>> "Thomas" == Thomas Petazzoni via buildroot <buildroot@buildroot.org> writes:
>  >> This is currently the latest version in the v16.x branch.
>  > Committed to 2022.08.x, thanks.
> I forgot to mention that this should have been marked as a security bump
> given the security fixes it contains:

Hrm... Aren't all nodejs version bumps security fixes? ;-]

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2022-10-14 19:33 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-25 17:19 [Buildroot] [PATCH 1/4] package/nodejs: fixup qemu dependencies Thomas Petazzoni
2022-09-25 17:19 ` [Buildroot] [PATCH 2/4] package/nodejs: bump to v16.17.1 Thomas Petazzoni via buildroot
2022-09-25 18:17   ` Yann E. MORIN
2022-10-11 19:19   ` Peter Korsgaard
2022-10-12  8:26     ` Peter Korsgaard
2022-10-14 19:33       ` Yann E. MORIN
2022-09-25 17:19 ` [Buildroot] [PATCH 3/4] package/nodejs: add patch to adjust default NodeJS search path Thomas Petazzoni
2022-09-25 18:15   ` Yann E. MORIN
2022-09-25 19:23     ` Thomas Petazzoni
2022-09-25 17:19 ` [Buildroot] [PATCH 4/4] support/testing/tests: add NodeJS tests Thomas Petazzoni
2022-09-25 18:16 ` [Buildroot] [PATCH 1/4] package/nodejs: fixup qemu dependencies Yann E. MORIN
2022-10-11 18:53 ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).