From: Jermain Horsman <[email protected]>

Includes a function to determine the default remote.

Signed-off-by: Jermain Horsman <[email protected]>
---
 meta/lib/oe/buildcfg.py | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/meta/lib/oe/buildcfg.py b/meta/lib/oe/buildcfg.py
index f9cb0cc74c..2ca654e56e 100644
--- a/meta/lib/oe/buildcfg.py
+++ b/meta/lib/oe/buildcfg.py
@@ -50,6 +50,22 @@ def get_metadata_git_remote_url(path, remote):
         uri = ''
     return uri.strip()
 
+def get_metadata_git_default_remote(path):
+    remotes = get_metadata_git_remotes(path)
+    if len(remotes) == 1:
+        default_remote = remotes[0]
+    else:
+        try:
+            default_remote, _ = bb.process.run('git config --local 
checkout.defaultRemote', cwd=path)
+        except bb.process.ExecutionError:
+            default_remote = ""
+        if not default_remote:
+            try:
+                default_remote, _ = bb.process.run('git config 
checkout.defaultRemote', cwd=path)
+            except bb.process.ExecutionError:
+                default_remote = ""
+    return default_remote.strip()
+
 def get_metadata_git_describe(path):
     try:
         describe, _ = bb.process.run('git describe --tags', cwd=path)
-- 
2.42.0.windows.2

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#190295): 
https://lists.openembedded.org/g/openembedded-core/message/190295
Mute This Topic: https://lists.openembedded.org/mt/102444609/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to