8 use vars qw($dbhost $dbname $dbuser $dbpass $dbport);
11 require "$ENV{BFConfDir}/BuildFarmWeb.pl";
14 my @members = $query->param('member');
16 my $dsn="dbi:Pg:dbname=$dbname";
17 $dsn .= ";host=$dbhost" if $dbhost;
18 $dsn .= ";port=$dbport" if $dbport;
20 my $db = DBI->connect($dsn,$dbuser,$dbpass) or die("$dsn,$dbuser,$dbpass,$!");
22 # there is possibly some redundancy in this query, but it makes
23 # a lot of the processing simpler.
25 my $statement = <<EOS;
27 select (now() at time zone 'GMT')::timestamp(0) - snapshot as when_ago,
28 sysname, snapshot, b.status, stage, branch, build_flags,
29 operating_system, os_version, compiler, compiler_version, architecture
31 build_status b natural join
32 (select sysname, branch, max(snapshot) as snapshot
34 group by sysname, branch
35 having max(snapshot) > now() - '30 days'::interval
38 and s.status = 'approved'
39 order by case when branch = 'HEAD' then 0 else 1 end,
47 my $sth=$db->prepare($statement);
49 while (my $row = $sth->fetchrow_hashref)
51 next if (@members && ! grep {$_ eq $row->{sysname} } @members);
52 $row->{build_flags} =~ s/^\{(.*)\}$/$1/;
53 $row->{build_flags} =~ s/,/ /g;
54 $row->{build_flags} =~ s/--((enable|with)-)?//g;
55 $row->{build_flags} =~ s/\S+=\S+//g;
56 push(@$statrows,$row);
63 my $template = new Template({});
65 print "Content-Type: text/html\n\n";
67 $template->process(\*DATA,{statrows=>$statrows});
73 [%- BLOCK cl %] class=" [% SWITCH bgfor -%]
74 [%- CASE 'OK' %]pass[% CASE 'ContribCheck' %]warn[% CASE [ 'Check' 'InstallCheck' ] %]warnx[% CASE %]fail[% END %]"
76 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
77 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
78 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
80 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
81 <title>PostgreSQL BuildFarm Status</title>
82 <link rel="stylesheet" rev="stylesheet" href="/inc/pgbf.css" charset="utf-8" />
83 <style type="text/css"><!--
84 li#status a { color:rgb(17,45,137); background: url(/inc/b/r.png) no-repeat 100% -20px; }
85 li#status { background: url(/inc/b/l.png) no-repeat 0% -20px; }
91 <a href="/index.html"><img src="/inc/pgbuildfarm-banner.png" alt="PostgreSQL BuildFarm" width="800" height="73" /></a>
94 <li id="home"><a href="/index.html" title="PostgreSQL BuildFarm Home">Home</a></li>
95 <li id="status"><a href="/cgi-bin/show_status.pl" title="Current results">Status</a></li>
96 <li id="members"><a href="/cgi-bin/show_members.pl" title="Platforms tested">Members</a></li>
97 <li id="register"><a href="/register.html" title="Join PostgreSQL BuildFarm">Register</a></li>
98 <li id="pgfoundry"><a href="http://pgfoundry.org/projects/pgbuildfarm/">PGFoundry</a></li>
99 <li id="postgresql.org"><a href="http://www.postgresql.org">PostgreSQL.org</a></li>
102 </div><!-- banner -->
104 <h1>PostgreSQL BuildFarm Status</h1>
106 Shown here is the latest status of each farm member
107 for each branch it has reported on in the last 30 days.
110 Use the farm member link for history of that member
111 on the relevant branch.
113 <table cellspacing="0">
115 [% FOREACH row IN statrows %]
116 [% IF row.branch != brch ; brch = row.branch %]
117 <tr><th class="head" colspan="4">Branch: [% brch %]</th></tr>
118 <tr><th>Alias</th><th>System</th><th>Status</th><th>Flags</th></tr>
120 <tr [% PROCESS cl bgfor=row.stage %]>
122 href="show_history.pl?nm=[% row.sysname %]&br=[% row.branch %]"
124 >[% row.sysname %]</a></td>
125 <td><span class="opsys">[% row.operating_system %]
126 [% row.os_version %]</span> <span class="compiler">
128 [% row.compiler_version %]</span> <span class="arch">
129 [%- row.architecture %]</span></td>
131 [%- row.when_ago | replace('\s',' ') %] ago
133 <a href="show_log.pl?nm=
134 [%- row.sysname %]&dt=
135 [%- row.snapshot | uri %]">
136 [%- IF row.stage != 'OK' %]Details[% ELSE %]Config[% END -%]</a></td>
138 <td class="flags">[% row.build_flags %]</td>
143 </div><!-- wrapper -->