]> xenbits.xensource.com Git - people/larsk/xen-release-scripts.git/commitdiff
Changed the way how the options work, streamlining defaults towards common use. This...
authorLars Kurth <lars.kurth@citrix.com>
Fri, 1 Sep 2017 19:05:41 +0000 (20:05 +0100)
committerLars Kurth <lars.kurth@citrix.com>
Fri, 1 Sep 2017 19:05:41 +0000 (20:05 +0100)
README
lib/myoptions.pm
make-webpage
match-xsa
xen-release-logs

diff --git a/README b/README
index e255c52e1916f6cf4cc68afad110f62ffda182e9..93c5ca2a42cd4e55a061edb42b7b34d8e2855be6 100644 (file)
--- a/README
+++ b/README
@@ -103,6 +103,14 @@ Note: you can also use the options for several releases, e.g.
 
 The log directory is called logs-470-4.
 
+Output logfiles for all three tools are saved in the logroot directory.
+In the last example above, the following files are created
+* 470-4-output_xenreleaselogs.txt
+* 470-4-output_xsamatch.html (or 470-4-output_xsamatch.txt)
+* 470-4-output_webpage.html
+
+You can override the output file by specifying
+--option <local filename (without path)>
 
 Developers and Users
 --------------------
@@ -125,49 +133,20 @@ xen-472.html)
 list-patches and copy to file into xsa-lists  with an appropriate name (e.g.
 xsa-210-222 or xsa-213-225)
 
-*STEP 4:* run the tool in dumb mode, which checks name signatures only.
+*STEP 4:* run the tool
+
+    ./match-xsa --version 4 --major 8 --since 1 --xsa xsa-213-225
 
-    ./match-xsa --version 4 --major 8 --since 1 --getlogs --html
-                --xsa ../xsa-lists/xsa-213-225
-                > ../xen-release-logs/481-stable-xsamatch.html
+And check for the output log in ../xen-release-logs/481-stable-xsamatch.html,
+or in an alternative lication, if you changed the logroot.
 
 The above command line will create a report that shows which XSA patches have
