]> xenbits.xensource.com Git - people/larsk/xen-release-scripts.git/commitdiff
Added support for fetching *.patch files from xenbits when --xsadir is not specified
authorLars Kurth <lars.kurth@citrix.com>
Tue, 18 Jul 2017 19:14:47 +0000 (20:14 +0100)
committerLars Kurth <lars.kurth@citrix.com>
Tue, 18 Jul 2017 19:14:47 +0000 (20:14 +0100)
README
match-xsa

diff --git a/README b/README
index e15d4b958f714023a9b042958718dc117b1c9f25..a7726203bae676c8cc9dd5cf187c9f9f0f8bba51 100644 (file)
--- a/README
+++ b/README
@@ -7,7 +7,7 @@ To keep things clean, I use the following directory structure
     - 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]
+    - xsa                  [git repo, optional]
 
 xen-release-logs
 ================
index b9f77e87c04c5b5fa91f78db58348e02c29791cf..b65cb79d5ed648cb298e4db50d8420e7c358608a 100755 (executable)
--- a/match-xsa
+++ b/match-xsa
@@ -22,7 +22,8 @@ my $MAJOR;
 my $SINCE="none";
 my $UNTIL="stable";
 my $XSAFILE;
-my $XSADIR = File::Spec->canonpath(cwd()."/../xsa" );
+my $XSADIR;
+my $XSAFETCH;
 my $LOGROOT = File::Spec->canonpath(cwd()."/../xen-release-logs" );
 
 GetOptions(
@@ -44,8 +45,8 @@ die "Usage: $0 --version <xen version, e.g. 4>".
              " [--until <minor version end>]".
              " [--smart] [--debug] [--html]".
              " [--getlogs]".
-             " [--xsadir xsadir(default=../xsa)]".
-             " [--logroot directory(default=../xen_release_logs)]".
+             " [--xsadir xsadir (default=../xsaweb; files fetched from http://xenbits.xenproject.org/xsa/)]".
+             " [--logroot directory (default=../xen_release_logs)]".
              " --xsa xsafile\n";
  
 if ($GETLOGS) {
@@ -55,6 +56,14 @@ if ($GETLOGS) {
 # Calculate log file names
 my $short="$VERSION$MAJOR$SINCE-$UNTIL";
 
+# Set up XSADIR and XSAFETCH, if not set
+if (!$XSADIR && $SMART!=0) {
+   $XSAFETCH = "https://xenbits.xenproject.org/xsa/";
+   $XSADIR = File::Spec->canonpath(cwd()."/../xsaweb" );
+   system("rm -rf $XSADIR");
+   mkdir $XSADIR;
+}
+  
 # Directories
 if (! -e $LOGROOT) {
     mkdir $LOGROOT;
@@ -331,6 +340,20 @@ sub matchsmart {
          chdir($git_dir);
          my $git_command="git show ".@$loghash_ref[$index].' --format=""';
          my $diff_git = `$git_command`;
+         
+         if ($XSAFETCH) {
+            my $path="";
+            # Check whether $XSA_PATCH[$i] contains a path
+            my $index = rindex($XSA_PATCH[$i], "/");
+            if ($index != -1) {
+                $path = "/".substr($XSA_PATCH[$i], 0, $index);
+            }
+            if (! -d "$xsa_dir$path") {
+               system("mkdir $xsa_dir$path");
+            }
+            system("wget --quiet --no-check-certificate -P $xsa_dir$path $XSAFETCH/$XSA_PATCH[$i]"); 
+         }
+         
          my $patch = read_file("$xsa_dir/$XSA_PATCH[$i]");
          
          my $diff_git_n = normalize_diff($diff_git);
@@ -445,4 +468,4 @@ sub normalize_diff {
    }   
      
    return join "\n", @newlines;
-}
+}
\ No newline at end of file