aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrevor Woerner <twoerner@gmail.com>2016-03-12 21:35:29 -0500
committerMartin Jansa <Martin.Jansa@gmail.com>2018-10-18 23:15:18 +0000
commit324947e7bbb354418d22255530655b3993d10e11 (patch)
treec69c42d5f28559c70d6e60507bb9a92943177616
parent0afee7d927389af1352d0f8dbff8be7aaf6b75b5 (diff)
downloadopenembedded-core-contrib-324947e7bbb354418d22255530655b3993d10e11.tar.gz
openembedded-core-contrib-324947e7bbb354418d22255530655b3993d10e11.tar.bz2
openembedded-core-contrib-324947e7bbb354418d22255530655b3993d10e11.zip
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>
-rw-r--r--meta/classes/buildhistory.bbclass5
-rw-r--r--meta/classes/metadata_scm.bbclass18
2 files changed, 22 insertions, 1 deletions
diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
index 725015e49b..08753339bb 100644
--- a/meta/classes/buildhistory.bbclass
+++ b/meta/classes/buildhistory.bbclass
@@ -673,8 +673,11 @@ def buildhistory_get_build_id(d):
def buildhistory_get_metadata_revs(d):
# We want an easily machine-readable format here, so get_layers_branch_rev isn't quite what we want
layers = (d.getVar("BBLAYERS") or "").split()
- medadata_revs = ["%-17s = %s:%s" % (os.path.relpath(i, d.getVar('BBLAYERS_FETCH_DIR')), \
+ medadata_revs = ["%s\tlayer: %s\n\tbranch: %s\n\tremote: %s\n\tHEAD: %s\n" % ( \
+ base_get_metadata_git_remote(i, None), \
+ os.path.relpath(i, d.getVar('BBLAYERS_FETCH_DIR')), \
base_get_metadata_git_branch(i, None).strip(), \
+ base_get_metadata_git_remote_branch(i, None).strip(), \
base_get_metadata_git_revision(i, None)) \
for i in layers]
return '\n'.join(medadata_revs)
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