Add check_missing_srcrev() to yocto-check-layer.bbclass to enforce the missing-srcrev check as an error during yocto-check-layer runs, using the shared oe.qa.check_uri_srcrev() helper.
This ensures layer maintainers submitting layers to the Yocto ecosystem must fix all missing SRCREVs before their layer passes validation, even if their layer only gets WARN_QA during normal builds. Note on design: missing-srcrev is not added to CHECKLAYER_REQUIRED_TESTS because that would promote it to ERROR_QA for all layers globally during normal builds, contradicting the layer-specific enforcement requested in Bug 16051 Comment 3. This direct implementation in yocto-check-layer.bbclass enforces it strictly during checklayer validation without affecting normal builds. This satisfies the requirement from Bug 16051 Comment 2: 'add a QA check outside of checklayer then add it to checklayer' Reported-by: Yoann Congal <[email protected]> Fixes: https://bugzilla.yoctoproject.org/show_bug.cgi?id=16051 AI-Generated: Developed with assistance from Anthropic Claude Signed-off-by: Sai Sneha <[email protected]> --- Changes in v4: - Refactored to use shared oe.qa.check_uri_srcrev() helper - Eliminates duplicated URI parsing logic - Added docstring Changes in v3: - Added AI-Generated disclosure and Reported-by tag Changes in v2: - Initial public submission meta/classes-global/yocto-check-layer.bbclass | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/meta/classes-global/yocto-check-layer.bbclass b/meta/classes-global/yocto-check-layer.bbclass index ba93085325..11b7f5d2ee 100644 --- a/meta/classes-global/yocto-check-layer.bbclass +++ b/meta/classes-global/yocto-check-layer.bbclass @@ -56,7 +56,22 @@ def check_network_flag(d): if network and not is_allowed(bpn, task): bb.error(f"QA Issue: task {task} has network enabled") +def check_missing_srcrev(d): + """ + Enforce missing-srcrev check as error during yocto-check-layer runs. + Uses the shared oe.qa.check_uri_srcrev() helper. + """ + import oe.qa + src_uri = (d.getVar('SRC_URI', False) or '').split() + pn = d.getVar('PN') + for uri in src_uri: + rev = oe.qa.check_uri_srcrev(pn, uri, d) + if rev is None: + bb.error("QA Issue: %s: SRCREV not set for SCM URI %s [missing-srcrev]" % (pn, uri)) + d.setVar("QA_ERRORS_FOUND", "True") + python () { check_insane_skip(d) check_network_flag(d) + check_missing_srcrev(d) } -- 2.34.1
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#237645): https://lists.openembedded.org/g/openembedded-core/message/237645 Mute This Topic: https://lists.openembedded.org/mt/119510789/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
