]> xenbits.xensource.com Git - people/larsk/xen-release-scripts.git/commitdiff
Added options to change location of lofgiles and xsa files
authorLars Kurth <lars.kurth@citrix.com>
Fri, 7 Jul 2017 13:19:16 +0000 (14:19 +0100)
committerLars Kurth <lars.kurth@citrix.com>
Fri, 7 Jul 2017 13:19:16 +0000 (14:19 +0100)
README
match-xsa
xen-release-logs

diff --git a/README b/README
index a452b93759b67051a51cdf8b0b83b8881d0c1787..3e68704c6905236af33f52cdbc7338df07fd4e63 100644 (file)
--- a/README
+++ b/README
@@ -1,3 +1,14 @@
+directory structure
+===================
+
+To keep things clean, I use the following directory structure
+
+    root
+    - xen-release-logs     [output/input directory]
+    - xen-release-scripts  [git repo]
+    - xsa-lists            [output/input directory, see steps 1-5 in match-xsa]
+    - xsa                  [git repo]
+
 xen-release-logs
 ================
 
@@ -39,9 +50,6 @@ Gets the logs from 4.7.0 to 4.7.1 (uses the 4.6.0 tags as common root) up to the
 
 Gets the logs from 4.7.0 to 4.7.1 (uses the 4.6.0 tags as common root) up to the 4.7.1 tags and will use a log directory of name *logs-470-1*.
 
-TODO
-----
-* Provide an option to specify the root log directory
 
 
 match-xsa
@@ -116,11 +124,10 @@ The tool will produce output blocks such as
 
 TODO
 ----
-* Provide an option to specify the root log directory 
 * Provide an option to *not* check out repos from scratch every single time 
 * The reporting can probably be improved: aka, highlight blocks with potential issues better. For example, embed relevant portions of an XSA into the output in cases where there is no match 
 * Create a wrapper which sets up the directory structure that deals with STEPS 1-5 in an automatic fashion, while keeping XSA information confidential
 
 ISSUES
 ------
-* *smart*: currently falls over and produces a non-match if the per-file diffs from *git show* and in the *.patch* file are listed in a different order. This seems to happen rarely, but does happen.
+* *smart*: currently falls over and produces a non-match if the per-file diffs from *git show* and in the *.patch* file are listed in a different order. This seems to happen rarely, but does happen.
\ No newline at end of file
index ca7944851d93b6e9567fce436d113f3188eabeb6..22240f34d5f757e697e28f4f8284d291f127eefc 100755 (executable)
--- a/match-xsa
+++ b/match-xsa
@@ -1,6 +1,9 @@
 #!/usr/bin/perl
 # Usage
-# $0 --version 4 --major 7 --since 0 [--until 1] [--getlogs] [--smart] [--debug] [--html] --xsa xsafile
+# $0 --version 4 --major 7 --since 0 [--until 1] 
+#   [--getlogs] [--smart] [--debug] [--html] 
+#   [--logroot directory]
+#   [--xsadir xsadir] --xsa xsafile
 
 use strict;
 use warnings;
@@ -9,6 +12,7 @@ use Getopt::Long qw(GetOptions);
 use Cwd;
 use File::Slurp;
 use Text::Diff;
+use File::Spec;
 
 my $GETLOGS=0;
 my $SMART=0;
@@ -19,6 +23,8 @@ my $MAJOR;
 my $SINCE="none";
 my $UNTIL="stable";
 my $XSAFILE;
