[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [OSSTEST PATCH 37/60] sg-report-job-history (nfc): Remove needless conditional
$htmlout is now always defined. Nothing other than indentation change, and removal of the surrounding if block. Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> --- sg-report-job-history | 162 +++++++++++++++++++++++++------------------------- 1 file changed, 80 insertions(+), 82 deletions(-) diff --git a/sg-report-job-history b/sg-report-job-history index 7197a5f6..3b45992f 100755 --- a/sg-report-job-history +++ b/sg-report-job-history @@ -209,89 +209,87 @@ END WHERE flight=? END - if (defined $htmlout) { - my ($title,$url); - ensuredir "$htmlout/history"; - ensuredir "$htmlout/history/$j"; - if (defined $bra) { - $title= "$j (branch $bra)"; - } else { - $title= "$j (all branches)"; - } - $html_file= "$htmlout/$html_file"; - open H, "> $html_file.new" or die "$html_file $!"; - $title= encode_entities($title); - print H "<html><head><title>$title</title></head><body>\n"; - print H "<h1>$title</h1>\n"; - print H "<table rules=all>"; - print H "<tr><th>started</th><th>flight</th>", - "<th>branch</th><th>failure</th>\n"; - print H "<th>", (join ", ", @hostvarcols), "</th>\n"; - print H "<th>osstest</th>"; - foreach my $c (@rev_grid_cols) { - print H "<th>".encode_entities($c)."</th>\n"; - } - print H "</tr>\n"; - my $alternate= 0; - my @last_revs; - my @alt_revs; - my $alt_hosts; - my $alt_osstest; - foreach my $r (@test_rows) { - my $altcolour= report_altcolour($alternate); - print H "<tr $altcolour>"; - my $started = $r->{Flight}{started}; - print H "<td>"; - print H show_abs_time $started if $started; - print H "</td>\n"; - my $flt= $r->{Flight}{flight}; - $url= "$c{ReportHtmlPubBaseUrl}/$flt"; - print H "<td><a href=\"$url\">$flt</a></td>\n"; - print H "<td>".encode_entities($r->{Flight}{branch})."</td>\n"; - $url= "$c{ReportHtmlPubBaseUrl}/$flt/".encode_entities($j). - "/info.html"; - print H "<td $r->{ColourAttr}><a href=\"$url\">". - $r->{Content}."</a></td>\n"; - my $lastrev; - my $hosts = join ", ", map { $_ // "-" } @{ $r->{Hosts} }; - my $hosts_colour = report_altchangecolour(\$alt_hosts, $hosts); - print H "<td $hosts_colour>".encode_entities($hosts)."</td>\n"; - $osstestverq->execute($r->{Flight}{flight}); - my $osstestrevs = join ' ', - map { - $_ = $_->{harness}; - s/^([0-9a-f]{12})[0-9a-f]+\b/$1/; - "<kbd>".encode_entities($_)."</kbd>"; - } - @{ $osstestverq->fetchall_arrayref({}) }; - my $osstest_colour = report_altchangecolour(\$alt_osstest, $osstestrevs); - print H "<td $osstest_colour>$osstestrevs</td>\n"; - foreach my $i (0..$#rev_grid_cols) { - my $v= $r->{Revisions}[$i]; - my $rev_colour = report_altchangecolour(\$alt_revs[$i], $v); - print H "<td $rev_colour>"; - if (defined $v) { - my $vp= $v; - if (defined $lastrev && $v eq $lastrev) { - $vp= '<-'; - } else { - $vp =~ s/^((?:\d+\:)?[0-9a-f]{12})([0-9a-f].*)$/$1/; - } - print H "<kbd>".encode_entities($vp)."</kbd>"; - } - $lastrev= $v; - $last_revs[$i]= $v; - print H "</td>"; - } - print H "</tr>\n"; - $alternate ^= 1; - } - print H "</table></body></html>\n"; - H->error and die $!; - close H or die $!; - rename "$html_file.new", $html_file or die "$html_file $!"; - #print "wrote $html_file\n"; + my ($title,$url); + ensuredir "$htmlout/history"; + ensuredir "$htmlout/history/$j"; + if (defined $bra) { + $title= "$j (branch $bra)"; + } else { + $title= "$j (all branches)"; + } + $html_file= "$htmlout/$html_file"; + open H, "> $html_file.new" or die "$html_file $!"; + $title= encode_entities($title); + print H "<html><head><title>$title</title></head><body>\n"; + print H "<h1>$title</h1>\n"; + print H "<table rules=all>"; + print H "<tr><th>started</th><th>flight</th>", + "<th>branch</th><th>failure</th>\n"; + print H "<th>", (join ", ", @hostvarcols), "</th>\n"; + print H "<th>osstest</th>"; + foreach my $c (@rev_grid_cols) { + print H "<th>".encode_entities($c)."</th>\n"; + } + print H "</tr>\n"; + my $alternate= 0; + my @last_revs; + my @alt_revs; + my $alt_hosts; + my $alt_osstest; + foreach my $r (@test_rows) { + my $altcolour= report_altcolour($alternate); + print H "<tr $altcolour>"; + my $started = $r->{Flight}{started}; + print H "<td>"; + print H show_abs_time $started if $started; + print H "</td>\n"; + my $flt= $r->{Flight}{flight}; + $url= "$c{ReportHtmlPubBaseUrl}/$flt"; + print H "<td><a href=\"$url\">$flt</a></td>\n"; + print H "<td>".encode_entities($r->{Flight}{branch})."</td>\n"; + $url= "$c{ReportHtmlPubBaseUrl}/$flt/".encode_entities($j). + "/info.html"; + print H "<td $r->{ColourAttr}><a href=\"$url\">". + $r->{Content}."</a></td>\n"; + my $lastrev; + my $hosts = join ", ", map { $_ // "-" } @{ $r->{Hosts} }; + my $hosts_colour = report_altchangecolour(\$alt_hosts, $hosts); + print H "<td $hosts_colour>".encode_entities($hosts)."</td>\n"; + $osstestverq->execute($r->{Flight}{flight}); + my $osstestrevs = join ' ', + map { + $_ = $_->{harness}; + s/^([0-9a-f]{12})[0-9a-f]+\b/$1/; + "<kbd>".encode_entities($_)."</kbd>"; + } + @{ $osstestverq->fetchall_arrayref({}) }; + my $osstest_colour = report_altchangecolour(\$alt_osstest, $osstestrevs); + print H "<td $osstest_colour>$osstestrevs</td>\n"; + foreach my $i (0..$#rev_grid_cols) { + my $v= $r->{Revisions}[$i]; + my $rev_colour = report_altchangecolour(\$alt_revs[$i], $v); + print H "<td $rev_colour>"; + if (defined $v) { + my $vp= $v; + if (defined $lastrev && $v eq $lastrev) { + $vp= '<-'; + } else { + $vp =~ s/^((?:\d+\:)?[0-9a-f]{12})([0-9a-f].*)$/$1/; + } + print H "<kbd>".encode_entities($vp)."</kbd>"; + } + $lastrev= $v; + $last_revs[$i]= $v; + print H "</td>"; + } + print H "</tr>\n"; + $alternate ^= 1; } + print H "</table></body></html>\n"; + H->error and die $!; + close H or die $!; + rename "$html_file.new", $html_file or die "$html_file $!"; + #print "wrote $html_file\n"; } my @tasks; -- 2.11.0
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |