--- /dev/null
+[% PERL %]
+ use POSIX qw(ceil);
+ my $lrfactor = 6;
+ $stash->set(lrfactor => $lrfactor);
+ my $rows = $stash->get('log_file_names');
+ my $logrows = ceil(scalar(@$rows)/$lrfactor);
+ my $logcells = $lrfactor * $logrows;
+ $stash->set( logcells => $logcells);
+ $stash->set( logrows => $logrows );
+[% END -%]
+[% mytitle = BLOCK %]PostgreSQL BuildFarm | [% IF stage != 'OK' %]Log for system "[% system %]" failure on snapshot taken [% urldt ; ELSE %]Configuration summary for system "[% system %]" snapshot taken [% urldt ; END ; END -%]
+[%
+ cvsurl = 'http://anoncvs.postgresql.org/cvsweb.cgi';
+ giturl = scmurl || 'http://git.postgresql.org/gitweb?p=postgresql.git;a=commit;h=';
+-%]
+[% WRAPPER 'page.tt'
+ title = mytitle
+ bodyclass = 'none'
+ pagebutton = 'none'
+%]
+<h1>PostgreSQL Build Farm Log</h1>
+<h2>Details for system "[% system %]"[% IF stage != 'OK' %] failure at stage [% stage ; ELSE %], status 'OK'[% END %], snapshot taken [% urldt %]</h2>
+<table cellspacing="0">
+ <tr>
+ <th class="head" rowspan="2">System Information</th>
+ <th>Farm member</th>
+ <th>Branch</th>
+ <th>OS</th>
+ <th>Compiler</th>
+ <th>Architecture</th>
+ <th>Owner</th>
+ </tr>
+ <tr>
+ <td>[% system %]</td>
+ <td><a href="/cgi-bin/show_history.pl?nm=[% system %]&br=[% branch %]">[% branch %]</a></td>
+ <td>[% info_row.operating_system %] [% info_row.os_version %]</td>
+ <td>[% info_row.compiler %] [% info_row.compiler_version %]</td>
+ <td>[% info_row.architecture %]</td>
+ <td>[% info_row.owner_email %]</td>
+ </tr>
+ </table>
+[% IF info_row.sys_notes %]
+ <br />
+ <table>
+ <tr>
+ <th class="head" rowspan="2">System Notes</th>
+ <th>Date</th>
+ <th>Notes</th>
+ </tr>
+ <tr>
+ <td>[% info_row.sys_notes_date %]</td>
+ <td>[% info_row.sys_notes %]</td>
+ </tr>
+ </table>
+[% END %]
+[% cell = 0; FOREACH logstage IN log_file_names ; striplog = logstage.replace('\.log$','') ; cell = loop.count %]
+ [% IF loop.first %]
+ <br /> <table><tr><th class='head' rowspan='[% logrows %]'>Stage Logs</th>
+ [% END %]
+ [% IF loop.count > 1 and loop.count % lrfactor == 1 %]<tr>[% END %]
+ <td><a href='show_stage_log.pl?nm=[% system %]&dt=[% urldt | uri %]&stg=[% striplog %]'>[% striplog %]</a></td>
+ [% IF loop.count % lrfactor == 0 %]</tr>[% END %]
+[% END %]
+
+[% IF cell > 0 ; nrcell = cell + 1; ncells = [ nrcell .. logcells ] ; FOREACH rcell IN ncells %]
+ [% IF rcell > 1 and rcell % lrfactor == 1 %]<tr>[% END %]
+ <td> </td>
+ [% IF rcell % lrfactor == 0 %]</tr>[% END %]
+ [% END %]
+ </table>
+[% END %]
+
+<h3>Configuration summary</h3>
+<pre>
+[% conf | html %]
+</pre>
+<h3>Files changed this run</h3>
+<pre>
+[%- IF changed_this_run.0 -%]
+[%- FOREACH changed IN changed_this_run %]
+<a href="[% IF scm == 'git' ; giturl; changed.1; ELSE ; cvsurl ; changed.0; 'rev='; changed.1; END %]">[% changed.0 ; IF scm == 'cvs'; ' '; changed.1; END %]</a>
+[%- END -%]
+[%- ELSE %]
+not recorded
+[% END -%]
+</pre>
+[% IF stage != 'OK' %]
+<h3>Files changed since last success</h3>
+<pre>
+[%- IF changed_since_success.0 %]
+[%- FOREACH changed IN changed_since_success %]
+<a href="[% IF scm == 'git' ; giturl; changed.1; ELSE ; cvsurl ; changed.0; 'rev='; changed.1; END %]">[% changed.0 ; IF scm == 'cvs'; ' '; changed.1; END %]</a>
+[%- END -%]
+[%- ELSE %]
+not recorded
+[% END -%]
+</pre>
+[% END %]
+<h3>Log</h3>
+<pre>
+[% log | html %]
+</pre>
+[% END %]