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/07/10 02:11:51 UTC
svn commit: r420376 - /spamassassin/branches/3.1/sa-update.raw
Author: felicity
Date: Sun Jul 9 17:11:51 2006
New Revision: 420376
URL: http://svn.apache.org/viewvc?rev=420376&view=rev
Log:
bug 4862: sa-update should replace @@VAR@@ macros for update files, such that report_contact will be set appropriately after updates
Modified:
spamassassin/branches/3.1/sa-update.raw
Modified: spamassassin/branches/3.1/sa-update.raw
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.1/sa-update.raw?rev=420376&r1=420375&r2=420376&view=diff
==============================================================================
--- spamassassin/branches/3.1/sa-update.raw (original)
+++ spamassassin/branches/3.1/sa-update.raw Sun Jul 9 17:11:51 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;
@@ -803,7 +815,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;