oe-setup-layers: make "path" optional

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".

(From OE-Core rev: 7f36f0526fae5a81f9bc02e16cc849a2b1ea5797)

Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Yoann Congal
2025-11-01 23:57:44 +01:00
committed by Richard Purdie
parent e2f12eabd7
commit 20c60e5ae3
3 changed files with 2 additions and 6 deletions

View File

@@ -24,8 +24,7 @@
}
},
"rev": "0a96edae609a3f48befac36af82cf1eed6786b4a"
},
"path": "meta-intel"
}
},
"poky": {
"git-remote": {

View File

@@ -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",

View File

@@ -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():