Re: [yocto] Modifying SRC_URI before it is parsed by the fetcher

Quentin Schulz <[email protected]> Wed, 13 May 2026 17:32:34 +0200
Newsgroups org.yoctoproject.lists.yocto
Message-ID <[email protected]>
Hi Antti,

On 5/13/26 5:07 PM, EXT-Antti G=C3=A4rding via lists.yoctoproject.org wrote=
:
>> Then what in Quentin's suggestion isn't going to work? You put the
> function and the SRC_URI_TAG assignment into the class. You modify the
> SRC_URI in the recipe to refer to SRC_URI_TAG variable, and add a
> class inherit into the recipe. Which part of this isn't appropriate or
> possible and why?
>=20
> As far as I see it, it requires you not only to inherit a class but also =
to modify the SRC_URI and possibly make it dependent of the class (I am not=
 sure what would happen if I added SRC_URI_TAG but didn't inherit the class=
).
>=20

But the *only* thing you want to do is modifying SRC_URI but not=20
actually modify it, I don't understand why this is an absolute=20
impossibility and why you must find hacks within BitBake instead. This=20
all sounds like a horrific XY problem.

> In other words, you can't turn the tag verification on and off by simply =
adding or removing line "inherit src-uri-tag".
>=20

classes/src_uri_tag.bbclass

def src_uri_tag(d):
     if conditions or not=20
bb.utils.to_boolean(d.getVar('PLEASE_ADD_TAG'), True):
         return ';tag=3D' + mytag
     return ''

SRC_URI_TAG =3D "${@src_uri_tag(d)}"

recipes-whatever/some/recipe.bb

inherit src_uri_tag

SRC_URI =3D "git://someforge.co/myrepo.git;branch=3Dmain${SRC_URI_TAG}"

 From your local.conf:

PLEASE_ADD_TAG =3D "0"

to disable tags globally.

PLEASE_ADD_TAG:pn-recipe =3D "0"

to disable tags for a specific recipe.

Untested of course.

Cheers,
Quentin