From: Ian Jackson Date: Tue, 4 Aug 2020 16:27:04 +0000 (+0100) Subject: sg-report-job-history (nfc): Remove needless conditional X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=485579e1c6d6f4866d37c08d2f252de668d5fe39;p=people%2Faperard%2Fosstest.git 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 --- 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 "$title\n"; - print H "

$title

\n"; - print H ""; - print H "", - "\n"; - print H "\n"; - print H ""; - foreach my $c (@rev_grid_cols) { - print H "\n"; - } - print H "\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 ""; - my $started = $r->{Flight}{started}; - print H "\n"; - my $flt= $r->{Flight}{flight}; - $url= "$c{ReportHtmlPubBaseUrl}/$flt"; - print H "\n"; - print H "\n"; - $url= "$c{ReportHtmlPubBaseUrl}/$flt/".encode_entities($j). - "/info.html"; - print H "\n"; - my $lastrev; - my $hosts = join ", ", map { $_ // "-" } @{ $r->{Hosts} }; - my $hosts_colour = report_altchangecolour(\$alt_hosts, $hosts); - print H "\n"; - $osstestverq->execute($r->{Flight}{flight}); - my $osstestrevs = join ' ', - map { - $_ = $_->{harness}; - s/^([0-9a-f]{12})[0-9a-f]+\b/$1/; - "".encode_entities($_).""; - } - @{ $osstestverq->fetchall_arrayref({}) }; - my $osstest_colour = report_altchangecolour(\$alt_osstest, $osstestrevs); - print H "\n"; - foreach my $i (0..$#rev_grid_cols) { - my $v= $r->{Revisions}[$i]; - my $rev_colour = report_altchangecolour(\$alt_revs[$i], $v); - print H ""; - } - print H "\n"; - $alternate ^= 1; - } - print H "
startedflightbranchfailure", (join ", ", @hostvarcols), "osstest".encode_entities($c)."
"; - print H show_abs_time $started if $started; - print H "$flt".encode_entities($r->{Flight}{branch})."{ColourAttr}>". - $r->{Content}."".encode_entities($hosts)."$osstestrevs"; - 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 "".encode_entities($vp).""; - } - $lastrev= $v; - $last_revs[$i]= $v; - print H "
\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 "$title\n"; + print H "

$title

\n"; + print H ""; + print H "", + "\n"; + print H "\n"; + print H ""; + foreach my $c (@rev_grid_cols) { + print H "\n"; + } + print H "\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 ""; + my $started = $r->{Flight}{started}; + print H "\n"; + my $flt= $r->{Flight}{flight}; + $url= "$c{ReportHtmlPubBaseUrl}/$flt"; + print H "\n"; + print H "\n"; + $url= "$c{ReportHtmlPubBaseUrl}/$flt/".encode_entities($j). + "/info.html"; + print H "\n"; + my $lastrev; + my $hosts = join ", ", map { $_ // "-" } @{ $r->{Hosts} }; + my $hosts_colour = report_altchangecolour(\$alt_hosts, $hosts); + print H "\n"; + $osstestverq->execute($r->{Flight}{flight}); + my $osstestrevs = join ' ', + map { + $_ = $_->{harness}; + s/^([0-9a-f]{12})[0-9a-f]+\b/$1/; + "".encode_entities($_).""; + } + @{ $osstestverq->fetchall_arrayref({}) }; + my $osstest_colour = report_altchangecolour(\$alt_osstest, $osstestrevs); + print H "\n"; + foreach my $i (0..$#rev_grid_cols) { + my $v= $r->{Revisions}[$i]; + my $rev_colour = report_altchangecolour(\$alt_revs[$i], $v); + print H ""; + } + print H "\n"; + $alternate ^= 1; } + print H "
startedflightbranchfailure", (join ", ", @hostvarcols), "osstest".encode_entities($c)."
"; + print H show_abs_time $started if $started; + print H "$flt".encode_entities($r->{Flight}{branch})."{ColourAttr}>". + $r->{Content}."".encode_entities($hosts)."$osstestrevs"; + 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 "".encode_entities($vp).""; + } + $lastrev= $v; + $last_revs[$i]= $v; + print H "
\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;