Skip to content

npm: list the dependencies in SRC_URI

Stefano Tondo openembedded-core 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest10 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10recipetool: create_npm: Give the fallback licenses as a stringscripts/lib/recipetool/create_npm.py+2 -30 replies
2/10recipetool: create: Get the checksum of npm packages from the registrymeta/lib/oeqa/selftest/cases/recipetool.py scripts/lib/recipetool/create.py+25 -10 replies
3/10recipetool: create_npm: Give the package fallback licenses as stringsscripts/lib/recipetool/create_npm.py+2 -10 replies
4/10recipetool: create_npm: Remove the "@" of a scope from generated namesscripts/lib/recipetool/create_npm.py+9 -31 reply
5/10oeqa/selftest: recipetool: Expect the npm source in UNPACKDIRmeta/lib/oeqa/selftest/cases/recipetool.py+1 -10 replies
6/10lib/oe/npm: Add SRC_URI entries for the dependencies of a shrinkwrap filemeta/lib/oe/npm.py meta/lib/oeqa/selftest/cases/oelib/npm.py+220 -00 replies
7/10npm-update-dependencies: Add a class to list the npm dependenciesmeta/classes-recipe/npm-update-dependencies.bbclass+48 -00 replies
8/10npm: Check that SRC_URI lists all dependencies of the shrinkwrap filemeta/classes-recipe/npm.bbclass+24 -00 replies
9/10recipetool: create: Clean the recipe after its tasksscripts/lib/recipetool/create.py+5 -00 replies
10/10recipetool: create_npm: List the npm dependencies in SRC_URImeta/lib/oeqa/selftest/cases/recipetool.py scripts/lib/recipetool/create.py scripts/lib/recipetool/create_npm.py+48 -140 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 00/10] npm: list the dependencies in SRC_URI

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/[email protected]/T/
[2] https://lore.kernel.org/bitbake-devel/[email protected]/

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
Signature · 1 line
2.56.1