summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEnrico Scholz <enrico.scholz@sigma-chemnitz.de>2022-05-19 12:05:53 +0200
committerSteve Sakoman <steve@sakoman.com>2022-09-06 07:10:59 -1000
commit81ad70619017570779adbc1ca928b2412ad9bce7 (patch)
treea3ff3f2f9a8aee4fcd0cb3784a5c87cd80e68225
parent2f5c53745b4420dac9198ec013c6653b3e339a6b (diff)
downloadopenembedded-core-81ad70619017570779adbc1ca928b2412ad9bce7.tar.gz
npm: take 'version' directly from 'package.json'
We know the content of 'package.json' from earlier patches; there is no need to parse the tarball name to extract the version. Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit f553e528e76f7e3925ed1c0950d96e73aec37da9) Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r--meta/classes/npm.bbclass7
1 files changed, 1 insertions, 6 deletions
diff --git a/meta/classes/npm.bbclass b/meta/classes/npm.bbclass
index 014f793450..11c80a738e 100644
--- a/meta/classes/npm.bbclass
+++ b/meta/classes/npm.bbclass
@@ -125,11 +125,6 @@ python npm_do_configure() {
sha512 = bb.utils.sha512_file(tarball)
return "sha512-" + base64.b64encode(bytes.fromhex(sha512)).decode()
- def _npm_version(tarball):
- """Return the version of a specified tarball"""
- regex = r"-(\d+\.\d+\.\d+(-.*)?(\+.*)?)\.tgz"
- return re.search(regex, tarball).group(1)
-
def _npmsw_dependency_dict(orig, deptree):
"""
Return the sub dictionary in the 'orig' dictionary corresponding to the
@@ -190,7 +185,7 @@ python npm_do_configure() {
_npm_cache_add(tarball)
# Add its signature to the cached shrinkwrap
dep = _npmsw_dependency_dict(cached_shrinkwrap, deptree)
- dep["version"] = _npm_version(tarball)
+ dep["version"] = pkg['version']
dep["integrity"] = _npm_integrity(tarball)
if params.get("dev", False):
dep["dev"] = True