Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Stefano Tondo <stondo@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Joshua Watt <JPEWhacker@gmail.com>,
	Alexander Kanavin <alex.kanavin@gmail.com>,
	Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>,
	Paul Barker <paul@pbarker.dev>,
	Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>,
	Peter Marko <peter.marko@siemens.com>,
	stefano.tondo.ext@siemens.com
Subject: [PATCH v4 0/4] spdx30: identity and purls of dependency downloads
Date: Wed, 25 Nov 2026 19:36:09 +0100	[thread overview]
Message-ID: <20261125183613.1335718-1-stondo@gmail.com> (raw)

Hi,

This series implements the parts of the RFC "spdx30: name, version
and purl for dependency downloads" [1] that we agreed on. It needs
package_identity() from the bitbake series "fetch: package identity
of crate, gomod and npm URLs" [2], which is in bitbake master now.

1. The SPDX of a crate, gomod or npm download gets the name, the
   version and the purl from the fetcher.
2. A class can give the downloads of a recipe a lifecycle scope with
   a function in the new variable SPDX_DEPENDENCY_SCOPE_FUNCS. The
   build links to each download with a runtime, build or test scope.
   A download that is not used on the target gets an annotation. For
   Cargo recipes, a new do_cargo_metadata task writes the crate
   dependency graph for the target with all features, and
   oe.rust.cargo_dependency_scopes() reads it.
3. Each output package gets the purls of its source downloads as
   external identifiers, as Joshua proposed: a statically linked
   dependency is part of the binary. A purl is left out only when a
   scope function shows that the download is not in the target. The
   software_packageUrl of the package does not change.
4. Selftests with python3-bcrypt.

For python3-bcrypt, the output package gets the purls of 25 of its
42 crates. The other 17 crates are not built into the target.

Three points for review:

- The cargo graph has all features, so a crate of a feature that the
  recipe does not enable counts as used on the target. rpm-sequoia
  selects one crypto backend, but its package gets the purls of the
  crates of the other backends too. A follow-up can make this more
  precise, for example with the crates that cargo really compiled.
- All output packages of a recipe get the purls, also -dbg and -src.
  I have no proof per package, so I followed the rule "keep the purl
  unless there is proof".
- Go recipes have no scope function yet. go version -m can give the
  proof per binary, and a follow-up can add it to
  SPDX_DEPENDENCY_SCOPE_FUNCS.

Changes in v4:

- Patch 2/4: the SPDX code does not read the cargo graph anymore, as
  Joshua asked [5]. create_spdx calls the functions in
  SPDX_DEPENDENCY_SCOPE_FUNCS. cargo.bbclass adds
  oe.rust.cargo_dependency_scopes(), and the walk over the cargo
  graph moves to oe/rust.py.
- Patch 2/4: do_cargo_metadata writes the graph with all features.
  v3 used the default features. rpm-sequoia builds with the feature
  crypto-openssl, so v3 annotated openssl-sys as not built and left
  its purl out of the package.
- Patch 2/4: do_cargo_metadata does not fail when cargo cannot give
  the graph. In v3 it failed for mozjs-140 in meta-oe, which
  configures the crate sources in its own way.
- Patch 3/4: uses the result of the scope functions, so it is not
  specific to Cargo anymore.
- Patch 4/4: add a test with rpm-sequoia.
- Patch 1/4: add the Reviewed-by of Joshua.
- Rebased on master.

Changes in v3:

- Patch 1/4: read the PackageIdentity dataclass that
  package_identity() returns in v2 of the bitbake series [2], as Paul
  proposed [4].
- Rebased on master, which has python3-uv-build 0.13.8.

Changes in v2:

- Patch 2/4: the walk over the cargo graph expands each workspace
  member only once. In v1 it did not end for python3-uv-build, where
  the member uv-preview is a dev dependency of itself. do_create_spdx
  used memory until the OOM killer stopped it. Thanks to Mathieu for
  the report [3].
- Patch 2/4: add unit tests for the scopes, with member cycles.
- Rebased on master.

Tests: oe-selftest -r oelib.cargo_scopes spdx.SPDX30Check passes on
master (24 tests). The new rpm-sequoia test fails without the
feature fix. do_cargo_metadata succeeds for the 29 recipes in oe-core
and meta-oe that inherit cargo: 27 get a graph, mozjs-140 gets none,
and python3-setuptools-rust is not a Cargo project.

[1] https://lore.kernel.org/openembedded-core/20261105122145.543282-1-stondo@gmail.com/
[2] https://lore.kernel.org/bitbake-devel/20261119204856.2930668-1-stondo@gmail.com/
[3] https://lore.kernel.org/openembedded-core/DMYFTUY2A6RH.1WI2PDCNCPOJY@bootlin.com/
[4] https://lore.kernel.org/bitbake-devel/DMZ3ERL47CEB.3KE9TOG6YIZPD@pbarker.dev/
[5] https://lore.kernel.org/openembedded-core/CAJdd5GaVPXT8Af3qNPWRArPLRMupC875nHSw_jdqBs_563hjkw@mail.gmail.com/

Stefano Tondo (4):
  spdx30: Take name, version and PURL of downloads from the fetcher
  spdx30: Record the lifecycle scope of dependencies
  spdx30: Add the PURLs of the source downloads to the output packages
  oeqa/selftest: spdx: Test crate identity, scope and output PURLs

 meta/classes-recipe/cargo.bbclass             |  27 ++++
 meta/classes/create-spdx-3.0.bbclass          |  12 ++
 meta/lib/oe/rust.py                           |  74 +++++++++
 meta/lib/oe/spdx30_tasks.py                   |  83 +++++++++-
 .../oeqa/selftest/cases/oelib/cargo_scopes.py |  96 +++++++++++
 meta/lib/oeqa/selftest/cases/spdx.py          | 151 ++++++++++++++++++
 6 files changed, 442 insertions(+), 1 deletion(-)
 create mode 100644 meta/lib/oeqa/selftest/cases/oelib/cargo_scopes.py

-- 
2.56.1


             reply	other threads:[~2026-11-25 18:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 18:36 Stefano Tondo [this message]
2026-11-25 18:36 ` [PATCH v4 1/4] spdx30: Take name, version and PURL of downloads from the fetcher Stefano Tondo
2026-11-25 18:36 ` [PATCH v4 2/4] spdx30: Record the lifecycle scope of dependencies Stefano Tondo
2026-11-26 13:24   ` Paul Barker
2026-11-26 23:07     ` Stefano Tondo
2026-11-25 18:36 ` [PATCH v4 3/4] spdx30: Add the PURLs of the source downloads to the output packages Stefano Tondo
2026-11-25 18:36 ` [PATCH v4 4/4] oeqa/selftest: spdx: Test crate identity, scope and output PURLs Stefano Tondo
2026-11-26 13:27   ` Paul Barker
2026-11-26 23:07     ` 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=20261125183613.1335718-1-stondo@gmail.com \
    --to=stondo@gmail.com \
    --cc=JPEWhacker@gmail.com \
    --cc=alex.kanavin@gmail.com \
    --cc=mathieu.dubois-briand@bootlin.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=paul@pbarker.dev \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox