[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[OSSTEST PATCH 37/60] sg-report-job-history (nfc): Remove needless conditional


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
  • Date: Fri, 14 Aug 2020 18:21:42 +0100
  • Authentication-results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
  • Delivery-date: Fri, 14 Aug 2020 17:26:38 +0000
  • Ironport-sdr: GQnkPuEvFvPygCaE7B/72A7gl2K5hfP+jxP3OspD//H00LURecshAlXMAOe9QCuqTw9cGMJ2G0 c8e0ACC/5PN2gYge1t3cWzVRQsgTiDkpsbHt5T0Tk4005tmRagTExLVazGd9DpAf1MMDmqHkMN Hp0fMMMb4/MfZzdWvTd92KxeCzh57SP/T9r7fVbQ7CxRw6n04YEuZ66lZzk5NsMqVT44iSr0jx SPKZJdsqwXn8VD4qkMq7tvyzAfhb3ynbLeZUOUBeS9fsX4j3oSaMfzxonz5E4FR48aCEmESv/l nJw=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

$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




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.