diff options
author | Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> | 2021-10-08 09:48:34 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-10-14 11:48:45 +0100 |
commit | fe87ab0a6a6f0c3d3fef4dd24a526dca3f9bde23 (patch) | |
tree | 0fba515caa5af9458386223d6144563cc668a8a8 /meta | |
parent | 9f452b48310a28f3471b17cc1085587c48e86c3b (diff) | |
download | poky-fe87ab0a6a6f0c3d3fef4dd24a526dca3f9bde23.tar.gz |
npm: Use configs for npm environment and args for npm run command
Use parameter configs of class NpmEnvironment and parameter args of
function run to support a common npmrc for all run calls of a single
NpmEnvironment.
(From OE-Core rev: 6490de38ba9563181653ef223224de066faf9166)
Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/npm.bbclass | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/meta/classes/npm.bbclass b/meta/classes/npm.bbclass index 05bb9f578d..547c531883 100644 --- a/meta/classes/npm.bbclass +++ b/meta/classes/npm.bbclass | |||
@@ -61,8 +61,8 @@ def npm_pack(env, srcdir, workdir): | |||
61 | """Run 'npm pack' on a specified directory""" | 61 | """Run 'npm pack' on a specified directory""" |
62 | import shlex | 62 | import shlex |
63 | cmd = "npm pack %s" % shlex.quote(srcdir) | 63 | cmd = "npm pack %s" % shlex.quote(srcdir) |
64 | configs = [("ignore-scripts", "true")] | 64 | args = [("ignore-scripts", "true")] |
65 | tarball = env.run(cmd, configs=configs, workdir=workdir).strip("\n") | 65 | tarball = env.run(cmd, args=args, workdir=workdir).strip("\n") |
66 | return os.path.join(workdir, tarball) | 66 | return os.path.join(workdir, tarball) |
67 | 67 | ||
68 | python npm_do_configure() { | 68 | python npm_do_configure() { |
@@ -228,15 +228,11 @@ python npm_do_compile() { | |||
228 | 228 | ||
229 | bb.utils.remove(d.getVar("NPM_BUILD"), recurse=True) | 229 | bb.utils.remove(d.getVar("NPM_BUILD"), recurse=True) |
230 | 230 | ||
231 | env = NpmEnvironment(d, configs=npm_global_configs(d)) | ||
232 | |||
233 | dev = bb.utils.to_boolean(d.getVar("NPM_INSTALL_DEV"), False) | ||
234 | |||
235 | with tempfile.TemporaryDirectory() as tmpdir: | 231 | with tempfile.TemporaryDirectory() as tmpdir: |
236 | args = [] | 232 | args = [] |
237 | configs = [] | 233 | configs = npm_global_configs(d) |
238 | 234 | ||
239 | if dev: | 235 | if bb.utils.to_boolean(d.getVar("NPM_INSTALL_DEV"), False): |
240 | configs.append(("also", "development")) | 236 | configs.append(("also", "development")) |
241 | else: | 237 | else: |
242 | configs.append(("only", "production")) | 238 | configs.append(("only", "production")) |
@@ -254,6 +250,8 @@ python npm_do_compile() { | |||
254 | configs.append(("nodedir", d.getVar("NPM_NODEDIR"))) | 250 | configs.append(("nodedir", d.getVar("NPM_NODEDIR"))) |
255 | configs.append(("python", d.getVar("PYTHON"))) | 251 | configs.append(("python", d.getVar("PYTHON"))) |
256 | 252 | ||
253 | env = NpmEnvironment(d, configs) | ||
254 | |||
257 | # Add node-pre-gyp configuration | 255 | # Add node-pre-gyp configuration |
258 | args.append(("target_arch", d.getVar("NPM_ARCH"))) | 256 | args.append(("target_arch", d.getVar("NPM_ARCH"))) |
259 | args.append(("build-from-source", "true")) | 257 | args.append(("build-from-source", "true")) |