5 Copyright (c) 2003-2010, Andrew Dunstan
7 See accompanying License file for license details
16 use vars qw($dbhost $dbname $dbuser $dbpass $dbport $template_dir);
18 use FindBin qw($RealBin);
19 require "$RealBin/../BuildFarmWeb.pl";
22 my @members = $query->param('member');
23 map { s/[^a-zA-Z0-9_ -]//g; } @members;
25 my $dsn="dbi:Pg:dbname=$dbname";
26 $dsn .= ";host=$dbhost" if $dbhost;
27 $dsn .= ";port=$dbport" if $dbport;
31 my $sortby = $query->param('sortby') || 'nosort';
32 if ($sortby eq 'name')
34 $sort_clause = 'lower(sysname),';
36 elsif ($sortby eq 'os')
38 $sort_clause = 'lower(operating_system), os_version desc,';
40 elsif ($sortby eq 'compiler')
42 $sort_clause = "lower(compiler), compiler_version,";
45 my $db = DBI->connect($dsn,$dbuser,$dbpass,{pg_expand_array => 0})
46 or die("$dsn,$dbuser,$dbpass,$!");
51 select timezone('GMT'::text, now())::timestamp(0) without time zone - b.snapshot AS when_ago, b.*
53 order by branch = 'master' desc,
54 branch desc, $sort_clause
61 my $sth=$db->prepare($statement);
63 while (my $row = $sth->fetchrow_hashref)
65 next if (@members && ! grep {$_ eq $row->{sysname} } @members);
66 $row->{build_flags} =~ s/^\{(.*)\}$/$1/;
67 $row->{build_flags} =~ s/,/ /g;
68 $row->{build_flags} =~ s/_PC\b//g;
69 $row->{build_flags} = lc($row->{build_flags});
70 push(@$statrows,$row);
78 my $template_opts = { INCLUDE_PATH => $template_dir };
79 my $template = new Template($template_opts);
81 print "Content-Type: text/html\n\n";
83 $template->process('status.tt',
84 {statrows=>$statrows});