public inbox for bitbake-devel@lists.openembedded.org
 help / color / mirror / Atom feed
* [PATCH] fetch2: Skip AUTOREV management if no SCM URI
@ 2025-12-08 16:12 Corentin Guillevic
  2025-12-08 16:59 ` [bitbake-devel] " Paul Barker
  2025-12-26 16:45 ` Mathieu Dubois-Briand
  0 siblings, 2 replies; 7+ messages in thread
From: Corentin Guillevic @ 2025-12-08 16:12 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Corentin Guillevic

AUTOREV allows to fetch the latest revision. If no SCM URI is used (e.g. git://, ...),
AUTOREV has no effect. However there is one case in which a recipe with AUTOREV
but no SCM URI will lead to a parsing error:

ERROR: /path/to/yocto/builds/build-qemux86-64/workspace/recipes/i2c-tools/i2c-tools_3.1.2.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.

This error is raised when AUTOREV occurs (__BBAUTOREV_SEEN) but is not acted
upon (__BBAUTOREV_ACTED_UPON). A recipe with one SCM URI causes the
srcrev_internal_helper() function to run, and read the value of SRCREV. If
SRCREV = "${AUTOREV}", then AUTOREV will be acted upon.

If the recipe does not have an SCM URI, SRCREV is not parsed and AUTOREV remains
unchanged. However, if SRCREV is expanded during the parsing time in Python code
(either pure or evaluated from BitBake code), then AUTOREV will be expanded too
and resulting in the setting of __BBAUTOREV_SEEN. However, as there is no SCM
URI, the code flow that would act upon AUTOREV is never run.

The fix slightly changes the way AUTOREV is handled: if no SCM URI is provided,
AUTOREV will be considered to have never occurred (__BBAUTOREV_SEEN will not be
defined).

Signed-off-by: Corentin Guillevic <corentin.guillevic@smile.fr>
---
 lib/bb/fetch2/__init__.py | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py
index bdd497394..a1e2def95 100644
--- a/lib/bb/fetch2/__init__.py
+++ b/lib/bb/fetch2/__init__.py
@@ -769,8 +769,16 @@ def mark_recipe_nocache(d):
         d.setVar('BB_DONT_CACHE', '1')
 
 def get_autorev(d):
-    mark_recipe_nocache(d)
-    d.setVar("__BBAUTOREV_SEEN", True)
+    fetcher = Fetch(d.getVar('SRC_URI').split(), d)
+    urldata = fetcher.ud
+    for u in urldata:
+        if not urldata[u].method.supports_srcrev():
+            continue
+
+        mark_recipe_nocache(d)
+        d.setVar("__BBAUTOREV_SEEN", True)
+        break
+
     return "AUTOINC"
 
 def _get_srcrev(d, method_name='sortable_revision'):
-- 
2.49.0



^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-12-26 16:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-08 16:12 [PATCH] fetch2: Skip AUTOREV management if no SCM URI Corentin Guillevic
2025-12-08 16:59 ` [bitbake-devel] " Paul Barker
2025-12-09 10:43   ` Corentin GUILLEVIC
2025-12-10 10:20     ` Paul Barker
2025-12-10 18:46       ` Corentin GUILLEVIC
2025-12-22 13:50         ` Corentin GUILLEVIC
2025-12-26 16:45 ` Mathieu Dubois-Briand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox