8 use vars qw($dbhost $dbname $dbuser $dbpass $dbport);
11 require "$ENV{BFConfDir}/BuildFarmWeb.pl";
12 #require "BuildFarmWeb.pl";
14 die "no dbname" unless $dbname;
15 die "no dbuser" unless $dbuser;
17 my $dsn="dbi:Pg:dbname=$dbname";
18 $dsn .= ";host=$dbhost" if $dbhost;
19 $dsn .= ";port=$dbport" if $dbport;
21 my $db = DBI->connect($dsn,$dbuser,$dbpass);
23 die $DBI::errstr unless $db;
26 my $member = $query->param('nm'); $member =~ s/[^a-zA-Z0-9_ -]//g;
27 my $branch = $query->param('br'); $branch =~ s/[^a-zA-Z0-9_ -]//g;
28 my $hm = $query->param('hm'); $hm =~ s/[^a-zA-Z0-9_ -]//g;
29 $hm = '240' unless $hm =~ /^\d+$/;
31 # we don't really need to do this join, since we only want
32 # one row from buildsystems. but it means we only have to run one
33 # query. If it gets heavy we'll split it up and run two
35 my $statement = <<EOS;
37 select (now() at time zone 'GMT')::timestamp(0) - snapshot as when_ago,
38 sysname, snapshot, b.status, stage,
39 operating_system, os_version, compiler, compiler_version, architecture,
45 and s.status = 'approved'
47 order by snapshot desc
54 my $sth=$db->prepare($statement);
55 $sth->execute($member,$branch);
56 while (my $row = $sth->fetchrow_hashref)
58 $row->{owner_email} =~ s/\@/ [ a t ] /;
59 push(@$statrows,$row);
65 my $template = new Template({EVAL_PERL => 1});
67 print "Content-Type: text/html\n\n";
69 $template->process(\*DATA,
79 [%- BLOCK cl %] class="[% SWITCH bgfor -%]
80 [%- CASE 'OK' %]pass[% CASE 'ContribCheck' %]warn[% CASE [ 'Check' 'InstallCheck' ] %]warnx[% CASE %]fail[% END %]"
82 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
83 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
84 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
86 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
87 <title>PostgreSQL BuildFarm History</title>
88 <link rel="icon" type="image/png" href="/elephant-icon.png" />
89 <link rel="stylesheet" rev="stylesheet" href="/inc/pgbf.css" charset="utf-8" />
90 <style type="text/css"><!--
91 li#status a { color:rgb(17,45,137); background: url(/inc/b/r.png) no-repeat 100% -20px; }
92 li#status { background: url(/inc/b/l.png) no-repeat 0% -20px; }
95 <body class="history">
98 <a href="/index.html"><img src="/inc/pgbuildfarm-banner.png" alt="PostgreSQL BuildFarm" width="800" height="73" /></a>
101 <li id="home"><a href="/index.html" title="PostgreSQL BuildFarm Home">Home</a></li>
102 <li id="status"><a href="/cgi-bin/show_status.pl" title="Current results">Status</a></li>
103 <li id="members"><a href="/cgi-bin/show_members.pl" title="Platforms tested">Members</a></li>
104 <li id="register"><a href="/register.html" title="Join PostgreSQL BuildFarm">Register</a></li>
105 <li id="pgfoundry"><a href="http://pgfoundry.org/projects/pgbuildfarm/">PGFoundry</a></li>
108 </div><!-- banner -->
110 <h1>PostgreSQL BuildFarm Status History</h1>
111 <table cellspacing="0">
112 <tr><th class="head" colspan="3">System Detail</th></tr>
113 <tr class="member"><th>Farm member</th><td>[% member %]</td></tr>
114 <tr><th>OS</th><td>[% statrows.0.operating_system %] [% statrows.0.os_version %]</td></tr>
115 <!-- <tr><th>OS Version</th><td>[% statrows.0.os_version %]</td></tr> -->
116 <tr><th>Compiler</th><td>[% statrows.0.compiler %] [% statrows.0.compiler_version %]</td></tr>
117 <!-- <tr><th>Compiler Version</th><td>[% statrows.0.compiler_version %]</td></tr> -->
118 <tr><th>Architecture</th><td>[% statrows.0.architecture %]</td></tr>
119 <tr><th>Owner</th><td>[% statrows.0.owner_email %]</td></tr>
121 <h3>Branch: [% branch %][% IF statrows.size >= hm %] (last [% hm %] entries shown)[% END %]</h3>
123 <tr [% PROCESS cl bgfor=row.stage %]>
124 <td>[%- row.when_ago | replace('\s',' ') %] ago </td>
125 <td class="status">[% row.stage -%]</td>
126 <td class="status"><a href="show_log.pl?nm=
127 [%- row.sysname %]&dt=
128 [%- row.snapshot | uri %]">
129 [%- IF row.stage != 'OK' %]Details[% ELSE %]Config[% END -%]</a></td>
133 <table border="0"> <tr>
134 [% FOREACH offset IN [0,1,2] %][% low = offset * statrows.size / 3 ; high = -1 + (offset + 1) * statrows.size / 3 %]
137 $stash->set(low => floor($stash->get('low')));
138 $stash->set(high => floor($stash->get('high')));
139 [% END %][% CATCH %]<!-- [% error.info %] --> [% END %]
140 <td><table cellspacing="0">
141 <!-- <tr><th colspan=3>low = [% low %], high = [% high %]</th></tr> -->
142 [% FOREACH xrow IN statrows.slice(low,high) %][% PROCESS stdet row=xrow %][% END %]
148 <p style="text-align: center;">
149 Hosting for the PostgreSQL Buildfarm is generously
151 <a href="http://www.commandprompt.com">CommandPrompt,
152 The PostgreSQL Company</a>
154 </div><!-- wrapper -->