9 use vars qw($dbhost $dbname $dbuser $dbpass $dbport @log_file_names);
12 require "$ENV{BFConfDir}/BuildFarmWeb.pl";
13 #require "BuildFarmWeb.pl";
15 die "no dbname" unless $dbname;
16 die "no dbuser" unless $dbuser;
18 my $dsn="dbi:Pg:dbname=$dbname";
19 $dsn .= ";host=$dbhost" if $dbhost;
20 $dsn .= ";port=$dbport" if $dbport;
24 my $system = $query->param('nm'); $system =~ s/[^a-zA-Z0-9_ -]//g;
25 my $logdate = $query->param('dt'); $logdate =~ s/[^a-zA-Z0-9_ -]//g;
29 my ($stage,$changed_this_run,$changed_since_success,$sysinfo,$branch,$scmurl);
32 use vars qw($info_row);
34 if ($system && $logdate)
37 my $db = DBI->connect($dsn,$dbuser,$dbpass);
39 die $DBI::errstr unless $db;
41 my $statement = <<EOS;
43 select log,conf_sum,stage, changed_this_run, changed_since_success,branch,
44 log_archive_filenames, scm, scmurl
46 where sysname = ? and snapshot = ?
50 my $sth=$db->prepare($statement);
51 $sth->execute($system,$logdate);
52 my $row=$sth->fetchrow_arrayref;
54 $conf=$row->[1] || "not recorded" ;
55 $stage=$row->[2] || "unknown";
56 $changed_this_run = $row->[3];
57 $changed_since_success = $row->[4];
59 my $log_file_names = $row->[6];
61 $scm ||= 'cvs'; # legacy scripts
63 $log_file_names =~ s/^\{(.*)\}$/$1/;
64 @log_file_names=split(',',$log_file_names)
70 select operating_system, os_version,
71 compiler, compiler_version,
73 replace(owner_email,'\@',' [ a t ] ') as owner_email,
74 sys_notes_ts::date AS sys_notes_date, sys_notes
76 where status = 'approved'
81 $sth=$db->prepare($statement);
82 $sth->execute($system);
83 $info_row=$sth->fetchrow_hashref;
84 # $sysinfo = join(" ",@$row);
89 foreach my $chgd ($changed_this_run,$changed_since_success)
91 my $cvsurl = 'http://anoncvs.postgresql.org/cvsweb.cgi';
92 my $giturl = $scmurl || 'http://git.postgresql.org/gitweb?p=postgresql.git;a=commit;h=';
93 my @lines = split(/!/,$chgd);
98 s!(^\S+)(\s+)(\S+)!<a href="$giturl$3">$1</a>!;
100 elsif ($scm eq 'cvs')
102 next unless m!^(pgsql|master|REL\d_\d_STABLE)/!;
103 s!(^\S+)(\s+)(\S+)!<a href="$cvsurl/$1?rev=$3">$1$2$3</a>!;
106 $chgd = join("\n",@lines);
107 $chgd ||= 'not recorded';
111 $conf =~ s/\@/ [ a t ] /g;
112 map {s/&/&/g; s/</</g; s/>/>/g; s/\"/"/g;} ($log,$conf);
113 # map {s/!/\n/g} ($changed_this_run,$changed_since_success);
118 my $logrows = ceil(scalar(@log_file_names)/$lrfactor);
119 my $logcells = $lrfactor * $logrows;
122 my $urldt = uri_escape($logdate);
128 print "Content-Type: text/html\n\n";
133 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
134 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
135 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
137 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
138 <title>PostgreSQL BuildFarm | Configuration summary for system "$system"</title>
139 <link rel="icon" type="image/png" href="/elephant-icon.png" />
140 <link rel="stylesheet" rev="stylesheet" href="/inc/pgbf.css" charset="utf-8" />
145 <a href="/index.html"><img src="/inc/pgbuildfarm-banner.png" alt="PostgreSQL BuildFarm" width="800" height="73" /></a>
148 <li id="home"><a href="/index.html" title="PostgreSQL BuildFarm Home">Home</a></li>
149 <li id="status"><a href="/cgi-bin/show_status.pl" title="Current results">Status</a></li>
150 <li id="members"><a href="/cgi-bin/show_members.pl" title="Platforms tested">Members</a></li>
151 <li id="register"><a href="/cgi-bin/register-form.pl" title="Join PostgreSQL BuildFarm">Register</a></li>
152 <li id="pgfoundry"><a href="http://pgfoundry.org/projects/pgbuildfarm/">PGFoundry</a></li>
155 </div><!-- banner -->
157 <h1>PostgreSQL Build Farm Log</h1>
158 <table align="top" cellspacing="0">
160 <th class="head" rowspan="2">System Information</th>
165 <th>Architecture</th>
170 <td><a href="/cgi-bin/show_history.pl?nm=$system&br=$branch">$branch</a></td>
171 <td>$info_row->{operating_system} $info_row->{os_version}</td>
172 <td>$info_row->{compiler} $info_row->{compiler_version}</td>
173 <td>$info_row->{architecture}</td>
174 <td>$info_row->{owner_email}</td>
179 if ($info_row->{sys_notes})
185 <th class="head" rowspan="2">System Notes</th>
190 <td>$info_row->{sys_notes_date}</td>
191 <td>$info_row->{sys_notes}</td>
198 for my $logstage (@log_file_names)
200 print "<br /> <table><tr><th class='head' rowspan='$logrows'>Stage Logs</th>\n"
201 unless $heading_done;
204 $logstage =~ s/\.log$//;
205 print "<tr>\n" if ($cell > 1 && $cell % $lrfactor == 1);
206 print "<td><a href='show_stage_log.pl?nm=$system&dt=$urldt&stg=$logstage'>$logstage</a></td>\n";
207 print "</tr>\n" if ($cell % $lrfactor == 0);
212 foreach my $rcell ($cell+1 .. $logcells)
214 print "<tr>\n" if ($rcell > 1 && $rcell % $lrfactor == 1);
215 print "<td> </td>\n";
216 print "</tr>\n" if ($rcell % $lrfactor == 0);
223 <h2>Configuration summary for system "$system"</h2>
224 <h3>Status 'OK' on snapshot taken $logdate</h3>
228 <h3>Files changed this run</h3>
233 print <<EOHTML if ($log);
242 <p style="text-align: center;">
243 Hosting for the PostgreSQL Buildfarm is generously
245 <a href="http://www.commandprompt.com">CommandPrompt,
246 The PostgreSQL Company</a>
248 </div><!-- wrapper -->
258 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
259 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
260 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
262 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
263 <title>PostgreSQL BuildFarm | Log for system "$system" failure on snapshot taken $logdate</title>
264 <link rel="stylesheet" rev="stylesheet" href="/inc/pgbf.css" charset="utf-8" />
269 <a href="/index.html"><img src="/inc/pgbuildfarm-banner.png" alt="PostgreSQL BuildFarm" width="800" height="73" /></a>
272 <li id="home"><a href="/index.html" title="PostgreSQL BuildFarm Home">Home</a></li>
273 <li id="status"><a href="/cgi-bin/show_status.pl" title="Status Page">Status</a></li>
274 <li id="members"><a href="/cgi-bin/show_members.pl" title="Status Page">Members</a></li>
275 <li id="register"><a href="/cgi-bin/register-form.pl" title="Register">Register</a></li>
276 <li id="pgfoundry"><a href="http://pgfoundry.org/projects/pgbuildfarm/">PGFoundry</a></li>
279 </div><!-- banner -->
281 <h1>PostgreSQL Build Farm Log</h1>
282 <h1>Details for system "$system" failure at stage $stage on snapshot taken $logdate</h1>
283 <table cellspacing="0">
285 <th class="head" rowspan="2">System Information</th>
290 <th>Architecture</th>
295 <td><a href="/cgi-bin/show_history.pl?nm=$system&br=$branch">$branch</a></td>
296 <td>$info_row->{operating_system} $info_row->{os_version}</td>
297 <td>$info_row->{compiler} $info_row->{compiler_version}</td>
298 <td>$info_row->{architecture}</td>
299 <td>$info_row->{owner_email}</td>
304 if ($info_row->{sys_notes})
310 <th class="head" rowspan="2">System Notes</th>
315 <td>$info_row->{sys_notes_date}</td>
316 <td>$info_row->{sys_notes}</td>
323 for my $logstage (@log_file_names)
325 print "<br /> <table><tr><th class='head' rowspan='4'>Stage Logs</th>\n"
326 unless $heading_done;
329 $logstage =~ s/\.log$//;
330 print "<tr>\n" if ($cell > 1 && $cell % $lrfactor == 1);
331 print "<td><a href='show_stage_log.pl?nm=$system&dt=$urldt&stg=$logstage'>$logstage</a></td>\n";
332 print "</tr>\n" if ($cell % $lrfactor == 0);
337 foreach my $rcell ($cell+1 .. $logcells)
339 print "<tr>\n" if ($rcell > 1 && $rcell % $lrfactor == 1);
340 print "<td> </td>\n";
341 print "</tr>\n" if ($rcell % $lrfactor == 0);
347 <h3>Configuration summary</h3>
351 <h3>Files changed this run</h3>
355 <h3>Files changed since last success</h3>
357 $changed_since_success
365 <p style="text-align: center;">
366 Hosting for the PostgreSQL Buildfarm is generously
368 <a href="http://www.commandprompt.com">CommandPrompt,
369 The PostgreSQL Company</a>
371 </div><!-- wrapper -->