summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/npm.bbclass18
1 files changed, 13 insertions, 5 deletions
diff --git a/meta/classes/npm.bbclass b/meta/classes/npm.bbclass
index 898a54eb50..c351ff0866 100644
--- a/meta/classes/npm.bbclass
+++ b/meta/classes/npm.bbclass
@@ -2,7 +2,15 @@ DEPENDS_prepend = "nodejs-native "
2RDEPENDS_${PN}_prepend = "nodejs " 2RDEPENDS_${PN}_prepend = "nodejs "
3S = "${WORKDIR}/npmpkg" 3S = "${WORKDIR}/npmpkg"
4 4
5NPM_INSTALLDIR = "${D}${libdir}/node_modules/${PN}" 5def node_pkgname(d):
6 bpn = d.getVar('BPN')
7 if bpn.startswith("node-"):
8 return bpn[5:]
9 return bpn
10
11NPMPN ?= "${@node_pkgname(d)}"
12
13NPM_INSTALLDIR = "${D}${libdir}/node_modules/${NPMPN}"
6 14
7# function maps arch names to npm arch names 15# function maps arch names to npm arch names
8def npm_oe_arch_map(target_arch, d): 16def npm_oe_arch_map(target_arch, d):
@@ -46,7 +54,7 @@ npm_do_install() {
46 export HOME=${WORKDIR} 54 export HOME=${WORKDIR}
47 mkdir -p ${NPM_INSTALLDIR}/ 55 mkdir -p ${NPM_INSTALLDIR}/
48 npm pack . 56 npm pack .
49 npm install --prefix ${D}${prefix} -g --arch=${NPM_ARCH} --target_arch=${NPM_ARCH} --production --no-registry ${PN}-${PV}.tgz 57 npm install --prefix ${D}${prefix} -g --arch=${NPM_ARCH} --target_arch=${NPM_ARCH} --production --no-registry ${NPMPN}-${PV}.tgz
50 if [ -d ${D}${prefix}/etc ] ; then 58 if [ -d ${D}${prefix}/etc ] ; then
51 # This will be empty 59 # This will be empty
52 rmdir ${D}${prefix}/etc 60 rmdir ${D}${prefix}/etc
@@ -54,13 +62,13 @@ npm_do_install() {
54} 62}
55 63
56python populate_packages_prepend () { 64python populate_packages_prepend () {
57 instdir = d.expand('${D}${libdir}/node_modules/${PN}') 65 instdir = d.expand('${D}${libdir}/node_modules/${NPMPN}')
58 extrapackages = oe.package.npm_split_package_dirs(instdir) 66 extrapackages = oe.package.npm_split_package_dirs(instdir)
59 pkgnames = extrapackages.keys() 67 pkgnames = extrapackages.keys()
60 d.prependVar('PACKAGES', '%s ' % ' '.join(pkgnames)) 68 d.prependVar('PACKAGES', '%s ' % ' '.join(pkgnames))
61 for pkgname in pkgnames: 69 for pkgname in pkgnames:
62 pkgrelpath, pdata = extrapackages[pkgname] 70 pkgrelpath, pdata = extrapackages[pkgname]
63 pkgpath = '${libdir}/node_modules/${PN}/' + pkgrelpath 71 pkgpath = '${libdir}/node_modules/${NPMPN}/' + pkgrelpath
64 # package names can't have underscores but npm packages sometimes use them 72 # package names can't have underscores but npm packages sometimes use them
65 oe_pkg_name = pkgname.replace('_', '-') 73 oe_pkg_name = pkgname.replace('_', '-')
66 expanded_pkgname = d.expand(oe_pkg_name) 74 expanded_pkgname = d.expand(oe_pkg_name)
@@ -76,7 +84,7 @@ python populate_packages_prepend () {
76} 84}
77 85
78FILES_${PN} += " \ 86FILES_${PN} += " \
79 ${libdir}/node_modules/${PN} \ 87 ${libdir}/node_modules/${NPMPN} \
80" 88"
81 89
82EXPORT_FUNCTIONS do_compile do_install 90EXPORT_FUNCTIONS do_compile do_install