summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonard Göhrs <l.goehrs@pengutronix.de>2024-08-23 07:46:34 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-08-25 15:37:02 +0100
commitee6bf285d7ca35ab0f76c151a36e888ad1e41c40 (patch)
tree705b1503d8347a1fec652842e734e4600ba27100
parent58414305b289ae725f99c09bbfc74e9e162b4a4d (diff)
downloadpoky-ee6bf285d7ca35ab0f76c151a36e888ad1e41c40.tar.gz
bitbake: fetch2/npm: allow the '@' character in package names
The '@types/ramda' [1] npm package has recently gained a dependency on the 'types-ramda' [2] npm package. Both have the same version number. The name mangling results in the tarballs of both packages sharing the same name, but different contents. Fix that by accepting '@' as valid character in the package name, resulting in one package named @types-ramda and one called types-ramda. [1]: https://www.npmjs.com/package/@types/ramda [2]: https://www.npmjs.com/package/types-ramda (Bitbake rev: 7c9573cb6ea2081bc585eb65267f3124fd4d7e43) Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/fetch2/npm.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/bitbake/lib/bb/fetch2/npm.py b/bitbake/lib/bb/fetch2/npm.py
index 15f3f19bc8..ac76d64cdb 100644
--- a/bitbake/lib/bb/fetch2/npm.py
+++ b/bitbake/lib/bb/fetch2/npm.py
@@ -42,11 +42,12 @@ from bb.utils import is_semver
42 42
43def npm_package(package): 43def npm_package(package):
44 """Convert the npm package name to remove unsupported character""" 44 """Convert the npm package name to remove unsupported character"""
45 # Scoped package names (with the @) use the same naming convention 45 # For scoped package names ('@user/package') the '/' is replaced by a '-'.
46 # as the 'npm pack' command. 46 # This is similar to what 'npm pack' does, but 'npm pack' also strips the
47 # leading '@', which can lead to ambiguous package names.
47 name = re.sub("/", "-", package) 48 name = re.sub("/", "-", package)
48 name = name.lower() 49 name = name.lower()
49 name = re.sub(r"[^\-a-z0-9]", "", name) 50 name = re.sub(r"[^\-a-z0-9@]", "", name)
50 name = name.strip("-") 51 name = name.strip("-")
51 return name 52 return name
52 53