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);
19 require "$ENV{BFConfDir}/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 # enable-integer-datetimes is now the default
69 if ($row->{branch} eq 'HEAD' || $row->{branch} gt 'REL8_3_STABLE')
71 $row->{build_flags} .= " --enable-integer-datetimes "
72 unless ($row->{build_flags} =~ /--(en|dis)able-integer-datetimes/);
74 # enable-thread-safety is now the default
75 if ($row->{branch} eq 'HEAD' || $row->{branch} gt 'REL8_5_STABLE')
77 $row->{build_flags} .= " --enable-thread-safety "
78 unless ($row->{build_flags} =~ /--(en|dis)able-thread-safety/);
80 $row->{build_flags} =~ s/--((enable|with)-)?//g;
81 $row->{build_flags} =~ s/libxml/xml/;
82 $row->{build_flags} =~ s/\S+=\S+//g;
83 push(@$statrows,$row);
91 my $template_opts = { INCLUDE_PATH => $template_dir };
92 my $template = new Template($template_opts);
94 print "Content-Type: text/html\n\n";
96 $template->process('status.tt',
97 {statrows=>$statrows});