From: Lars Kurth Date: Fri, 7 Jul 2017 13:19:16 +0000 (+0100) Subject: Added options to change location of lofgiles and xsa files X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=074f164087112e2fea45d83e5f7af63f8ec470bf;p=people%2Flarsk%2Fxen-release-scripts.git Added options to change location of lofgiles and xsa files --- diff --git a/README b/README index a452b93..3e68704 100644 --- 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 diff --git a/match-xsa b/match-xsa index ca79448..22240f3 100755 --- 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 --major [--since ] [--until ] [--getlogs] --xsa xsafile\n"; +die "Usage: $0 --version ". + " --major ". + " [--since ]". + " [--until ]". + " [--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"; diff --git a/xen-release-logs b/xen-release-logs index 1c6592f..c8a297a 100755 --- a/xen-release-logs +++ b/xen-release-logs @@ -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 (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}"