X-Git-Url: https://git.exim.org/buildfarm-server.git/blobdiff_plain/9aab6bac9c2c174a5ef8869e9b947a3917e18087..a78d9bf85e4e91b05abc18852c06e3ba65aff0aa:/cgi-bin/show_status.pl diff --git a/cgi-bin/show_status.pl b/cgi-bin/show_status.pl index c75b20e..1ac959e 100755 --- a/cgi-bin/show_status.pl +++ b/cgi-bin/show_status.pl @@ -15,11 +15,11 @@ 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 = $query->multi_param('member'); map { s/[^a-zA-Z0-9_ -]//g; } @members; my $dsn="dbi:Pg:dbname=$dbname"; @@ -48,11 +48,16 @@ my $db = DBI->connect($dsn,$dbuser,$dbpass,{pg_expand_array => 0}) my $statement =<prepare($statement); $sth->execute; + +# walk the set of result rows from the SQL query above while (my $row = $sth->fetchrow_hashref) { next if (@members && ! grep {$_ eq $row->{sysname} } @members); + $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} =~ s/_PC\b//g; + $row->{build_flags} = lc($row->{build_flags}); + + if (defined($row->{log_text})) + { # convert to a hash, find ranges, output list of ranges + my $h = { split /\s+/, $row->{log_text} }; + my ($i, $start, $last); + my @ranges; + + foreach my $k (sort {$a<=>$b} keys %$h) { - $row->{build_flags} .= " --enable-integer-datetimes " - unless ($row->{build_flags} =~ /--(en|dis)able-integer-datetimes/); + if (defined $start) + { + if ($h->{$k} ne $h->{$start} || $k != $last + 1) + { + # The result (skiped, Passed, Failed) for this testcase number + # is different to the start one of the range, + # or the range became non-contiguous. + # Add text for the range to list of ranges + # (these three elements get used by "status.tt" BLOCK colourbar) + # Reset the start and the count, for a new range. + + push @ranges, sprintf("%s %s %s", $h->{$start}, $start, $i); + $start = $k; + $i = 1; + } + else + { + # bump the size of this range + $i++; + } + } + else + { + # First ever range for this row + $start = $k; + $i = 1; + } + $last = $k; } - # enable-thread-safety is now the default - if ($row->{branch} eq 'HEAD' || $row->{branch} gt 'REL8_5_STABLE') + if (defined $start) { - $row->{build_flags} .= " --enable-thread-safety " - unless ($row->{build_flags} =~ /--(en|dis)able-thread-safety/); + # close out the final range + push @ranges, sprintf("%s %s %s", $h->{$start}, $start, $i); } - $row->{build_flags} =~ s/--((enable|with)-)?//g; - $row->{build_flags} =~ s/libxml/xml/; - $row->{build_flags} =~ s/\S+=\S+//g; + + $row->{log_text} = \@ranges; + } push(@$statrows,$row); } $sth->finish;