You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by mm...@apache.org on 2010/01/11 17:32:34 UTC

svn commit: r897929 - /spamassassin/trunk/sa-update.raw

Author: mmartinec
Date: Mon Jan 11 16:32:34 2010
New Revision: 897929

URL: http://svn.apache.org/viewvc?rev=897929&view=rev
Log:
Bug 6277: Add a verbose option to sa-update to show updated channels

Modified:
    spamassassin/trunk/sa-update.raw

Modified: spamassassin/trunk/sa-update.raw
URL: http://svn.apache.org/viewvc/spamassassin/trunk/sa-update.raw?rev=897929&r1=897928&r2=897929&view=diff
==============================================================================
--- spamassassin/trunk/sa-update.raw (original)
+++ spamassassin/trunk/sa-update.raw Mon Jan 11 16:32:34 2010
@@ -142,6 +142,7 @@
   'debug|D:s'                           => \$opt{'debug'},
   'version|V'                           => \$opt{'version'},
   'help|h|?'                            => \$opt{'help'},
+  'verbose|v'                           => \$opt{'verbose'},
   'checkonly'                           => \$opt{'checkonly'},
   'allowplugins'                        => \$opt{'allowplugins'},
   'refreshmirrors'                      => \$opt{'refreshmirrors'},
@@ -466,6 +467,8 @@
       next;
     }
 
+    print "Update available for channel $channel\n"  if $opt{'verbose'};
+
     # If we are only checking for update availability, exit now
     if ( defined $opt{'checkonly'} ) {            
       dbg("channel: $channel: update available, not downloading in checkonly mode");
@@ -483,6 +486,8 @@
     }
     $newV = $1;
 
+#   print "Update available for channel $channel\n"  if $opt{'verbose'};
+
     if ( defined $opt{'checkonly'} ) {            
       dbg("channel: $channel: --install and --checkonly, claiming update available");
       $exit = 0;
@@ -507,6 +512,7 @@
     dbg("generic: lint checking site pre files once before attempting channel updates");
     unless (lint_check_dir(File::Spec->catfile($UPDTmp, "doesnotexist"))) {
       dbg("generic: lint of site pre files failed, cannot continue"); 
+      print "Lint of site pre files failed, cannot continue\n"  if $opt{'verbose'};
       $exit = 2;
       last;
     }
@@ -1003,6 +1009,21 @@
 }
 
 dbg("diag: updates complete, exiting with code $exit");
+
+if ($opt{'verbose'}) {
+  if (!$exit) {
+    if (defined $opt{'checkonly'}) {
+      print "Update was available, but not installed in checkonly mode\n";
+    } else {
+      print "Update was available, and was downloaded and installed successfully\n";
+    }
+  } elsif ($exit == 1) {
+    print "Update finished, no fresh updates were available\n";
+  } else {
+    print "Update failed, exiting with code $exit\n";
+  }
+}
+
 exit $exit;
 
 ##############################################################################
@@ -1422,6 +1443,7 @@
                           (default: @@LOCAL_STATE_DIR@@/@@VERSION@@)
   --refreshmirrors        Force the MIRRORED.BY file to be updated
   -D, --debug [area=n,...]  Print debugging messages
+  -v, --verbose           Be more verbose, like print updated channel names
   -V, --version           Print version
   -h, --help              Print usage message