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 2006/06/27 08:24:07 UTC
svn commit: r417353 - /spamassassin/trunk/sa-update.raw
Author: felicity
Date: Mon Jun 26 23:24:07 2006
New Revision: 417353
URL: http://svn.apache.org/viewvc?rev=417353&view=rev
Log:
bug 4862: sa-update should do the same macro processing for update files that happens during installation
Modified:
spamassassin/trunk/sa-update.raw
Modified: spamassassin/trunk/sa-update.raw
URL: http://svn.apache.org/viewvc/spamassassin/trunk/sa-update.raw?rev=417353&r1=417352&r2=417353&view=diff
==============================================================================
--- spamassassin/trunk/sa-update.raw (original)
+++ spamassassin/trunk/sa-update.raw Mon Jun 26 23:24:07 2006
@@ -25,6 +25,18 @@
my $LOCAL_STATE_DIR = '@@LOCAL_STATE_DIR@@'; # substituted at 'make' time
use lib '@@INSTALLSITELIB@@'; # substituted at 'make' time
+# We want to do a small amount of macro processing during channel installs,
+# based on the values as passed in via 'make'
+my %MACRO_VALUES = (
+ 'VERSION' => '@@VERSION@@',
+ 'CONTACT_ADDRESS' => '@@CONTACT_ADDRESS@@',
+ 'PREFIX' => '@@PREFIX@@',
+ 'DEF_RULES_DIR' => '@@DEF_RULES_DIR@@',
+ 'LOCAL_RULES_DIR' => '@@LOCAL_RULES_DIR@@',
+ 'LOCAL_STATE_DIR' => '@@LOCAL_STATE_DIR@@',
+ 'INSTALLSITELIB' => '@@INSTALLSITELIB@@',
+);
+
# Standard perl modules
use File::Spec;
use File::Path;
@@ -812,7 +824,14 @@
dbg "extracting: $outfname";
if (open OUT, ">".$outfname) {
- print OUT $tar->get_content($file);
+ my $content = $tar->get_content($file);
+
+ # replace macros in the update files if it's a .pre or .cf
+ if ($outfname =~ /\.(?:pre|cf)$/) {
+ $content =~ s/\@\@([^\@]+)\@\@/$MACRO_VALUES{$1} || "\@\@$1\@\@"/ge;
+ }
+
+ print OUT $content;
if (!close OUT) {
warn "error: write failed to $outfname: $!";
goto failed;