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 $presort_clause = "";
32 my $sortby = $query->param('sortby') || 'nosort';
33 if ($sortby eq 'name')
35 $sort_clause = 'lower(b.sysname),';
37 elsif ($sortby eq 'namenobranch')
39 $presort_clause = "lower(b.sysname), b.snapshot desc,"
42 my $db = DBI->connect($dsn,$dbuser,$dbpass,{pg_expand_array => 0})
43 or die("$dsn,$dbuser,$dbpass,$!");
48 select timezone('GMT'::text,
49 now())::timestamp(0) without time zone - b.snapshot AS when_ago,
51 d.stage as current_stage
52 from nrecent_failures_db_data b
53 left join dashboard_mat d
54 on (d.sysname = b.sysname and d.branch = b.branch)
55 order by $presort_clause
56 b.branch = 'HEAD' desc,
65 my $sth=$db->prepare($statement);
67 while (my $row = $sth->fetchrow_hashref)
69 next if (@members && ! grep {$_ eq $row->{sysname} } @members);
70 $row->{build_flags} =~ s/^\{(.*)\}$/$1/;
71 $row->{build_flags} =~ s/,/ /g;
72 # enable-integer-datetimes is now the default
73 if ($row->{branch} eq 'HEAD' || $row->{branch} gt 'REL8_3_STABLE')
75 $row->{build_flags} .= " --enable-integer-datetimes "
76 unless ($row->{build_flags} =~ /--(en|dis)able-integer-datetimes/);
78 # enable-thread-safety is now the default
79 if ($row->{branch} eq 'HEAD' || $row->{branch} gt 'REL8_5_STABLE')
81 $row->{build_flags} .= " --enable-thread-safety "
82 unless ($row->{build_flags} =~ /--(en|dis)able-thread-safety/);
84 $row->{build_flags} =~ s/--((enable|with)-)?//g;
85 $row->{build_flags} =~ s/libxml/xml/;
86 $row->{build_flags} =~ s/\S+=\S+//g;
87 push(@$statrows,$row);
95 my $template_opts = { INCLUDE_PATH => $template_dir };
96 my $template = new Template($template_opts);
98 print "Content-Type: text/html\n\n";
100 $template->process('fstatus.tt',
101 {statrows=>$statrows,
103 members=> \@members} );