You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by fe...@apache.org on 2005/12/05 05:08:18 UTC

svn commit: r353978 - /spamassassin/trunk/build/mkrules

Author: felicity
Date: Sun Dec  4 20:08:17 2005
New Revision: 353978

URL: http://svn.apache.org/viewcvs?rev=353978&view=rev
Log:
including perl modules (as plugins) in the sandbox area wasn't working.  first, to know the appropriate path to load from we need to use 'file start' and 'file end' markers.  second, we shouldn't limit plugins to be ##_name.pm.  third, process the modules first since the later cf files will try to load them.  fourth, don't treat the module like a config file -- lint will fail, so just copy the file.

Modified:
    spamassassin/trunk/build/mkrules

Modified: spamassassin/trunk/build/mkrules
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/build/mkrules?rev=353978&r1=353977&r2=353978&view=diff
==============================================================================
--- spamassassin/trunk/build/mkrules (original)
+++ spamassassin/trunk/build/mkrules Sun Dec  4 20:08:17 2005
@@ -108,7 +108,7 @@
 
 sub lint_output_files {
   foreach my $file (keys %{$files_to_lint}) {
-    my $text = $output_file_text->{$file};
+    my $text = join("\n", "file start $file", $output_file_text->{$file}, "file end $file");
     if (lint_rule_text($text) != 0) {
       warn "\nERROR: LINT FAILED, suppressing output: $file\n\n";
       delete $output_file_text->{$file};
@@ -137,7 +137,7 @@
   return if (!-f $path);
   
   # limit what will be copied from sandboxes
-  return if ($path =~ /sandbox/ && !/\d.*\.(?:cf|pm)$/i);
+  return if ($path =~ /sandbox/ && !/(?:\d.*\.cf|\.pm)$/i);
 
   # a bit of sanity please - no svn metadata ;)
   return if ($path =~ /\.svn/);
@@ -164,7 +164,14 @@
 sub compile_sorted {
   my ($sources) = @_;
 
-  foreach my $f (sort keys %$sources) {
+  # deal with the perl modules first, so that later linting w/ loadplugin will
+  # work appropriately.
+  foreach my $f (sort {
+    my ($ae) = $a =~ /\.(cf|pm)$/;
+    my ($be) = $b =~ /\.(cf|pm)$/;
+    return $be cmp $ae || $a cmp $b;
+    } keys %$sources) {
+
     my $entry = $needs_compile->{$f};
     my $t = $entry->{t};
 
@@ -177,7 +184,18 @@
 
     my $needs_rebuild = 1;
 
-    if ($entry->{dir} =~ /sandbox/) {
+    if ($entry->{filename} =~ /\.pm$/) {
+      # just copy the raw perl module over to the new area
+      # we can't really rename to avoid conflicts since the loadplugin lines
+      # are going to be all screwed up in that case.
+      if (-e $entry->{t}) {
+	warn "The perl module ".$entry->{t}." already exists, can't copy from ".$entry->{f}."\n";
+      }
+      else {
+        copy($entry->{f}, $entry->{t}) || warn "Couldn't copy ".$entry->{f}.": $!";
+      }
+    }
+    elsif ($entry->{dir} =~ /sandbox/) {
       rule_file_compile_sandbox($f, $t, $entry->{filename});
     }
     elsif ($entry->{dir} =~ /extra/) {