X-Git-Url: https://git.exim.org/buildfarm-server.git/blobdiff_plain/a40507fdd34a204c774aa3038361f6000f4cfefb..77f0f9c5c215c72ce7a105bb3ac16d1c8f3b8a68:/cgi-bin/show_failures.pl diff --git a/cgi-bin/show_failures.pl b/cgi-bin/show_failures.pl index ad754fa..48f0e97 100755 --- a/cgi-bin/show_failures.pl +++ b/cgi-bin/show_failures.pl @@ -19,8 +19,13 @@ use vars qw($dbhost $dbname $dbuser $dbpass $dbport $template_dir); require "$ENV{BFConfDir}/BuildFarmWeb.pl"; my $query = new CGI; -my @members = $query->param('member'); +my @members = grep {$_ ne "" } $query->param('member'); map { s/[^a-zA-Z0-9_ -]//g; } @members; +my $max_days = $query->param('max_days') + 0 || 10; +my @branches = grep {$_ ne "" } $query->param('branch'); +map { s/[^a-zA-Z0-9_ -]//g; } @branches; +my @stages = grep {$_ ne "" } $query->param('stage'); +map { s/[^a-zA-Z0-9_ :-]//g; } @stages; my $dsn="dbi:Pg:dbname=$dbname"; $dsn .= ";host=$dbhost" if $dbhost; @@ -34,14 +39,6 @@ if ($sortby eq 'name') { $sort_clause = 'lower(b.sysname),'; } -elsif ($sortby eq 'os') -{ - $sort_clause = 'lower(b.operating_system), b.os_version desc,'; -} -elsif ($sortby eq 'compiler') -{ - $sort_clause = "lower(b.compiler), b.compiler_version,"; -} elsif ($sortby eq 'namenobranch') { $presort_clause = "lower(b.sysname), b.snapshot desc," @@ -50,6 +47,38 @@ elsif ($sortby eq 'namenobranch') my $db = DBI->connect($dsn,$dbuser,$dbpass,{pg_expand_array => 0}) or die("$dsn,$dbuser,$dbpass,$!"); +my $get_all_branches = qq{ + + select distinct branch + from nrecent_failures + where branch <> 'HEAD' + order by branch desc + +}; + +my $all_branches = $db->selectcol_arrayref($get_all_branches); +unshift (@$all_branches,'HEAD'); + +my $get_all_members = qq{ + + select distinct sysname + from nrecent_failures + order by sysname + +}; + +my $all_members = $db->selectcol_arrayref($get_all_members); + +my $get_all_stages = qq{ + + select distinct stage + from build_status + join nrecent_failures using (sysname,snapshot,branch) + +}; + +my $all_stages = $db->selectcol_arrayref($get_all_stages); + my $statement =<prepare($statement); -$sth->execute; +$sth->execute($max_days); while (my $row = $sth->fetchrow_hashref) { next if (@members && ! grep {$_ eq $row->{sysname} } @members); + next if (@stages && ! grep {$_ eq $row->{stage} } @stages); + next if (@branches && ! grep {$_ eq $row->{branch} } @branches); $row->{build_flags} =~ s/^\{(.*)\}$/$1/; $row->{build_flags} =~ s/,/ /g; # enable-integer-datetimes is now the default @@ -108,7 +140,13 @@ print "Content-Type: text/html\n\n"; $template->process('fstatus.tt', {statrows=>$statrows, sortby => $sortby, - members=> \@members} ); + max_days => $max_days, + all_branches => $all_branches, + all_members => $all_members, + all_stages => $all_stages, + qmembers=> \@members, + qbranches => \@branches, + qstages => \@stages} ); exit;