-matching commit messages to those in the XSA list file. You will have to
-manually check whether all relevant patches have been applied. Typically
-where there are no matches, the XSA does not apply (e.g. the XSA may apply to
-Linux or older Xen releases only): you will have to go and double check the
-XSA, which can be easily accessed from within the
-
-*STEP 5:* run the tool in smart mode, which checks against real patches
-rather then commit message titles. Note that this check is more fragile and
-can throw up errors in the following situations:
-* A wrong patch has been applied
-* The committer has made changes to the patch when committing (this may be a
-  real issue)
-* A bug in the match-xsa tool (none currently known)
-
-    ./match-xsa --version 4 --major 8 --since 1 --html --smart
-                --xsa ../xsa-lists/xsa-213-225
-                > ../xen-release-logs/481-stable-xsamatch-smart.html
-
-Note that you can omit the --getlogs option, as you have the logs already.
-
-Also note that the tool will fetch XSA patches from xenbits.xenproject.org/
-xsa and store these in a ../xsaweb directory. The tool uses git show to fetch
-commits from tree and will compare these against patches.
-
-If at this stage, there no unexplained discrepancies between XSAs as
-published on xenbits.xenproject.org/xsa, you are done. If there are you can
-do the following...
-
-*STEP 6:* run the tool in smart and debug mode
-
-    ./match-xsa --version 4 --major 8 --since 1 --html --smart --debug
-                --xsa ../xsa-lists/xsa-213-225
-                > ../xen-release-logs/481-stable-xsamatch-smartd.html
-
-In this mode, git diffs, patches and logs are saved in a debug directory in
-the log directory and are accessible from the generated html (via a DEBUG
+matching commit messages to those in the XSA list file. Once there is a match,
+the tool will get the patch from xsa.git or from xenbits.xenproject.org/
+xsa and store these in the logdir/tmp/xsaweb directory..
+
+Git diffs, patches and logs are saved in a debug directory in the log
+directory and are accessible from the generated html (via a DEBUG
 link). You can look at these to investigate issues. Let's say a xen patch has
 been matched by commit message, the following files will be generated:
 
@@ -182,6 +161,10 @@ been matched by commit message, the following files will be generated:
 Similar files will be available for qemu traditional (qemut*) and qemu
 upstream (qemuu*).
 
+You have additional options, which are typically only useful in rare situations
+* --not-debug does not create debug files
+* --not-html will create a markup file instead as output
+* --not-smar, will only compare file signatures
 
 Security Team Members
 ---------------------
index a69268fee59a7be1e476fcaa90cb89651e5347cf..ad0c41b6845712f8ad926660bf6dd8e9b21fc4bd 100755 (executable)
@@ -17,11 +17,12 @@ my %o = (
     'UNTIL'      => "stable",
     'LOGROOT'    => "../xen-release-logs",
     'XSALISTDIR' => "../xsa-lists",
-# LATER: Remove these
-    'GETLOGS'    => 0,
-    'SMART'      => 0,
-    'DEBUG'      => 0,
-    'HTML'       => 0,
+    'SMART'      => 1,
+    'DEBUG'      => 1,
+    'HTML'       => 1,
+    'NOTSMART'   => 0,
+    'NOTDEBUG'   => 0,
+    'NOTHTML'    => 0,
 );
 
 my %optionspec = (
@@ -40,17 +41,11 @@ my %optionspec = (
     'xsalist=s'    => \$o{'XSALIST'}, # DOCUMENT: Was xsa and $XSALIST
     'xsalistdir=s' => \$o{'XSALISTDIR'},
 
-# LATER: Remove these / default
-# Applicable to: match-xsa
-    'smart'        => \$o{'SMART'},
-    'debug'        => \$o{'DEBUG'},
-    'html'         => \$o{'HTML'},
-
-# LATER: Remove these
-    'getlogs'      => \$o{'GETLOGS'},
+    'not-smart'    => \$o{'NOTSMART'},
+    'not-debug'    => \$o{'NOTDEBUG'},
+    'not-html'     => \$o{'NOTHTML'},
 
-# Make these available to match-xsa
-# Applicable to: match-xsa, make-webpage
+# Applicable to: make-webpage
     'xsastart=s'   => \$o{'XSASTART'},
     'xsaend=s'     => \$o{'XSAEND'},
  );
@@ -66,14 +61,14 @@ sub handleoptions {
     Config::Simple->import_from('config/config', \%o);
     
     # Get Options
-    GetOptions(%optionspec) or die "Usage: $0".$usage;
+    GetOptions(%optionspec) or die "Usage: $0\n".$usage;
     # Error checking
     if ($o{'VERSION'} eq "none" ) {
-        die "Usage: $0".$usage."\n".
+        die "Usage: $0\n".$usage."\n".
         "       --version not specified\n";
     }
     if ($o{'MAJOR'} eq "none" ) {
-        die "Usage: $0".$usage."\n".
+        die "Usage: $0\n".$usage."\n".
         "       --major not specified\n";
     }
     
@@ -108,19 +103,18 @@ sub options_matchxsa {
             " [--since|--minor-since <minor version start>]\n".
             " [--until|--minor-until <minor version end>]\n".
             " [--outputfile filename (relative to logdir)]\n".
-#           " [--smart] [--debug] [--html]\n".
-#           " [--getlogs]\n".
+            " [--logroot directory]\n".
+            " [--not-smart] [--not-debug] [--not-html]\n".
             " [--xsadir xsadir (default=LOGDIR/tmp/xsaweb; files fetched from".
             " http://xenbits.xenproject.org/xsa/)]\n".
-            " [--logroot directory]\n".
             " [--xsalistdir directory]\n".
             " --xsalist xsalistfile\n";
     
-    my %opt = handleoptions("output_xsamatch.html", $u);
+    my %opt = handleoptions("output_xsamatch", $u);
     
     # Error checking
     if (! defined $o{'XSALIST'}) {
-        die "Usage: $0".$u."\n".
+        die "Usage: $0\n".$u."\n".
         "       --xsalist not specified\n";
     }
     
@@ -138,14 +132,28 @@ sub options_matchxsa {
     
     # Check whether files/directories exist
     if (!-d $opt{'XSALISTDIR'}) {
-        die "Usage: $0".$u."\n".
+        die "Usage: $0\n".$u."\n".
         "       directory ".$opt{'XSALISTDIR'}." does not exist.\n";
     }
     if (!-f $opt{'XSALISTFILE'}) {
-        die "Usage: $0".$u."\n".
+        die "Usage: $0\n".$u."\n".
         "       file ".$opt{'XSALISTFILE'}." does not exist.\n";
     }
     
+    # OVERRIDE 'SMART', 'DEBUG' & 'HTML' if specified
+    if ( $opt{'NOTSMART'} ) {
+        $opt{'SMART'} = 0;
+    }
+    if ( $opt{'NOTDEBUG'} ) {
+        $opt{'DEBUG'} = 0;
+    }
+    if ( $opt{'NOTHTML'} ) {
+        $opt{'HTML'} = 0;
+        $opt{'OUTPUTFILE'} .= ".txt";
+    } else {
+        $opt{'OUTPUTFILE'} .= ".html";
+    }
+    
     return %opt;
 }
 
@@ -155,7 +163,7 @@ sub options_xenreleaselogs {
             " [--since|--minor-since <minor version start>]\n".
             " [--until|--minor-until <minor version end>]\n".
             " [--outputfile filename (relative to logdir)]\n".
-            " [--logroot directory\n";
+            " [--logroot directory]\n";
     
     my %opt = handleoptions("output_xenreleaselogs.txt", $u);
     
@@ -168,21 +176,20 @@ sub options_makewebpage {
             " [--since|--minor-since <minor version start>]\n".
             " [--until|--minor-until <minor version end>]\n".
             " [--outputfile filename (relative to logdir)]\n".
-#           " [--nocheckout]\n".
+            " [--logroot directory]\n".
             " --xsastart <number of 1st xsa>\n".
-            " --xsasend <number of last xsa>\n".
-            " [--logroot directory]\n";
+            " --xsasend <number of last xsa>\n";
     
     my %opt = handleoptions("output_webpage.html", $u);
 
     # Error checking
     if (! defined $opt{'XSASTART'}) {
-        die "Usage: $0".$u."\n".
+        die "Usage: $0\n".$u."\n".
         "       --xsastart not specified\n";
     }
     # Error checking
     if (! defined $opt{'XSAEND'}) {
-        die "Usage: $0".$u."\n".
+        die "Usage: $0\n".$u."\n".
         "       --xsasend not specified\n";
     }
     
index 0bfcb5afb66c528b484b61013c78ba6dc73c9cd6..75105ead0e85c6fe59c3b5c15fed0022735a78f4 100755 (executable)
@@ -17,7 +17,6 @@ use MyOptions;
 my %opt = options_makewebpage();
 
 # Copy Variables from Options
-my $GETLOGS     = $opt{'GETLOGS'};
 my $VERSION     = $opt{'VERSION'};
 my $MAJOR       = $opt{'MAJOR'};
 my $SINCE       = $opt{'SINCE'};
@@ -30,6 +29,16 @@ my $LOGROOT     = $opt{'LOGROOT'};
 # Output
 my $OUTPUTFILE  = $opt{'OUTPUTFILE'};
 
+# Always get/update logs
+my $rl .= "./xen-release-logs --logroot $LOGROOT --version $VERSION --major $MAJOR";
+if ($SINCE ne "none") {
+   $rl .= " --since $SINCE";
+}
+if ($UNTIL ne "stable") {
+   $rl .= " --since $UNTIL";
+}
+system($rl);
+
 # Input
 my $xen_log     = "$LOGDIR/xen_$SHORT-pretty.log";
 my $qemuu_log   = "$LOGDIR/qemuu_$SHORT-pretty.log";
@@ -103,3 +112,5 @@ $s .= '<p>We recommend all users of the '.$releaseshort.' stable series to updat
 
 # WRITE REPORT
 write_file($OUTPUTFILE, $s);
+
+1;
index 986caa8d256bdf20e573e5dad22be09b10c510b9..8fb46ce1194c443e2cc7e0effeae82c7e9598030 100755 (executable)
--- a/match-xsa
+++ b/match-xsa
@@ -16,7 +16,6 @@ use MyOptions;
 my %opt = options_matchxsa();
 
 # Copy Variables from Options
-my $GETLOGS     = $opt{'GETLOGS'};
 my $SMART       = $opt{'SMART'};
 my $DEBUG       = $opt{'DEBUG'};
 my $HTML        = $opt{'HTML'};
@@ -38,6 +37,23 @@ my $qemut_git   = $opt{'QEMUT_GIT'};
 my $xsa         = $XSADIR;
 
 
+# Always get/update logs
+my $rl .= "./xen-release-logs --logroot $LOGROOT --version $VERSION --major $MAJOR";
+if ($SINCE ne "none") {
+    $rl .= " --since $SINCE";
+}
+if ($UNTIL ne "stable") {
+    $rl .= " --since $UNTIL";
+}
+system($rl);
+
+# Output
+my $OUTPUTFILE  = $opt{'OUTPUTFILE'};
+# Redirect Output to file
+print "Redirecting output to '$OUTPUTFILE'\n";
+open(OUTPUT, '>', $OUTPUTFILE) or die "Could not open file '$OUTPUTFILE' $!";
+STDOUT->fdopen( \*OUTPUT, 'w' ) or die $!;
+
 # Get the xsa list file
 my @XSA;
 my $XSAs;
@@ -913,3 +929,6 @@ sub processadvisoryfiles {
     }
     
 }
+
+1;
+
index b103ef239f839fde5d6ece3da32b0ffb701fdd5e..6497cac9454dfe606103be9246c58d8ac2978f92 100755 (executable)
@@ -193,3 +193,5 @@ sub getlogs {
   system("$git$Q%s$Q > ../$L.log");
   system("$git$Q%H$Q > ../$L-hash.log");
 }
+
+1;