summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/npm.py
diff options
context:
space:
mode:
authorPeter Kjellerstedt <peter.kjellerstedt@axis.com>2022-01-29 03:29:39 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-02-05 17:46:44 +0000
commitbef3fe496969e79c8c44d3b1c41f60273a182104 (patch)
tree28d77b238a0a314655539454d21031d1fc4146cd /bitbake/lib/bb/fetch2/npm.py
parent88993ae0308d74b4c78d28a1ff61cb20305f4e74 (diff)
downloadpoky-bef3fe496969e79c8c44d3b1c41f60273a182104.tar.gz
bitbake: fetch2: npm: Put all downloaded files in the npm2 directory
Previously npm files that specify downloadfilename= in the SRC_URI would be downloaded to the root of ${DL_DIR} rather than in the ${DL_DIR}/npm2 directory where all other npm files are downloaded. This should make it simpler when setting up and configuring a premirror with the downloaded npm packages. (Bitbake rev: 73fa376d6502ab6f2cccfb25a1193d9b1c3c3bc8) Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/fetch2/npm.py')
-rw-r--r--bitbake/lib/bb/fetch2/npm.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/bitbake/lib/bb/fetch2/npm.py b/bitbake/lib/bb/fetch2/npm.py
index b3a3a444ee..8f7c10ac9b 100644
--- a/bitbake/lib/bb/fetch2/npm.py
+++ b/bitbake/lib/bb/fetch2/npm.py
@@ -52,9 +52,13 @@ def npm_filename(package, version):
52 """Get the filename of a npm package""" 52 """Get the filename of a npm package"""
53 return npm_package(package) + "-" + version + ".tgz" 53 return npm_package(package) + "-" + version + ".tgz"
54 54
55def npm_localfile(package, version): 55def npm_localfile(package, version=None):
56 """Get the local filename of a npm package""" 56 """Get the local filename of a npm package"""
57 return os.path.join("npm2", npm_filename(package, version)) 57 if version is not None:
58 filename = npm_filename(package, version)
59 else:
60 filename = package
61 return os.path.join("npm2", filename)
58 62
59def npm_integrity(integrity): 63def npm_integrity(integrity):
60 """ 64 """
@@ -157,7 +161,7 @@ class Npm(FetchMethod):
157 # Using the 'downloadfilename' parameter as local filename 161 # Using the 'downloadfilename' parameter as local filename
158 # or the npm package name. 162 # or the npm package name.
159 if "downloadfilename" in ud.parm: 163 if "downloadfilename" in ud.parm:
160 ud.localfile = d.expand(ud.parm["downloadfilename"]) 164 ud.localfile = npm_localfile(d.expand(ud.parm["downloadfilename"]))
161 else: 165 else:
162 ud.localfile = npm_localfile(ud.package, ud.version) 166 ud.localfile = npm_localfile(ud.package, ud.version)
163 167