Skip to content

fetch: package identity of crate, gomod and npm URLs

Stefano Tondo bitbake-devel 2 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 0 repliesNew
  2. v12 patches 1 replySuperseded

Changes in v2 from the cover letter

- package_identity() returns a PackageIdentity dataclass instead of a dict, as Paul proposed [2]. The dataclass is frozen.
- Rebased on master.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2fetch: Add package_identity() to the fetcherslib/bb/fetch/__init__.py+38 -00 replies
2/2fetch: Return the package identity of crate, gomod and npm URLslib/bb/fetch/crate.py lib/bb/fetch/gomod.py lib/bb/fetch/npm.py +1 more+94 -00 replies

Reviews trailers per patch

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

Read the v2 thread

Cover letter [PATCH v2 0/2] fetch: package identity of crate, gomod and npm URLs

Hi,

This series adds the fetcher API from the RFC "spdx30: name, version and purl for dependency downloads" [1]. Richard asked for a fetcher API that returns structured data with the purl, so that OE-Core does not read fetcher internals.

Patch 1 adds FetchMethod.package_identity(). It returns a PackageIdentity dataclass with the name, the version and the purl of the downloaded package, or None. It uses only the URL and the datastore, so it works before the fetch and without network access.

Patch 2 implements it for the crate, gomod, gomodgit and npm fetchers, with unit tests.

The RFC also covered the downloads that gitsm and npmsw add by themselves. That part is not in this series. Richard and Alexander prefer to list those downloads in SRC_URI. I will send that change for npm in a separate series.

Changes in v2:

- package_identity() returns a PackageIdentity dataclass instead of a dict, as Paul proposed [2]. The dataclass is frozen.
- Rebased on master.

Tests: bitbake-selftest bb.tests.fetch.PackageIdentityTest passes. bb.tests.fetch without the network tests gives the same results as on master.

v3 of the OE-Core series that uses the API follows on the OE-Core list.

[1] https://lore.kernel.org/openembedded-core/[email protected]/
[2] https://lore.kernel.org/bitbake-devel/[email protected]/

Stefano Tondo (2):
fetch: Add package_identity() to the fetchers
fetch: Return the package identity of crate, gomod and npm URLs

 lib/bb/fetch/__init__.py | 38 ++++++++++++++++++++++++
 lib/bb/fetch/crate.py    |  7 +++++
 lib/bb/fetch/gomod.py    | 16 ++++++++++
 lib/bb/fetch/npm.py      |  7 +++++
 lib/bb/tests/fetch.py    | 64 ++++++++++++++++++++++++++++++++++++++++
 5 files changed, 132 insertions(+)
Signature · 1 line
2.56.1