You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by do...@apache.org on 2007/04/20 00:04:47 UTC
svn commit: r530564 -
/spamassassin/rules/trunk/sandbox/dos/new-rule-score-gen/merge-scoresets
Author: dos
Date: Thu Apr 19 15:04:46 2007
New Revision: 530564
URL: http://svn.apache.org/viewvc?view=rev&rev=530564
Log:
add option to omit score lines for rules that were active, say, in the last net run but not in the current non-net run which the current sa-update is based on (to avoid SA bitching about scores for non-existant rules)
Modified:
spamassassin/rules/trunk/sandbox/dos/new-rule-score-gen/merge-scoresets
Modified: spamassassin/rules/trunk/sandbox/dos/new-rule-score-gen/merge-scoresets
URL: http://svn.apache.org/viewvc/spamassassin/rules/trunk/sandbox/dos/new-rule-score-gen/merge-scoresets?view=diff&rev=530564&r1=530563&r2=530564
==============================================================================
--- spamassassin/rules/trunk/sandbox/dos/new-rule-score-gen/merge-scoresets (original)
+++ spamassassin/rules/trunk/sandbox/dos/new-rule-score-gen/merge-scoresets Thu Apr 19 15:04:46 2007
@@ -1,14 +1,34 @@
#!/usr/bin/perl
+# merges the scores found in score-setN into a singles scores file
+# if called with a scoreset parameter N, only rules that appear in
+# that score-setN file will used (score lines for rules only found
+# in other score-set files will be ignored)
+
use strict;
use warnings;
my %rules;
+my $active_rule_set;
+$active_rule_set = $ARGV[0] if (defined $ARGV[0] && $ARGV[0] =~ /^[0-3]$/);
+
+if (defined $active_rule_set) {
+ open (SCORES, "scores-set$active_rule_set") or die "Cannot open scores-set$active_rule_set: $!";
+ while(<SCORES>) {
+ next unless /^score (\S+)\s+(-?[\d.]+)$/;
+ @{$rules{$1}} = ('0.000', '0.000' ,'0.000', '0.000');
+ $rules{$1}[$active_rule_set] = $2;
+ }
+ close SCORES;
+}
+
for (my $i = 0; $i < 4; $i++) {
+ next if (defined $active_rule_set && $i == $active_rule_set);
open (SCORES, "scores-set$i") or die "Cannot open scores-set$i: $!";
while(<SCORES>) {
next unless /^score (\S+)\s+(-?[\d.]+)$/;
+ next if (defined $active_rule_set && !exists $rules{$1});
@{$rules{$1}} = ('0.000', '0.000' ,'0.000', '0.000') unless exists $rules{$1};
$rules{$1}[$i] = $2;
}