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 2009/06/12 01:07:30 UTC
svn commit: r783956 - /spamassassin/trunk/masses/rule-qa/reports-from-logs
Author: jm
Date: Thu Jun 11 23:07:30 2009
New Revision: 783956
URL: http://svn.apache.org/viewvc?rev=783956&view=rev
Log:
ugh. dealing with SVN is such a pain
Modified:
spamassassin/trunk/masses/rule-qa/reports-from-logs
Modified: spamassassin/trunk/masses/rule-qa/reports-from-logs
URL: http://svn.apache.org/viewvc/spamassassin/trunk/masses/rule-qa/reports-from-logs?rev=783956&r1=783955&r2=783956&view=diff
==============================================================================
--- spamassassin/trunk/masses/rule-qa/reports-from-logs (original)
+++ spamassassin/trunk/masses/rule-qa/reports-from-logs Thu Jun 11 23:07:30 2009
@@ -473,18 +473,29 @@
my ($rev, $args) = @_;
$rev ||= 'HEAD';
+ (-d "$cf{tmp}/hfdir") or system("mkdir -p $cf{tmp}/hfdir");
my $hfdir = "$cf{tmp}/hfdir/r$rev";
print "setting up hit-frequencies for r$rev in $hfdir\n";
- (-d "$cf{tmp}/hfdir") or system("mkdir $cf{tmp}/hfdir");
- if (!-d $hfdir) {
- system ("cp -pr $cf{tree} $hfdir");
- ($?>>8 != 0) and die "cp $cf{tree}/masses $hfdir failed";
+ my $needs_checkout = 0;
+ if (-d $hfdir && chdir $hfdir) {
+ system("svn up -r$rev && svn up -r$rev rulesrc");
+ if ($?>>8 != 0) {
+ print "simple 'svn update' failed. performing full checkout instead...\n";
+ $needs_checkout = 1;
+ }
+ } else {
+ $needs_checkout = 1;
}
+ if ($needs_checkout) {
+ my $svnurl = get_svn_url();
+ system("rm -rf $hfdir");
+ system("svn co $svnurl\@$rev $hfdir");
+ if ($?>>8 != 0) { die "svn co failed"; }
+ }
chdir "$hfdir" or die "cannot chdir $hfdir";
- system("svn up -r$rev; svn up -r$rev rulesrc");
# ensure these are rebuilt
system("rm -f rules/70_sandbox.cf rules/72_active.cf");
@@ -500,6 +511,18 @@
}
# ---------------------------------------------------------------------------
+
+sub get_svn_url {
+ open (SVNINFO, "svn info $cf{tree}|") or die "cannot run svn info";
+ my $svnurl;
+ while (<SVNINFO>) {
+ /URL: (.*)$/ and $svnurl = $1;
+ }
+ close SVNINFO or die "cannot close svn info";
+ return $svnurl;
+}
+
+# ---------------------------------------------------------------------------
sub gen_report_logs {
my ($fname, $hamref, $spamref) = @_;