+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
================
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
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
#!/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;
use Cwd;
use File::Slurp;
use Text::Diff;
+use File::Spec;
my $GETLOGS=0;
my $SMART=0;
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,
'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");
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";
# 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
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}"