-use vars qw($dbhost $dbname $dbuser $dbpass $dbport $sort_by);
+use vars qw($dbhost $dbname $dbuser $dbpass $dbport $template_dir $sort_by);
require "$ENV{BFConfDir}/BuildFarmWeb.pl";
# there is possibly some redundancy in this query, but it makes
# a lot of the processing simpler.
-my $statement = <<EOS;
+my $statement = q{
select name, operating_system, os_version, compiler, compiler_version, owner_email,
+ sys_notes_ts::date AS sys_notes_date, sys_notes,
architecture as arch, ARRAY(
- select distinct on (branch <> 'HEAD', branch)
- branch || ':' ||
- extract(days from now() - snapshot)
- from build_status
- where name = sysname
- order by branch <> 'HEAD', branch desc,
- snapshot desc
- ) as branches
- from buildsystems
+ select branch || ':' ||
+ extract(days from now() - l.snapshot)
+ from latest_snapshot l
+ where l.sysname = s.name
+ order by branch <> 'HEAD', branch desc
+ ) as branches,
+ ARRAY(select compiler_version || '\t' || os_version || '\t' || effective_date
+ from personality p
+ where p.name = s.name
+ order by effective_date
+ ) as personalities
+ from buildsystems s
where status = 'approved'
- order by $sort_by
+};
-EOS
-;
+$statement .= "order by $sort_by";
my $statrows=[];
my $sth=$db->prepare($statement);
while (my $row = $sth->fetchrow_hashref)
{
$row->{branches} =~ s/^\{(.*)\}$/$1/;
+ my $personalities = $row->{personalities};
+ $personalities =~ s/^\{(.*)\}$/$1/;
+ my @personalities = split(',',$personalities);
+ $row->{personalities} = [];
+ foreach my $personality (@personalities)
+ {
+ $personality =~ s/^"(.*)"$/$1/;
+ $personality =~ s/\\(.)/$1/g;
+
+ my ($compiler_version, $os_version, $effective_date) = split(/\t/,$personality);
+ $effective_date =~ s/ .*//;
+ push(@{$row->{personalities}}, {compiler_version => $compiler_version,
+ os_version => $os_version,
+ effective_date => $effective_date });
+ }
$row->{owner_email} =~ s/\@/ [ a t ] /;
push(@$statrows,$row);
}
# use Data::Dumper; print "Content-Type: text/plain\n\n",Dumper($statrows),"VERSION: ",$DBD::Pg::VERSION,"\n"; exit;
-my $template = new Template({});
+my $template_opts = { INCLUDE_PATH => $template_dir};
+my $template = new Template($template_opts);
print "Content-Type: text/html\n\n";
-$template->process(\*DATA,{statrows=>$statrows});
+$template->process('members.tt',
+ {statrows=>$statrows});
exit;
-
-__DATA__
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<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" />
- <title>PostgreSQL BuildFarm Members</title>
- <link rel="icon" type="image/png" href="/elephant-icon.png" />
- <link rel="stylesheet" rev="stylesheet" href="/inc/pgbf.css" charset="utf-8" />
- <style type="text/css"><!--
- li#members a { color:rgb(17,45,137); background: url(/inc/b/r.png) no-repeat 100% -20px; }
- li#members { background: url(/inc/b/l.png) no-repeat 0% -20px; }
- --></style>
- </style>
-</head>
-<body class="members">
-<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">
-<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="members"><a href="/cgi-bin/show_members.pl" title="Platforms tested">Members</a></li>
- <li id="register"><a href="/register.html" 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">
-<h1>PostgreSQL BuildFarm Members</h1>
- <p>Click branch links to see build history. Click the heading links to resort the list. Select members by checkbox and hit the button at the bottom to create a status custom filter.</p>
- <form name="filter" method="GET" action="/cgi-bin/show_status.pl">
- <table cellspacing="0">
- <tr>
- <td> </td>
- <th><a href="/cgi-bin/show_members.pl?sort_by=name">Name</a><br /><a href="/cgi-bin/show_members.pl?sort_by=owner">Owner</a></th>
- <th><a href="/cgi-bin/show_members.pl?sort_by=os">OS / Version</a></th>
- <th><a href="/cgi-bin/show_members.pl?sort_by=compiler">Compiler / Version</a></th>
- <th><a href="/cgi-bin/show_members.pl?sort_by=arch">Arch</a></th>
- <th>Branches reported on<br />(most recent report)</th>
- </tr>
-[% alt = true %]
-[% FOREACH row IN statrows %] <tr [%- IF alt %]class="alt"[% END -%]>
- [% alt = ! alt %]
- <td><input type="checkbox" name="member" value="[% row.name %]" /></td>
- <td>[% row.name %]<br />[% row.owner_email %]</td>
- <td>[% row.operating_system %]<br />[% row.os_version %]</td>
- <td>[% row.compiler %]<br />[% row.compiler_version %]</td>
- <td>[% row.arch %]</td>
- <td class="branch">[% IF ! row.branches ; ' ' ; END -%]
- <ul>
- [%-
- FOREACH branch_days IN row.branches.split(',') ;
- branch_fields = branch_days.split(':');
- branch = branch_fields.0;
- branch_day = branch_fields.1;
- %]<li><a
- href="show_history.pl?nm=[% row.name %]&br=[% branch %]"
- title="History"
- >[% branch %]</a> ([% branch_day %] days ago)</li>[% END %]</ul></td>
- </tr>
-[% END %]
- </table>
- <input type="submit" value="Make Filter" />
- </form>
- </div><!-- main -->
-<hr />
-<p style="text-align: center;">
-Hosting for the PostgreSQL Buildfarm is generously
-provided by:
-<a href="http://www.commandprompt.com">CommandPrompt,
-The PostgreSQL Company</a>
-</p>
- </div><!-- wrapper -->
- </body>
-</html>
-
-
-
-
-
-
-
-