From: Andrew Dunstan Date: Mon, 11 Oct 2010 20:45:16 +0000 (+0000) Subject: remove inline templates and replace with files in templates directory X-Git-Url: https://git.exim.org/buildfarm-server.git/commitdiff_plain/c3ad6df34e5ec30c6be887033dad6d834ddf8fb1 remove inline templates and replace with files in templates directory --- diff --git a/cgi-bin/register-form.pl b/cgi-bin/register-form.pl index 3281a1f..cf4621a 100755 --- a/cgi-bin/register-form.pl +++ b/cgi-bin/register-form.pl @@ -4,7 +4,7 @@ use strict; use Template; use Captcha::reCAPTCHA; -use vars qw( $captcha_pubkey ); +use vars qw( $template_dir $captcha_pubkey ); require "$ENV{BFConfDir}/BuildFarmWeb.pl"; @@ -12,8 +12,8 @@ my $c = Captcha::reCAPTCHA->new; my $captcha = $c->get_html($captcha_pubkey); - -my $template = new Template({INCLUDE_PATH => '/home/community/pgbuildfarm/templates' }); +my $template_opts = { INCLUDE_PATH => $template_dir }; +my $template = new Template($template_opts); print "Content-Type: text/html\n\n"; diff --git a/cgi-bin/show_history.pl b/cgi-bin/show_history.pl index f600175..f1fa13c 100755 --- a/cgi-bin/show_history.pl +++ b/cgi-bin/show_history.pl @@ -5,7 +5,7 @@ use DBI; use Template; use CGI; -use vars qw($dbhost $dbname $dbuser $dbpass $dbport); +use vars qw($dbhost $dbname $dbuser $dbpass $dbport $template_dir); require "$ENV{BFConfDir}/BuildFarmWeb.pl"; @@ -62,11 +62,12 @@ $sth->finish; $db->disconnect; -my $template = new Template({EVAL_PERL => 1}); +my $template_opts = { INCLUDE_PATH => $template_dir, EVAL_PERL => 1 }; +my $template = new Template($template_opts); print "Content-Type: text/html\n\n"; -$template->process(\*DATA, +$template->process('history.tt', {statrows=>$statrows, branch=>$branch, member => $member, @@ -74,83 +75,3 @@ $template->process(\*DATA, }); exit; - -__DATA__ -[%- BLOCK cl %] class="[% SWITCH bgfor -%] - [%- CASE 'OK' %]pass[% CASE 'ContribCheck' %]warn[% CASE [ 'Check' 'InstallCheck' ] %]warnx[% CASE %]fail[% END %]" -[%- END -%] - - - - - PostgreSQL BuildFarm History - - - - - -
- -
-

PostgreSQL BuildFarm Status History

- - - - - - - - - -
System Detail
Farm member[% member %]
OS[% statrows.0.operating_system %] [% statrows.0.os_version %]
Compiler[% statrows.0.compiler %] [% statrows.0.compiler_version %]
Architecture[% statrows.0.architecture %]
Owner[% statrows.0.owner_email %]
-

Branch: [% branch %][% IF statrows.size >= hm %] (last [% hm %] entries shown)[% END %]

-[% BLOCK stdet %] - - [%- row.when_ago | replace('\s',' ') %] ago  - [% row.stage -%] - - [%- IF row.stage != 'OK' %]Details[% ELSE %]Config[% END -%] - - -[% END %] - -[% FOREACH offset IN [0,1,2] %][% low = offset * statrows.size / 3 ; high = -1 + (offset + 1) * statrows.size / 3 %] -[% TRY %][% PERL %] - use POSIX qw(floor); - $stash->set(low => floor($stash->get('low'))); - $stash->set(high => floor($stash->get('high'))); -[% END %][% CATCH %] [% END %] - -[% END %] -
- - [% FOREACH xrow IN statrows.slice(low,high) %][% PROCESS stdet row=xrow %][% END %] -
-
-
-

-Hosting for the PostgreSQL Buildfarm is generously -provided by: -CommandPrompt, -The PostgreSQL Company -

