]> xenbits.xensource.com Git - people/larsk/xen-release-scripts.git/commitdiff
Fixed some loose ends, cleaned up and added DEBUG support
authorLars Kurth <lars.kurth@citrix.com>
Sat, 29 Jul 2017 10:07:15 +0000 (11:07 +0100)
committerLars Kurth <lars.kurth@citrix.com>
Sat, 29 Jul 2017 10:07:15 +0000 (11:07 +0100)
match-xsa

index 93e3fc4f962700520ac2e65aa61f90f184818fda..60d2b8d829c0647fe0f94f86ecb786a462424e46 100755 (executable)
--- 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)
 }