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

EXT-Antti Gärding <[email protected]> Wed, 13 May 2026 13:11:44 +0000
Newsgroups org.yoctoproject.lists.yocto
Message-ID <AS8PR08MB72519BF260608361FE603E29D5062@AS8PR08MB7251.eurprd08.prod.outlook.com>
--_000_AS8PR08MB72519BF260608361FE603E29D5062AS8PR08MB7251eurp_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

> Which conditions?

> The following pseudocode could help (untested).

> def src_uri_tag(d):
>      if conditions:
>         return ';tag=3D' + mytag
>     return ''

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

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

I am getting back to this almost immediately after saying that I would try =
this...

I think this would work if the only goal was to append a tag parameter into=
 an SRC_URI entry, but I need something more. I'd like the function to be i=
n a class so that I can add the tag matching into a recipe by just inheriti=
ng that class regardless of what is in SRC_URI and also disable tag matchin=
g by just not inheriting that class anymore.

I don't know what to say about the conditions. Maybe they are not condition=
s at all but rather the logic that decides which SRC_URI entry to append th=
e tag parameter to. That logic depends on PV and a variable that, if define=
d, contains the name of the repository for which the tag is to be appended.=
 It is defined only when there are multiple repositories in SRC_URI and in =
that case, there is also a name parameter in each repository URI and that v=
ariable matches one of those repository names.


BR,
Antti G=E4rding

--_000_AS8PR08MB72519BF260608361FE603E29D5062AS8PR08MB7251eurp_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-8859-=
1">
<style type=3D"text/css" style=3D"display:none;"> P {margin-top:0;margin-bo=
ttom:0;} </style>
</head>
<body dir=3D"ltr">
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; c=
olor: rgb(0, 0, 0);">
&gt; Which conditions?<br>
<br>
&gt; The following pseudocode could help (untested).<br>
<br>
&gt; def src_uri_tag(d):<br>
&gt;&nbsp; &nbsp; &nbsp; if conditions:<br>
&gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return ';tag=3D' + mytag<br>
&gt;&nbsp; &nbsp; &nbsp;return ''<br>
<br>
&gt; SRC_URI_TAG =3D &quot;${@src_uri_tag(d)}&quot;<br>
<br>
&gt; SRC_URI =3D &quot;git://someforge.co/myrepo.git;branch=3Dmain${SRC_URI=
_TAG}&quot;<br>
<br>
</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; c=
olor: rgb(0, 0, 0);">
I am getting back to this almost immediately after saying that I would try =
this...</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; c=
olor: rgb(0, 0, 0);">
<br>
</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; c=
olor: rgb(0, 0, 0);">
I think this would work if the only goal was to append a tag parameter into=
 an SRC_URI entry, but I need something more. I'd like the function to be i=
n a class so that I can add the tag matching into a recipe by just inheriti=
ng that class regardless of what
 is in SRC_URI and also disable tag matching by just not inheriting that cl=
ass anymore.</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; c=
olor: rgb(0, 0, 0);">
<br>
</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; c=
olor: rgb(0, 0, 0);">
I don't know what to say about the conditions. Maybe they are not condition=
s at all but rather the logic that decides which SRC_URI entry to append th=
e tag parameter to. That logic depends on PV and a variable that, if define=
d, contains the name of the repository
 for which the tag is to be appended. It is defined only when there are mul=
tiple repositories in SRC_URI and in that case, there is also a name parame=
ter in each repository URI and that variable matches one of those repositor=
y names.</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; c=
olor: rgb(0, 0, 0);">
<br>
</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; c=
olor: rgb(0, 0, 0);">
<br>
</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; c=
olor: rgb(0, 0, 0);">
BR,</div>
<div class=3D"elementToProof" style=3D"font-family: Aptos, Aptos_EmbeddedFo=
nt, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 11pt; c=
olor: rgb(0, 0, 0);">
Antti G=E4rding</div>
</body>
</html>

--_000_AS8PR08MB72519BF260608361FE603E29D5062AS8PR08MB7251eurp_--