Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 00/10] npm: list the dependencies in SRC_URI
@ 2026-11-20 13:53 Stefano Tondo
  2026-11-20 13:53 ` [PATCH 01/10] recipetool: create_npm: Give the fallback licenses as a string Stefano Tondo
                   ` (9 more replies)
  0 siblings, 10 replies; 12+ messages in thread
From: Stefano Tondo @ 2026-11-20 13:53 UTC (permalink / raw)
  To: openembedded-core
  Cc: Alexander Kanavin, Joshua Watt, Stefan Herbrechtsmeier,
	Peter Marko, stefano.tondo.ext

Hi,

This series lets an npm recipe list its dependencies in SRC_URI. Each
package gets one entry with its checksum. We agreed on this in the RFC
thread [1]. npmsw:// still works, but recipetool no longer uses it.

Today, a recipe that recipetool creates builds without its
dependencies. recipetool writes an npmsw:// entry without destsuffix.
Since bitbake commit 84f102954, npmsw unpacks into UNPACKDIR and not
into ${S}. So npm.bbclass does not find npm-shrinkwrap.json, packs no
dependencies, and gives no error. The package has no node_modules.

1. Patches 1 to 5 make "recipetool create" for npm work again on
   master. It failed on the missing checksum, on license values given
   as lists, and on the "@" of scoped names. The selftest expected an
   old value of S.
2. lib/oe/npm gives the SRC_URI entries for the dependencies of a
   shrinkwrap file, with unit tests.
3. The new class npm-update-dependencies writes these entries to
   ${BPN}-npm-deps.inc, like the cargo and Go update classes.
4. npm.bbclass checks that SRC_URI matches the shrinkwrap file, as
   Richard asked. It fails with a hint to run the update task.
5. recipetool runs do_clean after the tasks that it runs for the new
   recipe. Else devtool leaves stale stamps of do_unpack behind.
6. recipetool creates the recipe with the explicit list.

This series needs the two patches of the bitbake series "fetch/npm: no
npm executable, and an event log fix" [2]. Without "fetch/npm: Build
the tarball URL without the npm executable", the npm fetcher still
calls the npm executable of the host. Without "cooker: Write variables
that are not JSON types to the event log", the recipetool selftest
fails.

Two points for review:

- The check also applies to a recipe without npmsw:// that has
  node_modules in its source tree. I do not know of such a recipe.
  If there is one, an opt-out variable is simple to add.
- This series does not deprecate npmsw://. That can follow if you
  want it.

Tests on master with the two bitbake patches: oe-selftest -r oelib.npm
recipetool.RecipetoolCreateTests.test_recipetool_create_npm
devtool.DevtoolAddTests.test_devtool_add_npm pass. A build of
node-server-example with the explicit list installs all 72
dependencies. With one entry removed, do_configure fails and names it.

[1] https://lore.kernel.org/openembedded-core/20261111115845.1940227-1-stondo@gmail.com/T/
[2] https://lore.kernel.org/bitbake-devel/20261120135323.2627478-1-stondo@gmail.com/

Stefano Tondo (10):
  recipetool: create_npm: Give the fallback licenses as a string
  recipetool: create: Get the checksum of npm packages from the registry
  recipetool: create_npm: Give the package fallback licenses as strings
  recipetool: create_npm: Remove the "@" of a scope from generated names
  oeqa/selftest: recipetool: Expect the npm source in UNPACKDIR
  lib/oe/npm: Add SRC_URI entries for the dependencies of a shrinkwrap
    file
  npm-update-dependencies: Add a class to list the npm dependencies
  npm: Check that SRC_URI lists all dependencies of the shrinkwrap file
  recipetool: create: Clean the recipe after its tasks
  recipetool: create_npm: List the npm dependencies in SRC_URI

 .../npm-update-dependencies.bbclass           |  48 +++++++
 meta/classes-recipe/npm.bbclass               |  24 ++++
 meta/lib/oe/npm.py                            |  99 ++++++++++++++
 meta/lib/oeqa/selftest/cases/oelib/npm.py     | 121 ++++++++++++++++++
 meta/lib/oeqa/selftest/cases/recipetool.py    |  22 +++-
 scripts/lib/recipetool/create.py              |  31 +++++
 scripts/lib/recipetool/create_npm.py          |  62 ++++++---
 7 files changed, 384 insertions(+), 23 deletions(-)
 create mode 100644 meta/classes-recipe/npm-update-dependencies.bbclass
 create mode 100644 meta/lib/oe/npm.py
 create mode 100644 meta/lib/oeqa/selftest/cases/oelib/npm.py

-- 
2.56.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2026-11-20 14:04 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-20 13:53 [PATCH 00/10] npm: list the dependencies in SRC_URI Stefano Tondo
2026-11-20 13:53 ` [PATCH 01/10] recipetool: create_npm: Give the fallback licenses as a string Stefano Tondo
2026-11-20 13:53 ` [PATCH 02/10] recipetool: create: Get the checksum of npm packages from the registry Stefano Tondo
2026-11-20 13:53 ` [PATCH 03/10] recipetool: create_npm: Give the package fallback licenses as strings Stefano Tondo
2026-11-20 13:53 ` [PATCH 04/10] recipetool: create_npm: Remove the "@" of a scope from generated names Stefano Tondo
2026-11-20 14:04   ` Patchtest results for " patchtest
2026-11-20 13:53 ` [PATCH 05/10] oeqa/selftest: recipetool: Expect the npm source in UNPACKDIR Stefano Tondo
2026-11-20 13:53 ` [PATCH 06/10] lib/oe/npm: Add SRC_URI entries for the dependencies of a shrinkwrap file Stefano Tondo
2026-11-20 13:53 ` [PATCH 07/10] npm-update-dependencies: Add a class to list the npm dependencies Stefano Tondo
2026-11-20 13:53 ` [PATCH 08/10] npm: Check that SRC_URI lists all dependencies of the shrinkwrap file Stefano Tondo
2026-11-20 13:53 ` [PATCH 09/10] recipetool: create: Clean the recipe after its tasks Stefano Tondo
2026-11-20 13:53 ` [PATCH 10/10] recipetool: create_npm: List the npm dependencies in SRC_URI Stefano Tondo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox