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 11c80a738e..8379c7b988 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"""
@@ -109,16 +110,18 @@ python npm_do_configure() {
109 from bb.fetch2.npm import npm_unpack 110 from bb.fetch2.npm import npm_unpack
110 from bb.fetch2.npmsw import foreach_dependencies 111 from bb.fetch2.npmsw import foreach_dependencies
111 from bb.progress import OutOfProgressHandler 112 from bb.progress import OutOfProgressHandler
113 from oe.npm_registry import NpmRegistry
112 114
113 bb.utils.remove(d.getVar("NPM_CACHE"), recurse=True) 115 bb.utils.remove(d.getVar("NPM_CACHE"), recurse=True)
114 bb.utils.remove(d.getVar("NPM_PACKAGE"), recurse=True) 116 bb.utils.remove(d.getVar("NPM_PACKAGE"), recurse=True)
115 117
116 env = NpmEnvironment(d, configs=npm_global_configs(d)) 118 env = NpmEnvironment(d, configs=npm_global_configs(d))
119 registry = NpmRegistry(d.getVar('NPM_REGISTRY'), d.getVar('NPM_CACHE'))
117 120
118 def _npm_cache_add(tarball): 121 def _npm_cache_add(tarball, pkg):
119 """Run 'npm cache add' for a specified tarball""" 122 """Add tarball to local registry and register it in the
120 cmd = "npm cache add %s" % shlex.quote(tarball) 123 cache"""
121 env.run(cmd) 124 registry.add_pkg(tarball, pkg)
122 125
123 def _npm_integrity(tarball): 126 def _npm_integrity(tarball):
124 """Return the npm integrity of a specified tarball""" 127 """Return the npm integrity of a specified tarball"""
@@ -182,7 +185,7 @@ python npm_do_configure() {
182 # Add the dependency to the npm cache 185 # Add the dependency to the npm cache
183 destdir = os.path.join(d.getVar("S"), destsuffix) 186 destdir = os.path.join(d.getVar("S"), destsuffix)
184 (tarball, pkg) = npm_pack(env, destdir, tmpdir) 187 (tarball, pkg) = npm_pack(env, destdir, tmpdir)
185 _npm_cache_add(tarball) 188 _npm_cache_add(tarball, pkg)
186 # Add its signature to the cached shrinkwrap 189 # Add its signature to the cached shrinkwrap
187 dep = _npmsw_dependency_dict(cached_shrinkwrap, deptree) 190 dep = _npmsw_dependency_dict(cached_shrinkwrap, deptree)
188 dep["version"] = pkg['version'] 191 dep["version"] = pkg['version']