#!/usr/bin/perl # CHANGEME! my $USER = 'you@somewhere.org'; my $PASS = 'yourpassword'; open (TST, ") { chomp; push (@togo, $_); } close TST; open (IN, ") { chomp; / (\S+)\s*$/ and $freq{$1} = $_; } close IN; use HTTP::Request::Common qw(POST); use LWP::UserAgent; use HTTP::Cookies; $ua = LWP::UserAgent->new; $ua->cookie_jar(HTTP::Cookies->new(file => "lwpcookies.txt", autosave => 1)); my $lreq = POST 'http://issues.apache.org/SpamAssassin/query.cgi', [ GoAheadAndLogIn => '1', Bugzilla_login => $USER, Bugzilla_password => $PASS, GoAheadAndLogIn => 'Login' ]; my $result = $ua->request($lreq)->as_string; if ($result =~ /Log out<.a> \Q$USER\E/ ){ print "logged in as $USER\n"; } else { die "cannot login as $USER"; } foreach my $test (@togo) { my $grep = ''; open (GREP, "grep $test ../rules/*.cf |"); while () { s/^\S+://g; next if /^score/; next if /^#/; next if (/_$test/ || /${test}_/); $grep .= $_; } close GREP; my $DESC = "$test low-performing rule pruned"; my $LONGDESC = "Removed $test from HEAD cvs. hit frequencies: OVERALL% SPAM% NONSPAM% S/O RANK SCORE NAME $freq{$test} test code from all files in rules dir: $grep If you want to re-add this test to SpamAssassin, please follow up this bug entry, improving the code until the S/O ratio goes above 0.7 (or below 0.3 for nice tests). (automated submission) "; print ("-" x 75); print "\nDesc: $DESC\n$LONGDESC\n\n"; my $req = POST 'http://issues.apache.org/SpamAssassin/post_bug.cgi', [ reporter => 'jm@jmason.org', product => 'Spamassassin', version => 'current-CVS', component => 'Rules', rep_platform => 'Other', op_sys => 'other', priority => 'P4', bug_severity => 'trivial', assigned_to => '', bug_file_loc => 'http://', short_desc => $DESC, comment => $LONGDESC, form_name => 'enter_bug' ]; $result = $ua->request($req)->as_string; #$result = "

Bug 0 posted

"; if ($result =~ /

Bug (\d+) posted<.H2>/) { print "created: bug $1\n"; } else { warn "failed to file bug! see file 'failure' for details\n"; open (O, ">failure"); print O $result; close O; } }