mirror of
https://git.yoctoproject.org/poky
synced 2026-05-31 00:39:46 +00:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
58414305b2
commit
ee6bf285d7
@@ -42,11 +42,12 @@ from bb.utils import is_semver
|
|||||||
|
|
||||||
def npm_package(package):
|
def npm_package(package):
|
||||||
"""Convert the npm package name to remove unsupported character"""
|
"""Convert the npm package name to remove unsupported character"""
|
||||||
# Scoped package names (with the @) use the same naming convention
|
# For scoped package names ('@user/package') the '/' is replaced by a '-'.
|
||||||
# as the 'npm pack' command.
|
# This is similar to what 'npm pack' does, but 'npm pack' also strips the
|
||||||
|
# leading '@', which can lead to ambiguous package names.
|
||||||
name = re.sub("/", "-", package)
|
name = re.sub("/", "-", package)
|
||||||
name = name.lower()
|
name = name.lower()
|
||||||
name = re.sub(r"[^\-a-z0-9]", "", name)
|
name = re.sub(r"[^\-a-z0-9@]", "", name)
|
||||||
name = name.strip("-")
|
name = name.strip("-")
|
||||||
return name
|
return name
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user