aboutsummaryrefslogtreecommitdiffstats
path: root/meta/classes/metadata_scm.bbclass
diff options
context:
space:
mode:
authorTrevor Woerner <twoerner@gmail.com>2016-03-12 21:35:29 -0500
committerMartin Jansa <Martin.Jansa@gmail.com>2020-09-16 15:24:49 +0200
commit67ae5c5e52d82624c7b986724d52f354ed7f2ee6 (patch)
tree0a41dbee6eb6ee3e4e0dbba0f2343e2c81fbc463 /meta/classes/metadata_scm.bbclass
parentaea5fb762510d7df039dbe815f424f7a97635ae5 (diff)
downloadopenembedded-core-contrib-67ae5c5e52d82624c7b986724d52f354ed7f2ee6.tar.gz
metadata-revs: provide more information
Provide many more details concerning the repositories that are used in a particular build: the remote information, the layer, the local branch, the remote branch the local branch tracks (if any), and the HEAD commit. Signed-off-by: Trevor Woerner <twoerner@gmail.com> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'meta/classes/metadata_scm.bbclass')
-rw-r--r--meta/classes/metadata_scm.bbclass18
1 files changed, 18 insertions, 0 deletions
diff --git a/meta/classes/metadata_scm.bbclass b/meta/classes/metadata_scm.bbclass
index fa791f04c4..9285664bb5 100644
--- a/meta/classes/metadata_scm.bbclass
+++ b/meta/classes/metadata_scm.bbclass
@@ -72,6 +72,15 @@ def base_get_metadata_git_branch(path, d):
rev = '<unknown>'
return rev.strip()
+def base_get_metadata_git_remote_branch(path, d):
+ import bb.process
+
+ try:
+ rev, _ = bb.process.run('git rev-parse --abbrev-ref --symbolic-full-name @{u}', cwd=path)
+ except bb.process.ExecutionError:
+ rev = '(HEAD does not point to a remote branch)'
+ return rev.strip()
+
def base_get_metadata_git_revision(path, d):
import bb.process
@@ -80,3 +89,12 @@ def base_get_metadata_git_revision(path, d):
except bb.process.ExecutionError:
rev = '<unknown>'
return rev.strip()
+
+def base_get_metadata_git_remote(path, d):
+ import bb.process
+
+ try:
+ lines, _ = bb.process.run('git remote -v', cwd=path)
+ except bb.process.ExecutionError:
+ return '<unknown>'
+ return lines