* [PATCH v2 1/2] insane.bbclass: check revision for every git URI
@ 2025-11-17 17:12 Corentin Guillevic
2025-11-17 17:12 ` [PATCH v2 2/2] layer.conf: enable test for revision alongside a " Corentin Guillevic
2025-11-18 16:20 ` [OE-core] [PATCH v2 1/2] insane.bbclass: check revision for every " Mathieu Dubois-Briand
0 siblings, 2 replies; 3+ messages in thread
From: Corentin Guillevic @ 2025-11-17 17:12 UTC (permalink / raw)
To: openembedded-core; +Cc: Corentin Guillevic
Every git URI into SRC_URI variable should have a revision. However, if
the revision is missing (SRCREV), BitBake will perform a query on the
remote repository every time it parses a recipe.
This check will raise an error if a git URI is not provided alongside a revision.
Signed-off-by: Corentin Guillevic <corentin.guillevic@smile.fr>
---
v2: add support of rev= parameter
meta/classes-global/insane.bbclass | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/meta/classes-global/insane.bbclass b/meta/classes-global/insane.bbclass
index fed8163c3e..63490ecf25 100644
--- a/meta/classes-global/insane.bbclass
+++ b/meta/classes-global/insane.bbclass
@@ -1495,7 +1495,33 @@ python do_recipe_qa() {
error_msg = "%s: invalid PACKAGECONFIG(s): %s" % (pn, " ".join(sorted(invalid_pkgconfigs)))
oe.qa.handle_error("invalid-packageconfig", error_msg, d)
+ def test_git_missing_srcrev(pn, d):
+ sha1_re = re.compile(r'^[0-9a-f]{40}$')
+ for uri in d.getVar('SRC_URI').split():
+ if not uri.startswith('git://'):
+ continue
+
+ # Get parameters for the current URI
+ params = bb.fetch2.decodeurl(uri)[5]
+ name = params.get('name', '')
+ rev = params.get('rev', '')
+
+ # Revision is provided as a 'rev' parameter
+ if rev:
+ # Prevent any revision that doesn't look like a SHA-1
+ if not sha1_re.match(rev or ''):
+ oe.qa.handle_error("missing-srcrev", "%s: ;rev=%s URL parameter doesn't look like a SHA-1" % (pn, rev), d)
+ # git URI has a "name" parameter
+ elif name:
+ rev = d.getVar('SRCREV_' + name)
+ if not rev:
+ oe.qa.handle_error("missing-srcrev", "%s: no revision (%s) defined for URI %s" % (pn, 'SRCREV_' + name, uri), d)
+ else:
+ if d.getVar('SRCREV') == "INVALID":
+ oe.qa.handle_error("missing-srcrev", "%s: no revision (SRCREV) defined for URI %s" % (pn, uri), d)
+
pn = d.getVar('PN')
+ test_git_missing_srcrev(pn, d)
test_naming(pn, d)
test_missing_metadata(pn, d)
test_missing_maintainer(pn, d)
--
2.49.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v2 2/2] layer.conf: enable test for revision alongside a git URI
2025-11-17 17:12 [PATCH v2 1/2] insane.bbclass: check revision for every git URI Corentin Guillevic
@ 2025-11-17 17:12 ` Corentin Guillevic
2025-11-18 16:20 ` [OE-core] [PATCH v2 1/2] insane.bbclass: check revision for every " Mathieu Dubois-Briand
1 sibling, 0 replies; 3+ messages in thread
From: Corentin Guillevic @ 2025-11-17 17:12 UTC (permalink / raw)
To: openembedded-core; +Cc: Corentin Guillevic
As meta is the main layer, its recipes should fully comply with revisions
for git URIs. Enable the check for this layer only.
Signed-off-by: Corentin Guillevic <corentin.guillevic@smile.fr>
---
meta/conf/layer.conf | 3 +++
1 file changed, 3 insertions(+)
diff --git a/meta/conf/layer.conf b/meta/conf/layer.conf
index ba25ca3029..1f95867165 100644
--- a/meta/conf/layer.conf
+++ b/meta/conf/layer.conf
@@ -19,6 +19,9 @@ BBLAYERS_LAYERINDEX_NAME_core = "openembedded-core"
# Set a variable to get to the top of the metadata location
COREBASE = '${@os.path.normpath("${LAYERDIR}/../")}'
+# Raise an error if no revision is provided with a git URI
+ERROR_QA:append:layer-core = " missing-srcrev"
+
# opkg-utils is for update-alternatives :(
SIGGEN_EXCLUDERECIPES_ABISAFE += " \
sysvinit-inittab \
--
2.49.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [OE-core] [PATCH v2 1/2] insane.bbclass: check revision for every git URI
2025-11-17 17:12 [PATCH v2 1/2] insane.bbclass: check revision for every git URI Corentin Guillevic
2025-11-17 17:12 ` [PATCH v2 2/2] layer.conf: enable test for revision alongside a " Corentin Guillevic
@ 2025-11-18 16:20 ` Mathieu Dubois-Briand
1 sibling, 0 replies; 3+ messages in thread
From: Mathieu Dubois-Briand @ 2025-11-18 16:20 UTC (permalink / raw)
To: corentin.guillevic, openembedded-core
On Mon Nov 17, 2025 at 6:12 PM CET, Corentin Guillevic via lists.openembedded.org wrote:
> Every git URI into SRC_URI variable should have a revision. However, if
> the revision is missing (SRCREV), BitBake will perform a query on the
> remote repository every time it parses a recipe.
>
> This check will raise an error if a git URI is not provided alongside a revision.
>
> Signed-off-by: Corentin Guillevic <corentin.guillevic@smile.fr>
> ---
Hi Corentin,
Thanks for your patch.
It looks like this is braking a lot of seltests, with errors such as:
2025-11-18 10:16:22,997 - oe-selftest - INFO - devtool.DevtoolAddTests.test_devtool_add_binary (subunit.RemotedTestCase)
2025-11-18 10:16:22,998 - oe-selftest - INFO - ... FAIL
...
Parsing recipes...ERROR: /srv/pokybuild/yocto-worker/oe-selftest-debian/build/build-st-38423/workspace/recipes/recipetool/tmp-recipetool-oalz2197.bb: AUTOREV/SRCPV set too late for the fetcher to work properly, please set the variables earlier in parsing. Erroring instead of later obtuse build failures.
ERROR: Parsing halted due to errors, see error messages above
Summary: There were 2 ERROR messages, returning a non-zero exit code.
Traceback (most recent call last):
File "/srv/pokybuild/yocto-worker/oe-selftest-debian/build/layers/openembedded-core/scripts/recipetool", line 111, in <module>
ret = main()
^^^^^^
File "/srv/pokybuild/yocto-worker/oe-selftest-debian/build/layers/openembedded-core/scripts/recipetool", line 100, in main
ret = args.func(args)
^^^^^^^^^^^^^^^
File "/srv/pokybuild/yocto-worker/oe-selftest-debian/build/layers/openembedded-core/scripts/lib/recipetool/create.py", line 525, in create_recipe
checksums, ftmpdir = scriptutils.fetch_url(tinfoil, fetchuri, srcrev, srctree, logger, preserve_tmp=args.keep_temp)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/srv/pokybuild/yocto-worker/oe-selftest-debian/build/layers/openembedded-core/scripts/lib/scriptutils.py", line 202, in fetch_url
tinfoil.parse_recipes()
File "/srv/pokybuild/yocto-worker/oe-selftest-debian/build/layers/bitbake/lib/bb/tinfoil.py", line 585, in parse_recipes
self.run_actions(config_params)
File "/srv/pokybuild/yocto-worker/oe-selftest-debian/build/layers/bitbake/lib/bb/tinfoil.py", line 568, in run_actions
raise TinfoilUIException(ret)
bb.tinfoil.TinfoilUIException: 1
ERROR: Command 'recipetool --color=auto create --devtool -o /tmp/devtoolordsanap 'file:///tmp/devtoolqa1ao0e11u/tst-bin.tar.gz' -x /srv/pokybuild/yocto-worker/oe-selftest-debian/build/build-st-38423/workspace/sources/devtoolsrcka3994q2 -N tst-bin -b' failed
This is just one error, there is about 24 of them on each builds:
2025-11-18 16:02:59,746 - oe-selftest - INFO - oe-selftest - FAIL - Required tests failed (successes=609, skipped=12, failures=24, errors=0)
https://autobuilder.yoctoproject.org/valkyrie/#/builders/35/builds/2713
https://autobuilder.yoctoproject.org/valkyrie/#/builders/23/builds/2849
https://autobuilder.yoctoproject.org/valkyrie/#/builders/48/builds/2607
Can you have a look at these?
Thanks,
Mathieu
--
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-11-18 16:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-17 17:12 [PATCH v2 1/2] insane.bbclass: check revision for every git URI Corentin Guillevic
2025-11-17 17:12 ` [PATCH v2 2/2] layer.conf: enable test for revision alongside a " Corentin Guillevic
2025-11-18 16:20 ` [OE-core] [PATCH v2 1/2] insane.bbclass: check revision for every " Mathieu Dubois-Briand
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.