forked from FFmpeg/fateserver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhistory.cgi
executable file
·90 lines (81 loc) · 2.6 KB
/
history.cgi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#! /usr/bin/perl
#
# Copyright (c) 2011 Mans Rullgard <[email protected]>
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
use strict;
use warnings;
use CGI qw/param/;
use FATE;
use Time::Zone;
my $slot = param 'slot';
my $slotdir = "$fatedir/$slot";
opendir D, $slotdir or fail "Slot $slot not found";
my @reps = grep { /^[0-9]/ and -d "$slotdir/$_" } readdir D;
close D;
print "Content-type: text/html\r\n\r\n";
doctype;
start 'html', xmlns => "http://www.w3.org/1999/xhtml";
start 'head';
tag 'meta', 'http-equiv' => "Content-Type",
'content' => "text/html; charset=utf-8";
tag 'link', rel => 'stylesheet',
type => 'text/css',
href => '/fate.css';
print "<title>FATE: $slot</title>\n";
end 'head';
start 'body';
h1 "Report history for $slot";
start 'table', id => 'history', class => 'replist';
start 'thead';
trowh 'Time', 'Rev', 'Arch', 'OS', 'Compiler', 'Warnings', 'Tests';
end 'thead';
start 'tbody';
for my $date ((sort { $b cmp $a } @reps)[0..49]) {
my $rep = load_summary $slot, $date or next;
my $ntest = $$rep{ntests};
my $npass = $$rep{npass};
my $time = parse_date $$rep{date};
my $age = time - tz_local_offset() - $time;
my $rtext;
my $rclass;
start 'tr', class => 'alt hilight';
td agestr $age, $time;
if ($gitweb and $$rep{rev} =~ /(git-)?(.*)/) {
start 'td';
anchor $$rep{rev}, href => "$gitweb;a=commit;h=$2";
end 'td';
} else {
td $$rep{rev};
}
td $$rep{subarch} || $$rep{arch};
td $$rep{os};
td $$rep{cc};
td $$rep{nwarn};
if ($npass) {
$rtext = "$npass / $ntest";
$rclass = $npass==$ntest? 'pass' : $npass? 'warn' : 'fail';
} else {
$rtext = $$rep{errstr};
$rclass = 'fail'
}
start 'td', class => $rclass;
anchor $rtext, href => href slot => $$rep{slot}, time => $$rep{date};
end 'td';
end 'tr';
print "\n";
}
end 'tbody';
end 'table';
end 'body';
end 'html';