summaryrefslogtreecommitdiffstats
path: root/meta/classes
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-06-28 12:55:26 +0100
commit2c9c9641bf438165dea4139a239581e2995e5615 (patch)
treea03cd01ea153e2e962e051f2f37315db97732de2 /meta/classes
parent3a4c11f2c733c6a9b652410d55495c7ae7eebf57 (diff)
downloadpoky-2c9c9641bf438165dea4139a239581e2995e5615.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: f553e528e76f7e3925ed1c0950d96e73aec37da9) Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-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 73483cb994..c180804e0e 100644
--- a/meta/classes/npm.bbclass
+++ b/meta/classes/npm.bbclass
@@ -126,11 +126,6 @@ python npm_do_configure() {
126 sha512 = bb.utils.sha512_file(tarball) 126 sha512 = bb.utils.sha512_file(tarball)
127 return "sha512-" + base64.b64encode(bytes.fromhex(sha512)).decode() 127 return "sha512-" + base64.b64encode(bytes.fromhex(sha512)).decode()
128 128
129 def _npm_version(tarball):
130 """Return the version of a specified tarball"""
131 regex = r"-(\d+\.\d+\.\d+(-.*)?(\+.*)?)\.tgz"
132 return re.search(regex, tarball).group(1)
133
134 def _npmsw_dependency_dict(orig, deptree): 129 def _npmsw_dependency_dict(orig, deptree):
135 """ 130 """
136 Return the sub dictionary in the 'orig' dictionary corresponding to the 131 Return the sub dictionary in the 'orig' dictionary corresponding to the
@@ -191,7 +186,7 @@ python npm_do_configure() {
191 _npm_cache_add(tarball) 186 _npm_cache_add(tarball)
192 # Add its signature to the cached shrinkwrap 187 # Add its signature to the cached shrinkwrap
193 dep = _npmsw_dependency_dict(cached_shrinkwrap, deptree) 188 dep = _npmsw_dependency_dict(cached_shrinkwrap, deptree)
194 dep["version"] = _npm_version(tarball) 189 dep["version"] = pkg['version']
195 dep["integrity"] = _npm_integrity(tarball) 190 dep["integrity"] = _npm_integrity(tarball)
196 if params.get("dev", False): 191 if params.get("dev", False):
197 dep["dev"] = True 192 dep["dev"] = True