diff options
author | André Draszik <andre.draszik@jci.com> | 2019-01-14 10:31:43 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2019-01-14 17:38:24 +0000 |
commit | 181e3a8446a93e94a4dbc4a564adbf9f5b4c08ad (patch) | |
tree | c3b5b7fb5255724f286da94479dd6a46b2ce0441 /meta/classes/buildhistory.bbclass | |
parent | 0c9f6e9bb18b2a52b5a5e828772a9619ee4d8515 (diff) | |
download | poky-181e3a8446a93e94a4dbc4a564adbf9f5b4c08ad.tar.gz |
classes/buildhistory: display modified git branches
When collecting the git revision of repositories, also take
note of whether or not that repository has uncommited
changes.
This makes it a bit clearer what went on when looking at
diffs.
(From OE-Core rev: b9d780c7eeda0fefb13edde8bdba4f1d91e7823c)
Signed-off-by: André Draszik <andre.draszik@jci.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/buildhistory.bbclass')
-rw-r--r-- | meta/classes/buildhistory.bbclass | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass index 33eb1b00f6..796f68cf8f 100644 --- a/meta/classes/buildhistory.bbclass +++ b/meta/classes/buildhistory.bbclass | |||
@@ -672,12 +672,29 @@ def buildhistory_get_build_id(d): | |||
672 | statusheader = d.getVar('BUILDCFG_HEADER') | 672 | statusheader = d.getVar('BUILDCFG_HEADER') |
673 | return('\n%s\n%s\n' % (statusheader, '\n'.join(statuslines))) | 673 | return('\n%s\n%s\n' % (statusheader, '\n'.join(statuslines))) |
674 | 674 | ||
675 | def buildhistory_get_modified(path): | ||
676 | # copied from get_layer_git_status() in image-buildinfo.bbclass | ||
677 | import subprocess | ||
678 | try: | ||
679 | subprocess.check_output("""cd %s; export PSEUDO_UNLOAD=1; set -e; | ||
680 | git diff --quiet --no-ext-diff | ||
681 | git diff --quiet --no-ext-diff --cached""" % path, | ||
682 | shell=True, | ||
683 | stderr=subprocess.STDOUT) | ||
684 | return "" | ||
685 | except subprocess.CalledProcessError as ex: | ||
686 | # Silently treat errors as "modified", without checking for the | ||
687 | # (expected) return code 1 in a modified git repo. For example, we get | ||
688 | # output and a 129 return code when a layer isn't a git repo at all. | ||
689 | return " -- modified" | ||
690 | |||
675 | def buildhistory_get_metadata_revs(d): | 691 | def buildhistory_get_metadata_revs(d): |
676 | # We want an easily machine-readable format here, so get_layers_branch_rev isn't quite what we want | 692 | # We want an easily machine-readable format here, so get_layers_branch_rev isn't quite what we want |
677 | layers = (d.getVar("BBLAYERS") or "").split() | 693 | layers = (d.getVar("BBLAYERS") or "").split() |
678 | medadata_revs = ["%-17s = %s:%s" % (os.path.basename(i), \ | 694 | medadata_revs = ["%-17s = %s:%s%s" % (os.path.basename(i), \ |
679 | base_get_metadata_git_branch(i, None).strip(), \ | 695 | base_get_metadata_git_branch(i, None).strip(), \ |
680 | base_get_metadata_git_revision(i, None)) \ | 696 | base_get_metadata_git_revision(i, None), \ |
697 | buildhistory_get_modified(i)) \ | ||
681 | for i in layers] | 698 | for i in layers] |
682 | return '\n'.join(medadata_revs) | 699 | return '\n'.join(medadata_revs) |
683 | 700 | ||