diff mbox series

[1/1] npm: Convert to list-based commands for NpmEnvironment.run()

Message ID 20260610133444.29699-1-eric.meyers@arthrex.com
State New
Headers show
Series [1/1] npm: Convert to list-based commands for NpmEnvironment.run() | expand

Commit Message

Eric Meyers June 10, 2026, 1:34 p.m. UTC
This only affects those who have bypassed npm being disabled in bitbake (post commit 355cd226)

This recent upstream bitbake commit:
https://git.openembedded.org/bitbake/commit/?id=2ee0a002cd50eec1a0743c9ced9e07e529c79ddf

broke npm install commands within the npm bitbake class since NpmEnvironment.run() expects a list
instead of a string. Update the remaining callers to pass list-based commands to avoid:

  AttributeError: 'str' object has no attribute 'append'

Signed-off-by: Eric Meyers <eric.meyers@arthrex.com>
---
 meta/classes-recipe/npm.bbclass      | 2 +-
 scripts/lib/recipetool/create_npm.py | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Richard Purdie June 10, 2026, 2:29 p.m. UTC | #1
On Wed, 2026-06-10 at 08:34 -0500, Eric Meyers via lists.openembedded.org wrote:
> This only affects those who have bypassed npm being disabled in
> bitbake (post commit 355cd226)

I am curious if you plan to help fix/maintain the npm fetcher?

If nobody actually steps up and fixes it, I will remove it. I'm getting
a bit tired of maintaining things I have no interest in with no help
from the people who actually use it.

Cheers,

Richard
diff mbox series

Patch

diff --git a/meta/classes-recipe/npm.bbclass b/meta/classes-recipe/npm.bbclass
index 7bb791d543..b1183a7ae3 100644
--- a/meta/classes-recipe/npm.bbclass
+++ b/meta/classes-recipe/npm.bbclass
@@ -300,7 +300,7 @@  python npm_do_compile() {
 
         # Pack and install the main package
         (tarball, _) = npm_pack(env, d.getVar("NPM_PACKAGE"), tmpdir)
-        cmd = "npm install %s %s" % (shlex.quote(tarball), d.getVar("EXTRA_OENPM"))
+        cmd = ["npm", "install", tarball] + shlex.split(d.getVar("EXTRA_OENPM") or "")
         env.run(cmd, args=args)
 }
 
diff --git a/scripts/lib/recipetool/create_npm.py b/scripts/lib/recipetool/create_npm.py
index 8c4cdd5234..4d316d9a55 100644
--- a/scripts/lib/recipetool/create_npm.py
+++ b/scripts/lib/recipetool/create_npm.py
@@ -97,14 +97,14 @@  class NpmRecipeHandler(RecipeHandler):
         bb.utils.remove(os.path.join(srctree, "node_modules"), recurse=True)
 
         env = NpmEnvironment(d, configs=configs)
-        env.run("npm install", workdir=srctree)
+        env.run(["npm", "install"], workdir=srctree)
 
     def _generate_shrinkwrap(self, d, srctree, dev):
         """Check and generate the 'npm-shrinkwrap.json' file if needed"""
         configs = self._npm_global_configs(dev)
 
         env = NpmEnvironment(d, configs=configs)
-        env.run("npm shrinkwrap", workdir=srctree)
+        env.run(["npm", "shrinkwrap"], workdir=srctree)
 
         return os.path.join(srctree, "npm-shrinkwrap.json")