* [master][PATCH] fetch2: npm: Remove special caracters that casauses recipe tool to fail
@ 2023-05-31 18:45 belouargamohamed
0 siblings, 0 replies; only message in thread
From: belouargamohamed @ 2023-05-31 18:45 UTC (permalink / raw)
To: bitbake-devel; +Cc: f.lahoudere, e.aubineau, j.guignard, BELOUARGA Mohamed
From: BELOUARGA Mohamed <m.belouarga@technologyandstrategy.com>
Packages like @(._.)/execute causes problems because they generate names
that are not supported by yocto
Signed-off-by: BELOUARGA Mohamed <m.belouarga@technologyandstrategy.com>
---
lib/bb/fetch2/npm.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/lib/bb/fetch2/npm.py b/lib/bb/fetch2/npm.py
index e6d0598f5d..f83485ad85 100644
--- a/lib/bb/fetch2/npm.py
+++ b/lib/bb/fetch2/npm.py
@@ -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"""
--
2.25.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-05-31 18:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-31 18:45 [master][PATCH] fetch2: npm: Remove special caracters that casauses recipe tool to fail belouargamohamed
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).