summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/npm.bbclass15
1 files changed, 9 insertions, 6 deletions
diff --git a/meta/classes/npm.bbclass b/meta/classes/npm.bbclass
index 3ab67769e1..deea53c9ec 100644
--- a/meta/classes/npm.bbclass
+++ b/meta/classes/npm.bbclass
@@ -19,7 +19,7 @@
19 19
20inherit python3native 20inherit python3native
21 21
22DEPENDS:prepend = "nodejs-native " 22DEPENDS:prepend = "nodejs-native nodejs-oe-cache-native "
23RDEPENDS:${PN}:append:class-target = " nodejs" 23RDEPENDS:${PN}:append:class-target = " nodejs"
24 24
25EXTRA_OENPM = "" 25EXTRA_OENPM = ""
@@ -46,6 +46,7 @@ NPM_ARCH ?= "${@npm_target_arch_map(d.getVar("TARGET_ARCH"))}"
46NPM_PACKAGE = "${WORKDIR}/npm-package" 46NPM_PACKAGE = "${WORKDIR}/npm-package"
47NPM_CACHE = "${WORKDIR}/npm-cache" 47NPM_CACHE = "${WORKDIR}/npm-cache"
48NPM_BUILD = "${WORKDIR}/npm-build" 48NPM_BUILD = "${WORKDIR}/npm-build"
49NPM_REGISTRY = "${WORKDIR}/npm-registry"
49 50
50def npm_global_configs(d): 51def npm_global_configs(d):
51 """Get the npm global configuration""" 52 """Get the npm global configuration"""
@@ -112,16 +113,18 @@ python npm_do_configure() {
112 from bb.fetch2.npm import npm_unpack 113 from bb.fetch2.npm import npm_unpack
113 from bb.fetch2.npmsw import foreach_dependencies 114 from bb.fetch2.npmsw import foreach_dependencies
114 from bb.progress import OutOfProgressHandler 115 from bb.progress import OutOfProgressHandler
116 from oe.npm_registry import NpmRegistry
115 117
116 bb.utils.remove(d.getVar("NPM_CACHE"), recurse=True) 118 bb.utils.remove(d.getVar("NPM_CACHE"), recurse=True)
117 bb.utils.remove(d.getVar("NPM_PACKAGE"), recurse=True) 119 bb.utils.remove(d.getVar("NPM_PACKAGE"), recurse=True)
118 120
119 env = NpmEnvironment(d, configs=npm_global_configs(d)) 121 env = NpmEnvironment(d, configs=npm_global_configs(d))
122 registry = NpmRegistry(d.getVar('NPM_REGISTRY'), d.getVar('NPM_CACHE'))
120 123
121 def _npm_cache_add(tarball): 124 def _npm_cache_add(tarball, pkg):
122 """Run 'npm cache add' for a specified tarball""" 125 """Add tarball to local registry and register it in the
123 cmd = "npm cache add %s" % shlex.quote(tarball) 126 cache"""
124 env.run(cmd) 127 registry.add_pkg(tarball, pkg)
125 128
126 def _npm_integrity(tarball): 129 def _npm_integrity(tarball):
127 """Return the npm integrity of a specified tarball""" 130 """Return the npm integrity of a specified tarball"""
@@ -185,7 +188,7 @@ python npm_do_configure() {
185 # Add the dependency to the npm cache 188 # Add the dependency to the npm cache
186 destdir = os.path.join(d.getVar("S"), destsuffix) 189 destdir = os.path.join(d.getVar("S"), destsuffix)
187 (tarball, pkg) = npm_pack(env, destdir, tmpdir) 190 (tarball, pkg) = npm_pack(env, destdir, tmpdir)
188 _npm_cache_add(tarball) 191 _npm_cache_add(tarball, pkg)
189 # Add its signature to the cached shrinkwrap 192 # Add its signature to the cached shrinkwrap
190 dep = _npmsw_dependency_dict(cached_shrinkwrap, deptree) 193 dep = _npmsw_dependency_dict(cached_shrinkwrap, deptree)
191 dep["version"] = pkg['version'] 194 dep["version"] = pkg['version']