Most of the time, when we describe a remote, the layer data (also used by
the script bitbake-setup) 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";,
        ...
    }
}

'uri' and 'remote' are then mutually exclusive.

Signed-off-by: Corentin Guillevic <[email protected]>
---
 scripts/oe-setup-layers | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/scripts/oe-setup-layers b/scripts/oe-setup-layers
index 31cb963251..bac685a209 100755
--- a/scripts/oe-setup-layers
+++ b/scripts/oe-setup-layers
@@ -60,6 +60,14 @@ 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 _handle_uri_shortcut(r_remote):
+    if 'remotes' in r_remote and 'uri' in r_remote:
+        raise Exception("Keys 'remotes' and 'uri' are mutually exclusive")
+
+    if 'uri' in r_remote:
+        r_remote['remotes'] = {'origin': {'uri': r_remote['uri']}}
+        del r_remote['uri']
+
 def _do_checkout(args, json):
     repos = json['sources']
     repodirs = []
@@ -80,6 +88,9 @@ def _do_checkout(args, json):
         if not desc:
             desc = rev[:10]
         branch = r_remote['branch']
+
+        _handle_uri_shortcut(r_remote)
+
         remotes = r_remote['remotes']
 
         print('\nSetting up source {}, revision {}, branch {}'.format(r_name, 
desc, branch))
-- 
2.49.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#227172): 
https://lists.openembedded.org/g/openembedded-core/message/227172
Mute This Topic: https://lists.openembedded.org/mt/116578285/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to