All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 00/21] Concept for tightly coupled package manager (Node.js, Go, Rust)
@ 2024-12-20 11:25 Stefan Herbrechtsmeier
  2024-12-20 11:25 ` [RFC PATCH 01/21] tests: fetch: update npmsw tests to new lockfile format Stefan Herbrechtsmeier
                   ` (24 more replies)
  0 siblings, 25 replies; 66+ messages in thread
From: Stefan Herbrechtsmeier @ 2024-12-20 11:25 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Stefan Herbrechtsmeier

From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>

The patch series improves the fetcher support for tightly coupled
package manager (npm, go and cargo). It adds support for embedded
dependency fetcher via a common dependency mixin. The patch series
reworks the npm-shrinkwrap.json (package-lock.json) support and adds a
fetcher for go.sum and cargo.lock files. The dependency mixin contains
two stages. The first stage locates a local specification file or
fetches an archive or git repository with a specification file. The
second stage resolves the dependency URLs from the specification file
and fetches the dependencies.

SRC_URI = "<type>://npm-shrinkwrap.json"
SRC_URI = "<type>+http://example.com/ npm-shrinkwrap.json"
SRC_URI = "<type>+http://example.com/${BP}.tar.gz;striplevel=1;subdir=${BP}"
SRC_URI = "<type>+git://example.com/${BPN}.git;protocol=https"

Additionally, the patch series reworks the npm fetcher to work without a
npm binary and external package repository. It adds support for a common
dependency name and version schema to integrate the dependencies into
the SBOM.

= Background
Bitbake has diverse concepts and drawbacks for different tightly coupled
package manager. The Python support uses a recipe per dependency and
generates common fetcher URLs via a python function. The other languages
embed the dependencies inside the recipe. The Node.js support offers a
npmsw fetcher which uses a lock file beside the recipe to generates
multiple common fetcher URLs on the fly and thereby hides the real
download sources. This leads to a single source in the SBOM for example.
The Go support contains two parallel implementations. A vendor-based
solution with a common fetcher and a go-mod-based solution with a gomod
fetcher. The vendor-based solution includes the individual dependencies
into the SRC_URI of the recipe and uses a python function to generate
common fetcher URLs which additional information for the vendor task.The
gomod fetcher uses a proprietary gomod URL. It translates the URL into a
common URL and prepares meta data during unpack. The Rust support
includes the individual dependencies in the SRC_URI of the recipe and
uses proprietary crate URLs. The crate fetcher translates a proprietary
URL into a common fetcher URL and prepares meta data during unpack. The
recipetool does not support the crate and the gomod fetcher. This leads
to missing licenses of the dependencies in the recipe for example
librsvg.

The steps needed to fetch dependencies for Node.js, Go and Rust are
similar:
1. Extract the dependencies from a specification file (name, version,
   checksum and URL)
2. Generate proprietary fetcher URIs
  a. npm://registry.npmjs.org/;package=glob;version= 10.3.15
  b. gomod://golang.org/x/net;version=v0.9.0
     gomodgit://golang.org/x/net;version=v0.9.0;repo=go.googlesource.com/net
  c. crate://crates.io/glob/0.3.1
3. Generate wget or git fetcher URIs
  a. https://registry.npmjs.org/glob/-/glob-10.3.15.tgz;downloadfilename=…
  b. https://proxy.golang.org/golang.org/x/net/@v/v0.9.0.zip;downloadfilename=…
     git://go.googlesource.com/net;protocol=https; subdir=…
  c. https://crates.io/api/v1/crates/glob/0.3.1/download;downloadfilename=…
4. Unpack
5. Create meta files
  a. Update lockfile and create tar.gz archives
  b. Create go.mod file
     Create info, go.mod file and zip archives
  c. Create .cargo-checksum.json files

It looks like the recipetool is not widely used and therefore this patch
series integrates the dependency resolving into the fetcher. After an
agreement on a concept the fetcher could be extended. The fetcher could
download the license information per package and a new build task could
run the license cruncher from the recipetool.

= Open questions

* Where should we download dependencies?
** Should we use a folder per fetcher (ex. git and npm)?
** Should we use the main folder (ex. crate)?
** Should we translate the name into folder (ex. gomod)?
** Should we integrate the name into the filename (ex. git)?
* Where should we unpack the dependencies?
** Should we use a folder inside the parent folder (ex. node_modules)?
** Should we use a fixed folder inside unpackdir
   (ex. go/pkg/mod/cache/download and cargo_home/bitbake)?
