From: Lars Kurth Date: Sat, 29 Jul 2017 10:07:15 +0000 (+0100) Subject: Fixed some loose ends, cleaned up and added DEBUG support X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=695eaf002d921e0143db5d90ce1ba78dac6392a6;p=people%2Flarsk%2Fxen-release-scripts.git Fixed some loose ends, cleaned up and added DEBUG support --- diff --git a/match-xsa b/match-xsa index 93e3fc4..60d2b8d 100755 --- a/match-xsa +++ b/match-xsa @@ -564,11 +564,9 @@ sub advisorysnippet { sub processadvisoryfiles { my $xsa_dir = $XSADIR; - #my $version = $VERSION.".".$MAJOR; - #note: 4.6 contains [12], 4.5 , - my $version = "4."; - - print "* $version\n"; + my $version = $VERSION.".".$MAJOR; + # Note: For testing at the beginning of the function set + # $version to "4." or "4.6" contains [12], "4.5", etc. # Get a unique array of XSA numbers in the file my @xsa = uniq(@XSA); @@ -660,7 +658,7 @@ sub processadvisoryfiles { # Find brackets for processing {[0123456789.,]+} my $regex = qr/{[0123456789.,]+}/p; if ($tmp =~ /$regex/g) { - # Use index, as \$-[0] and \$+[0] isn't working + my $s = index($tmp, "{"); my $e = index($tmp, "}"); @@ -670,14 +668,6 @@ sub processadvisoryfiles { my $middle = substr $tmp, $s+1, $e-$s-1; my $end = substr $tmp, $e+1; - #print "<<<<".$tmp."\n"; - #print $start."\n"; - #print "----\n"; - #print $middle."\n"; - #print "----\n"; - #print $end."\n"; - #print ">>>>\n"; - # Process the content my $leadingzero; my @numbers; @@ -713,7 +703,6 @@ sub processadvisoryfiles { # Re-assemble $tmp = $start.$middle.$end; - #print "OUTPUT: ".$tmp."\n\n"; } } @@ -721,12 +710,17 @@ sub processadvisoryfiles { push @XSA_REGEXFORVERSION, $tmp; } @XSA_REGEXFORVERSION = uniq(@XSA_REGEXFORVERSION); + + if ($DEBUG != 0) { + # DEBUG FILES + my $debugregex = $debug."/XSA_REGEXFORVERSION.txt"; + my $debugversion = $debug."/XSA_PATCHFORVERSION.txt"; + + write_file($debugregex , join("\n", @XSA_REGEXFORVERSION)."\n"); + write_file($debugversion , join("\n", @XSA_PATCHFORVERSION)."\n"); + } - # print join("\n", @XSA_REGEXFORVERSION); - - # TODO: check whether the found matches can be found - # Note: For testing at the beginning of the function set - # $version to "4." or "4.6" contains [12], "4.5", etc. + # TODO: Check whether the found matches can be found # TODO: maybe make @XSA_REGEXFORVERSION a hash (see later) }