#!/usr/bin/perl -w use strict; sub run; my $BYMAILCF = '/export/home/bbmass/bymail/latest.cf'; # Mar 6 2007 jm: use the "Cool Tools" Solaris-optimized perl my $perl = '/usr/local/bin/perl'; # my $perl = $^X; if (!$perl) { die "no perl path found in ARGV!"; } my $slavename; $|=1; my $pwd = `pwd`; $pwd =~ /slaves\/([-_A-Za-z0-9]+)\//; if ($1) { $slavename = $1; } else { die "cannot work out slavename! $pwd"; } my %mass_check_args = ( 'mc-fast' => '--tail=1000', 'mc-med' => '--tail=6000 --head=5000', 'mc-slow' => '--tail=16000 --head=10000', 'mc-slower' => '--tail=36000 --head=20000', ); # super-nice please! # system ("renice +19 $$"); $ENV{'TMPDIR'} = '/tmpfs'; # cd to masses # chdir "masses" or die; unlink ("ham.log", "spam.log"); # change of plan: mass-check the entire ruleset # system ("rm -rf tstrules"); run "mkdir tstrules"; run "cp ../rules/*.* tstrules"; run "cp plugins/*.* tstrules"; # well, ok just those, and anything that's been mailed-in # if (-f 'mailed.cf') { run "cp mailed.cf tstrules/70_mailed.cf"; } run "ls -l tstrules"; # lint those rule files, and abort if they fail; this is a sanity check # now that we have mailed-in rules used in this mass-check # # Feb 20 2007 jm: actually, go ahead and mass-check anyway. Note that # the "make test" continuous integration buildbot will issue warnings # about the lint failure, so we don't need to do that here. # if (run ("../spamassassin --lint -x -C tstrules", 1) != 0) { warn "*** lint failed; performing mass-check ANYWAY! ***\n\n"; # still, delete the mailed-in stuff. warn "Deleting 'mailed.cf', if it exists.\n"; unlink $BYMAILCF; unlink "tstrules/70_mailed.cf"; } else { print "lint passed.\n"; } # create the user_prefs file for the mass-check. Settings: turn off Bayes; # turn off the auto-whitelist. mkdir "spamassassin"; open PREFS, ">spamassassin/user_prefs"; print PREFS q{ use_bayes 0 use_auto_whitelist 0 }; close PREFS or die "cannot create 'spamassassin/user_prefs' file: $! $@"; # notes on this mass-check command: # # this is run in a chroot jail, just in case there's hostile rule code in # there. # de-encapsulate 'report_safe' messages from petuniapress.com. # produce lots of noisy output to stop the buildbot from timing out on # mass-checks of large corpora. # store AICache data in /tmpfs/aicache. # ignore mails older than 6 months (use the nightly runs for those corpora, # it's too slow to mass-check them here). run "/local/bbmasstools/masschroot $perl ". "mass-check -c=tstrules --cache -j=1 ". "--noisy --deencap='petuniapress.com' ". "--cachedir=/tmpfs/aicache ". "--after='6 months ago' ". $mass_check_args{$slavename}." ". "ham:detect:/export/home/bbmass/rawcor/*/ham/* ". "spam:detect:/export/home/bbmass/rawcor/*/spam/*"; exit; # --------------------------------------------------------------------------- sub run { my ($cmd, $ignoreexit) = @_; print "[$cmd]\n"; system ($cmd); if (!$ignoreexit) { die "command '$cmd' failed with status $?" if (($? >> 8) != 0); } else { return ($? >> 8); } }