* How should we treat archives for package manager caches?
** Should we unpack the archives to support patching (ex. npm)?
** Should we copy the packed archive to avoid unpacking and packaging
   (ex. gomod)?

This patch series depends on patch series
20241209103158.20833-1-stefan.herbrechtsmeier-oss@weidmueller.com
("[1/4] tests: fetch: adapt npmsw tests to fixed unpack behavior").


Stefan Herbrechtsmeier (21):
  tests: fetch: update npmsw tests to new lockfile format
  fetch2: npmsw: remove old lockfile format support
  tests: fetch: replace [url] with urls for npm
  fetch2: do not prefix embedded checksums
  fetch2: read checksum from SRC_URI flag for npm
  fetch2: introduce common package manager metadata
  fetch2: add unpack support for npm archives
  utils: add Go mod h1 checksum support
  fetch2: add destdir to FetchData
  fetch: npm: rework
  tests: fetch: adapt style in npm(sw) class
  tests: fetch: move npmsw test cases into npmsw test class
  tests: fetch: adapt npm test cases
  fetch: add dependency mixin
  tests: fetch: add test cases for dependency fetcher
  fetch: npmsw: migrate to dependency mixin
  tests: fetch: adapt npmsw test cases
  fetch: add gosum fetcher
  tests: fetch: add test cases for gosum
  fetch: add cargolock fetcher
  tests: fetch: add test cases for cargolock

 lib/bb/fetch2/__init__.py   |  35 +-
 lib/bb/fetch2/cargolock.py  |  73 +++
 lib/bb/fetch2/dependency.py | 167 +++++++
 lib/bb/fetch2/gomod.py      |   5 +-
 lib/bb/fetch2/gosum.py      |  51 +++
 lib/bb/fetch2/npm.py        | 244 +++-------
 lib/bb/fetch2/npmsw.py      | 347 ++++----------
 lib/bb/tests/fetch.py       | 880 +++++++++++++++++-------------------
 lib/bb/utils.py             |  25 +
 9 files changed, 916 insertions(+), 911 deletions(-)
 create mode 100644 lib/bb/fetch2/cargolock.py
 create mode 100644 lib/bb/fetch2/dependency.py
 create mode 100644 lib/bb/fetch2/gosum.py

-- 
2.39.5



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

end of thread, other threads:[~2025-01-17 14:09 UTC | newest]

