]> xenbits.xensource.com Git - people/larsk/xen-release-scripts.git/commitdiff
Group output by XSA => better readability
authorLars Kurth <lars.kurth@citrix.com>
Sun, 30 Jul 2017 09:30:29 +0000 (10:30 +0100)
committerLars Kurth <lars.kurth@citrix.com>
Sun, 30 Jul 2017 09:30:29 +0000 (10:30 +0100)
match-xsa

index 47fe6cc69c8df5e6b8e12122dd8344704cdbb962..cdd48a8df80630b94b65c3faa48c13eefafd7c9d 100755 (executable)
--- a/match-xsa
+++ b/match-xsa
@@ -182,35 +182,58 @@ for ($i=0; $i <= $XSAs; $i++) {
 }
 
 # PRINT REPORT
+my @XSA_LIST;
+my %XSA_TO_INDEX;
+
+preparedatabyxsa();
 printreport();
 
 #############################################################################
 
-sub printreport {
+sub preparedatabyxsa {
+
+    my $i;
     
-    my $LAST_XSA = $XSA[0];
+    @XSA_LIST = uniq ( @XSA );
+    @XSA_LIST = sort { $a <=> $b } @XSA_LIST;
     
-    printheader();
+    for ($i=0; $i <= $#XSA; $i++) {
+        push @{ $XSA_TO_INDEX{$XSA[$i]} }, $i;
+    }
+}
 
-    for ($i=0; $i <= $XSAs; $i++) {
-   
-        my $i_correct = $i+1;
-       
-        if ($LAST_XSA != $XSA[$i]) {
-           printseparator();
-           $LAST_XSA = $XSA[$i];
+
+sub printreport {
+    
+    my $e;
+    my $i;
+    
+    foreach $e (@XSA_LIST)
+    {
+        printheadline($e);
+        printlistheader();
+        foreach $i ( @{ $XSA_TO_INDEX{$e} } ) {
+             printxsadetail_byindex($i, $debug);
         }
-        printxsadetail_byindex($i, $debug);
+        printlistend();
     }
-    printend();
-
 }
 
-sub printheader {
+
+sub printheadline {
+
+    my $xsa = shift;
     
     if ($HTML) {
-        printf('<ol type="1"> ');
-        printf("\n");
+        printf('<a name="%s">', $xsa);
+        printf('<h3>');
+        printf('<a href="http://xenbits.xenproject.org/xsa/'.
+        'advisory-%s.html">XSA %s</a>', $xsa, $xsa);
+        printf('</h3>');
+
+    } else {
+        printf("XSA %-3s\n", $xsa);
+        printf("=======\n");
     }
 }
 
@@ -223,17 +246,15 @@ sub printxsadetail_byindex {
     
     if ($HTML) {
         printf('  <li>');
-        printf('<a href="http://xenbits.xenproject.org/xsa/'.
-        'advisory-%s.html">XSA %s</a> : ', $XSA[$i], $XSA[$i]);
-        printf(' <b>%s</b> ', $XSA_IN[$i]);
-        printf('(<a href="http://xenbits.xenproject.org/xsa/%s">%s</a>) ',
+        printf('<a href="http://xenbits.xenproject.org/xsa/%s">%s</a> ',
         $XSA_PATCH[$i], $XSA_PATCH[$i]);
+        printf(' <b>%s</b> ', $XSA_IN[$i]);
         if ($XSA_HASH[$i]) {
-            printf('<em><a href="http://xenbits.xenproject.org/gitweb/?'.
-            'p=%s;a=commitdiff;h=%s">%s</a></em> ', $XSA_REPO[$i],
+            printf('(<em><a href="http://xenbits.xenproject.org/gitweb/?'.
+            'p=%s;a=commitdiff;h=%s">%s</a></em>) ', $XSA_REPO[$i],
             $XSA_HASH[$i], $XSA_ID[$i]);
         } else {
-            printf('<em>%s</em> ', $XSA_ID[$i]);
+            printf('(<em>%s</em>) ', $XSA_ID[$i]);
         }
         if ($DEBUG != 0) {
             printf(' ... <a href="File://%s">DEBUG</a> ', $debug."/".
@@ -243,10 +264,8 @@ sub printxsadetail_byindex {
         printf("\n");
         
     } else {
-        printf("%-3s: XSA %-3s %-10s: PATCH = %s\n",
-               $i_correct, $XSA[$i], $XSA_IN[$i], $XSA_PATCH[$i]);
-        printf("                       : TITLE = %s\n",
-               "'".$XSA_ID[$i]."'");
+        printf("* %s %-10s (%s)\n",
+               $XSA_PATCH[$i], $XSA_IN[$i], $XSA_ID[$i]);
     }
 }
 
@@ -258,13 +277,20 @@ sub printseparator {
     printf("\n");
 }
 
-sub printend {
+sub printlistheader {
     
     if ($HTML) {
-        printf('</ol>');
+        printf('<ul> ');
         printf("\n");
     }
+}
 
+sub printlistend {
+    
+    if ($HTML) {
+        printf('</ul>');
+    }
+    printf("\n");
 }
 
 #############################################################################