bitbake: bitbake-setup: checkout_layers: construct 'src_uri' separatly

Construct the 'src_uri' separately, and then pass either variant into
one call that creates the Fetch. Making use of format-strings to
shorten/simplify the code.

Also: using 'proto' instead of 'type' for a variable name, to avoid
the protected keyword.

(Bitbake rev: 4ad70e05ceca19c1e903dafc33386a82b1176bba)

Signed-off-by: Johannes Schneider <johannes.schneider@leica-geosystems.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Johannes Schneider 2025-11-05 20:06:34 +01:00 committed by Richard Purdie
parent 729e6f2cfd
commit 5de850ec01

View File

@ -90,13 +90,14 @@ def checkout_layers(layers, layerdir, d):
remotes = r_remote['remotes']
for remote in remotes:
type,host,path,user,pswd,params = bb.fetch.decodeurl(remotes[remote]["uri"])
prot,host,path,user,pswd,params = bb.fetch.decodeurl(remotes[remote]["uri"])
fetchuri = bb.fetch.encodeurl(('git',host,path,user,pswd,params))
print(" {}".format(r_name))
if branch:
fetcher = bb.fetch.Fetch(["{};protocol={};rev={};branch={};destsuffix={}".format(fetchuri,type,rev,branch,repodir)], d)
src_uri = f"{fetchuri};protocol={prot};rev={rev};branch={branch};destsuffix={repodir}"
else:
fetcher = bb.fetch.Fetch(["{};protocol={};rev={};nobranch=1;destsuffix={}".format(fetchuri,type,rev,repodir)], d)
src_uri = f"{fetchuri};protocol={prot};rev={rev};nobranch=1;destsuffix={repodir}"
fetcher = bb.fetch.Fetch([src_uri], d)
do_fetch(fetcher, layerdir)
if os.path.exists(os.path.join(layerdir, repodir, 'scripts/oe-setup-build')):