summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorJean-Marie LEMETAYER <jean-marie.lemetayer@savoirfairelinux.com>2019-05-17 17:14:09 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-06-07 13:57:48 +0100
commit7a779a13517593dbcb9507b0993c6e3f9daea52d (patch)
treee345aa94259c9663c7a985393d784f921dd2ae0f /meta/classes
parent033029855189fc7ab307e78bf435e36000622941 (diff)
downloadpoky-7a779a13517593dbcb9507b0993c6e3f9daea52d.tar.gz
npm: fix node and npm default directory conflict
Fixes [YOCTO #13349] When dealing with node modules which have declared "bin" files [1], npm will create a link in '/usr/bin' with a relative link to '../lib/node_modules/<module bin file>'. The commits e9270af4296ce2af292059617a717e42fc17425c and 2713d9bcc39c712ef34003ce8424416441be558e explicitely use '/usr/lib/node/' as install directory, but does not care about the "bin" symbolic linked files. In order to keep valid links, and to keep it as simple as possible, the path '/usr/lib/node_modules/' is used as install directory for npm. And a symbolic link is created to have a valid '/usr/lib/node/' path, needed for node. [1]: https://docs.npmjs.com/files/package.json#bin (From OE-Core rev: 67846b3b2d2d45401d500bff5cf3d4d71c003f7a) Signed-off-by: Jean-Marie LEMETAYER <jean-marie.lemetayer@savoirfairelinux.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/npm.bbclass6
1 files changed, 4 insertions, 2 deletions
diff --git a/meta/classes/npm.bbclass b/meta/classes/npm.bbclass
index 3dd2d13804..9703f4c1ec 100644
--- a/meta/classes/npm.bbclass
+++ b/meta/classes/npm.bbclass
@@ -10,7 +10,7 @@ def node_pkgname(d):
10 10
11NPMPN ?= "${@node_pkgname(d)}" 11NPMPN ?= "${@node_pkgname(d)}"
12 12
13NPM_INSTALLDIR = "${libdir}/node/${NPMPN}" 13NPM_INSTALLDIR = "${libdir}/node_modules/${NPMPN}"
14 14
15# function maps arch names to npm arch names 15# function maps arch names to npm arch names
16def npm_oe_arch_map(target_arch, d): 16def npm_oe_arch_map(target_arch, d):
@@ -55,7 +55,7 @@ npm_do_install() {
55 mkdir -p ${D}${libdir}/node_modules 55 mkdir -p ${D}${libdir}/node_modules
56 local NPM_PACKFILE=$(npm pack .) 56 local NPM_PACKFILE=$(npm pack .)
57 npm install --prefix ${D}${prefix} -g --arch=${NPM_ARCH} --target_arch=${NPM_ARCH} --production --no-registry ${NPM_PACKFILE} 57 npm install --prefix ${D}${prefix} -g --arch=${NPM_ARCH} --target_arch=${NPM_ARCH} --production --no-registry ${NPM_PACKFILE}
58 mv ${D}${libdir}/node_modules ${D}${libdir}/node 58 ln -fs node_modules ${D}${libdir}/node
59 if [ -d ${D}${prefix}/etc ] ; then 59 if [ -d ${D}${prefix}/etc ] ; then
60 # This will be empty 60 # This will be empty
61 rmdir ${D}${prefix}/etc 61 rmdir ${D}${prefix}/etc
@@ -85,6 +85,8 @@ python populate_packages_prepend () {
85} 85}
86 86
87FILES_${PN} += " \ 87FILES_${PN} += " \
88 ${bindir} \
89 ${libdir}/node \
88 ${NPM_INSTALLDIR} \ 90 ${NPM_INSTALLDIR} \
89" 91"
90 92