@@ -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)
}
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 <yoann.congal@smile.fr> Fixes: https://bugzilla.yoctoproject.org/show_bug.cgi?id=16051 AI-Generated: Developed with assistance from Anthropic Claude Signed-off-by: Sai Sneha <saisneha196@gmail.com> --- 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(+)