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/11/12 23:11:08 UTC

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

Author: felicity
Date: Sat Nov 12 14:11:06 2005
New Revision: 332850

URL: http://svn.apache.org/viewcvs?rev=332850&view=rev
Log:
allow mkrules to put conditionals around unknown lines if necessary

Modified:
    spamassassin/trunk/build/mkrules

Modified: spamassassin/trunk/build/mkrules
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/build/mkrules?rev=332850&r1=332849&r2=332850&view=diff
==============================================================================
--- spamassassin/trunk/build/mkrules (original)
+++ spamassassin/trunk/build/mkrules Sat Nov 12 14:11:06 2005
@@ -242,7 +242,8 @@
   # another "fake name" for lines that should always be published, to an
   # output file with the same name as the input file.
   my $ALWAYS_PUBLISH = '!always_publish!';
-  $rules->{$ALWAYS_PUBLISH} = { text => '', publish => 0 };
+  $rules->{$ALWAYS_PUBLISH} = rule_entry_create();
+  my %ALWAYS = ( $ALWAYS_PUBLISH => 1 );
 
   # an "ifplugin" or "if" scope
   my $current_conditional;
@@ -334,8 +335,18 @@
       undef $current_conditional;
     }
     else {
+      my $NAME = $ALWAYS_PUBLISH;
+      if ($current_conditional) {
+        $NAME .= $current_conditional . '!';
+        unless ($rules->{$NAME}) {
+	  $rules->{$NAME} = rule_entry_create();
+	  $ALWAYS{$NAME} = 1;
+	}
+	$rules->{$NAME}->{cond} = $current_conditional;
+      }
+
       # warn "unknown line in rules file '$f', saving to default: $orig";
-      $rules->{$ALWAYS_PUBLISH}->{text} .= $orig;
+      $rules->{$NAME}->{text} .= $orig;
     }
   }
   close IN;
@@ -343,7 +354,7 @@
   # now append all the found text to the output file buffers
   my %already_done = ();
   my $copied = 0;
-  foreach my $name ($ALWAYS_PUBLISH, @$rule_order)
+  foreach my $name (@$rule_order, keys(%ALWAYS))
   {
     # only do each rule once, please ;)
     next if exists $already_done{$name};