8 use vars qw($dbhost $dbname $dbuser $dbpass $dbport);
11 require "$ENV{BFConfDir}/BuildFarmWeb.pl";
14 my @members = $query->param('member');
15 map { s/[^a-zA-Z0-9_ -]//g; } @members;
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) or die("$dsn,$dbuser,$dbpass,$!");
23 # there is possibly some redundancy in this query, but it makes
24 # a lot of the processing simpler.
26 my $statement = <<EOS;
28 select (now() at time zone 'GMT')::timestamp(0) - snapshot as when_ago,
29 sysname, snapshot, b.status, stage, branch, build_flags,
30 operating_system, os_version, compiler, compiler_version, architecture
34 (select sysname, branch, max(snapshot) as snapshot
36 group by sysname, branch
37 having max(snapshot) > now() - '30 days'::interval
40 and s.status = 'approved'
41 order by branch = 'HEAD' desc,
51 select (now() at time zone 'GMT')::timestamp(0) - snapshot as when_ago,
52 sysname, snapshot, b.status, stage, branch, build_flags,
53 operating_system, coalesce(b.os_version,s.os_version) as os_version,
54 compiler, coalesce(b.compiler_version, s.compiler_version) as compiler_version,
58 select distinct on (bs.sysname, bs.branch, bs.report_time)
59 sysname, snapshot, status, stage, branch, build_flags,
60 report_time ,compiler_version, os_version
64 on (p.name = bs.sysname and p.effective_date <= bs.report_time)
65 order by bs.sysname, bs.branch, bs.report_time,
66 p.effective_date is null, p.effective_date desc
69 (select sysname, branch, max(snapshot) as snapshot
71 group by sysname, branch
72 having max(snapshot) > now() - '30 days'::interval
75 and s.status = 'approved'
76 order by branch = 'HEAD' desc,
86 my $sth=$db->prepare($statement);
88 while (my $row = $sth->fetchrow_hashref)
90 next if (@members && ! grep {$_ eq $row->{sysname} } @members);
91 $row->{build_flags} =~ s/^\{(.*)\}$/$1/;
92 $row->{build_flags} =~ s/,/ /g;
93 $row->{build_flags} =~ s/--((enable|with)-)?//g;
94 $row->{build_flags} =~ s/\S+=\S+//g;
95 push(@$statrows,$row);
102 my $template = new Template({});
104 print "Content-Type: text/html\n\n";
106 $template->process(\*DATA,{statrows=>$statrows});
112 [%- BLOCK img ; flag ; END -%]
113 [%- BLOCK imgx ; IF flag_imgs.$flag ; '<img src="' . flag_imgs{flag} . '" alt="' . flag . '" /> ' ; ELSE flag . ' ' ; END ; END -%]
120 perl = '/img/camel.png',
121 python = '/img/python.png',
122 debug = '/img/bug.png',
123 pam => '/img/pam.png',
124 cassert => '/img/cassert.png',
125 openssl => '/img/ssl_icon.gif',
126 nls => '/img/translateicon.gif',
127 krb5 => '/img/krb.gif',
128 tcl => '/img/tcl.png',
129 xml => '/img/xml.png',
130 'thread-safety' => '/img/threads.gif',
131 'integer-datetimes' = '/img/days.png',
134 [%- 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 %][%#
137 [%- BLOCK cl %] class=" [% SWITCH bgfor -%]
138 [%- CASE 'OK' %]pass[% CASE 'ContribCheck' %]warn[% CASE [ 'Check' 'InstallCheck' ] %]warnx[% CASE %]fail[% END %]"
140 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
141 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
142 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
144 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
145 <title>PostgreSQL BuildFarm Status</title>
146 <link rel="icon" type="image/png" href="/elephant-icon.png" />
147 <link rel="stylesheet" rev="stylesheet" href="/inc/pgbf.css" charset="utf-8" />
148 <style type="text/css"><!--
149 li#status a { color:rgb(17,45,137); background: url(/inc/b/r.png) no-repeat 100% -20px; }
150 li#status { background: url(/inc/b/l.png) no-repeat 0% -20px; }
156 <a href="/index.html"><img src="/inc/pgbuildfarm-banner.png" alt="PostgreSQL BuildFarm" width="800" height="73" /></a>
159 <li id="home"><a href="/index.html" title="PostgreSQL BuildFarm Home">Home</a></li>
160 <li id="status"><a href="/cgi-bin/show_status.pl" title="Current results">Status</a></li>
161 <li id="members"><a href="/cgi-bin/show_members.pl" title="Platforms tested">Members</a></li>
162 <li id="register"><a href="/register.html" title="Join PostgreSQL BuildFarm">Register</a></li>
163 <li id="pgfoundry"><a href="http://pgfoundry.org/projects/pgbuildfarm/">PGFoundry</a></li>
164 <li id="postgresql.org"><a href="http://www.postgresql.org">PostgreSQL.org</a></li>
167 </div><!-- banner -->
169 <h1>PostgreSQL BuildFarm Status</h1>
171 Shown here is the latest status of each farm member
172 for each branch it has reported on in the last 30 days.
175 Use the farm member link for history of that member
176 on the relevant branch.
178 <table><tr><th class="head" rowspan="2">Legend</th>
179 [% FOREACH flagset IN flag_imgs %]
180 <td><img src="[% flagset.value %]" title="[% flagset.key %]" alt="[% flagset.key %]" height="16" width="16" class="inline" align="center"/> = [% flagset.key %]</td>
181 [% IF loop.count == 6 %]</tr><tr>[% END %]
185 <table cellspacing="0">
187 [% FOREACH row IN statrows %]
188 [% IF row.branch != brch ; brch = row.branch %]
189 <tr><th class="head" colspan="4">Branch: [% brch %]</th></tr>
190 <tr><th>Alias</th><th>System</th><th>Status</th><th>Flags</th></tr>
192 <tr [% PROCESS cl bgfor=row.stage %]>
194 href="show_history.pl?nm=[% row.sysname %]&br=[% row.branch %]"
196 >[% row.sysname %]</a></td>
197 <td><span class="opsys">[% row.operating_system %]
198 [% row.os_version %]</span> <span class="compiler">
200 [% row.compiler_version %]</span> <span class="arch">
201 [%- row.architecture %]</span></td>
203 [%- row.when_ago | replace('\s',' ') %] ago
205 <a href="show_log.pl?nm=
206 [%- row.sysname %]&dt=
207 [%- row.snapshot | uri %]">
208 [%- IF row.stage != 'OK' %]Details[% ELSE %]Config[% END -%]</a></td>
210 <td class="flags">[% FOREACH flag IN row.build_flags.split().sort() ; PROCESS img ; END %]</td>
216 <p style="text-align: center;">
217 The PostgreSQL Buildfarm website is provided by:
218 <a href="http://www.commandprompt.com">CommandPrompt,
219 The PostgreSQL Company</a> <br />
220 The PostgreSQL community makes it work!
222 </div><!-- wrapper -->