]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
metadata-revs: provide more information
authorTrevor Woerner <twoerner@gmail.com>
Sun, 13 Mar 2016 02:35:29 +0000 (21:35 -0500)
committerMartin Jansa <Martin.Jansa@gmail.com>
Thu, 25 Apr 2019 17:40:16 +0000 (17:40 +0000)
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>
meta/classes/buildhistory.bbclass
meta/classes/metadata_scm.bbclass

index c62842c3fac74ec9dd33529c6de8dfd7d92acd7f..4344ba755adfa69fc16d227310eb03bd48355e3e 100644 (file)
@@ -672,8 +672,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)
index fa791f04c4c090d1f9a3dd77e0b853fa9d4ddae1..9285664bb5da409e5a1e596ec50d3c06d94f4975 100644 (file)
@@ -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