public inbox for bitbake-devel@lists.openembedded.org
 help / color / mirror / Atom feed
* [PATCH v4 1/4] bitbake-setup: add inline URI
@ 2025-12-19 16:12 Corentin Guillevic
  2025-12-19 16:12 ` [PATCH v4 2/4] layers.schema.json: support 'uri' Corentin Guillevic
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Corentin Guillevic @ 2025-12-19 16:12 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Corentin Guillevic

Most of the time, when we describe a remote, a bitbake-setup source looks like this:

"bitbake": {
    "git-remote": {
        "remotes": {
            "origin": {
                "uri": "https://git.openembedded.org/bitbake"
            }
        },
        ...
    }
}

i.e. an URI with the common name 'origin'. Alternatively, we could simplify this, by
using a shorter structure with the property 'uri' only:

"bitbake": {
    "git-remote": {
        "uri": "https://git.openembedded.org/bitbake",
        ...
    }
}

These properties can be used together.

Signed-off-by: Corentin Guillevic <corentin.guillevic@smile.fr>
---

Changes in v4:
- Fix a wrong indentation in the file bitbake-user-manual-environment-setup.rst

 bin/bitbake-setup | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/bin/bitbake-setup b/bin/bitbake-setup
index 73f734e73..809077518 100755
--- a/bin/bitbake-setup
+++ b/bin/bitbake-setup
@@ -89,14 +89,30 @@ def _write_layer_list(dest, repodirs):
     with open(layers_f, 'w') as f:
         json.dump({"version":"1.0","layers":layers}, f, sort_keys=True, indent=4)
 
+def _get_remotes(r_remote):
+    remotes = []
+
+    if not 'remotes' in r_remote and not 'uri' in r_remote:
+        raise Exception("Expected key(s): 'remotes', 'uri'")
+
+    if 'remotes' in r_remote:
+        for remote in r_remote['remotes']:
+            remotes.append(r_remote['remotes'][remote]['uri'])
+
+    if 'uri' in r_remote:
+        remotes.append(r_remote['uri'])
+
+    return remotes
+
 def checkout_layers(layers, layerdir, d):
     def _checkout_git_remote(r_remote, repodir, layers_fixed_revisions):
         rev = r_remote['rev']
         branch = r_remote.get('branch', None)
-        remotes = r_remote['remotes']
+
+        remotes = _get_remotes(r_remote)
 
         for remote in remotes:
-            prot,host,path,user,pswd,params = bb.fetch.decodeurl(remotes[remote]["uri"])
+            prot,host,path,user,pswd,params = bb.fetch.decodeurl(remote)
             fetchuri = bb.fetch.encodeurl(('git',host,path,user,pswd,params))
             logger.plain("    {}".format(r_name))
             if branch:
@@ -600,7 +616,8 @@ def are_layers_changed(layers, layerdir, d):
         changed = False
         rev = r_remote['rev']
         branch = r_remote.get('branch', None)
-        remotes = r_remote['remotes']
+
+        remotes = _get_remotes(r_remote)
 
         for remote in remotes:
             type,host,path,user,pswd,params = bb.fetch.decodeurl(remotes[remote]["uri"])
-- 
2.51.0



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

end of thread, other threads:[~2025-12-22 10:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-19 16:12 [PATCH v4 1/4] bitbake-setup: add inline URI Corentin Guillevic
2025-12-19 16:12 ` [PATCH v4 2/4] layers.schema.json: support 'uri' Corentin Guillevic
2025-12-19 16:12 ` [PATCH v4 3/4] bitbake-setup: use URI shortcut for all configurations Corentin Guillevic
2025-12-19 16:12 ` [PATCH v4 4/4] doc/bitbake-setup: document "uri" property Corentin Guillevic
2025-12-22 10:41 ` [bitbake-devel] [PATCH v4 1/4] bitbake-setup: add inline URI 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