failures completion
authorAndrew Dunstan <andrew@dunslane.net>
Thu, 20 Jan 2011 22:02:52 +0000 (14:02 -0800)
committerAndrew Dunstan <andrew@dunslane.net>
Thu, 20 Jan 2011 22:02:52 +0000 (14:02 -0800)
cgi-bin/pgstatus.pl
cgi-bin/show_failures.pl [new file with mode: 0755]
htdocs/inc/pgbf.css
htdocs/index.html
templates/fstatus.tt [new file with mode: 0644]
templates/page.tt

index 0c60f80793f43a81e9050f110383ef3f23e9da32..9043b325786d48e6d5e53c12fc5f8253ecbbceb0 100755 (executable)
@@ -407,7 +407,7 @@ if ($stage ne 'OK')
        # prevent occasional duplication by forcing serialization of this operation
        $db->do("lock table nrecent_failures in share row exclusive mode");
        $db->do("delete from nrecent_failures");
-       $db->do("insert into nrecent_failures select bs.sysname, bs.snapshot, bs.branch from build_status bs where bs.stage <> 'OK' and bs.snapshot > now() - interval '30 days'");
+       $db->do("insert into nrecent_failures select bs.sysname, bs.snapshot, bs.branch from build_status bs where bs.stage <> 'OK' and bs.snapshot > now() - interval '90 days'");
        $db->commit;
 }
 
