From: Stefano Tondo <stondo@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: yoann.congal@smile.fr, jpewhacker@gmail.com,
peter.marko@siemens.com, adrian.freihofer@siemens.com,
patrick.wicki@siemens.com, stefano.tondo.ext@siemens.com,
Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>,
Richard Purdie <richard.purdie@linuxfoundation.org>
Subject: [blacksail][PATCH 3/3] oeqa/selftest: Add tests for source download enrichment
Date: Wed, 11 Nov 2026 18:35:26 +0100 [thread overview]
Message-ID: <20261111173526.3653122-4-stondo@gmail.com> (raw)
In-Reply-To: <20261111173526.3653122-1-stondo@gmail.com>
From: Stefano Tondo <stefano.tondo.ext@siemens.com>
test_gitsm_source_version builds git-submodule-test, which uses gitsm,
and checks that its source download carries the SRCREV as version.
test_git_purl_mappings_rerun_create_spdx builds fastfloat twice, first
with the default mapping and then with github.com mapped to another
PURL type, and checks that the second SPDX carries the new PURL. Before
the enrichment became part of the task signature, the second build
restored the first SPDX from sstate.
Signed-off-by: Stefano Tondo <stefano.tondo.ext@siemens.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 3ca309cbd38e7115705a9871c389b4641ec88c63)
Signed-off-by: Stefano Tondo <stefano.tondo.ext@siemens.com>
---
meta/lib/oeqa/selftest/cases/spdx.py | 47 ++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
diff --git a/meta/lib/oeqa/selftest/cases/spdx.py b/meta/lib/oeqa/selftest/cases/spdx.py
index 8285189382..e65ab46f30 100644
--- a/meta/lib/oeqa/selftest/cases/spdx.py
+++ b/meta/lib/oeqa/selftest/cases/spdx.py
@@ -443,3 +443,50 @@ class SPDX30Check(SPDX3CheckBase, OESelftestTestCase):
r'\d',
f"Version '{version}' for package '{name}' should contain digits"
)
+ def test_gitsm_source_version(self):
+ """Test that gitsm source downloads are enriched like git ones.
+
+ git-submodule-test is fetched with gitsm://, so its source download
+ must carry the SRCREV as version.
+ """
+ objset = self.check_recipe_spdx(
+ "git-submodule-test",
+ "{DEPLOY_DIR_SPDX}/{SSTATE_PKGARCH}/builds/build-git-submodule-test.spdx.json",
+ )
+
+ srcrev = get_bb_var("SRCREV", "git-submodule-test")
+ for pkg in objset.foreach_type(oe.spdx30.software_Package):
+ location = pkg.software_downloadLocation or ""
+ if location.startswith("git+https://git.yoctoproject.org/git-submodule-test"):
+ self.assertEqual(pkg.software_packageVersion, srcrev)
+ break
+ else:
+ self.fail("git-submodule-test gitsm source download not found")
+
+ def test_git_purl_mappings_rerun_create_spdx(self):
+ """Test that SPDX_GIT_PURL_MAPPINGS is part of the do_create_spdx signature.
+
+ fastfloat is fetched from github.com. Build it with the default
+ mapping, then map github.com to another PURL type: do_create_spdx
+ must run again instead of restoring the first result from sstate.
+ """
+ spdx_path = "{DEPLOY_DIR_SPDX}/{SSTATE_PKGARCH}/builds/build-fastfloat.spdx.json"
+ location_prefix = "git+https://github.com/fastfloat/fast_float"
+ srcrev = get_bb_var("SRCREV", "fastfloat")
+
+ def source_purl(objset):
+ for pkg in objset.foreach_type(oe.spdx30.software_Package):
+ if (pkg.software_downloadLocation or "").startswith(location_prefix):
+ return pkg.software_packageUrl
+ self.fail("fastfloat git source download not found")
+
+ objset = self.check_recipe_spdx("fastfloat", spdx_path)
+ self.assertEqual(source_purl(objset), f"pkg:github/fastfloat/fast_float@{srcrev}")
+
+ objset = self.check_recipe_spdx(
+ "fastfloat",
+ spdx_path,
+ extraconf='SPDX_GIT_PURL_MAPPINGS = "github.com:pkg:selftest"\n',
+ )
+ self.assertEqual(source_purl(objset), f"pkg:selftest/fastfloat/fast_float@{srcrev}")
+
--
2.56.0
prev parent reply other threads:[~2026-11-11 17:35 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 17:35 [blacksail][PATCH 0/3] spdx30: fix the source download enrichment Stefano Tondo
2026-11-11 17:35 ` [blacksail][PATCH 1/3] spdx30: Make source download enrichment part of the task signature Stefano Tondo
2026-11-11 17:35 ` [blacksail][PATCH 2/3] spdx30: Enrich gitsm source downloads like git ones Stefano Tondo
2026-11-11 17:35 ` 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=20261111173526.3653122-4-stondo@gmail.com \
--to=stondo@gmail.com \
--cc=adrian.freihofer@siemens.com \
--cc=jpewhacker@gmail.com \
--cc=mathieu.dubois-briand@bootlin.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=patrick.wicki@siemens.com \
--cc=peter.marko@siemens.com \
--cc=richard.purdie@linuxfoundation.org \
--cc=stefano.tondo.ext@siemens.com \
--cc=yoann.congal@smile.fr \
/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