Skip to contentSkip to conversation

nodejs_12.21.0.bb: only handle npm if configured

PATCH In review Nisha Parrakat 4 participants 5 messages Jan 13, 2022 – Apr 5, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 nodejs_12.21.0.bb: only handle npm if configured

npm-cli.js should be symlinked only when the file is present the file may not be available if the configure option is --without-npm

---
 meta-oe/recipes-devtools/nodejs/nodejs_12.21.0.bb | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
meta-oe/recipes-devtools/nodejs/nodejs_12.21.0.bb +6 -2
index b9e382177..22191a157 100644
@@ -133,7 +133,9 @@ do_install_append_class-native() {
     # /usr/bin/npm is symlink to /usr/lib/node_modules/npm/bin/npm-cli.js
     # use sed on npm-cli.js because otherwise symlink is replaced with normal file and
     # npm-cli.js continues to use old shebang
-    sed "1s^.*^#\!/usr/bin/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js
+    if [[ -f "${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js" ]]; then
+        sed "1s^.*^#\!/usr/bin/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js
+    fi
 
     # Install the native binaries to provide it within sysroot for the target compilation
     install -d ${D}${bindir}
@@ -147,7 +149,9 @@ do_install_append_class-native() {
 }
 
 do_install_append_class-target() {
-    sed "1s^.*^#\!${bindir}/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js
+    if [[ -f "${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js" ]]; then
+        sed "1s^.*^#\!${bindir}/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js
+    fi
 }
 
 PACKAGES =+ "${PN}-npm"
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/2 nodejs: upgrade to 12.22.2

upgrading to next maintainence LTS version

---
 .../nodejs/{nodejs_12.21.0.bb => nodejs_12.22.2.bb}             | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
 rename meta-oe/recipes-devtools/nodejs/{nodejs_12.21.0.bb => nodejs_12.22.2.bb} (98%)
meta-oe/recipes-devtools/nodejs/nodejs_12.22.2.bb renamed from meta-oe/recipes-devtools/nodejs/nodejs_12.21.0.bb +1 -1
similarity index 98%
rename from meta-oe/recipes-devtools/nodejs/nodejs_12.21.0.bb
rename to meta-oe/recipes-devtools/nodejs/nodejs_12.22.2.bb
index 22191a157..8d533199b 100644
@@ -26,7 +26,7 @@ SRC_URI = "http://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz \
 SRC_URI_append_class-target = " \
            file://0002-Using-native-binaries.patch \
            "
-SRC_URI[sha256sum] = "052f37ace6f569b513b5a1154b2a45d3c4d8b07d7d7c807b79f1566db61e979d"
+SRC_URI[sha256sum] = "7fd805571df106f086f4c45e131efed98bfd62628d9dec96bd62f8c11b0c48dc"
 
 S = "${WORKDIR}/node-v${PV}"
 
Signature · 1 line
2.17.1
#2 lore raw

Re: [meta-oe][dunfell][PATCH 2/2] nodejs: upgrade to 12.22.2

Is there any reason why we have not merged this yet on the dunfell branch?

Thanks,
Ranjitsinh Rathod

#3 lore raw
In reply to Nisha Parrakat
Quoted 42 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Nisha Parrakat
Sent: den 13 januari 2022 09:13
To: [email protected]; [email protected]
Cc: [email protected]
Subject: [oe] [meta-oe][dunfell][PATCH 1/2] nodejs_12.21.0.bb: only handle npm if configured

npm-cli.js should be symlinked only when the file is present the file may not be available if the configure option is --without-npm

---
 meta-oe/recipes-devtools/nodejs/nodejs_12.21.0.bb | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
meta-oe/recipes-devtools/nodejs/nodejs_12.21.0.bb +6 -3
index b9e382177..22191a157 100644
@@ -133,7 +133,9 @@ do_install_append_class-native() {
     # /usr/bin/npm is symlink to /usr/lib/node_modules/npm/bin/npm-cli.js
     # use sed on npm-cli.js because otherwise symlink is replaced with normal file and
     # npm-cli.js continues to use old shebang
-    sed "1s^.*^#\!/usr/bin/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js
+    if [[ -f "${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js" ]]; then
+        sed "1s^.*^#\!/usr/bin/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js
+    fi
 
     # Install the native binaries to provide it within sysroot for the target compilation
     install -d ${D}${bindir}
@@ -147,7 +149,9 @@ do_install_append_class-native() {
 }
 
 do_install_append_class-target() {
-    sed "1s^.*^#\!${bindir}/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js
+    if [[ -f "${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js" ]]; then
+        sed "1s^.*^#\!${bindir}/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js
+    fi
 }
 
 PACKAGES =+ "${PN}-npm"
--
Quoted 1 line

2.17.1

This patch should not be applied because it a) contains bashisms and b) it is better to just remove the workaround as it is no longer needed (see the patches I just sent for master).

//Peter

#4 lore raw
Quoted 40 lines · Peter Kjellerstedt
Quoted 40 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of Nisha Parrakat
Sent: den 13 januari 2022 09:13
To: [email protected]; [email protected]
Cc: [email protected]
Subject: [oe] [meta-oe][dunfell][PATCH 1/2] nodejs_12.21.0.bb: only handle npm if configured

npm-cli.js should be symlinked only when the file is present the file may not be available if the configure option is --without-npm

---
 meta-oe/recipes-devtools/nodejs/nodejs_12.21.0.bb | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
meta-oe/recipes-devtools/nodejs/nodejs_12.21.0.bb +6 -2
index b9e382177..22191a157 100644
@@ -133,7 +133,9 @@ do_install_append_class-native() {
     # /usr/bin/npm is symlink to /usr/lib/node_modules/npm/bin/npm-cli.js
     # use sed on npm-cli.js because otherwise symlink is replaced with normal file and
     # npm-cli.js continues to use old shebang
-    sed "1s^.*^#\!/usr/bin/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js
+    if [[ -f "${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js" ]]; then
+        sed "1s^.*^#\!/usr/bin/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js
+    fi
 
     # Install the native binaries to provide it within sysroot for the target compilation
     install -d ${D}${bindir}
@@ -147,7 +149,9 @@ do_install_append_class-native() {
 }
 
 do_install_append_class-target() {
-    sed "1s^.*^#\!${bindir}/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js
+    if [[ -f "${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js" ]]; then
+        sed "1s^.*^#\!${bindir}/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js
+    fi
 }
 
Quoted 7 lines
Quoted 3 lines
meta-oe/recipes-devtools/nodejs/nodejs_12.21.0.bb +0 -1
 PACKAGES =+ "${PN}-npm"
--

2.17.1

This patch should not be applied because it a) contains bashisms and b) it is better to just remove the workaround as it is no longer needed (see the patches I just sent for master).

agreed, with dash nodejs do_install fails with dash:

tmp-glibc/work/x86_64-linux/nodejs-native/16.11.1-r0/temp/run.do_install.2837733:169: [[: not found

but unfortunately it doesn't cause do_install to fail, because [[ is in if expression.

Quoted 13 lines

//Peter

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#94833): https://lists.openembedded.org/g/openembedded-devel/message/94833
Mute This Topic: https://lists.openembedded.org/mt/88392913/3617156
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-