diff --git a/cgi-bin/show_failures.pl b/cgi-bin/show_failures.pl
new file mode 100755 (executable)
index 0000000..104bd66
--- /dev/null
@@ -0,0 +1,109 @@
+#!/usr/bin/perl
+
+=comment
+
+Copyright (c) 2003-2010, Andrew Dunstan
+
+See accompanying License file for license details
+
+=cut 
+
+use strict;
+use DBI;
+use Template;
+use CGI;
+
+use vars qw($dbhost $dbname $dbuser $dbpass $dbport $template_dir);
+
+
+require "$ENV{BFConfDir}/BuildFarmWeb.pl";
+
+my $query = new CGI;
+my @members = $query->param('member');
+map { s/[^a-zA-Z0-9_ -]//g; } @members;
+
+my $dsn="dbi:Pg:dbname=$dbname";
+$dsn .= ";host=$dbhost" if $dbhost;
+$dsn .= ";port=$dbport" if $dbport;
+
+
+my $sort_clause = "";
+my $presort_clause = "";
+my $sortby = $query->param('sortby') || 'nosort';
+if ($sortby eq 'name')
+{
+       $sort_clause = 'lower(sysname),';
+}
+elsif ($sortby eq 'os')
+{
+       $sort_clause = 'lower(operating_system), os_version desc,'; 
+}
+elsif ($sortby eq 'compiler')
+{
+       $sort_clause = "lower(compiler), compiler_version,";
+}
+elsif ($sortby eq 'namenobranch')
+{
+       $presort_clause = "lower(sysname), snapshot desc,"
+}
+
+my $db = DBI->connect($dsn,$dbuser,$dbpass,{pg_expand_array => 0}) 
+    or die("$dsn,$dbuser,$dbpass,$!");
+
+my $statement =<<EOS;
+
+
+  select timezone('GMT'::text, now())::timestamp(0) without time zone - b.snapshot AS when_ago, b.*
+  from nrecent_failures_db_data b
+  order by $presort_clause 
+        branch = 'HEAD' desc,
+        branch desc, 
+        $sort_clause 
+        snapshot desc
+
+EOS
+;
+
+my $statrows=[];
+my $sth=$db->prepare($statement);
+$sth->execute;
+while (my $row = $sth->fetchrow_hashref)
+{
+    next if (@members && ! grep {$_ eq $row->{sysname} } @members);
+    $row->{build_flags}  =~ s/^\{(.*)\}$/$1/;
+    $row->{build_flags}  =~ s/,/ /g;
+       # enable-integer-datetimes is now the default
+       if ($row->{branch} eq 'HEAD' || $row->{branch} gt 'REL8_3_STABLE')
+       {
+               $row->{build_flags} .= " --enable-integer-datetimes "
+                       unless ($row->{build_flags} =~ /--(en|dis)able-integer-datetimes/);
+       }
+       # enable-thread-safety is now the default
+       if ($row->{branch} eq 'HEAD' || $row->{branch} gt 'REL8_5_STABLE')
+       {
+               $row->{build_flags} .= " --enable-thread-safety "
+                       unless ($row->{build_flags} =~ /--(en|dis)able-thread-safety/);
+       }
+    $row->{build_flags}  =~ s/--((enable|with)-)?//g;
+       $row->{build_flags} =~ s/libxml/xml/;
+    $row->{build_flags}  =~ s/\S+=\S+//g;
+    push(@$statrows,$row);
+}
+$sth->finish;
+
+
+$db->disconnect;
+
+
+my $template_opts = { INCLUDE_PATH => $template_dir };
+my $template = new Template($template_opts);
+
+print "Content-Type: text/html\n\n";
+
+$template->process('fstatus.tt',
+               {statrows=>$statrows, 
+                sortby => $sortby,
+                members=> \@members} );
+
+exit;
+
index 0873d6d51a552e8378e9843d36a953894b6f61e7..5c7ef7d138c5fd0316e86d6e3477c59e8ceb0ef8 100644 (file)
@@ -19,27 +19,31 @@ a:hover img { border: none; }
 
 #banner img { margin:6px 0; }
 
-#nav {
+li#thismenu a { color:rgb(17,45,137); background: url(/inc/b/r.png) no-repeat 100% -20px; } 
+li#thismenu { background: url(/inc/b/l.png) no-repeat 0% -20px; }
+
+
+.nav {
    float:left;
    width:780px;
    background:#fff;
    margin:0 10px 10px;
 }
 
-#nav ul {
+.nav ul {
    margin:0;
    padding:0;
    list-style:none;
 }
 
-#nav li {
+.nav li {
    float:left;
    margin:0 .5em 0 0;
    padding:0 0 0 4px;
    background: url(/inc/b/l.png) no-repeat left top;
 }
 
-#nav li a { 
+.nav li a { 
     display:block;
     background:url(/inc/b/r.png) no-repeat right top;
     padding:0 11px 0 7px;
@@ -48,20 +52,20 @@ a:hover img { border: none; }
     line-height:20px;
 }
 
-#nav li a:hover {
+.nav li a:hover {
     background: url(/inc/b/r.png) no-repeat 100% -20px;
     color:rgb(17,45,137); 
     border: 0;
 }
 
-#nav li:hover { background: url(/inc/b/l.png) no-repeat 0% -20px; } 
+.nav li:hover { background: url(/inc/b/l.png) no-repeat 0% -20px; } 
 
-#main {
+.main {
     clear:both;
     margin:0 5px;
 }
 
-#main a {
+.main a {
        text-decoration: none;
        color: rgb(17,45,137);
        font-weight: bold;
@@ -125,5 +129,6 @@ td.branch ul, td.branch li {
 .compiler { color: navy; }
 .arch { color: purple; }
 
-td.flags { white-space: normal;  font-size: x-small; }
+td.flags { white-space: nowrap;  font-size: x-small; }
+td.failflags {white-space: nowrap; font-size: x-small; }
 
index 9609bb4b54c6780e98c26ed0a0d8a953a98840b2..18f5bbe5775830d028769b0042a72ff73eaa357a 100644 (file)
@@ -1,12 +1,5 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<!--
-
-Copyright (c) 2003-2010, Andrew Dunstan
-
-See accompanying License file for license details
-
--->
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
   <head>
     <meta http-equiv="content-type" content="text/html; charset=utf-8" />
@@ -22,17 +15,18 @@ See accompanying License file for license details
     <div id="wrapper">
       <div id="banner">
         <a href="/index.html"><img src="/inc/pgbuildfarm-banner.png" alt="PostgreSQL BuildFarm" width="800" height="73" /></a>
-        <div id="nav">
+        <div class="nav">
           <ul>
            <li id="home"><a href="/index.html" title="PostgreSQL BuildFarm Home">Home</a></li>
            <li id="status"><a href="/cgi-bin/show_status.pl" title="Current results">Status</a></li>
+           <li id="failures"><a href="/cgi-bin/show_failures.pl" title="Recent Failures">Failures</a></li>
            <li id="members"><a href="/cgi-bin/show_members.pl" title="Platforms tested">Members</a></li>
            <li id="register"><a href="/cgi-bin/register-form.pl" title="Join PostgreSQL BuildFarm">Register</a></li>
            <li id="pgfoundry"><a href="http://pgfoundry.org/projects/pgbuildfarm/">PGFoundry</a></li>
           </ul>
         </div><!-- nav -->
       </div><!-- banner -->
-      <div id="main">
+      <div class="main">
         
 <!-- html generated from index.tt -->
 <p>
diff --git a/templates/fstatus.tt b/templates/fstatus.tt
new file mode 100644 (file)
index 0000000..6412a23
--- /dev/null
@@ -0,0 +1,97 @@
+[%#
+
+Copyright (c) 2003-2010, Andrew Dunstan
+
+See accompanying License file for license details
+
+-%]
+[%
+ flag_imgs = {
+     perl = '/img/camel.png',
+     python = '/img/python.png',
+     debug = '/img/bug.png',
+     pam => '/img/pam.png',
+     cassert => '/img/cassert.png',
+     openssl => '/img/ssl_icon.gif',
+     nls => '/img/translateicon.gif',
+     krb5 => '/img/krb.gif',
+     tcl => '/img/tcl.png',
+     vpath => '/img/vpath.png',
+     xml => '/img/xml.png',
+     'thread-safety' => '/img/threads.gif',
+     'integer-datetimes' = '/img/days.png',
+     git => '/img/git.png',
+     }
+-%]
+[%- BLOCK img ; IF flag == 'depend' or flag == 'gnu-ld' ; ; ELSIF flag_imgs.$flag %]<img src="[% flag_imgs.$flag %]" title="[% flag %]" alt="[% flag %]" height="16" width="16" class="inline" align="bottom" />  [% ELSE %][%#
+                                                                                                                                                                                                         flag ; ' '
+%][% END ; END -%]
+[%- BLOCK sysnotes ; IF row.sys_notes %]<img src="/img/notes.png" height="16" width="16" title="[% row.sys_notes_ts.replace(' .*','') | html %]: [% row.sys_notes | html %]" />
+[%- ELSE %]&nbsp;[% END ; END -%]
+[%- BLOCK cl %] class="[% SWITCH bgfor.replace('-.*','') -%]
+  [%- CASE 'OK' %]pass[% CASE 'ContribCheck' %]warn[% CASE [ 'Check' 'InstallCheck' ] %]warnx[% CASE %]fail[% END %]"
+[%- END -%]
+[% WRAPPER 'page.tt' 
+       title = 'PostgreSQL BuildFarm Recent Failures'
+       bodyclass = 'none'
+       pagebutton = 'failures'
+%]
+    <h1>PostgreSQL BuildFarm Recent Failures</h1>
+    <p>
+      Shown here are build failures that occurred in the last 90 days.
+    </p>
+    <p>
+       Use the farm member link for history of that member 
+       on the relevant branch.
+    </p>
+
+               <div class="nav">
+          <ul>
+            <li [% IF sortby != 'name' && sortby != 'namenobranch' %] id='thismenu' [% END %]><a href="/cgi-bin/show_failures.pl" title="Sort By Branch, Date">Sort By Branch, Date</a></li>
+            <li  [% IF sortby == 'name' %] id='thismenu' [% END %]><a href="/cgi-bin/show_failures.pl?sortby=name" title="Sort By Branch, Name">Sort By Branch, Name</a></li>
+            <li [% IF sortby == 'namenobranch' %] id='thismenu' [% END %]><a href="/cgi-bin/show_failures.pl?sortby=namenobranch" title="Sort By Name">Sort By Name</a></li>
+          </ul>
+                 </div>
+<h3>&nbsp;</h3>
+<table><tr><th class="head" rowspan="2">Legend</th>
+[% FOREACH flagset IN flag_imgs %]
+<td><img src="[% flagset.value %]" title="[% flagset.key %]" alt="[% flagset.key %]" height="16" width="16" class="inline"  align="center"/> =  [% flagset.key %]</td>
+[% IF loop.count == 7 %]</tr><tr>[% END %]
+[% END %]
+</tr></table>
+<br />
+    <table cellspacing="0">
+[% brch = "" %]
+[% IF sortby == 'namenobranch' %]
+<tr><th colspan="2">Alias</th><th>Branch</th><th>System</th><th>Status</th><th>Flags</th></tr>
+[% END %]
+[% FOREACH row IN statrows %]
+[% IF row.branch != brch && sortby != 'namenobranch' ; brch = row.branch %]
+<tr><th class="head" colspan="5">Branch: [% brch %]</th></tr>
+<tr><th colspan="2">Alias</th><th>System</th><th>Status</th><th>Flags</th></tr>
+[% END %]
+<tr [% PROCESS cl bgfor=row.stage %]>
+    <td><a 
+    href="show_history.pl?nm=[% row.sysname %]&amp;br=[% row.branch %]"
+    title="History"
+  >[% row.sysname %]</a></td>
+    <td>[% PROCESS sysnotes %]</td>
+    [% IF sortby == 'namenobranch' %]<td>[% row.branch %]</td>[% END %]
+    <td><span class="opsys">[% row.operating_system %]
+            [% row.os_version %]</span> <span class="compiler">
+            [%- row.compiler %]
+            [% row.compiler_version %]</span> <span class="arch">
+            [%- row.architecture %]</span></td>
+    <td class="status">
+            [%- row.when_ago | replace('\s','&nbsp;') %]&nbsp;ago&nbsp;
+            [% row.stage -%]
+            <a href="show_log.pl?nm=
+               [%- row.sysname %]&amp;dt=
+               [%- row.snapshot | uri %]">
+                [%- IF row.stage != 'OK' %]Details[% ELSE %]Config[% END -%]</a></td>
+
+    <td class="failflags">[% FOREACH flag IN row.build_flags.split().sort() ; PROCESS img ; END %]</td>
+</tr>
+[% END %]
+    </table>
+[% END %]
index 381b467f1df4147d805de21d3dfea9baff33cf60..f33af46e7a0f115a6a72062caae429f02e3dffa1 100644 (file)
@@ -22,17 +22,18 @@ See accompanying License file for license details
     <div id="wrapper">
       <div id="banner">
         <a href="/index.html"><img src="/inc/pgbuildfarm-banner.png" alt="PostgreSQL BuildFarm" width="800" height="73" /></a>
-        <div id="nav">
+        <div class="nav">
           <ul>
            <li id="home"><a href="/index.html" title="PostgreSQL BuildFarm Home">Home</a></li>
            <li id="status"><a href="/cgi-bin/show_status.pl" title="Current results">Status</a></li>
+           <li id="failures"><a href="/cgi-bin/show_failures.pl" title="Recent Failures">Failures</a></li>
            <li id="members"><a href="/cgi-bin/show_members.pl" title="Platforms tested">Members</a></li>
            <li id="register"><a href="/cgi-bin/register-form.pl" title="Join PostgreSQL BuildFarm">Register</a></li>
            <li id="pgfoundry"><a href="http://pgfoundry.org/projects/pgbuildfarm/">PGFoundry</a></li>
           </ul>
         </div><!-- nav -->
       </div><!-- banner -->
-      <div id="main">
+      <div class="main">
         [% content %]
       </div><!-- main -->
       <hr />