9 use vars qw($dbhost $dbname $dbuser $dbpass $dbport $template_dir @log_file_names);
12 require "$ENV{BFConfDir}/BuildFarmWeb.pl";
13 #require "BuildFarmWeb.pl";
15 my $template_opts = { INCLUDE_PATH => $template_dir};
16 my $template = new Template($template_opts);
18 die "no dbname" unless $dbname;
19 die "no dbuser" unless $dbuser;
21 my $dsn="dbi:Pg:dbname=$dbname";
22 $dsn .= ";host=$dbhost" if $dbhost;
23 $dsn .= ";port=$dbport" if $dbport;
27 my $system = $query->param('nm'); $system =~ s/[^a-zA-Z0-9_ -]//g;
28 my $logdate = $query->param('dt'); $logdate =~ s/[^a-zA-Z0-9_ -]//g;
32 my ($stage,$changed_this_run,$changed_since_success,$sysinfo,$branch,$scmurl);
35 use vars qw($info_row);
37 if ($system && $logdate)
40 my $db = DBI->connect($dsn,$dbuser,$dbpass);
42 die $DBI::errstr unless $db;
44 my $statement = <<EOS;
46 select log,conf_sum,stage, changed_this_run, changed_since_success,branch,
47 log_archive_filenames, scm, scmurl
49 where sysname = ? and snapshot = ?
53 my $sth=$db->prepare($statement);
54 $sth->execute($system,$logdate);
55 my $row=$sth->fetchrow_arrayref;
57 $conf=$row->[1] || "not recorded" ;
58 $stage=$row->[2] || "unknown";
59 $changed_this_run = $row->[3];
60 $changed_since_success = $row->[4];
62 my $log_file_names = $row->[6];
64 $scm ||= 'cvs'; # legacy scripts
66 $log_file_names =~ s/^\{(.*)\}$/$1/;
67 @log_file_names=split(',',$log_file_names)
73 select operating_system, os_version,
74 compiler, compiler_version,
76 replace(owner_email,'\@',' [ a t ] ') as owner_email,
77 sys_notes_ts::date AS sys_notes_date, sys_notes
79 where status = 'approved'
84 $sth=$db->prepare($statement);
85 $sth->execute($system);
86 $info_row=$sth->fetchrow_hashref;
87 # $sysinfo = join(" ",@$row);
92 foreach my $chgd ($changed_this_run,$changed_since_success)
94 my $cvsurl = 'http://anoncvs.postgresql.org/cvsweb.cgi';
95 my $giturl = $scmurl || 'http://git.postgresql.org/gitweb?p=postgresql.git;a=commit;h=';
96 my @lines = split(/!/,$chgd);
101 s!(^\S+)(\s+)(\S+)!<a href="$giturl$3">$1</a>!;
103 elsif ($scm eq 'cvs')
105 next unless m!^(pgsql|master|REL\d_\d_STABLE)/!;
106 s!(^\S+)(\s+)(\S+)!<a href="$cvsurl/$1?rev=$3">$1$2$3</a>!;
109 $chgd = join("\n",@lines);
110 $chgd ||= 'not recorded';
114 $conf =~ s/\@/ [ a t ] /g;
115 map {s/&/&/g; s/</</g; s/>/>/g; s/\"/"/g;} ($log,$conf);
116 # map {s/!/\n/g} ($changed_this_run,$changed_since_success);
121 my $logrows = ceil(scalar(@log_file_names)/$lrfactor);
122 my $logcells = $lrfactor * $logrows;
125 my $urldt = uri_escape($logdate);
131 print "Content-Type: text/html\n\n";
136 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
137 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
138 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
140 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
141 <title>PostgreSQL BuildFarm | Configuration summary for system "$system"</title>
142 <link rel="icon" type="image/png" href="/elephant-icon.png" />
143 <link rel="stylesheet" rev="stylesheet" href="/inc/pgbf.css" charset="utf-8" />
148 <a href="/index.html"><img src="/inc/pgbuildfarm-banner.png" alt="PostgreSQL BuildFarm" width="800" height="73" /></a>
151 <li id="home"><a href="/index.html" title="PostgreSQL BuildFarm Home">Home</a></li>
152 <li id="status"><a href="/cgi-bin/show_status.pl" title="Current results">Status</a></li>
153 <li id="members"><a href="/cgi-bin/show_members.pl" title="Platforms tested">Members</a></li>
154 <li id="register"><a href="/cgi-bin/register-form.pl" title="Join PostgreSQL BuildFarm">Register</a></li>
155 <li id="pgfoundry"><a href="http://pgfoundry.org/projects/pgbuildfarm/">PGFoundry</a></li>
158 </div><!-- banner -->
160 <h1>PostgreSQL Build Farm Log</h1>
161 <table align="top" cellspacing="0">
163 <th class="head" rowspan="2">System Information</th>
168 <th>Architecture</th>
173 <td><a href="/cgi-bin/show_history.pl?nm=$system&br=$branch">$branch</a></td>
174 <td>$info_row->{operating_system} $info_row->{os_version}</td>
175 <td>$info_row->{compiler} $info_row->{compiler_version}</td>
176 <td>$info_row->{architecture}</td>
177 <td>$info_row->{owner_email}</td>
182 if ($info_row->{sys_notes})
188 <th class="head" rowspan="2">System Notes</th>
193 <td>$info_row->{sys_notes_date}</td>
194 <td>$info_row->{sys_notes}</td>
201 for my $logstage (@log_file_names)
203 print "<br /> <table><tr><th class='head' rowspan='$logrows'>Stage Logs</th>\n"
204 unless $heading_done;
207 $logstage =~ s/\.log$//;
208 print "<tr>\n" if ($cell > 1 && $cell % $lrfactor == 1);
209 print "<td><a href='show_stage_log.pl?nm=$system&dt=$urldt&stg=$logstage'>$logstage</a></td>\n";
210 print "</tr>\n" if ($cell % $lrfactor == 0);
215 foreach my $rcell ($cell+1 .. $logcells)
217 print "<tr>\n" if ($rcell > 1 && $rcell % $lrfactor == 1);
218 print "<td> </td>\n";
219 print "</tr>\n" if ($rcell % $lrfactor == 0);
226 <h2>Configuration summary for system "$system"</h2>
227 <h3>Status 'OK' on snapshot taken $logdate</h3>
231 <h3>Files changed this run</h3>
236 print <<EOHTML if ($log);
245 <p style="text-align: center;">
246 Hosting for the PostgreSQL Buildfarm is generously
248 <a href="http://www.commandprompt.com">CommandPrompt,
249 The PostgreSQL Company</a>
251 </div><!-- wrapper -->
261 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
262 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
263 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
265 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
266 <title>PostgreSQL BuildFarm | Log for system "$system" failure on snapshot taken $logdate</title>
267 <link rel="stylesheet" rev="stylesheet" href="/inc/pgbf.css" charset="utf-8" />
272 <a href="/index.html"><img src="/inc/pgbuildfarm-banner.png" alt="PostgreSQL BuildFarm" width="800" height="73" /></a>
275 <li id="home"><a href="/index.html" title="PostgreSQL BuildFarm Home">Home</a></li>
276 <li id="status"><a href="/cgi-bin/show_status.pl" title="Status Page">Status</a></li>
277 <li id="members"><a href="/cgi-bin/show_members.pl" title="Status Page">Members</a></li>
278 <li id="register"><a href="/cgi-bin/register-form.pl" title="Register">Register</a></li>
279 <li id="pgfoundry"><a href="http://pgfoundry.org/projects/pgbuildfarm/">PGFoundry</a></li>
282 </div><!-- banner -->
284 <h1>PostgreSQL Build Farm Log</h1>
285 <h1>Details for system "$system" failure at stage $stage on snapshot taken $logdate</h1>
286 <table cellspacing="0">
288 <th class="head" rowspan="2">System Information</th>
293 <th>Architecture</th>
298 <td><a href="/cgi-bin/show_history.pl?nm=$system&br=$branch">$branch</a></td>
299 <td>$info_row->{operating_system} $info_row->{os_version}</td>
300 <td>$info_row->{compiler} $info_row->{compiler_version}</td>
301 <td>$info_row->{architecture}</td>
302 <td>$info_row->{owner_email}</td>
307 if ($info_row->{sys_notes})
313 <th class="head" rowspan="2">System Notes</th>
318 <td>$info_row->{sys_notes_date}</td>
319 <td>$info_row->{sys_notes}</td>
326 for my $logstage (@log_file_names)
328 print "<br /> <table><tr><th class='head' rowspan='4'>Stage Logs</th>\n"
329 unless $heading_done;
332 $logstage =~ s/\.log$//;
333 print "<tr>\n" if ($cell > 1 && $cell % $lrfactor == 1);
334 print "<td><a href='show_stage_log.pl?nm=$system&dt=$urldt&stg=$logstage'>$logstage</a></td>\n";
335 print "</tr>\n" if ($cell % $lrfactor == 0);
340 foreach my $rcell ($cell+1 .. $logcells)
342 print "<tr>\n" if ($rcell > 1 && $rcell % $lrfactor == 1);
343 print "<td> </td>\n";
344 print "</tr>\n" if ($rcell % $lrfactor == 0);
350 <h3>Configuration summary</h3>
354 <h3>Files changed this run</h3>
358 <h3>Files changed since last success</h3>
360 $changed_since_success
368 <p style="text-align: center;">
369 Hosting for the PostgreSQL Buildfarm is generously
371 <a href="http://www.commandprompt.com">CommandPrompt,
372 The PostgreSQL Company</a>
374 </div><!-- wrapper -->