-
- - diff --git a/cgi-bin/show_log.pl b/cgi-bin/show_log.pl index d282c1e..bd1a608 100755 --- a/cgi-bin/show_log.pl +++ b/cgi-bin/show_log.pl @@ -6,12 +6,15 @@ use Template; use CGI; use URI::Escape; -use vars qw($dbhost $dbname $dbuser $dbpass $dbport @log_file_names); +use vars qw($dbhost $dbname $dbuser $dbpass $dbport $template_dir @log_file_names); require "$ENV{BFConfDir}/BuildFarmWeb.pl"; #require "BuildFarmWeb.pl"; +my $template_opts = { INCLUDE_PATH => $template_dir}; +my $template = new Template($template_opts); + die "no dbname" unless $dbname; die "no dbuser" unless $dbuser; diff --git a/cgi-bin/show_members.pl b/cgi-bin/show_members.pl index 31b61dc..2b6e0be 100755 --- a/cgi-bin/show_members.pl +++ b/cgi-bin/show_members.pl @@ -7,7 +7,7 @@ use Template; -use vars qw($dbhost $dbname $dbuser $dbpass $dbport $sort_by); +use vars qw($dbhost $dbname $dbuser $dbpass $dbport $template_dir $sort_by); require "$ENV{BFConfDir}/BuildFarmWeb.pl"; @@ -65,106 +65,13 @@ $db->disconnect; # use Data::Dumper; print "Content-Type: text/plain\n\n",Dumper($statrows),"VERSION: ",$DBD::Pg::VERSION,"\n"; exit; -my $template = new Template({}); +my $template_opts = { INCLUDE_PATH => $template_dir}; +my $template = new Template($template_opts); print "Content-Type: text/html\n\n"; -$template->process(\*DATA,{statrows=>$statrows}); +$template->process('members.tt', + {statrows=>$statrows}); exit; - -__DATA__ - - - - - PostgreSQL BuildFarm Members - - - - - - -
- -
-

PostgreSQL BuildFarm Members

-

Click branch links to see build history. Click the heading links to resort the list. Select members by checkbox and hit the button at the bottom to create a status custom filter.

-
- - - - - - - - - -[% alt = true %] -[% FOREACH row IN statrows ; - have_recent = 0; - FOREACH branch_days IN row.branches.split(',') ; - branch_fields = branch_days.split(':'); - branch_day = branch_fields.1; - IF branch_day < 365 ; have_recent = 1; END; - END; - IF have_recent ; -%] - [% alt = ! alt %] - - - - - - - -[% END; END %] -
 Name
Owner
OS / VersionCompiler / VersionArchBranches reported on
(most recent report)
[% row.name %]
[% row.owner_email %]
[% row.operating_system %]
[% row.os_version %]
[% row.compiler %]
[% row.compiler_version %]
[% row.arch %][% IF ! row.branches ; ' ' ; END -%] -
    - [%- - FOREACH branch_days IN row.branches.split(',') ; - branch_fields = branch_days.split(':'); - branch = branch_fields.0; - branch_day = branch_fields.1; - IF branch_day < 365 ; - %]
  • [% branch %] ([% branch_day %] days ago)
  • [% END; END %]
- -
-
-
-

-Hosting for the PostgreSQL Buildfarm is generously -provided by: -CommandPrompt, -The PostgreSQL Company -

