From: Stefano Tondo <stondo@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: JPEWhacker@gmail.com, alex.kanavin@gmail.com,
stefan.herbrechtsmeier@weidmueller.com, paul@pbarker.dev,
mathieu.dubois-briand@bootlin.com, peter.marko@siemens.com,
stefano.tondo.ext@siemens.com
Subject: [PATCH v5 3/3] oeqa/selftest: spdx: Test crate identity and output PURLs
Date: Fri, 27 Nov 2026 00:07:32 +0100 [thread overview]
Message-ID: <20261126230732.2708012-4-stondo@gmail.com> (raw)
In-Reply-To: <20261126230732.2708012-1-stondo@gmail.com>
From: Stefano Tondo <stefano.tondo.ext@siemens.com>
hello-rs from meta-selftest has a fixed SRCREV. It fetches its source
and one git dependency from github.com, and one crate, figlet-rs
0.1.5. The new tests check that:
- The crate download has its name, version and PURL.
- The output package gets the PURLs of the three downloads and keeps
its own PURLs.
- A download PURL does not become the PURL of the package when
SPDX_PACKAGE_URLS is empty.
Signed-off-by: Stefano Tondo <stefano.tondo.ext@siemens.com>
---
meta/lib/oeqa/selftest/cases/spdx.py | 55 ++++++++++++++++++++++++++++
1 file changed, 55 insertions(+)
diff --git a/meta/lib/oeqa/selftest/cases/spdx.py b/meta/lib/oeqa/selftest/cases/spdx.py
index ce9a8af4f6..17484df591 100644
--- a/meta/lib/oeqa/selftest/cases/spdx.py
+++ b/meta/lib/oeqa/selftest/cases/spdx.py
@@ -543,3 +543,58 @@ class SPDX30Check(SPDX3CheckBase, OESelftestTestCase):
# Document should be fully linked
self.check_objset_missing_ids(objset)
+
+ # hello-rs is a test recipe with a fixed SRCREV. It fetches its source
+ # and one git dependency from github.com, and one crate.
+ HELLO_RS_DOWNLOAD_PURLS = {
+ "pkg:github/akiernan/hello-bin@d3d096eda182644868f8e7458dcfa538ff637db3",
+ "pkg:github/akiernan/hello-lib@59c84574e844617043cf337bc8fa537cf87ad8ae",
+ "pkg:cargo/figlet-rs@0.1.5",
+ }
+
+ def test_crate_package_identity(self):
+ """Test that a crate download has its name, version and PURL."""
+ objset = self.check_recipe_spdx(
+ "hello-rs",
+ "{DEPLOY_DIR_SPDX}/{SSTATE_PKGARCH}/builds/build-hello-rs.spdx.json",
+ )
+
+ crates = [
+ (pkg.name, pkg.software_packageVersion, pkg.software_packageUrl)
+ for pkg in objset.foreach_type(oe.spdx30.software_Package)
+ if (pkg.software_downloadLocation or "").startswith("https://static.crates.io/")
+ ]
+ self.assertEqual(crates, [("figlet-rs", "0.1.5", "pkg:cargo/figlet-rs@0.1.5")])
+
+ def get_package_purls(self, extraconf=""):
+ objset = self.check_recipe_spdx(
+ "hello-rs",
+ "{DEPLOY_DIR_SPDX}/{SSTATE_PKGARCH}/packages/package-hello-rs.spdx.json",
+ extraconf=extraconf,
+ )
+ package = next(
+ pkg
+ for pkg in objset.foreach_type(oe.spdx30.software_Package)
+ if pkg.name == "hello-rs"
+ )
+ purls = {
+ e.identifier
+ for e in package.externalIdentifier
+ if e.externalIdentifierType == oe.spdx30.ExternalIdentifierType.packageUrl
+ }
+ return package.software_packageUrl, purls
+
+ def test_download_purls_in_output_package(self):
+ """Test that the output package gets the PURLs of its downloads."""
+ package_purl, purls = self.get_package_purls()
+
+ own_purls = get_bb_var("SPDX_PACKAGE_URLS", "hello-rs").split()
+ self.assertEqual(package_purl, own_purls[0])
+ self.assertEqual(purls, set(own_purls) | self.HELLO_RS_DOWNLOAD_PURLS)
+
+ def test_download_purls_without_package_urls(self):
+ """Test that a download PURL does not become the package PURL."""
+ package_purl, purls = self.get_package_purls('SPDX_PACKAGE_URLS:pn-hello-rs = ""\n')
+
+ self.assertIsNone(package_purl)
+ self.assertEqual(purls, self.HELLO_RS_DOWNLOAD_PURLS)
--
2.56.1
prev parent reply other threads:[~2026-11-26 23:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 23:07 [PATCH v5 0/3] spdx30: identity and purls of dependency downloads Stefano Tondo
2026-11-26 23:07 ` [PATCH v5 1/3] spdx30: Take name, version and PURL of downloads from the fetcher Stefano Tondo
2026-11-26 23:07 ` [PATCH v5 2/3] spdx30: Add the PURLs of the source downloads to the output packages Stefano Tondo
2026-11-26 23:07 ` Stefano Tondo [this message]
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=20261126230732.2708012-4-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