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

* [PATCH v4 2/4] layers.schema.json: support 'uri'
  2025-12-19 16:12 [PATCH v4 1/4] bitbake-setup: add inline URI Corentin Guillevic
@ 2025-12-19 16:12 ` Corentin Guillevic
  2025-12-19 16:12 ` [PATCH v4 3/4] bitbake-setup: use URI shortcut for all configurations Corentin Guillevic
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Corentin Guillevic @ 2025-12-19 16:12 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Corentin Guillevic

The property 'uri', which is a shortcut for 'remotes/origin/uri', is now
supported under 'git-remote'.

Signed-off-by: Corentin Guillevic <corentin.guillevic@smile.fr>
---
 setup-schema/layers.schema.json | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/setup-schema/layers.schema.json b/setup-schema/layers.schema.json
index 1a0255435..f42606941 100644
--- a/setup-schema/layers.schema.json
+++ b/setup-schema/layers.schema.json
@@ -46,6 +46,10 @@
                                 "description": "The output of 'git describe' (human readable description of the revision using tags in revision history).",
                                 "type": "string"
                             },
+                            "uri": {
+                                "description": "Specifies the git URI, can be used instead of the more elaborate 'remotes' property when there is only a single URI",
+                                "type": "string"
+                            },
                             "remotes": {
                                 "description": "The dict of git remotes to add to this repository",
                                 "type": "object",
-- 
2.51.0



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

* [PATCH v4 3/4] bitbake-setup: use URI shortcut for all configurations
  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 ` 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
  3 siblings, 0 replies; 5+ messages in thread
From: Corentin Guillevic @ 2025-12-19 16:12 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Corentin Guillevic

Currently, no source has several remotes. So we can replace their entire
structure 'remote' -> 'origin' -> 'uri' with a shorter one (property 'uri'
only).

Signed-off-by: Corentin Guillevic <corentin.guillevic@smile.fr>
---
 .../oe-nodistro-master.conf.json              | 18 +++-----------
 .../oe-nodistro-whinlatter.conf.json          | 18 +++-----------
 .../configurations/poky-master.conf.json      | 24 ++++---------------
 .../configurations/poky-whinlatter.conf.json  | 24 ++++---------------
 4 files changed, 14 insertions(+), 70 deletions(-)

diff --git a/default-registry/configurations/oe-nodistro-master.conf.json b/default-registry/configurations/oe-nodistro-master.conf.json
index 180d2008a..e4e842177 100644
--- a/default-registry/configurations/oe-nodistro-master.conf.json
+++ b/default-registry/configurations/oe-nodistro-master.conf.json
@@ -3,33 +3,21 @@
     "sources": {
         "bitbake": {
             "git-remote": {
-                "remotes": {
-                    "origin": {
-                        "uri": "https://git.openembedded.org/bitbake"
-                    }
-                },
+                "uri": "https://git.openembedded.org/bitbake",
                 "branch": "master",
                 "rev": "master"
             }
         },
         "openembedded-core": {
             "git-remote": {
-                "remotes": {
-                    "origin": {
-                        "uri": "https://git.openembedded.org/openembedded-core"
-                    }
-                },
+                "uri": "https://git.openembedded.org/openembedded-core",
                 "branch": "master",
                 "rev": "master"
             }
         },
         "yocto-docs": {
             "git-remote": {
-                "remotes": {
-                    "origin": {
-                        "uri": "https://git.yoctoproject.org/yocto-docs"
-                    }
-                },
+                "uri": "https://git.yoctoproject.org/yocto-docs",
                 "branch": "master",
                 "rev": "master"
             }
diff --git a/default-registry/configurations/oe-nodistro-whinlatter.conf.json b/default-registry/configurations/oe-nodistro-whinlatter.conf.json
index 7b183ae1c..8342f2cf5 100644
--- a/default-registry/configurations/oe-nodistro-whinlatter.conf.json
+++ b/default-registry/configurations/oe-nodistro-whinlatter.conf.json
@@ -4,33 +4,21 @@
     "sources": {
         "bitbake": {
             "git-remote": {
-                "remotes": {
-                    "origin": {
-                        "uri": "https://git.openembedded.org/bitbake"
-                    }
-                },
+                "uri": "https://git.openembedded.org/bitbake",
                 "branch": "2.16",
                 "rev": "2.16"
             }
         },
         "openembedded-core": {
             "git-remote": {
-                "remotes": {
-                    "origin": {
-                        "uri": "https://git.openembedded.org/openembedded-core"
-                    }
-                },
+                "uri": "https://git.openembedded.org/openembedded-core",
                 "branch": "whinlatter",
                 "rev": "whinlatter"
             }
         },
         "yocto-docs": {
             "git-remote": {
-                "remotes": {
-                    "origin": {
-                        "uri": "https://git.yoctoproject.org/yocto-docs"
-                    }
-                },
+                "uri": "https://git.yoctoproject.org/yocto-docs",
                 "branch": "whinlatter",
                 "rev": "whinlatter"
             }
diff --git a/default-registry/configurations/poky-master.conf.json b/default-registry/configurations/poky-master.conf.json
index 1de038bab..82464e8ab 100644
--- a/default-registry/configurations/poky-master.conf.json
+++ b/default-registry/configurations/poky-master.conf.json
@@ -3,44 +3,28 @@
     "sources": {
         "bitbake": {
             "git-remote": {
-                "remotes": {
-                    "origin": {
-                        "uri": "https://git.openembedded.org/bitbake"
-                    }
-                },
+                "uri": "https://git.openembedded.org/bitbake",
                 "branch": "master",
                 "rev": "master"
             }
         },
         "openembedded-core": {
             "git-remote": {
-                "remotes": {
-                    "origin": {
-                        "uri": "https://git.openembedded.org/openembedded-core"
-                    }
-                },
+                "uri": "https://git.openembedded.org/openembedded-core",
                 "branch": "master",
                 "rev": "master"
             }
         },
         "meta-yocto": {
             "git-remote": {
-                "remotes": {
-                    "origin": {
-                        "uri": "https://git.yoctoproject.org/meta-yocto"
-                    }
-                },
+                "uri": "https://git.yoctoproject.org/meta-yocto",
                 "branch": "master",
                 "rev": "master"
             }
         },
         "yocto-docs": {
             "git-remote": {
-                "remotes": {
-                    "origin": {
-                        "uri": "https://git.yoctoproject.org/yocto-docs"
-                    }
-                },
+                "uri": "https://git.yoctoproject.org/yocto-docs",
                 "branch": "master",
                 "rev": "master"
             }
diff --git a/default-registry/configurations/poky-whinlatter.conf.json b/default-registry/configurations/poky-whinlatter.conf.json
index bfa67426d..80b3c7f8c 100644
--- a/default-registry/configurations/poky-whinlatter.conf.json
+++ b/default-registry/configurations/poky-whinlatter.conf.json
@@ -4,44 +4,28 @@
     "sources": {
         "bitbake": {
             "git-remote": {
-                "remotes": {
-                    "origin": {
-                        "uri": "https://git.openembedded.org/bitbake"
-                    }
-                },
+                "uri": "https://git.openembedded.org/bitbake",
                 "branch": "2.16",
                 "rev": "2.16"
             }
         },
         "openembedded-core": {
             "git-remote": {
-                "remotes": {
-                    "origin": {
-                        "uri": "https://git.openembedded.org/openembedded-core"
-                    }
-                },
+                "uri": "https://git.openembedded.org/openembedded-core",
                 "branch": "whinlatter",
                 "rev": "whinlatter"
             }
         },
         "meta-yocto": {
             "git-remote": {
-                "remotes": {
-                    "origin": {
-                        "uri": "https://git.yoctoproject.org/meta-yocto"
-                    }
-                },
+                "uri": "https://git.yoctoproject.org/meta-yocto",
                 "branch": "whinlatter",
                 "rev": "whinlatter"
             }
         },
         "yocto-docs": {
             "git-remote": {
-                "remotes": {
-                    "origin": {
-                        "uri": "https://git.yoctoproject.org/yocto-docs"
-                    }
-                },
+                "uri": "https://git.yoctoproject.org/yocto-docs",
                 "branch": "whinlatter",
                 "rev": "whinlatter"
             }
-- 
2.51.0



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

* [PATCH v4 4/4] doc/bitbake-setup: document "uri" property
  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 ` Corentin Guillevic
  2025-12-22 10:41 ` [bitbake-devel] [PATCH v4 1/4] bitbake-setup: add inline URI Mathieu Dubois-Briand
  3 siblings, 0 replies; 5+ messages in thread
From: Corentin Guillevic @ 2025-12-19 16:12 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Corentin Guillevic

The property 'uri' is a simplification of the property 'remotes'. It is
used to provide only one URI.

Signed-off-by: Corentin Guillevic <corentin.guillevic@smile.fr>
---
 .../bitbake-user-manual-environment-setup.rst        | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/doc/bitbake-user-manual/bitbake-user-manual-environment-setup.rst b/doc/bitbake-user-manual/bitbake-user-manual-environment-setup.rst
index ec1bdeecd..b3588f27d 100644
--- a/doc/bitbake-user-manual/bitbake-user-manual-environment-setup.rst
+++ b/doc/bitbake-user-manual/bitbake-user-manual-environment-setup.rst
@@ -673,11 +673,7 @@ They contain the following sections:
          "sources": {
              "bitbake": {
                  "git-remote": {
-                     "remotes": {
-                         "origin": {
-                             "uri": "https://git.openembedded.org/bitbake"
-                         }
-                     },
+                     "uri": "https://git.openembedded.org/bitbake",
                      "branch": "master",
                      "rev": "master"
                  },
@@ -716,6 +712,12 @@ They contain the following sections:
       -  ``branch`` (**required**): the Git branch, used to check that the
          specified ``rev`` is indeed on that branch.
 
+      -  ``uri`` (*optional*): a URI that follows the git URI syntax. Can replace the
+         ``remotes`` structure if only one URI is provided. Despite this, ``uri`` and
+         ``remotes`` can still be used together.
+
+         See https://git-scm.com/docs/git-clone#_git_urls for more information.
+
    -  ``local`` (*optional*): specifies a path on local disk that should be symlinked
       to under ``layers/``. This is useful for local development, where some layer
       or other component used in a build is managed separately, but should still be
-- 
2.51.0



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

* Re: [bitbake-devel] [PATCH v4 1/4] bitbake-setup: add inline URI
  2025-12-19 16:12 [PATCH v4 1/4] bitbake-setup: add inline URI Corentin Guillevic
                   ` (2 preceding siblings ...)
  2025-12-19 16:12 ` [PATCH v4 4/4] doc/bitbake-setup: document "uri" property Corentin Guillevic
@ 2025-12-22 10:41 ` Mathieu Dubois-Briand
  3 siblings, 0 replies; 5+ messages in thread
From: Mathieu Dubois-Briand @ 2025-12-22 10:41 UTC (permalink / raw)
  To: corentin.guillevic, bitbake-devel

On Fri Dec 19, 2025 at 5:12 PM CET, Corentin Guillevic via lists.openembedded.org wrote:
> 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"])

Hi Corentin,

Thanks for your patch.

It looks like this is breaking a bitbake-selftest:

ERROR: test_setup (bb.tests.setup.BitbakeSetupTest.test_setup)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/layers/bitbake/lib/bb/tests/setup.py", line 318, in test_setup
    out = self.runbbsetup("status")
  File "/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/layers/bitbake/lib/bb/tests/setup.py", line 90, in runbbsetup
    return bb.process.run("{} --global-settings {} {}".format(bbsetup, os.path.join(self.tempdir, 'global-config'), cmd))
           ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/layers/bitbake/lib/bb/process.py", line 189, in run
    raise ExecutionError(cmd, pipe.returncode, stdout, stderr)
bb.process.ExecutionError: Execution of '/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/layers/bitbake/bin/bitbake-setup --global-settings /tmp/bitbake-fetch-fb2c75qw/global-config status' failed with exit code 1:
Traceback (most recent call last):
  File "/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/layers/bitbake/bin/bitbake-setup", line 1059, in <module>
    main()
    ~~~~^^
  File "/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/layers/bitbake/bin/bitbake-setup", line 1052, in main
    args.func(top_dir, all_settings, args, d)
    ~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/layers/bitbake/bin/bitbake-setup", line 675, in build_status
    if are_layers_changed(current_upstream_config["data"]["sources"], layerdir, d):
       ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/layers/bitbake/bin/bitbake-setup", line 644, in are_layers_changed
    changed = changed | _is_git_remote_changed(git_remote, repodir)
                        ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
  File "/srv/pokybuild/yocto-worker/oe-selftest-armhost/build/layers/bitbake/bin/bitbake-setup", line 623, in _is_git_remote_changed
    type,host,path,user,pswd,params = bb.fetch.decodeurl(remotes[remote]["uri"])
                                                         ~~~~~~~^^^^^^^^
TypeError: list indices must be integers or slices, not str

https://autobuilder.yoctoproject.org/valkyrie/#/builders/23/builds/3016
https://autobuilder.yoctoproject.org/valkyrie/#/builders/35/builds/2879
https://autobuilder.yoctoproject.org/valkyrie/#/builders/48/builds/2774

Can you have a look at this failure?

Thanks,
Mathieu

-- 
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com



^ permalink raw reply	[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