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 img ; flag ; END -%]
74 [%- BLOCK imgx ; IF flag_imgs.$flag ; '<img src="' . flag_imgs{flag} . '" alt="' . flag . '" /> ' ; ELSE flag . ' ' ; END ; END -%]
81 perl = '/img/camel.png',
82 python = '/img/python.png',
83 debug = '/img/bug.png',
84 pam => '/img/pam.png',
85 cassert => '/img/cassert.png',
86 openssl => '/img/ssl_icon.gif',
87 nls => '/img/translateicon.gif',
88 krb5 => '/img/krb.gif',
89 tcl => '/img/tcl.png',
90 'thread-safety' => '/img/threads.gif',
91 'integer-datetimes' = '/img/days.png',
94 [%- BLOCK img ; IF flag == 'blank' %]<img src="/img/blank.gif" height="16" width="16" class="inline" align="bottom" /> [% ELSIF flag_imgs.$flag %]<img src="[% flag_imgs.$flag %]" title="[% flag %]" alt="[% flag %]" height="16" width="16" class="inline" align="bottom" /> [% ELSE %][%#
97 [%- BLOCK cl %] class=" [% SWITCH bgfor -%]
98 [%- CASE 'OK' %]pass[% CASE 'ContribCheck' %]warn[% CASE [ 'Check' 'InstallCheck' ] %]warnx[% CASE %]fail[% END %]"
100 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
101 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
102 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
104 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
105 <title>PostgreSQL BuildFarm Status</title>
106 <link rel="stylesheet" rev="stylesheet" href="/inc/pgbf.css" charset="utf-8" />
107 <style type="text/css"><!--
108 li#status a { color:rgb(17,45,137); background: url(/inc/b/r.png) no-repeat 100% -20px; }
109 li#status { background: url(/inc/b/l.png) no-repeat 0% -20px; }
115 <a href="/index.html"><img src="/inc/pgbuildfarm-banner.png" alt="PostgreSQL BuildFarm" width="800" height="73" /></a>
118 <li id="home"><a href="/index.html" title="PostgreSQL BuildFarm Home">Home</a></li>
119 <li id="status"><a href="/cgi-bin/show_status.pl" title="Current results">Status</a></li>
120 <li id="members"><a href="/cgi-bin/show_members.pl" title="Platforms tested">Members</a></li>
121 <li id="register"><a href="/register.html" title="Join PostgreSQL BuildFarm">Register</a></li>
122 <li id="pgfoundry"><a href="http://pgfoundry.org/projects/pgbuildfarm/">PGFoundry</a></li>
123 <li id="postgresql.org"><a href="http://www.postgresql.org">PostgreSQL.org</a></li>
126 </div><!-- banner -->
128 <h1>PostgreSQL BuildFarm Status</h1>
130 Shown here is the latest status of each farm member
131 for each branch it has reported on in the last 30 days.
134 Use the farm member link for history of that member
135 on the relevant branch.
137 <table><tr><th class="head" rowspan="2" cellspacing="0">Legend</th>
138 [% FOREACH flagset IN flag_imgs %]
139 <td><img src="[% flagset.value %]" title="[% flagset.key %]" alt="[% flagset.key %]" height="16" width="16" class="inline" align="center"/> = [% flagset.key %]</td>
140 [% IF loop.count == 6 %]</tr><tr>[% END %]
144 <table cellspacing="0">
146 [% FOREACH row IN statrows %]
147 [% IF row.branch != brch ; brch = row.branch %]
148 <tr><th class="head" colspan="4">Branch: [% brch %]</th></tr>
149 <tr><th>Alias</th><th>System</th><th>Status</th><th>Flags</th></tr>
151 <tr [% PROCESS cl bgfor=row.stage %]>
153 href="show_history.pl?nm=[% row.sysname %]&br=[% row.branch %]"
155 >[% row.sysname %]</a></td>
156 <td><span class="opsys">[% row.operating_system %]
157 [% row.os_version %]</span> <span class="compiler">
159 [% row.compiler_version %]</span> <span class="arch">
160 [%- row.architecture %]</span></td>
162 [%- row.when_ago | replace('\s',' ') %] ago
164 <a href="show_log.pl?nm=
165 [%- row.sysname %]&dt=
166 [%- row.snapshot | uri %]">
167 [%- IF row.stage != 'OK' %]Details[% ELSE %]Config[% END -%]</a></td>
170 flags = row.build_flags.split();
171 FOREACH flagme IN flag_imgs.keys() ;
172 IF flags.grep(flagme).size > 0 ;
173 PROCESS img flag = flagme ;
175 PROCESS img flag = 'blank' ;
183 </div><!-- wrapper -->