Skip to contentSkip to conversation

nodejs_12.21.0.bb: only handle npm if configured

PATCH In review Nisha Parrakat 2 participants 4 messages Jan 12, 2022 – Jan 13, 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
In reply to Nisha Parrakat
Quoted 6 lines · Nisha Parrakat

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 ++++++--

we do not have nodejs 12.21.0 on master, is it meant for some other release branch ?

Quoted 28 lines
  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"
#3 lore raw

Sorry Sent for dunfell again now.

regards
Nisha

Quoted 53 lines · Khem Raj
Quoted 6 lines · Nisha Parrakat

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 ++++++--

we do not have nodejs 12.21.0 on master, is it meant for some other release branch ?

Review

Quoted 3 lines
  1 file changed, 6 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/meta-oe/recipes-devtools/nodejs/nodejs_12.21.0.bb

meta-oe/recipes-devtools/nodejs/nodejs_12.21.0.bb do_install_append_class-native() { · line 133

Quoted 5 lines

index b9e382177..22191a157 100644

meta-oe/recipes-devtools/nodejs/nodejs_12.21.0.bb +0 -0
@@ -133,7 +133,9 @@ do_install_append_class-native() {
      # /usr/bin/npm is symlink to

/usr/lib/node_modules/npm/bin/npm-cli.js

meta-oe/recipes-devtools/nodejs/nodejs_12.21.0.bb do_install_append_class-native() { · line 134

Quoted 1 line
meta-oe/recipes-devtools/nodejs/nodejs_12.21.0.bb +0 -0
      # use sed on npm-cli.js because otherwise symlink is replaced with

normal file and

meta-oe/recipes-devtools/nodejs/nodejs_12.21.0.bb do_install_append_class-native() { · line 136

Quoted 2 lines
meta-oe/recipes-devtools/nodejs/nodejs_12.21.0.bb +0 -1
      # 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

meta-oe/recipes-devtools/nodejs/nodejs_12.21.0.bb do_install_append_class-native() { · line 136

Quoted 1 line
meta-oe/recipes-devtools/nodejs/nodejs_12.21.0.bb +1 -0
+    if [[ -f "${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js"

]]; then

meta-oe/recipes-devtools/nodejs/nodejs_12.21.0.bb do_install_append_class-native() { · line 137

Quoted 1 line
meta-oe/recipes-devtools/nodejs/nodejs_12.21.0.bb +1 -0
+        sed "1s^.*^#\!/usr/bin/env node^g" -i

${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js

meta-oe/recipes-devtools/nodejs/nodejs_12.21.0.bb do_install_append_class-native() {

Quoted 3 lines
meta-oe/recipes-devtools/nodejs/nodejs_12.21.0.bb +1 -0
+    fi
 
      # Install the native binaries to provide it within sysroot for the

target compilation

meta-oe/recipes-devtools/nodejs/nodejs_12.21.0.bb do_install_append_class-native() { · line 150

Quoted 6 lines
meta-oe/recipes-devtools/nodejs/nodejs_12.21.0.bb +0 -1
      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

meta-oe/recipes-devtools/nodejs/nodejs_12.21.0.bb do_install_append_class-native() { · line 152

Quoted 1 line
meta-oe/recipes-devtools/nodejs/nodejs_12.21.0.bb +1 -0
+    if [[ -f "${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js"

]]; then

meta-oe/recipes-devtools/nodejs/nodejs_12.21.0.bb do_install_append_class-native() { · line 153

Quoted 1 line
meta-oe/recipes-devtools/nodejs/nodejs_12.21.0.bb +1 -0
+        sed "1s^.*^#\!${bindir}/env node^g" -i

${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js

Quoted 4 lines
meta-oe/recipes-devtools/nodejs/nodejs_12.21.0.bb +1 -0
+    fi
  }
 
  PACKAGES =+ "${PN}-npm"