summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorJermain Horsman <jermain.horsman@nedap.com>2023-11-07 16:26:40 +0100
committerMartin Jansa <martin.jansa@gmail.com>2024-03-27 08:00:49 +0100
commit2be4fed8cdbd71812bc5db34f60d7c1181c82a6e (patch)
tree6323818b74ad633f96d4a9f944e3b3a078f33f8a /meta
parent7f6f239ab704b583e731557c7c2ddd7aab93c6a3 (diff)
downloadopenembedded-core-contrib-jansa/master.tar.gz
lib/oe/buildcfg.py: Add additional git functionsjansa/master
Includes a function to determine the default remote. Signed-off-by: Jermain Horsman <jermain.horsman@nedap.com>
Diffstat (limited to 'meta')
-rw-r--r--meta/lib/oe/buildcfg.py16
1 files changed, 16 insertions, 0 deletions
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)