diff mbox series

[4/6] bitbake-setup: checkout_layers: construct 'src_uri' separatly

Message ID 20251105190636.679388-4-alex.kanavin@gmail.com
State Accepted, archived
Commit 4ad70e05ceca19c1e903dafc33386a82b1176bba
Headers show
Series [1/6] bitbake-setup: rename function 'default_settings_path' to 'topdir_settings_path' | expand

Commit Message

Alexander Kanavin Nov. 5, 2025, 7:06 p.m. UTC
From: Johannes Schneider <johannes.schneider@leica-geosystems.com>

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.

Signed-off-by: Johannes Schneider <johannes.schneider@leica-geosystems.com>
---
 bin/bitbake-setup | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/bin/bitbake-setup b/bin/bitbake-setup
index 59b4dfdb8..ff753557c 100755
--- a/bin/bitbake-setup
+++ b/bin/bitbake-setup
@@ -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')):