From: Trevor Woerner <twoerner@gmail.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH] metadata-revs: provide more information
Date: Sat, 12 Mar 2016 21:35:29 -0500 [thread overview]
Message-ID: <1457836529-32388-1-git-send-email-twoerner@gmail.com> (raw)
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>
---
meta/classes/buildhistory.bbclass | 6 +++++-
meta/classes/metadata_scm.bbclass | 18 ++++++++++++++++++
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
index b6b4324..1b0ae0e 100644
--- a/meta/classes/buildhistory.bbclass
+++ b/meta/classes/buildhistory.bbclass
@@ -615,9 +615,13 @@ 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
+ import subprocess
layers = (d.getVar("BBLAYERS", True) or "").split()
- medadata_revs = ["%-17s = %s:%s" % (os.path.relpath(i, d.getVar('BBLAYERS_FETCH_DIR', True)), \
+ 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', True)), \
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 0f7f423..31a2c54 100644
--- a/meta/classes/metadata_scm.bbclass
+++ b/meta/classes/metadata_scm.bbclass
@@ -73,6 +73,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
@@ -81,3 +90,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
--
2.7.0.rc3
next reply other threads:[~2016-03-13 2:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-13 2:35 Trevor Woerner [this message]
2016-03-13 19:26 ` [PATCH] metadata-revs: provide more information Paul Eggleton
2016-03-13 20:42 ` Trevor Woerner
2016-03-13 20:53 ` Paul Eggleton
2016-03-13 21:54 ` Trevor Woerner
2016-03-13 23:03 ` Paul Eggleton
2016-03-14 10:15 ` Martin Jansa
2016-03-14 10:26 ` Jeremy Rosen
2016-03-13 20:53 ` Trevor Woerner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1457836529-32388-1-git-send-email-twoerner@gmail.com \
--to=twoerner@gmail.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox