bitbake: fetch2/npm: Remove special caracters that causes recipe tool to fail

Packages like @(._.)/execute causes problems because they generate names
that are not supported by yocto

(Bitbake rev: b2e1be67d2acca27451bed59874bc1c2a7ec44a6)

Signed-off-by: BELOUARGA Mohamed <m.belouarga@technologyandstrategy.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
BELOUARGA Mohamed
2023-06-04 03:39:19 +02:00
committed by Richard Purdie
parent d3642c2d10
commit 55f2e20350

View File

@@ -44,9 +44,12 @@ def npm_package(package):
"""Convert the npm package name to remove unsupported character"""
# Scoped package names (with the @) use the same naming convention
# as the 'npm pack' command.
if package.startswith("@"):
return re.sub("/", "-", package[1:])
return package
name = re.sub("/", "-", package)
name = name.lower()
name = re.sub(r"[^\-a-z0-9]", "", name)
name = name.strip("-")
return name
def npm_filename(package, version):
"""Get the filename of a npm package"""