diff options
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/npm.bbclass | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/meta/classes/npm.bbclass b/meta/classes/npm.bbclass index d5ff0c6d57..30febcffb2 100644 --- a/meta/classes/npm.bbclass +++ b/meta/classes/npm.bbclass | |||
@@ -10,7 +10,7 @@ def node_pkgname(d): | |||
10 | 10 | ||
11 | NPMPN ?= "${@node_pkgname(d)}" | 11 | NPMPN ?= "${@node_pkgname(d)}" |
12 | 12 | ||
13 | NPM_INSTALLDIR = "${D}${libdir}/node/${NPMPN}" | 13 | NPM_INSTALLDIR = "${libdir}/node/${NPMPN}" |
14 | 14 | ||
15 | # function maps arch names to npm arch names | 15 | # function maps arch names to npm arch names |
16 | def npm_oe_arch_map(target_arch, d): | 16 | def npm_oe_arch_map(target_arch, d): |
@@ -52,9 +52,10 @@ npm_do_install() { | |||
52 | # changing the home directory to the working directory, the .npmrc will | 52 | # changing the home directory to the working directory, the .npmrc will |
53 | # be created in this directory | 53 | # be created in this directory |
54 | export HOME=${WORKDIR} | 54 | export HOME=${WORKDIR} |
55 | mkdir -p ${NPM_INSTALLDIR}/ | 55 | mkdir -p ${D}${libdir}/node_modules |
56 | npm pack . | 56 | npm pack . |
57 | npm install --prefix ${D}${prefix} -g --arch=${NPM_ARCH} --target_arch=${NPM_ARCH} --production --no-registry ${NPMPN}-${PV}.tgz | 57 | npm install --prefix ${D}${prefix} -g --arch=${NPM_ARCH} --target_arch=${NPM_ARCH} --production --no-registry ${NPMPN}-${PV}.tgz |
58 | mv ${D}${libdir}/node_modules ${D}${libdir}/node | ||
58 | if [ -d ${D}${prefix}/etc ] ; then | 59 | if [ -d ${D}${prefix}/etc ] ; then |
59 | # This will be empty | 60 | # This will be empty |
60 | rmdir ${D}${prefix}/etc | 61 | rmdir ${D}${prefix}/etc |
@@ -62,13 +63,13 @@ npm_do_install() { | |||
62 | } | 63 | } |
63 | 64 | ||
64 | python populate_packages_prepend () { | 65 | python populate_packages_prepend () { |
65 | instdir = d.expand('${D}${libdir}/node_modules/${NPMPN}') | 66 | instdir = d.expand('${D}${NPM_INSTALLDIR}') |
66 | extrapackages = oe.package.npm_split_package_dirs(instdir) | 67 | extrapackages = oe.package.npm_split_package_dirs(instdir) |
67 | pkgnames = extrapackages.keys() | 68 | pkgnames = extrapackages.keys() |
68 | d.prependVar('PACKAGES', '%s ' % ' '.join(pkgnames)) | 69 | d.prependVar('PACKAGES', '%s ' % ' '.join(pkgnames)) |
69 | for pkgname in pkgnames: | 70 | for pkgname in pkgnames: |
70 | pkgrelpath, pdata = extrapackages[pkgname] | 71 | pkgrelpath, pdata = extrapackages[pkgname] |
71 | pkgpath = '${libdir}/node_modules/${NPMPN}/' + pkgrelpath | 72 | pkgpath = '${NPM_INSTALLDIR}/' + pkgrelpath |
72 | # package names can't have underscores but npm packages sometimes use them | 73 | # package names can't have underscores but npm packages sometimes use them |
73 | oe_pkg_name = pkgname.replace('_', '-') | 74 | oe_pkg_name = pkgname.replace('_', '-') |
74 | expanded_pkgname = d.expand(oe_pkg_name) | 75 | expanded_pkgname = d.expand(oe_pkg_name) |
@@ -84,7 +85,7 @@ python populate_packages_prepend () { | |||
84 | } | 85 | } |
85 | 86 | ||
86 | FILES_${PN} += " \ | 87 | FILES_${PN} += " \ |
87 | ${libdir}/node_modules/${NPMPN} \ | 88 | ${NPM_INSTALLDIR} \ |
88 | " | 89 | " |
89 | 90 | ||
90 | EXPORT_FUNCTIONS do_compile do_install | 91 | EXPORT_FUNCTIONS do_compile do_install |