aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Jansa <martin.jansa@gmail.com>2024-01-15 16:32:25 +0100
committerMartin Jansa <martin.jansa@gmail.com>2024-04-16 09:00:51 +0200
commitd05a6683ebf021232f9639f2c6c83dc6d85e7f7c (patch)
treea8a8bc57337ed05b440aeaa015b0cc8afb1e4345
parenta0bf0333de230b2f16f6983e15d940d83616591e (diff)
downloadbitbake-contrib-d05a6683ebf021232f9639f2c6c83dc6d85e7f7c.tar.gz
fetch2: npmsw: add TODO about local link sources
* be a bit more strict when searching for file: prefix, but it's not clear if file:// prefix is allowed as well, the 3 examples in: https://docs.npmjs.com/cli/v10/configuring-npm/package-lock-json currently show: http tarball sources: This is the URL of the tarball. (eg, https://example.com/example-1.3.0.tgz) local tarball sources: This is the file URL of the tarball. (eg file:///opt/storage/example-1.3.0.tgz) local link sources: This is the file URL of the link. (eg file:libs/our-module) for absolute path it doesn't matter much as ///opt/storage/example-1.3.0.tgz will still resolve correctly but if someone uses file://../ then it won't be resolved as relative path (npm itself resolved "file:../", "file://../", "../" and just ".." the same). Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
-rw-r--r--lib/bb/fetch2/npmsw.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/bb/fetch2/npmsw.py b/lib/bb/fetch2/npmsw.py
index 694994660..cdab56ea4 100644
--- a/lib/bb/fetch2/npmsw.py
+++ b/lib/bb/fetch2/npmsw.py
@@ -143,7 +143,8 @@ class NpmShrinkWrap(FetchMethod):
localpath = os.path.join(d.getVar("DL_DIR"), localfile)
# Handle local tarball and link sources
- elif version.startswith("file"):
+ # TODO: properly resolve file:, file:// and missing file: prefix
+ elif version.startswith("file:"):
localpath = version[5:]
if not version.endswith(".tgz"):
unpack = False