diff options
author | Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> | 2021-10-06 16:35:54 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-10-08 16:45:06 +0100 |
commit | fb437d6db17d984bf9638324cca51d6009d76ff2 (patch) | |
tree | e09206c4b3493ff55271177c4affed2003945531 /bitbake | |
parent | 00f2b6d0b70a067e88957585a50183548a0d92a4 (diff) | |
download | poky-fb437d6db17d984bf9638324cca51d6009d76ff2.tar.gz |
bitbake: fetch2: npmsw: Add support for local tarball and link sources
(Bitbake rev: 4f983dc419a1a6f635a5d333f253d49244cec374)
Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/fetch2/npmsw.py | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/bitbake/lib/bb/fetch2/npmsw.py b/bitbake/lib/bb/fetch2/npmsw.py index 0c3511d8ab..9523cece1a 100644 --- a/bitbake/lib/bb/fetch2/npmsw.py +++ b/bitbake/lib/bb/fetch2/npmsw.py | |||
@@ -24,6 +24,7 @@ import bb | |||
24 | from bb.fetch2 import Fetch | 24 | from bb.fetch2 import Fetch |
25 | from bb.fetch2 import FetchMethod | 25 | from bb.fetch2 import FetchMethod |
26 | from bb.fetch2 import ParameterError | 26 | from bb.fetch2 import ParameterError |
27 | from bb.fetch2 import runfetchcmd | ||
27 | from bb.fetch2 import URI | 28 | from bb.fetch2 import URI |
28 | from bb.fetch2.npm import npm_integrity | 29 | from bb.fetch2.npm import npm_integrity |
29 | from bb.fetch2.npm import npm_localfile | 30 | from bb.fetch2.npm import npm_localfile |
@@ -78,6 +79,7 @@ class NpmShrinkWrap(FetchMethod): | |||
78 | extrapaths = [] | 79 | extrapaths = [] |
79 | destsubdirs = [os.path.join("node_modules", dep) for dep in deptree] | 80 | destsubdirs = [os.path.join("node_modules", dep) for dep in deptree] |
80 | destsuffix = os.path.join(*destsubdirs) | 81 | destsuffix = os.path.join(*destsubdirs) |
82 | unpack = True | ||
81 | 83 | ||
82 | integrity = params.get("integrity", None) | 84 | integrity = params.get("integrity", None) |
83 | resolved = params.get("resolved", None) | 85 | resolved = params.get("resolved", None) |
@@ -148,7 +150,12 @@ class NpmShrinkWrap(FetchMethod): | |||
148 | 150 | ||
149 | url = str(uri) | 151 | url = str(uri) |
150 | 152 | ||
151 | # local tarball sources and local link sources are unsupported | 153 | # Handle local tarball and link sources |
154 | elif version.startswith("file"): | ||
155 | localpath = version[5:] | ||
156 | if not version.endswith(".tgz"): | ||
157 | unpack = False | ||
158 | |||
152 | else: | 159 | else: |
153 | raise ParameterError("Unsupported dependency: %s" % name, ud.url) | 160 | raise ParameterError("Unsupported dependency: %s" % name, ud.url) |
154 | 161 | ||
@@ -157,6 +164,7 @@ class NpmShrinkWrap(FetchMethod): | |||
157 | "localpath": localpath, | 164 | "localpath": localpath, |
158 | "extrapaths": extrapaths, | 165 | "extrapaths": extrapaths, |
159 | "destsuffix": destsuffix, | 166 | "destsuffix": destsuffix, |
167 | "unpack": unpack, | ||
160 | }) | 168 | }) |
161 | 169 | ||
162 | try: | 170 | try: |
@@ -177,7 +185,7 @@ class NpmShrinkWrap(FetchMethod): | |||
177 | # This fetcher resolves multiple URIs from a shrinkwrap file and then | 185 | # This fetcher resolves multiple URIs from a shrinkwrap file and then |
178 | # forwards it to a proxy fetcher. The management of the donestamp file, | 186 | # forwards it to a proxy fetcher. The management of the donestamp file, |
179 | # the lockfile and the checksums are forwarded to the proxy fetcher. | 187 | # the lockfile and the checksums are forwarded to the proxy fetcher. |
180 | ud.proxy = Fetch([dep["url"] for dep in ud.deps], data) | 188 | ud.proxy = Fetch([dep["url"] for dep in ud.deps if dep["url"]], data) |
181 | ud.needdonestamp = False | 189 | ud.needdonestamp = False |
182 | 190 | ||
183 | @staticmethod | 191 | @staticmethod |
@@ -237,7 +245,16 @@ class NpmShrinkWrap(FetchMethod): | |||
237 | 245 | ||
238 | for dep in manual: | 246 | for dep in manual: |
239 | depdestdir = os.path.join(destdir, dep["destsuffix"]) | 247 | depdestdir = os.path.join(destdir, dep["destsuffix"]) |
240 | npm_unpack(dep["localpath"], depdestdir, d) | 248 | if dep["url"]: |
249 | npm_unpack(dep["localpath"], depdestdir, d) | ||
250 | else: | ||
251 | depsrcdir= os.path.join(destdir, dep["localpath"]) | ||
252 | if dep["unpack"]: | ||
253 | npm_unpack(depsrcdir, depdestdir, d) | ||
254 | else: | ||
255 | bb.utils.mkdirhier(depdestdir) | ||
256 | cmd = 'cp -fpPRH "%s/." .' % (depsrcdir) | ||
257 | runfetchcmd(cmd, d, workdir=depdestdir) | ||
241 | 258 | ||
242 | def clean(self, ud, d): | 259 | def clean(self, ud, d): |
243 | """Clean any existing full or partial download""" | 260 | """Clean any existing full or partial download""" |