Mailing List Archive

svn commit: r329762 - in /spamassassin/trunk/masses: mass-check rule-qa/automc/gen_info_xml rule-qa/automc/ruleqa.cgi rule-qa/corpus-hourly
Author: jm
Date: Sun Oct 30 22:50:58 2005
New Revision: 329762

URL: http://svn.apache.org/viewcvs?rev=329762&view=rev
Log:
mass-check: report switches; automc: nicer UI for the overview links

Added:
spamassassin/trunk/masses/rule-qa/automc/gen_info_xml (with props)
Modified:
spamassassin/trunk/masses/mass-check
spamassassin/trunk/masses/rule-qa/automc/ruleqa.cgi
spamassassin/trunk/masses/rule-qa/corpus-hourly

Modified: spamassassin/trunk/masses/mass-check
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/masses/mass-check?rev=329762&r1=329761&r2=329762&view=diff
==============================================================================
--- spamassassin/trunk/masses/mass-check (original)
+++ spamassassin/trunk/masses/mass-check Sun Oct 30 22:50:58 2005
@@ -117,6 +117,7 @@
$opt_learn = 0;
$reuse_rules_loaded_p = 0;

+my @ORIG_ARGV = @ARGV;
GetOptions("c=s", "p=s", "f=s", "j=i", "n", "o", "all", "bayes", "debug:s",
"hamlog=s", "head=i", "loghits", "mh", "mid", "ms", "net",
"progress", "rewrite:s", "showdots", "spamlog=s", "tail=i",
@@ -227,11 +228,13 @@
chomp $when;
chomp $host;
my $revision = get_current_svn_revision();
+my $cmdline = join(' ',@ORIG_ARGV); $cmdline =~ s/\s+/ /gs;

my $log_header = "# mass-check results from $who\@$where, on $when\n" .
"# M:SA version ".$spamtest->Version()."\n" .
"# SVN revision: $revision\n" .
- "# Perl version: $] on $Config{archname}\n";
+ "# Perl version: $] on $Config{archname}\n" .
+ "# Switches: '$cmdline'\n";

my $updates = 10;
my $total_count = 0;

Added: spamassassin/trunk/masses/rule-qa/automc/gen_info_xml
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/masses/rule-qa/automc/gen_info_xml?rev=329762&view=auto
==============================================================================
--- spamassassin/trunk/masses/rule-qa/automc/gen_info_xml (added)
+++ spamassassin/trunk/masses/rule-qa/automc/gen_info_xml Sun Oct 30 22:50:58 2005
@@ -0,0 +1,85 @@
+#!/local/perl586/bin/perl -w
+my $automcdir = "/home/automc/svn/spamassassin/masses/rule-qa/automc";
+
+use XML::Simple;
+
+use strict;
+use bytes;
+use POSIX qw(strftime);
+
+my $myperl = $^X;
+
+open (CF, "<$automcdir/config");
+my %conf; while(<CF>) { /^(\S+)=(\S+)/ and $conf{$1} = $2; }
+close CF;
+
+die "no conf{html}: $conf{html}" unless (-d $conf{html});
+
+# all known date/revision combos. warning: could get slow in future
+my @daterevs = get_all_daterevs();
+
+foreach my $dr (@daterevs) {
+ my $drdir = get_datadir_for_daterev($dr);
+ if (-f "$drdir/info.xml" && -s _) {
+ print "$drdir/info.xml: good\n";
+ }
+
+ print "$drdir/info.xml: creating...\n";
+ my $info = get_info($dr, $drdir);
+ open (OUT, ">$drdir/info.xml") or die "cannot write $drdir/info.xml";
+ print OUT $info;
+ close OUT or die "failed to write to $drdir/info.xml";
+}
+
+sub get_info {
+ my ($dr, $drdir) = @_;
+
+ $dr =~ /^(\d+)[-\/]r(\d+)$/;
+ my $date = $1;
+ my $rev = $2;
+
+ my $info = {
+ date => $date,
+ rev => $rev,
+ includes_net => 0
+ };
+
+ if (open (IN, "svn log --xml -r$rev |")) {
+ eval {
+ my $xml = join('', <IN>);
+ my $ref = XMLin($xml);
+ $info->{msg} = $ref->msg;
+ $info->{checkin_date} = $ref->date; # '2005-10-31T04:20:10.686485Z'
+ $info->{author} = $ref->author;
+ };
+ if ($@) {
+ warn "svn xml: $@";
+ }
+ close IN or warn "svn failed: $!";
+ }
+
+ if (-f "$drdir/NET.all") {
+ $info->{includes_net} = 1;
+ }
+
+ return XMLout($info);
+}
+
+sub get_all_daterevs {
+ return sort map {
+ s/^.*\/(\d+)\/(r\d+)$/$1-$2/; $_;
+ } grep { /\/(\d+\/r\d+)$/ && -d $_ } (<$conf{html}/2*/r*>);
+}
+
+sub get_datadir_for_daterev {
+ my $npath = shift;
+ $npath =~ s/-/\//;
+ return $conf{html}."/".$npath."/";
+}
+
+=cut
+
+to install, add this line to httpd.conf:
+
+ ScriptAlias /ruleqa "/path/to/spamassassin/automc/ruleqa.cgi"
+

Propchange: spamassassin/trunk/masses/rule-qa/automc/gen_info_xml
------------------------------------------------------------------------------
svn:executable = *

Modified: spamassassin/trunk/masses/rule-qa/automc/ruleqa.cgi
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/masses/rule-qa/automc/ruleqa.cgi?rev=329762&r1=329761&r2=329762&view=diff
==============================================================================
--- spamassassin/trunk/masses/rule-qa/automc/ruleqa.cgi (original)
+++ spamassassin/trunk/masses/rule-qa/automc/ruleqa.cgi Sun Oct 30 22:50:58 2005
@@ -7,6 +7,7 @@
use CGI;
use Template;
use Date::Manip;
+use XML::Simple;

use strict;
use bytes;
@@ -257,7 +258,6 @@
my ($key, $daycount);
while (($key, $daycount) = each %{$days}) {
my $dr = date_in_direction($daterev, $daycount);
- my $drtext = $dr;
if (!$dr) {
$tmpl =~ s/!daylink${key}!/
(no logs<br\/>available)
@@ -265,7 +265,7 @@
}
else {
$dr = gen_switch_url("daterev", $dr);
- $drtext =~ s,-,-<br/>,gs; # allow line-break
+ my $drtext = get_daterev_description($dr);

$tmpl =~ s/!daylink${key}!/
<a href="$dr">$drtext<\/a>
@@ -274,8 +274,7 @@
}

$daterev = date_in_direction($daterev, 0);
-my $todaytext = $daterev;
-$todaytext =~ s,-,-<br/>,gs; # allow line-break
+my $todaytext = get_daterev_description($daterev);
$tmpl =~ s/!todaytext!/$todaytext/gs;


@@ -793,6 +792,39 @@
my $npath = shift;
$npath =~ s/-/\//;
return $conf{html}."/".$npath."/";
+}
+
+sub get_daterev_description {
+ my ($dr) = @_;
+ my $fname = get_datadir_for_daterev($dr)."/info.xml";
+
+ my $txt;
+ if (-f $fname) {
+ eval {
+ my $info = XMLin($fname);
+ my $net = $info->{includes_net} ?
+ "[net]" :
+ "";
+
+ $txt = qq{
+
+ $info->{date} <br/>
+ $info->{rev} <br/>
+ $info->{checkin_date} <br/>
+ $info->{author} <br/>
+ $net
+
+ };
+
+ return $txt;
+ };
+ }
+
+ # if that failed, just use the daterev itself.
+
+ $txt = $dr;
+ $txt =~ s,-,-<br/>,gs; # allow line-break
+ return $txt;
}

=cut

Modified: spamassassin/trunk/masses/rule-qa/corpus-hourly
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/masses/rule-qa/corpus-hourly?rev=329762&r1=329761&r2=329762&view=diff
==============================================================================
--- spamassassin/trunk/masses/rule-qa/corpus-hourly (original)
+++ spamassassin/trunk/masses/rule-qa/corpus-hourly Sun Oct 30 22:50:58 2005
@@ -469,6 +469,7 @@
}

$output_revpath = $revpath; # set the global
+ $output_revpath =~ s/\//-/; # looks nicer

return $dir;
}