X-Git-Url: https://git.exim.org/buildfarm-server.git/blobdiff_plain/ffe3a5f17b995075ccf28c773786015b83e45f75..a30f4fdc1b6d0b503014736074783ee53ed15d32:/cgi-bin/show_failures.pl diff --git a/cgi-bin/show_failures.pl b/cgi-bin/show_failures.pl index ba6837b..592ab4f 100755 --- a/cgi-bin/show_failures.pl +++ b/cgi-bin/show_failures.pl @@ -15,12 +15,17 @@ use CGI; use vars qw($dbhost $dbname $dbuser $dbpass $dbport $template_dir); - -require "$ENV{BFConfDir}/BuildFarmWeb.pl"; +use FindBin qw($RealBin); +require "$RealBin/../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; @@ -42,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 build_status.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 - if ($row->{branch} eq 'HEAD' || $row->{branch} gt 'REL8_3_STABLE') - { - $row->{build_flags} .= " --enable-integer-datetimes " - unless ($row->{build_flags} =~ /--(en|dis)able-integer-datetimes/); - } - # enable-thread-safety is now the default - if ($row->{branch} eq 'HEAD' || $row->{branch} gt 'REL8_5_STABLE') - { - $row->{build_flags} .= " --enable-thread-safety " - unless ($row->{build_flags} =~ /--(en|dis)able-thread-safety/); - } +## # enable-integer-datetimes is now the default +## if ($row->{branch} eq 'HEAD' || $row->{branch} gt 'REL8_3_STABLE') +## { +## $row->{build_flags} .= " --enable-integer-datetimes " +## unless ($row->{build_flags} =~ /--(en|dis)able-integer-datetimes/); +## } +## # enable-thread-safety is now the default +## if ($row->{branch} eq 'HEAD' || $row->{branch} gt 'REL8_5_STABLE') +## { +## $row->{build_flags} .= " --enable-thread-safety " +## unless ($row->{build_flags} =~ /--(en|dis)able-thread-safety/); +## } $row->{build_flags} =~ s/--((enable|with)-)?//g; $row->{build_flags} =~ s/libxml/xml/; $row->{build_flags} =~ s/\S+=\S+//g; @@ -100,7 +140,12 @@ 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; -