Thread overview: 66+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-20 11:25 [RFC PATCH 00/21] Concept for tightly coupled package manager (Node.js, Go, Rust) Stefan Herbrechtsmeier
2024-12-20 11:25 ` [RFC PATCH 01/21] tests: fetch: update npmsw tests to new lockfile format Stefan Herbrechtsmeier
2024-12-20 11:25 ` [RFC PATCH 02/21] fetch2: npmsw: remove old lockfile format support Stefan Herbrechtsmeier
2024-12-20 11:25 ` [RFC PATCH 03/21] tests: fetch: replace [url] with urls for npm Stefan Herbrechtsmeier
2024-12-20 11:25 ` [RFC PATCH 04/21] fetch2: do not prefix embedded checksums Stefan Herbrechtsmeier
2024-12-20 11:25 ` [RFC PATCH 05/21] fetch2: read checksum from SRC_URI flag for npm Stefan Herbrechtsmeier
2024-12-20 11:25 ` [RFC PATCH 06/21] fetch2: introduce common package manager metadata Stefan Herbrechtsmeier
2024-12-20 11:25 ` [RFC PATCH 07/21] fetch2: add unpack support for npm archives Stefan Herbrechtsmeier
2024-12-23 11:56   ` [bitbake-devel] " Richard Purdie
2025-01-02 12:39     ` Stefan Herbrechtsmeier
2025-01-02 13:59       ` Richard Purdie
2024-12-20 11:25 ` [RFC PATCH 08/21] utils: add Go mod h1 checksum support Stefan Herbrechtsmeier
2024-12-23 10:01   ` [bitbake-devel] " Richard Purdie
2025-01-02  8:27     ` Stefan Herbrechtsmeier
2024-12-20 11:26 ` [RFC PATCH 09/21] fetch2: add destdir to FetchData Stefan Herbrechtsmeier
2024-12-23  9:56   ` [bitbake-devel] " Richard Purdie
2025-01-02  8:04     ` Stefan Herbrechtsmeier
2024-12-20 11:26 ` [RFC PATCH 10/21] fetch: npm: rework Stefan Herbrechtsmeier
2024-12-20 11:26 ` [RFC PATCH 11/21] tests: fetch: adapt style in npm(sw) class Stefan Herbrechtsmeier
2024-12-20 11:26 ` [RFC PATCH 12/21] tests: fetch: move npmsw test cases into npmsw test class Stefan Herbrechtsmeier
2024-12-20 11:26 ` [RFC PATCH 13/21] tests: fetch: adapt npm test cases Stefan Herbrechtsmeier
2024-12-20 11:26 ` [RFC PATCH 14/21] fetch: add dependency mixin Stefan Herbrechtsmeier
2024-12-20 11:26 ` [RFC PATCH 15/21] tests: fetch: add test cases for dependency fetcher Stefan Herbrechtsmeier
2024-12-20 11:26 ` [RFC PATCH 16/21] fetch: npmsw: migrate to dependency mixin Stefan Herbrechtsmeier
2024-12-20 11:26 ` [RFC PATCH 17/21] tests: fetch: adapt npmsw test cases Stefan Herbrechtsmeier
2024-12-20 11:26 ` [RFC PATCH 18/21] fetch: add gosum fetcher Stefan Herbrechtsmeier
2024-12-20 11:26 ` [RFC PATCH 19/21] tests: fetch: add test cases for gosum Stefan Herbrechtsmeier
2024-12-20 11:26 ` [RFC PATCH 20/21] fetch: add cargolock fetcher Stefan Herbrechtsmeier
2024-12-20 11:26 ` [RFC PATCH 21/21] tests: fetch: add test cases for cargolock Stefan Herbrechtsmeier
2024-12-23 10:03 ` [bitbake-devel] [RFC PATCH 00/21] Concept for tightly coupled package manager (Node.js, Go, Rust) Richard Purdie
2024-12-25 15:17   ` Alexander Kanavin
2025-01-06 14:42     ` Stefan Herbrechtsmeier
2025-01-09 10:40       ` Alexander Kanavin
2025-01-09 14:00         ` Stefan Herbrechtsmeier
2025-01-09 19:40           ` Alexander Kanavin
2025-01-10 11:32             ` Stefan Herbrechtsmeier
2025-01-10 13:26               ` Alexander Kanavin
2025-01-10 15:04                 ` Stefan Herbrechtsmeier
2025-01-10 16:07                   ` Alexander Kanavin
2025-01-10 20:24                   ` Bruce Ashfield
2025-01-13  7:11                     ` Stefan Herbrechtsmeier
2025-01-17  4:19                       ` Bruce Ashfield
2025-01-17  5:37                         ` Alexander Kanavin
2025-01-17  7:45                         ` Stefan Herbrechtsmeier
2025-01-17 14:09                           ` Bruce Ashfield
     [not found]       ` <18190013516DD62F.1999@lists.openembedded.org>
2025-01-09 10:50         ` Alexander Kanavin
2025-01-09 14:18           ` Stefan Herbrechtsmeier
2025-01-02  8:55   ` Stefan Herbrechtsmeier
2025-01-02  9:32     ` Richard Purdie
2025-01-02 10:51       ` Stefan Herbrechtsmeier
2025-01-02 13:50       ` Stefan Herbrechtsmeier
2025-01-02 14:07         ` Richard Purdie
2025-01-02 15:11           ` Stefan Herbrechtsmeier
2025-01-06 11:04 ` Richard Purdie
2025-01-06 14:35   ` Stefan Herbrechtsmeier
2025-01-06 15:30     ` Richard Purdie
2025-01-07  9:47       ` Stefan Herbrechtsmeier
2025-01-07 11:01         ` Richard Purdie
2025-01-07 16:13           ` Stefan Herbrechtsmeier
2025-01-07 16:58             ` Bruce Ashfield
2025-01-07 17:46               ` Stefan Herbrechtsmeier
2025-01-08 15:43                 ` Bruce Ashfield
2025-01-09 11:51                   ` Stefan Herbrechtsmeier
2025-01-09 11:53 ` Martin Jansa
2025-01-09 14:26   ` Stefan Herbrechtsmeier
     [not found] ` <1812DEFF37B8C65E.26783@lists.openembedded.org>
2025-01-10  7:12   ` [bitbake-devel] [RFC PATCH 06/21] fetch2: introduce common package manager metadata Stefan Herbrechtsmeier

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.