+my $XSADIR = File::Spec->canonpath(cwd()."/../xsa" );
+my $LOGROOT = File::Spec->canonpath(cwd()."/../xen-release-logs" );
 
 GetOptions(
     'version=s' => \$VERSION,
@@ -26,27 +32,40 @@ GetOptions(
     'since=s'   => \$SINCE,
     'until=s'   => \$UNTIL,
     'xsa=s'     => \$XSAFILE,
+    'xsadir=s'  => \$XSADIR,  
+    'logroot=s' => \$LOGROOT,      
     'getlogs'   => \$GETLOGS,
     'smart'     => \$SMART,
     'debug'     => \$DEBUG,
     'html'      => \$HTML,
 ) or 
-die "Usage: $0 --version <xen version, e.g. 4> --major <major version> [--since <minor version start>] [--until <minor version end>] [--getlogs] --xsa xsafile\n";
+die "Usage: $0 --version <xen version, e.g. 4>".
+             " --major <major version>".
+             " [--since <minor version start>]".
+             " [--until <minor version end>]".
+             " [--smart] [--debug] [--html]".
+             " [--getlogs]".
+             " [--xsadir xsadir(default=../xsa)]".
+             " [--logroot directory(default=../xen_release_logs)]".
+             " --xsa xsafile\n";
  
 if ($GETLOGS) {
-    system("./xen-release-logs --version $VERSION --major $MAJOR --since $SINCE --until $UNTIL");
+    system("./xen-release-logs --version $VERSION --major $MAJOR --since $SINCE --until $UNTIL --logroot $LOGROOT");
 }
 
 # Calculate log file names
 my $short="$VERSION$MAJOR$SINCE-$UNTIL";
 
 # Directories
-my $dir=cwd();
-my $debug="$dir/logs-$short/debug";
-my $xen_git="$dir/logs-$short/xen";
-my $qemuu_git="$dir/logs-$short/qemu-xen";
-my $qemut_git="$dir/logs-$short/qemu-xen-traditional";
-my $xsa="$dir/xsa";
+if (! -e $LOGROOT) {
+    mkdir $LOGROOT;
+}
+
+my $debug="$LOGROOT/logs-$short/debug";
+my $xen_git="$LOGROOT/logs-$short/xen";
+my $qemuu_git="$LOGROOT/logs-$short/qemu-xen";
+my $qemut_git="$LOGROOT/logs-$short/qemu-xen-traditional";
+my $xsa=$XSADIR;
 
 if ($DEBUG != 0) { 
     system("rm -rf $debug");
@@ -91,9 +110,9 @@ my @LOGQEMUU_hash;
 my @LOGQEMUT;
 my @LOGQEMUT_hash;
 
-getlogs("./logs-$short/xen_$short", \@LOGXEN, \@LOGXEN_hash);
-getlogs("./logs-$short/qemuu_$short", \@LOGQEMUU, \@LOGQEMUU_hash);
-getlogs("./logs-$short/qemut_$short", \@LOGQEMUT, \@LOGQEMUT_hash);
+getlogs("$LOGROOT/logs-$short/xen_$short", \@LOGXEN, \@LOGXEN_hash);
+getlogs("$LOGROOT/logs-$short/qemuu_$short", \@LOGQEMUU, \@LOGQEMUU_hash);
+getlogs("$LOGROOT/logs-$short/qemut_$short", \@LOGQEMUT, \@LOGQEMUT_hash);
 
 # Do the actual matching
 print "CHECKING '$XSAFILE' against 'xen_$short.log', 'qemuu_$short.log' and 'qemut_$short.log'.\n";
index 1c6592f925b2de139099a6380cb7b09398cf7c0f..c8a297a3c7aca5e2ceaea38480af797928662965 100755 (executable)
@@ -5,10 +5,16 @@
 # xen-release-logs --version 4 --major 7 (for new major releases)
 # xen-release-logs --version 4 --major 7 --until 0 (for new major releases)
 # xen-release-logs --nocheckout (does not check out tree)
+# xen-release-logs --logroot <directory> (needs to exist)
 
+USAGE="Usage: xen-release-logs --version v --major m [--since s] [--until u] [--nocheckout] [--logroot directory]\n"
+
+VERSION="none"
+MAJOR="none"
 UNTIL="stable"
 SINCE="none"
 NOCHECKOUT="false"
+LOGROOT=".";
 
 while [[ $# -gt 1 ]]
 do
@@ -32,19 +38,42 @@ case $key in
     UNTIL="$2"
     shift # past argument
     ;;  
+    -l|--logroot)
+    LOGROOT="$2"
+    if [ ! -d $LOGROOT ]; then
+       echo ${USAGE}
+       echo "Log directory '${LOGROOT}' does not exist"
+       exit 1;
+    fi
+    shift # past argument
+    ;;  
     -n|--nocheckout)
     NOCHECKOUT="true"
     ;;      
     *)
     # unknown option
+    echo ${USAGE}
+    exit 1;
     ;;
 esac
 shift # past argument or value
 done
 
+# Error checking
+if [ $VERSION == "none" ]; then
+   echo ${USAGE}
+   echo "--version not specified"
+   exit 1;
+fi
+if [ $MAJOR == "none" ]; then
+   echo ${USAGE}
+   echo "--major not specified"
+   exit 1;
+fi
+
 # Set up variables
 SHORT="${VERSION}${MAJOR}${SINCE}-${UNTIL}"
-DIR="logs-${SHORT}"
+DIR="${LOGROOT}/logs-${SHORT}"
 SERIES="${VERSION}.${MAJOR}"
 SERIES_LAST="${VERSION}.${MAJOR_LAST}"