diff mbox series

oe-setup-layers: make "path" optional

Message ID 20251101225744.3856186-1-yoann.congal@smile.fr
State New
Headers show
Series oe-setup-layers: make "path" optional | expand

Commit Message

Yoann Congal Nov. 1, 2025, 10:57 p.m. UTC
From: Yoann Congal <yoann.congal@smile.fr>

Layer names and path are often redundant. Allow users to omit the path
key when it is equal to the layer name by using the layer name as a
default value for its path.

For example, from layers.example.json:
  "sources": {
      "meta-alex": {
          "path": "meta-alex"
      },
      "meta-intel": {
          "path": "meta-intel"
      },
      "poky": {
          "path": "poky"
      }
  },

Update the schema to stop requiring "path" and remove it in example for
"meta-intel".

Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
---
 meta/files/layers.example.json | 3 +--
 meta/files/layers.schema.json  | 3 ---
 scripts/oe-setup-layers        | 2 +-
 3 files changed, 2 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/meta/files/layers.example.json b/meta/files/layers.example.json
index 0a6a6a7b489..f3b65220831 100644
--- a/meta/files/layers.example.json
+++ b/meta/files/layers.example.json
@@ -24,8 +24,7 @@ 
                     }
                 },
                 "rev": "0a96edae609a3f48befac36af82cf1eed6786b4a"
-            },
-            "path": "meta-intel"
+            }
         },
         "poky": {
             "git-remote": {
diff --git a/meta/files/layers.schema.json b/meta/files/layers.schema.json
index 659ee8da498..b5c13fdb5c9 100644
--- a/meta/files/layers.schema.json
+++ b/meta/files/layers.schema.json
@@ -17,9 +17,6 @@ 
                 "type": "object",
                 "description": "The upstream source from which a set of layers may be fetched",
                 "additionalProperties": false,
-                "required": [
-                    "path"
-                ],
                 "properties": {
                     "path": {
                         "description": "The path where this layer source will be placed when fetching",
diff --git a/scripts/oe-setup-layers b/scripts/oe-setup-layers
index 6fbfefd656f..31cb9632515 100755
--- a/scripts/oe-setup-layers
+++ b/scripts/oe-setup-layers
@@ -66,7 +66,7 @@  def _do_checkout(args, json):
     oesetupbuild = None
     for r_name in repos:
         r_data = repos[r_name]
-        repodir = os.path.abspath(os.path.join(args['destdir'], r_data['path']))
+        repodir = os.path.abspath(os.path.join(args['destdir'], r_data.get('path', r_name)))
         repodirs.append(repodir)
 
         if 'contains_this_file' in r_data.keys():