You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by he...@apache.org on 2019/06/15 15:29:54 UTC

svn commit: r1861404 - in /spamassassin: branches/3.4/sa-update.raw trunk/sa-update.raw

Author: hege
Date: Sat Jun 15 15:29:54 2019
New Revision: 1861404

URL: http://svn.apache.org/viewvc?rev=1861404&view=rev
Log:
Skip downloading sha256 file needlessly if already having sha512

Modified:
    spamassassin/branches/3.4/sa-update.raw
    spamassassin/trunk/sa-update.raw

Modified: spamassassin/branches/3.4/sa-update.raw
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.4/sa-update.raw?rev=1861404&r1=1861403&r2=1861404&view=diff
==============================================================================
--- spamassassin/branches/3.4/sa-update.raw (original)
+++ spamassassin/branches/3.4/sa-update.raw Sat Jun 15 15:29:54 2019
@@ -785,15 +785,17 @@ foreach my $channel (@channels) {
         $preserve_files{$result_fname} = 1;
       }
 
-      # SHA256 of the archive file
-      ($result_fname, $http_ok) = http_get("$mirror/$newV.tar.gz.sha256", $UPDDir);
-      if (!$http_ok || !-s $result_fname) {
-        undef $SHA256;
-        dbg("channel: No sha256 file available from $mirror");
-      } else {
-        $SHA256 = read_content($result_fname, 0);
-        last unless $SHA256;
-        $preserve_files{$result_fname} = 1;
+      # SHA256 of the archive file (only if SHA512 not found)
+      if (!$SHA512) {
+        ($result_fname, $http_ok) = http_get("$mirror/$newV.tar.gz.sha256", $UPDDir);
+        if (!$http_ok || !-s $result_fname) {
+          undef $SHA256;
+          dbg("channel: No sha256 file available from $mirror");
+        } else {
+          $SHA256 = read_content($result_fname, 0);
+          last unless $SHA256;
+          $preserve_files{$result_fname} = 1;
+        }
       }
 
       # if GPG is enabled, the GPG detached signature of the archive file
@@ -1558,7 +1560,7 @@ sub http_get {
     push(@args, qw(-q -n -a -w 20 -m -o), $out_fname_short);
     push(@args, '-m')  if $out_fname_exists && !$force_reload;
   } elsif ($have_lwp) {
-    dbg("http: no external tool for download, fallback to using LWP");
+    dbg("http: no external tool for download, fallback to using LWP") if !$opt{'httputil'};
     my $ims;
     if ($out_fname_exists && !$force_reload) {
       my @out_fname_stat = stat($out_fname);

Modified: spamassassin/trunk/sa-update.raw
URL: http://svn.apache.org/viewvc/spamassassin/trunk/sa-update.raw?rev=1861404&r1=1861403&r2=1861404&view=diff
==============================================================================
--- spamassassin/trunk/sa-update.raw (original)
+++ spamassassin/trunk/sa-update.raw Sat Jun 15 15:29:54 2019
@@ -785,15 +785,17 @@ foreach my $channel (@channels) {
         $preserve_files{$result_fname} = 1;
       }
 
-      # SHA256 of the archive file
-      ($result_fname, $http_ok) = http_get("$mirror/$newV.tar.gz.sha256", $UPDDir);
-      if (!$http_ok || !-s $result_fname) {
-        undef $SHA256;
-        dbg("channel: No sha256 file available from $mirror");
-      } else {
-        $SHA256 = read_content($result_fname, 0);
-        last unless $SHA256;
-        $preserve_files{$result_fname} = 1;
+      # SHA256 of the archive file (only if SHA512 not found)
+      if (!$SHA512) {
+        ($result_fname, $http_ok) = http_get("$mirror/$newV.tar.gz.sha256", $UPDDir);
+        if (!$http_ok || !-s $result_fname) {
+          undef $SHA256;
+          dbg("channel: No sha256 file available from $mirror");
+        } else {
+          $SHA256 = read_content($result_fname, 0);
+          last unless $SHA256;
+          $preserve_files{$result_fname} = 1;
+        }
       }
 
       # if GPG is enabled, the GPG detached signature of the archive file
@@ -1558,7 +1560,7 @@ sub http_get {
     push(@args, qw(-q -n -a -w 20 -m -o), $out_fname_short);
     push(@args, '-m')  if $out_fname_exists && !$force_reload;
   } elsif ($have_lwp) {
-    dbg("http: no external tool for download, fallback to using LWP");
+    dbg("http: no external tool for download, fallback to using LWP") if !$opt{'httputil'};
     my $ims;
     if ($out_fname_exists && !$force_reload) {
       my @out_fname_stat = stat($out_fname);