-
- - - - - - - - - - diff --git a/cgi-bin/show_status.pl b/cgi-bin/show_status.pl index 59d0e63..e1a6ef6 100755 --- a/cgi-bin/show_status.pl +++ b/cgi-bin/show_status.pl @@ -5,7 +5,7 @@ use DBI; use Template; use CGI; -use vars qw($dbhost $dbname $dbuser $dbpass $dbport); +use vars qw($dbhost $dbname $dbuser $dbpass $dbport $template_dir); require "$ENV{BFConfDir}/BuildFarmWeb.pl"; @@ -79,136 +79,13 @@ $sth->finish; $db->disconnect; -my $template = new Template({}); +my $template_opts = { INCLUDE_PATH => $template_dir }; +my $template = new Template($template_opts); print "Content-Type: text/html\n\n"; -$template->process(\*DATA,{statrows=>$statrows}); +$template->process('status.tt', + {statrows=>$statrows}); exit; -=comment - -[%- BLOCK img ; flag ; END -%] -[%- BLOCK imgx ; IF flag_imgs.$flag ; '' . flag . ' ' ; ELSE flag . ' ' ; END ; END -%] - -=cut - -__DATA__ -[% - flag_imgs = { - perl = '/img/camel.png', - python = '/img/python.png', - debug = '/img/bug.png', - pam => '/img/pam.png', - cassert => '/img/cassert.png', - openssl => '/img/ssl_icon.gif', - nls => '/img/translateicon.gif', - krb5 => '/img/krb.gif', - tcl => '/img/tcl.png', - vpath => '/img/vpath.png', - xml => '/img/xml.png', - 'thread-safety' => '/img/threads.gif', - 'integer-datetimes' = '/img/days.png', - git => '/img/git.png', - } --%] -[%- BLOCK img ; IF flag == 'depend' or flag == 'gnu-ld' ; ; ELSIF flag_imgs.$flag %][% flag %] [% ELSE %][%# - flag ; ' ' -%][% END ; END -%] -[%- BLOCK cl %] class="[% SWITCH bgfor.replace('-.*','') -%] - [%- CASE 'OK' %]pass[% CASE 'ContribCheck' %]warn[% CASE [ 'Check' 'InstallCheck' ] %]warnx[% CASE %]fail[% END %]" -[%- END -%] - - - - - PostgreSQL BuildFarm Status - - - - - -
- -
-

PostgreSQL BuildFarm Status

-

- Shown here is the latest status of each farm member - for each branch it has reported on in the last 30 days. -

-

- Use the farm member link for history of that member - on the relevant branch. -

- -[% FOREACH flagset IN flag_imgs %] - -[% IF loop.count == 7 %][% END %] -[% END %] -
Legend[% flagset.key %] = [% flagset.key %]
-
- -[% brch = "" %] -[% FOREACH row IN statrows %] -[% IF row.branch != brch ; brch = row.branch %] - - -[% END %] - - - - - - - -[% END %] -
Branch: [% brch %]
AliasSystemStatusFlags
[% row.sysname %][% row.operating_system %] - [% row.os_version %] - [%- row.compiler %] - [% row.compiler_version %] - [%- row.architecture %] - [%- row.when_ago | replace('\s',' ') %] ago  - [% row.stage -%] - - [%- IF row.stage != 'OK' %]Details[% ELSE %]Config[% END -%][% FOREACH flag IN row.build_flags.split().sort() ; PROCESS img ; END %]
-
-
-

-The PostgreSQL Buildfarm website is provided by: -CommandPrompt, -The PostgreSQL Company
-The PostgreSQL community makes it work! -

-
- - - - - - - - - - diff --git a/templates/history.tt b/templates/history.tt new file mode 100644 index 0000000..27a5be1 --- /dev/null +++ b/templates/history.tt @@ -0,0 +1,78 @@ +[%- BLOCK cl %] class="[% SWITCH bgfor -%] + [%- CASE 'OK' %]pass[% CASE 'ContribCheck' %]warn[% CASE [ 'Check' 'InstallCheck' ] %]warnx[% CASE %]fail[% END %]" +[%- END -%] + + + + + PostgreSQL BuildFarm History + + + + + +
+ +
+

PostgreSQL BuildFarm Status History

+ + + + + + + + + +
System Detail
Farm member[% member %]
OS[% statrows.0.operating_system %] [% statrows.0.os_version %]
Compiler[% statrows.0.compiler %] [% statrows.0.compiler_version %]
Architecture[% statrows.0.architecture %]
Owner[% statrows.0.owner_email %]
+

Branch: [% branch %][% IF statrows.size >= hm %] (last [% hm %] entries shown)[% END %]

+[% BLOCK stdet %] + + [%- row.when_ago | replace('\s',' ') %] ago  + [% row.stage -%] + + [%- IF row.stage != 'OK' %]Details[% ELSE %]Config[% END -%] + + +[% END %] + +[% FOREACH offset IN [0,1,2] %][% low = offset * statrows.size / 3 ; high = -1 + (offset + 1) * statrows.size / 3 %] +[% TRY %][% PERL %] + use POSIX qw(floor); + $stash->set(low => floor($stash->get('low'))); + $stash->set(high => floor($stash->get('high'))); +[% END %][% CATCH %] [% END %] + +[% END %] +
+ + [% FOREACH xrow IN statrows.slice(low,high) %][% PROCESS stdet row=xrow %][% END %] +
+
+
+

+Hosting for the PostgreSQL Buildfarm is generously +provided by: +CommandPrompt, +The PostgreSQL Company +

+
+ + diff --git a/templates/members.tt b/templates/members.tt new file mode 100644 index 0000000..7e737b4 --- /dev/null +++ b/templates/members.tt @@ -0,0 +1,93 @@ + + + + + PostgreSQL BuildFarm Members + + + + + + +
+ +
+

PostgreSQL BuildFarm Members

+

Click branch links to see build history. Click the heading links to resort the list. Select members by checkbox and hit the button at the bottom to create a status custom filter.

+
+ + + + + + + + + +[% alt = true %] +[% FOREACH row IN statrows ; + have_recent = 0; + FOREACH branch_days IN row.branches.split(',') ; + branch_fields = branch_days.split(':'); + branch_day = branch_fields.1; + IF branch_day < 365 ; have_recent = 1; END; + END; + IF have_recent ; +%] + [% alt = ! alt %] + + + + + + + +[% END; END %] +
 Name
Owner
OS / VersionCompiler / VersionArchBranches reported on
(most recent report)
[% row.name %]
[% row.owner_email %]
[% row.operating_system %]
[% row.os_version %]
[% row.compiler %]
[% row.compiler_version %]
[% row.arch %][% IF ! row.branches ; ' ' ; END -%] +
    + [%- + FOREACH branch_days IN row.branches.split(',') ; + branch_fields = branch_days.split(':'); + branch = branch_fields.0; + branch_day = branch_fields.1; + IF branch_day < 365 ; + %]
  • [% branch %] ([% branch_day %] days ago)
  • [% END; END %]
+ +
+
+
+

+Hosting for the PostgreSQL Buildfarm is generously +provided by: +CommandPrompt, +The PostgreSQL Company +

+
+ + + + + + + + + + diff --git a/templates/status.tt b/templates/status.tt new file mode 100644 index 0000000..23fcff2 --- /dev/null +++ b/templates/status.tt @@ -0,0 +1,117 @@ +[% + flag_imgs = { + perl = '/img/camel.png', + python = '/img/python.png', + debug = '/img/bug.png', + pam => '/img/pam.png', + cassert => '/img/cassert.png', + openssl => '/img/ssl_icon.gif', + nls => '/img/translateicon.gif', + krb5 => '/img/krb.gif', + tcl => '/img/tcl.png', + vpath => '/img/vpath.png', + xml => '/img/xml.png', + 'thread-safety' => '/img/threads.gif', + 'integer-datetimes' = '/img/days.png', + git => '/img/git.png', + } +-%] +[%- BLOCK img ; IF flag == 'depend' or flag == 'gnu-ld' ; ; ELSIF flag_imgs.$flag %][% flag %] [% ELSE %][%# + flag ; ' ' +%][% END ; END -%] +[%- BLOCK cl %] class="[% SWITCH bgfor.replace('-.*','') -%] + [%- CASE 'OK' %]pass[% CASE 'ContribCheck' %]warn[% CASE [ 'Check' 'InstallCheck' ] %]warnx[% CASE %]fail[% END %]" +[%- END -%] + + + + + PostgreSQL BuildFarm Status + + + + + +
+ +
+

PostgreSQL BuildFarm Status

+

+ Shown here is the latest status of each farm member + for each branch it has reported on in the last 30 days. +

+

+ Use the farm member link for history of that member + on the relevant branch. +

+ +[% FOREACH flagset IN flag_imgs %] + +[% IF loop.count == 7 %][% END %] +[% END %] +
Legend[% flagset.key %] = [% flagset.key %]
+
+ +[% brch = "" %] +[% FOREACH row IN statrows %] +[% IF row.branch != brch ; brch = row.branch %] + + +[% END %] + + + + + + + +[% END %] +
Branch: [% brch %]
AliasSystemStatusFlags
[% row.sysname %][% row.operating_system %] + [% row.os_version %] + [%- row.compiler %] + [% row.compiler_version %] + [%- row.architecture %] + [%- row.when_ago | replace('\s',' ') %] ago  + [% row.stage -%] + + [%- IF row.stage != 'OK' %]Details[% ELSE %]Config[% END -%][% FOREACH flag IN row.build_flags.split().sort() ; PROCESS img ; END %]
+
+
+

+The PostgreSQL Buildfarm website is provided by: +CommandPrompt, +The PostgreSQL Company
+The PostgreSQL community makes it work! +

+
+ + + + + + + + + +