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 'os')
39 $sort_clause = 'lower(b.operating_system), b.os_version desc,';
41 elsif ($sortby eq 'compiler')
43 $sort_clause = "lower(b.compiler), b.compiler_version,";
45 elsif ($sortby eq 'namenobranch')
47 $presort_clause = "lower(b.sysname), b.snapshot desc,"
50 my $db = DBI->connect($dsn,$dbuser,$dbpass,{pg_expand_array => 0})
51 or die("$dsn,$dbuser,$dbpass,$!");
56 select timezone('GMT'::text,
57 now())::timestamp(0) without time zone - b.snapshot AS when_ago,
59 d.stage as current_stage
60 from nrecent_failures_db_data b
61 left join dashboard_mat d
62 on (d.sysname = b.sysname and d.branch = b.branch)
63 order by $presort_clause
64 b.branch = 'HEAD' desc,
73 my $sth=$db->prepare($statement);
75 while (my $row = $sth->fetchrow_hashref)
77 next if (@members && ! grep {$_ eq $row->{sysname} } @members);
78 $row->{build_flags} =~ s/^\{(.*)\}$/$1/;
79 $row->{build_flags} =~ s/,/ /g;
80 # enable-integer-datetimes is now the default
81 if ($row->{branch} eq 'HEAD' || $row->{branch} gt 'REL8_3_STABLE')
83 $row->{build_flags} .= " --enable-integer-datetimes "
84 unless ($row->{build_flags} =~ /--(en|dis)able-integer-datetimes/);
86 # enable-thread-safety is now the default
87 if ($row->{branch} eq 'HEAD' || $row->{branch} gt 'REL8_5_STABLE')
89 $row->{build_flags} .= " --enable-thread-safety "
90 unless ($row->{build_flags} =~ /--(en|dis)able-thread-safety/);
92 $row->{build_flags} =~ s/--((enable|with)-)?//g;
93 $row->{build_flags} =~ s/libxml/xml/;
94 $row->{build_flags} =~ s/\S+=\S+//g;
95 push(@$statrows,$row);
103 my $template_opts = { INCLUDE_PATH => $template_dir };
104 my $template = new Template($template_opts);
106 print "Content-Type: text/html\n\n";
108 $template->process('fstatus.tt',
109 {statrows=>$statrows,
111 members=> \@members} );