1
0
mirror of https://git.yoctoproject.org/poky synced 2026-06-02 01:19:52 +00:00

npm: return content of 'package.json' in 'npm_pack'

We have to read 'package.json' to calculate the name of the tarball.
This content is interesting for later patches.

(From OE-Core rev: d67367e389c492ae90f9021066d6a4d5ebcf68e5)

Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Enrico Scholz
2022-05-19 12:05:52 +02:00
committed by Richard Purdie
parent 6853b9b7d5
commit 3a4c11f2c7
+4 -4
View File
@@ -86,7 +86,7 @@ def npm_pack(env, srcdir, workdir):
'.'], '.'],
check = True, cwd = srcdir) check = True, cwd = srcdir)
return tarball return (tarball, j)
python npm_do_configure() { python npm_do_configure() {
""" """
@@ -187,7 +187,7 @@ python npm_do_configure() {
with tempfile.TemporaryDirectory() as tmpdir: with tempfile.TemporaryDirectory() as tmpdir:
# Add the dependency to the npm cache # Add the dependency to the npm cache
destdir = os.path.join(d.getVar("S"), destsuffix) destdir = os.path.join(d.getVar("S"), destsuffix)
tarball = npm_pack(env, destdir, tmpdir) (tarball, pkg) = npm_pack(env, destdir, tmpdir)
_npm_cache_add(tarball) _npm_cache_add(tarball)
# Add its signature to the cached shrinkwrap # Add its signature to the cached shrinkwrap
dep = _npmsw_dependency_dict(cached_shrinkwrap, deptree) dep = _npmsw_dependency_dict(cached_shrinkwrap, deptree)
@@ -208,7 +208,7 @@ python npm_do_configure() {
# Configure the main package # Configure the main package
with tempfile.TemporaryDirectory() as tmpdir: with tempfile.TemporaryDirectory() as tmpdir:
tarball = npm_pack(env, d.getVar("S"), tmpdir) (tarball, _) = npm_pack(env, d.getVar("S"), tmpdir)
npm_unpack(tarball, d.getVar("NPM_PACKAGE"), d) npm_unpack(tarball, d.getVar("NPM_PACKAGE"), d)
# Configure the cached manifest file and cached shrinkwrap file # Configure the cached manifest file and cached shrinkwrap file
@@ -282,7 +282,7 @@ python npm_do_compile() {
args.append(("build-from-source", "true")) args.append(("build-from-source", "true"))
# Pack and install the main package # Pack and install the main package
tarball = npm_pack(env, d.getVar("NPM_PACKAGE"), tmpdir) (tarball, _) = npm_pack(env, d.getVar("NPM_PACKAGE"), tmpdir)
cmd = "npm install %s %s" % (shlex.quote(tarball), d.getVar("EXTRA_OENPM")) cmd = "npm install %s %s" % (shlex.quote(tarball), d.getVar("EXTRA_OENPM"))
env.run(cmd, args=args) env.run(cmd, args=args)
} }