From: Lars Kurth Date: Sun, 30 Jul 2017 10:52:09 +0000 (+0100) Subject: Made output better X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=04d0ff8affd62e2d97f48b9f47cc15f491872c2f;p=people%2Flarsk%2Fxen-release-scripts.git Made output better --- diff --git a/match-xsa b/match-xsa index cdd48a8..fbf7efb 100755 --- a/match-xsa +++ b/match-xsa @@ -6,6 +6,12 @@ # [--xsadir xsadir] --xsa xsafile use strict; +# Disabled warnings as +# - if ( @{ $XSA_TO_INDEX_MATCH{$e} } ) throws an error, while +# if ( defined @{ $XSA_TO_INDEX_MATCH{$e} } ) works but warns +no warnings 'deprecated'; +no warnings 'experimental'; + use warnings; use 5.010; use Getopt::Long qw(GetOptions); @@ -184,6 +190,8 @@ for ($i=0; $i <= $XSAs; $i++) { # PRINT REPORT my @XSA_LIST; my %XSA_TO_INDEX; +my %XSA_TO_INDEX_AUX; # Contains *.patch files deemed not important +my %XSA_TO_INDEX_MATCH; # Contains *.patch files matching a version preparedatabyxsa(); printreport(); @@ -199,6 +207,17 @@ sub preparedatabyxsa { for ($i=0; $i <= $#XSA; $i++) { push @{ $XSA_TO_INDEX{$XSA[$i]} }, $i; + + # Check $XSA_PATCH[$i] against @XSA_REGEXFORVERSION + # If there is a match put in %XSA_TO_INDEX_MATCH + # Otherwise in %XSA_TO_INDEX_AUX + my $rx = join "|", @XSA_REGEXFORVERSION; + + if ($XSA_PATCH[$i] =~ /$rx/) { + push @{ $XSA_TO_INDEX_MATCH{$XSA[$i]} }, $i; + } else { + push @{ $XSA_TO_INDEX_AUX{$XSA[$i]} }, $i; + } } } @@ -211,11 +230,25 @@ sub printreport { foreach $e (@XSA_LIST) { printheadline($e); - printlistheader(); - foreach $i ( @{ $XSA_TO_INDEX{$e} } ) { - printxsadetail_byindex($i, $debug); + if ( defined @{ $XSA_TO_INDEX_MATCH{$e} } ) { + printlistheader("Comparisons specific to $VERSION.$MAJOR:", + "BLACK"); + foreach $i ( @{ $XSA_TO_INDEX_MATCH{$e} } ) { + printxsadetail_byindex($i, "RED", $debug); + } + printlistend(); + + printseparator(); + } + + if ( defined @{ $XSA_TO_INDEX_AUX{$e} } ) { + printlistheader("Other comparisons (can probably be ignored):", + "GRAY"); + foreach $i ( @{ $XSA_TO_INDEX_AUX{$e} } ) { + printxsadetail_byindex($i, "GRAY", $debug); + } + printlistend(); } - printlistend(); } } @@ -240,12 +273,17 @@ sub printheadline { sub printxsadetail_byindex { my $i = shift; + my $nomatchcolor = shift; my $debug = shift; my $i_correct = $i+1; if ($HTML) { - printf('
  • '); + if ( $XSA_IN[$i] eq "in NONE" ) { + printf('
  • ', $nomatchcolor); + } else { + printf('
  • '); + } printf('%s ', $XSA_PATCH[$i], $XSA_PATCH[$i]); printf(' %s ', $XSA_IN[$i]); @@ -271,16 +309,19 @@ sub printxsadetail_byindex { sub printseparator { - if ($HTML) { - printf('
    '); - } printf("\n"); } sub printlistheader { + my $text = shift; + my $color = shift; if ($HTML) { - printf('