All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Tondo <stondo@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Alexander Kanavin <alex.kanavin@gmail.com>,
	Joshua Watt <JPEWhacker@gmail.com>,
	Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>,
	Peter Marko <peter.marko@siemens.com>,
	stefano.tondo.ext@siemens.com
Subject: [PATCH 00/10] npm: list the dependencies in SRC_URI
Date: Fri, 20 Nov 2026 14:53:31 +0100	[thread overview]
Message-ID: <20261120135342.2628228-1-stondo@gmail.com> (raw)

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


             reply	other threads:[~2026-11-20 13:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 13:53 Stefano Tondo [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261120135342.2628228-1-stondo@gmail.com \
    --to=stondo@gmail.com \
    --cc=JPEWhacker@gmail.com \
    --cc=alex.kanavin@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=peter.marko@siemens.com \
    --cc=stefan.herbrechtsmeier@weidmueller.com \
    --cc=stefano.tondo.ext@siemens.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.