summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorEnrico Scholz <enrico.scholz@sigma-chemnitz.de>2022-05-19 12:05:53 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-09-12 08:41:48 +0100
commitdcf593b7a6ed865bcb8cd60cf588851c28dfd846 (patch)
treed82ca99daff59a3ab73c32a59c9ddb40fc31e787 /meta
parent54962ac3a96214daa1d3c84c9b5c02ea4fb1783d (diff)
downloadpoky-dcf593b7a6ed865bcb8cd60cf588851c28dfd846.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. (From OE-Core rev: 81ad70619017570779adbc1ca928b2412ad9bce7) 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> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-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() {
125 sha512 = bb.utils.sha512_file(tarball) 125 sha512 = bb.utils.sha512_file(tarball)
126 return "sha512-" + base64.b64encode(bytes.fromhex(sha512)).decode() 126 return "sha512-" + base64.b64encode(bytes.fromhex(sha512)).decode()
127 127
128 def _npm_version(tarball):
129 """Return the version of a specified tarball"""
130 regex = r"-(\d+\.\d+\.\d+(-.*)?(\+.*)?)\.tgz"
131 return re.search(regex, tarball).group(1)
132
133 def _npmsw_dependency_dict(orig, deptree): 128 def _npmsw_dependency_dict(orig, deptree):
134 """ 129 """
135 Return the sub dictionary in the 'orig' dictionary corresponding to the 130 Return the sub dictionary in the 'orig' dictionary corresponding to the
@@ -190,7 +185,7 @@ python npm_do_configure() {
190 _npm_cache_add(tarball) 185 _npm_cache_add(tarball)
191 # Add its signature to the cached shrinkwrap 186 # Add its signature to the cached shrinkwrap
192 dep = _npmsw_dependency_dict(cached_shrinkwrap, deptree) 187 dep = _npmsw_dependency_dict(cached_shrinkwrap, deptree)
193 dep["version"] = _npm_version(tarball) 188 dep["version"] = pkg['version']
194 dep["integrity"] = _npm_integrity(tarball) 189 dep["integrity"] = _npm_integrity(tarball)
195 if params.get("dev", False): 190 if params.get("dev", False):
196 dep["dev"] = True 191 dep["dev"] = True