You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by gb...@apache.org on 2021/01/08 15:49:48 UTC

svn commit: r1885273 - in /spamassassin/trunk: UPGRADE sa-update.raw

Author: gbechis
Date: Fri Jan  8 15:49:48 2021
New Revision: 1885273

URL: http://svn.apache.org/viewvc?rev=1885273&view=rev
Log:
Add a --forcemirror option to sa-update in order to be able to download
updates from a specific mirror. Bz #7867

Modified:
    spamassassin/trunk/UPGRADE
    spamassassin/trunk/sa-update.raw

Modified: spamassassin/trunk/UPGRADE
URL: http://svn.apache.org/viewvc/spamassassin/trunk/UPGRADE?rev=1885273&r1=1885272&r2=1885273&view=diff
==============================================================================
--- spamassassin/trunk/UPGRADE (original)
+++ spamassassin/trunk/UPGRADE Fri Jan  8 15:49:48 2021
@@ -2,6 +2,8 @@
 Note for Users Upgrading to SpamAssassin 4.0.0
 ----------------------------------------------
 
+- New option added to sa-update to force rules download from a specific mirror
+
 - New Esp plugin that checks spam coming from some Esp providers
 
 - New nolog tflag added to hide info coming from rules in SpamAssassin reports

Modified: spamassassin/trunk/sa-update.raw
URL: http://svn.apache.org/viewvc/spamassassin/trunk/sa-update.raw?rev=1885273&r1=1885272&r2=1885273&view=diff
==============================================================================
--- spamassassin/trunk/sa-update.raw (original)
+++ spamassassin/trunk/sa-update.raw Fri Jan  8 15:49:48 2021
@@ -190,6 +190,7 @@ GetOptions(
   'allowplugins'                        => \$opt{'allowplugins'},
   'reallyallowplugins'                  => \$opt{'reallyallowplugins'},
   'refreshmirrors'                      => \$opt{'refreshmirrors'},
+  'forcemirror=s'                       => \$opt{'forcemirror'},
   'httputil=s'                          => \$opt{'httputil'},
   'score-multiplier=s'                  => \$opt{'score-multiplier'},
   'score-limit=s'                       => \$opt{'score-limit'},
@@ -729,6 +730,12 @@ foreach my $channel (@channels) {
     my @mirrors = split(/^/, $mirby);
     while(my $mirror = shift @mirrors) {
       chomp $mirror;
+      if ( defined $opt{'forcemirror'} ) {
+        $mirror = $opt{'forcemirror'};
+        $mirrors{$mirror}->{"weight"} = 1;
+        dbg("channel: found mirror $mirror (forced)");
+	last;
+      }
 
       $mirror =~ s/#.*$//;   # remove comments
       $mirror =~ s/^\s+//;   # remove leading whitespace
@@ -2012,6 +2019,8 @@ Options:
                           SpamAssassin site rules directory
                           (default: @@LOCAL_STATE_DIR@@/@@VERSION@@)
   --refreshmirrors        Force the MIRRORED.BY file to be updated
+  --forcemirror           Use a specific mirror instead of downloading from
+                          official mirrors
   --httputil util         Force used download tool. By default first found
                           from these is used: curl, wget, fetch, lwp
   --score-multiplier x.x  Adjust all scores from update channel, multiply
@@ -2177,6 +2186,11 @@ Force the list of sa-update mirrors for
 file, to be updated.  By default, the MIRRORED.BY file will be cached for up to
 7 days after each time it is downloaded.
 
+=item B<--forcemirror>
+
+Force the download from a specific host instead of relying on mirrors listed
+in MIRRORED.BY.
+
 =item B<--updatedir>
 
 By default, C<sa-update> will use the system-wide rules update directory: