diff mbox series

oe-setup-layers: support inline URI

Message ID 20251202155043.815098-1-corentin.guillevic@smile.fr
State New
Headers show
Series oe-setup-layers: support inline URI | expand

Commit Message

Corentin GUILLEVIC Dec. 2, 2025, 3:50 p.m. UTC
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 <corentin.guillevic@smile.fr>
---
 scripts/oe-setup-layers | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Alexander Kanavin Dec. 2, 2025, 3:56 p.m. UTC | #1
On Tue, 2 Dec 2025 at 16:50, Corentin Guillevic via
lists.openembedded.org
<corentin.guillevic=smile.fr@lists.openembedded.org> wrote:
>  scripts/oe-setup-layers | 11 +++++++++++
>  1 file changed, 11 insertions(+)

I like the idea, but this is extremely incomplete. You need to update
the schema in bitbake repo, the sample file in meta-files, and the
generator in 'bitbake-layers create-layers-setup'. You also need to
update bitbake-setup and its tests.

Alex
Corentin GUILLEVIC Dec. 2, 2025, 4:10 p.m. UTC | #2
Hi, Alexander,

Yes, I have pushed more patches to bitbake-devel:
- https://lists.openembedded.org/g/bitbake-devel/message/18507
- https://lists.openembedded.org/g/bitbake-devel/message/18508

Corentin

Le mar. 2 déc. 2025 à 16:56, Alexander Kanavin <alex.kanavin@gmail.com> a
écrit :

> On Tue, 2 Dec 2025 at 16:50, Corentin Guillevic via
> lists.openembedded.org
> <corentin.guillevic=smile.fr@lists.openembedded.org> wrote:
> >  scripts/oe-setup-layers | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
>
> I like the idea, but this is extremely incomplete. You need to update
> the schema in bitbake repo, the sample file in meta-files, and the
> generator in 'bitbake-layers create-layers-setup'. You also need to
> update bitbake-setup and its tests.
>
> Alex
>
diff mbox series

Patch

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))