npm: list the dependencies in SRC_URI
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest10 patches 1 replyIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/10 | recipetool: create_npm: Give the fallback licenses as a stringscripts/ | +2 | 0 replies | |
| 2/10 | recipetool: create: Get the checksum of npm packages from the registrymeta/ scripts/ | +25 | 0 replies | |
| 3/10 | recipetool: create_npm: Give the package fallback licenses as stringsscripts/ | +2 | 0 replies | |
| 4/10 | recipetool: create_npm: Remove the "@" of a scope from generated namesscripts/ | +9 | 1 reply | |
| 5/10 | oeqa/selftest: recipetool: Expect the npm source in UNPACKDIRmeta/ | +1 | 0 replies | |
| 6/10 | lib/oe/npm: Add SRC_URI entries for the dependencies of a shrinkwrap filemeta/ meta/ | +220 | 0 replies | |
| 7/10 | npm-update-dependencies: Add a class to list the npm dependenciesmeta/ | +48 | 0 replies | |
| 8/10 | npm: Check that SRC_URI lists all dependencies of the shrinkwrap filemeta/ | +24 | 0 replies | |
| 9/10 | recipetool: create: Clean the recipe after its tasksscripts/ | +5 | 0 replies | |
| 10/10 | recipetool: create_npm: List the npm dependencies in SRC_URImeta/ scripts/ scripts/ | +48 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
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