3 # Copyright (c) 2003 Dag-Erling Coïdan Smørgrav
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
9 # 1. Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer
11 # in this position and unchanged.
12 # 2. Redistributions in binary form must reproduce the above copyright
13 # notice, this list of conditions and the following disclaimer in the
14 # documentation and/or other materials provided with the distribution.
15 # 3. The name of the author may not be used to endorse or promote products
16 # derived from this software without specific prior written permission.
18 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 use POSIX qw(strftime);
45 if (open(FILE, "<", $log)) {
47 if (m/tinderbox run completed/) {
60 my @a = split('_', $a);
61 my @b = split('_', $b);
63 ($a, $b) = (shift(@a), shift(@b));
64 return 1 unless defined($a);
65 return -1 unless defined($b);
67 if ($a =~ m/^\d+$/ && $b =~ m/^\d+$/) {
76 sub inverse_branch_sort($$) {
79 return branch_sort($b, $a);
85 my %branches = %{$CONFIGS{$config}};
90 foreach my $arch (sort(keys(%ARCHES))) {
91 foreach my $machine (sort(keys(%{$ARCHES{$arch}}))) {
92 if ($arch eq $machine) {
93 print " <th>$arch</th>\n";
95 print " <th>$arch<br />$machine</th>\n";
103 foreach my $branch (sort(inverse_branch_sort keys(%branches))) {
107 foreach my $arch (sort(keys(%ARCHES))) {
108 foreach my $machine (sort(keys(%{$ARCHES{$arch}}))) {
109 my $log = "tinderbox-$config-$branch-$arch-$machine";
111 if (-f "$DIR/$log.brief") {
112 my @stat = stat("$DIR/$log.brief");
113 my $class = success("$DIR/$log.brief") ? "ok" : "fail";
114 my $age = int(($now - $stat[9]) / 1800);
118 $links .= "<span class='$class'>" .
119 strftime("%Y-%m-%d %H:%M UTC", gmtime($stat[9])) .
121 my $size = sprintf("[%.1f kB]", $stat[7] / 1024);
122 $links .= " <span class='tiny'>" .
123 "<a target='_top' href='$log.brief'>summary $size</a>" .
126 if (-f "$DIR/$log.full") {
127 my @stat = stat("$DIR/$log.full");
128 my $size = sprintf("[%.1f MB]", $stat[7] / 1048576);
129 $links .= " <span class='tiny'>" .
130 "<a target='_top' href='$log.full'>full log $size</a>" .
134 $html .= " <td>n/a</td>\n";
136 $html .= " <td>$links</td>\n";
146 if ($ENV{'GATEWAY_INTERFACE'}) {
148 print "Content-Type: text/html\n\n";
150 if ($0 =~ m|^(/[\w/._-]+)/[^/]+$|) {
153 open(STDOUT, ">", "$DIR/index.html")
154 or die("index.html: $!\n");
159 or die("$DIR: $!\n");
160 foreach (readdir(DIR)) {
161 next unless m/^tinderbox-(\w+)-(\w+)-(\w+)-(\w+)\.(brief|full)$/;
162 $CONFIGS{$1}->{$2} = $ARCHES{$3}->{$4} = 1;
166 print "<?xml version='1.0' encoding='iso-8859-1'?>
168 PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'
169 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
170 <html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
172 <title>FreeBSD tinderbox logs</title>
173 <meta name='robots' content='nofollow' />
174 <meta http-equiv='refresh' content='600' />
175 <link rel='stylesheet' type='text/css' media='screen' href='tb.css' />
176 <link rel='shortcut icon' type='image/png' href='daemon.png' />
179 <!-- h1>FreeBSD tinderbox logs</h1 -->
181 <table border='1' cellpadding='3'>
183 foreach my $config (sort(keys(%CONFIGS))) {
184 next if $config =~ m/^update_/;
187 my $date = strftime("%Y-%m-%d %H:%M UTC", gmtime());
190 <!-- p class='update'>Last updated: $date</p -->
192 <a target='_top' href='http://validator.w3.org/check/referer'><img
193 src='valid-xhtml10.png'
194 alt='Valid XHTML 1.0!' height='31' width='88' /></a>
195 <a target='_top' href='http://jigsaw.w3.org/css-validator/check/referer'><img
197 alt='Valid CSS!' height='31' width='88' /></a>