summaryrefslogtreecommitdiffstats
path: root/meta/classes-recipe/npm.bbclass
diff options
context:
space:
mode:
authorEnrico Scholz <enrico.scholz@sigma-chemnitz.de>2022-08-22 13:13:37 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-08-25 11:07:33 +0100
commitcd773722cb66eea487c6004a006e1b88f0b07a5a (patch)
tree104c36d63f418ff71c3cba3cfb8c3f986237c0ae /meta/classes-recipe/npm.bbclass
parenta28cde6defe9aefc3df02f321cc293f0b562304a (diff)
downloadopenembedded-core-cd773722cb66eea487c6004a006e1b88f0b07a5a.tar.gz
npm.bbclass: fix architecture mapping
Use the same code as the 'nodejs_16.4.bb recipe' for mapping the OE arch to the NPM arch. A noticeable change (and fix for exiting problems) is the move from 'arm' to 'arm64' for 'aarch64'. Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes-recipe/npm.bbclass')
-rw-r--r--meta/classes-recipe/npm.bbclass24
1 files changed, 11 insertions, 13 deletions
diff --git a/meta/classes-recipe/npm.bbclass b/meta/classes-recipe/npm.bbclass
index 8e73400678..20350cea25 100644
--- a/meta/classes-recipe/npm.bbclass
+++ b/meta/classes-recipe/npm.bbclass
@@ -28,20 +28,18 @@ NPM_INSTALL_DEV ?= "0"
NPM_NODEDIR ?= "${RECIPE_SYSROOT_NATIVE}${prefix_native}"
-def npm_target_arch_map(target_arch):
- """Maps arch names to npm arch names"""
+## must match mapping in nodejs.bb (openembedded-meta)
+def map_nodejs_arch(a, d):
import re
- if re.match("p(pc|owerpc)(|64)", target_arch):
- return "ppc"
- elif re.match("i.86$", target_arch):
- return "ia32"
- elif re.match("x86_64$", target_arch):
- return "x64"
- elif re.match("arm64$", target_arch):
- return "arm"
- return target_arch
-
-NPM_ARCH ?= "${@npm_target_arch_map(d.getVar("TARGET_ARCH"))}"
+
+ if re.match('i.86$', a): return 'ia32'
+ elif re.match('x86_64$', a): return 'x64'
+ elif re.match('aarch64$', a): return 'arm64'
+ elif re.match('(powerpc64|powerpc64le|ppc64le)$', a): return 'ppc64'
+ elif re.match('powerpc$', a): return 'ppc'
+ return a
+
+NPM_ARCH ?= "${@map_nodejs_arch(d.getVar("TARGET_ARCH"), d)}"
NPM_PACKAGE = "${WORKDIR}/npm-package"
NPM_CACHE = "${WORKDIR}/npm-cache"