aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Stannard <ostannard@gmail.com>2020-04-20 12:16:12 +0100
committerOliver Stannard <ostannard@gmail.com>2020-04-20 12:22:11 +0100
commit8b7841e37e7bd3d931aed345836efb1f37a3d884 (patch)
tree6742606643c6ebbb0c8355fa96d3012cde066b18
parent72ac1688cf4fd514e4c1729ff451e68d048e7acf (diff)
downloadlinaro-scripts-8b7841e37e7bd3d931aed345836efb1f37a3d884.tar.gz
Update llvm bot monitor for git hashes
- The revisions are now git hashes, so don't try to parse them as integers. - Truncate hashes to 8 characters for user-facing display. - The JSON object returned by buildbot has the commits in time order, so we don't need to iterate the whole list to find the first and last ones. Change-Id: I818f36a65b85b23a64017106494e56141095966e
-rwxr-xr-xmonitor/bot-status28
1 files changed, 7 insertions, 21 deletions
diff --git a/monitor/bot-status b/monitor/bot-status
index 18144a4..963840d 100755
--- a/monitor/bot-status
+++ b/monitor/bot-status
@@ -166,27 +166,13 @@ sub get_status() {
}
$status{'fail'} =~ s/ $//;
- # Commit range
- # [
- # 'revision',
- # '238202',
- # 'Build'
- # ],
- my $max = 0;
- foreach (@{$json->{'properties'}}) {
- if ($_->[0] eq 'revision') {
- $max = $_->[1];
- last;
- }
- }
- # Min is in the changes' section
- my $min = $max;
- foreach (@{$json->{'sourceStamp'}->{'changes'}}) {
- my $commit = $_->{'revision'};
- $min = $commit if ($commit < $min);
- }
- $status{'from'} = $min;
- $status{'to'} = $max;
+ # Commit range. All LLVM repositories are in git now, so truncate the hashes
+ # to 8 characters for display.
+ my @commits = @{$json->{'sourceStamp'}->{'changes'}};
+ my $first_rev = $commits[0]->{'revision'};
+ my $last_rev = $commits[-1]->{'revision'};
+ $status{'from'} = substr($first_rev, 0, 8);
+ $status{'to'} = substr($last_rev, 0, 8);
return \%status;
}