From: Jermain Horsman <jermain.hors...@nedap.com>

Having a default remote present allows for the checkout of a
branch in the case multiple remotes are available.

This requires an update to the json-schema and associated checks.

Signed-off-by: Jermain Horsman <jermain.hors...@nedap.com>
---
 meta/files/layers.example.json                    | 5 ++++-
 meta/files/layers.schema.json                     | 8 ++++++--
 meta/lib/bblayers/makesetup.py                    | 1 +
 meta/lib/bblayers/setupwriters/oe-setup-layers.py | 2 +-
 scripts/oe-setup-layers                           | 2 +-
 5 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/meta/files/layers.example.json b/meta/files/layers.example.json
index 0a6a6a7b48..06ba196cf6 100644
--- a/meta/files/layers.example.json
+++ b/meta/files/layers.example.json
@@ -4,6 +4,7 @@
             "contains_this_file": true,
             "git-remote": {
                 "branch": "master",
+                "default-remote": "remote-alex",
                 "describe": "",
                 "remotes": {
                     "remote-alex": {
@@ -17,6 +18,7 @@
         "meta-intel": {
             "git-remote": {
                 "branch": "master",
+                "default-remote": "origin",
                 "describe": "15.0-hardknott-3.3-310-g0a96edae",
                 "remotes": {
                     "origin": {
@@ -30,6 +32,7 @@
         "poky": {
             "git-remote": {
                 "branch": "akanavin/setup-layers",
+                "default-remote": "poky-contrib",
                 "describe": "4.1_M1-374-g9dda719b2a",
                 "remotes": {
                     "origin": {
@@ -44,5 +47,5 @@
             "path": "poky"
         }
     },
-    "version": "1.0"
+    "version": "1.1"
 }
diff --git a/meta/files/layers.schema.json b/meta/files/layers.schema.json
index 659ee8da49..06a34656e5 100644
--- a/meta/files/layers.schema.json
+++ b/meta/files/layers.schema.json
@@ -7,8 +7,8 @@
     ],
     "properties": {
         "version": {
-            "description": "The version of this document; currently '1.0'",
-            "enum": ["1.0"]
+            "description": "The version of this document; currently '1.1'",
+            "enum": ["1.1"]
         },
         "sources": {
             "description": "The dict of layer sources",
@@ -41,6 +41,10 @@
                                         "description": "The git branch to 
fetch (optional)",
                                         "type": "string"
                                     },
+                                    "default-remote": {
+                                        "description": "The default git 
remote",
+                                        "type": "string"
+                                    },
                                     "rev": {
                                         "description": "The git revision to 
checkout",
                                         "type": "string"
diff --git a/meta/lib/bblayers/makesetup.py b/meta/lib/bblayers/makesetup.py
index d24470dc83..0d0e42e1d0 100644
--- a/meta/lib/bblayers/makesetup.py
+++ b/meta/lib/bblayers/makesetup.py
@@ -62,6 +62,7 @@ class MakeSetupPlugin(LayerPlugin):
                         'rev':l_rev,
                         'branch':l_branch,
                         'remotes':self._get_remotes_with_url(repo_path),
+                        
'default-remote':oe.buildcfg.get_metadata_git_default_remote(repo_path),
                         
'describe':oe.buildcfg.get_metadata_git_describe(repo_path)}}
                 if repo_path == destdir_repo:
                     repos[repo_path]['contains_this_file'] = True
diff --git a/meta/lib/bblayers/setupwriters/oe-setup-layers.py 
b/meta/lib/bblayers/setupwriters/oe-setup-layers.py
index d5bc19a8cb..4e0c780eab 100644
--- a/meta/lib/bblayers/setupwriters/oe-setup-layers.py
+++ b/meta/lib/bblayers/setupwriters/oe-setup-layers.py
@@ -36,7 +36,7 @@ class OeSetupLayersWriter():
         if not os.path.exists(args.destdir):
             os.makedirs(args.destdir)
         repos = parent.make_repo_config(args.destdir)
-        json = {"version":"1.0","sources":repos}
+        json = {"version":"1.1","sources":repos}
         if not repos:
             raise Exception("Could not determine layer sources")
         output = args.output_prefix or "setup-layers"
diff --git a/scripts/oe-setup-layers b/scripts/oe-setup-layers
index ac9a9f139b..4622c264f9 100755
--- a/scripts/oe-setup-layers
+++ b/scripts/oe-setup-layers
@@ -191,7 +191,7 @@ args = parser.parse_args()
 with open(args.jsondata) as f:
     json_f = json.load(f)
 
-supported_versions = ["1.0"]
+supported_versions = ["1.0", "1.1"]
 if json_f["version"] not in supported_versions:
     raise Exception("File {} has version {}, which is not in supported 
versions: {}".format(args.jsondata, json_f["version"], supported_versions))
 
-- 
2.42.0.windows.2

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#190296): 
https://lists.openembedded.org/g/openembedded-core/message/190296
Mute This Topic: https://lists.openembedded.org/mt/102444611/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to