diff options
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/fetch2/npmsw.py | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/bitbake/lib/bb/fetch2/npmsw.py b/bitbake/lib/bb/fetch2/npmsw.py index cc81100b3a..359192a29e 100644 --- a/bitbake/lib/bb/fetch2/npmsw.py +++ b/bitbake/lib/bb/fetch2/npmsw.py | |||
@@ -41,20 +41,15 @@ def foreach_dependencies(shrinkwrap, callback=None, dev=False): | |||
41 | with: | 41 | with: |
42 | name = the package name (string) | 42 | name = the package name (string) |
43 | params = the package parameters (dictionary) | 43 | params = the package parameters (dictionary) |
44 | deptree = the package dependency tree (array of strings) | 44 | destdir = the destination of the package (string) |
45 | """ | 45 | """ |
46 | def _walk_deps(deps, deptree): | 46 | packages = shrinkwrap.get("packages", {}) |
47 | for name in deps: | 47 | |
48 | subtree = [*deptree, name] | 48 | for package in packages: |
49 | _walk_deps(deps[name].get("dependencies", {}), subtree) | 49 | if package != "": |
50 | if callback is not None: | 50 | name = package.split('node_modules/')[-1] |
51 | if deps[name].get("dev", False) and not dev: | 51 | package_infos = packages.get(package, {}) |
52 | continue | 52 | callback(name, package_infos, package) |
53 | elif deps[name].get("bundled", False): | ||
54 | continue | ||
55 | callback(name, deps[name], subtree) | ||
56 | |||
57 | _walk_deps(shrinkwrap.get("dependencies", {}), []) | ||
58 | 53 | ||
59 | class NpmShrinkWrap(FetchMethod): | 54 | class NpmShrinkWrap(FetchMethod): |
60 | """Class to fetch all package from a shrinkwrap file""" | 55 | """Class to fetch all package from a shrinkwrap file""" |
@@ -75,12 +70,10 @@ class NpmShrinkWrap(FetchMethod): | |||
75 | # Resolve the dependencies | 70 | # Resolve the dependencies |
76 | ud.deps = [] | 71 | ud.deps = [] |
77 | 72 | ||
78 | def _resolve_dependency(name, params, deptree): | 73 | def _resolve_dependency(name, params, destsuffix): |
79 | url = None | 74 | url = None |
80 | localpath = None | 75 | localpath = None |
81 | extrapaths = [] | 76 | extrapaths = [] |
82 | destsubdirs = [os.path.join("node_modules", dep) for dep in deptree] | ||
83 | destsuffix = os.path.join(*destsubdirs) | ||
84 | unpack = True | 77 | unpack = True |
85 | 78 | ||
86 | integrity = params.get("integrity", None) | 79 | integrity = params.get("integrity", None) |