[oe-commits] [openembedded-core] 02/20: npm: fix node and npm default directory conflict

git at git.openembedded.org git at git.openembedded.org
Tue May 21 12:08:06 UTC 2019


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master
in repository openembedded-core.

commit 2d72007deea7ed529f82b8a6e67e2715dd0a0dca
Author: Jean-Marie LEMETAYER <jean-marie.lemetayer at savoirfairelinux.com>
AuthorDate: Fri May 17 17:14:09 2019 +0200

    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
    
    Signed-off-by: Jean-Marie LEMETAYER <jean-marie.lemetayer at savoirfairelinux.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/classes/npm.bbclass | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/meta/classes/npm.bbclass b/meta/classes/npm.bbclass
index 3dd2d13..9703f4c 100644
--- a/meta/classes/npm.bbclass
+++ b/meta/classes/npm.bbclass
@@ -10,7 +10,7 @@ def node_pkgname(d):
 
 NPMPN ?= "${@node_pkgname(d)}"
 
-NPM_INSTALLDIR = "${libdir}/node/${NPMPN}"
+NPM_INSTALLDIR = "${libdir}/node_modules/${NPMPN}"
 
 # function maps arch names to npm arch names
 def npm_oe_arch_map(target_arch, d):
@@ -55,7 +55,7 @@ npm_do_install() {
 	mkdir -p ${D}${libdir}/node_modules
 	local NPM_PACKFILE=$(npm pack .)
 	npm install --prefix ${D}${prefix} -g --arch=${NPM_ARCH} --target_arch=${NPM_ARCH} --production --no-registry ${NPM_PACKFILE}
-	mv ${D}${libdir}/node_modules ${D}${libdir}/node
+	ln -fs node_modules ${D}${libdir}/node
 	if [ -d ${D}${prefix}/etc ] ; then
 		# This will be empty
 		rmdir ${D}${prefix}/etc
@@ -85,6 +85,8 @@ python populate_packages_prepend () {
 }
 
 FILES_${PN} += " \
+    ${bindir} \
+    ${libdir}/node \
     ${NPM_INSTALLDIR} \
 "
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list