You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2005/01/11 02:47:35 UTC
svn commit: r124864 - /spamassassin/trunk/MANIFEST /spamassassin/trunk/lib/Mail/SpamAssassin.pm /spamassassin/trunk/lib/Mail/SpamAssassin/Util/DependencyInfo.pm /spamassassin/trunk/spamassassin.raw
Author: jm
Date: Mon Jan 10 17:47:34 2005
New Revision: 124864
URL: http://svn.apache.org/viewcvs?view=rev&rev=124864
Log:
bug 3856: reinstate debug_diagnostics API, but move its implementation code to a lazily-loaded class with no external dependencies of its own; ie. open the way to running this from a separate tool
Added:
spamassassin/trunk/lib/Mail/SpamAssassin/Util/DependencyInfo.pm
Modified:
spamassassin/trunk/MANIFEST
spamassassin/trunk/lib/Mail/SpamAssassin.pm
spamassassin/trunk/spamassassin.raw
Modified: spamassassin/trunk/MANIFEST
Url: http://svn.apache.org/viewcvs/spamassassin/trunk/MANIFEST?view=diff&rev=124864&p1=spamassassin/trunk/MANIFEST&r1=124863&p2=spamassassin/trunk/MANIFEST&r2=124864
==============================================================================
--- spamassassin/trunk/MANIFEST (original)
+++ spamassassin/trunk/MANIFEST Mon Jan 10 17:47:34 2005
@@ -380,3 +380,4 @@
tools/sysreport
tools/test_extract
tools/triplets.pl
+lib/Mail/SpamAssassin/Util/DependencyInfo.pm
Modified: spamassassin/trunk/lib/Mail/SpamAssassin.pm
Url: http://svn.apache.org/viewcvs/spamassassin/trunk/lib/Mail/SpamAssassin.pm?view=diff&rev=124864&p1=spamassassin/trunk/lib/Mail/SpamAssassin.pm&r1=124863&p2=spamassassin/trunk/lib/Mail/SpamAssassin.pm&r2=124864
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin.pm Mon Jan 10 17:47:34 2005
@@ -1195,6 +1195,26 @@
###########################################################################
+=item $f->debug_diagnostics ()
+
+Output some diagnostic information, useful for debugging SpamAssassin
+problems.
+
+=cut
+
+sub debug_diagnostics {
+ my ($self) = @_;
+
+ # load this class lazily, to avoid overhead when this method isn't
+ # called.
+ eval {
+ require Mail::SpamAssassin::Util::DependencyInfo;
+ dbg(Mail::SpamAssassin::Util::DependencyInfo::debug_diagnostics($self));
+ };
+}
+
+###########################################################################
+
=item $failed = $f->lint_rules ()
Syntax-check the current set of rules. Returns the number of
Added: spamassassin/trunk/lib/Mail/SpamAssassin/Util/DependencyInfo.pm
Url: http://svn.apache.org/viewcvs/spamassassin/trunk/lib/Mail/SpamAssassin/Util/DependencyInfo.pm?view=auto&rev=124864
==============================================================================
--- (empty file)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Util/DependencyInfo.pm Mon Jan 10 17:47:34 2005
@@ -0,0 +1,60 @@
+# Helper code to debug dependencies and their versions.
+
+# <@LICENSE>
+# Copyright 2004 Apache Software Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# </...@LICENSE>
+
+package Mail::SpamAssassin::Util::DependencyInfo;
+
+use strict;
+use warnings;
+use bytes;
+
+use vars qw (
+ @MODULES
+);
+
+@MODULES = qw(
+ Net::DNS Razor2::Client::Agent MIME::Base64
+ IO::Socket::UNIX DB_File Digest::SHA1
+ DBI URI Net::LDAP Storable
+);
+
+###########################################################################
+
+=item $f->debug_diagnostics ()
+
+Output some diagnostic information, useful for debugging SpamAssassin
+problems.
+
+=cut
+
+sub debug_diagnostics {
+ my $out = "diag: perl platform: $] $^O\n";
+
+ foreach my $module (sort @MODULES) {
+ my $modver;
+ if (eval ' require '.$module.'; $modver = $'.$module.'::VERSION; 1;')
+ {
+ $modver ||= '(undef)';
+ $out .= "module installed: $module, version $modver\n";
+ } else {
+ $out .= "module not installed: $module ('require' failed)\n";
+ }
+ }
+ return $out;
+}
+
+1;
Modified: spamassassin/trunk/spamassassin.raw
Url: http://svn.apache.org/viewcvs/spamassassin/trunk/spamassassin.raw?view=diff&rev=124864&p1=spamassassin/trunk/spamassassin.raw&r1=124863&p2=spamassassin/trunk/spamassassin.raw&r2=124864
==============================================================================
--- spamassassin/trunk/spamassassin.raw (original)
+++ spamassassin/trunk/spamassassin.raw Mon Jan 10 17:47:34 2005
@@ -231,6 +231,7 @@
);
if ( $opt{'lint'} ) {
+ $spamtest->debug_diagnostics();
my $res = $spamtest->lint_rules();
warn "lint: $res issues detected. please rerun with debug enabled for more information.\n" if ($res);
exit $res ? 1: 0;