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 2006/12/18 19:02:30 UTC

svn commit: r488376 - in /spamassassin/trunk: Makefile.PL sa-compile.raw sa-learn.raw sa-update.raw spamassassin.raw spamd/spamd.raw

Author: jm
Date: Mon Dec 18 10:02:29 2006
New Revision: 488376

URL: http://svn.apache.org/viewvc?view=rev&rev=488376
Log:
bug 4882: don't use relative paths in @INC in the installed SpamAssassin scripts; just in the uncompiled build tree

Modified:
    spamassassin/trunk/Makefile.PL
    spamassassin/trunk/sa-compile.raw
    spamassassin/trunk/sa-learn.raw
    spamassassin/trunk/sa-update.raw
    spamassassin/trunk/spamassassin.raw
    spamassassin/trunk/spamd/spamd.raw

Modified: spamassassin/trunk/Makefile.PL
URL: http://svn.apache.org/viewvc/spamassassin/trunk/Makefile.PL?view=diff&rev=488376&r1=488375&r2=488376
==============================================================================
--- spamassassin/trunk/Makefile.PL (original)
+++ spamassassin/trunk/Makefile.PL Mon Dec 18 10:02:29 2006
@@ -1116,10 +1116,10 @@
 		  -DCONTACT_ADDRESS="$(CONTACT_ADDRESS)"
 
 FIXBANG		= -Msharpbang \
+                  -Mconditional \
 		  -DPERL_BIN="$(PERL_BIN)" \
 		  -DPERL_WARN="$(PERL_WARN)" \
 		  -DPERL_TAINT="$(PERL_TAINT)"
-
 
 spamassassin: spamassassin.raw
 	$(PREPROCESS) $(FIXBYTES) $(FIXVARS) $(FIXBANG) -m$(PERM_RWX) -i$? -o$@

Modified: spamassassin/trunk/sa-compile.raw
URL: http://svn.apache.org/viewvc/spamassassin/trunk/sa-compile.raw?view=diff&rev=488376&r1=488375&r2=488376
==============================================================================
--- spamassassin/trunk/sa-compile.raw (original)
+++ spamassassin/trunk/sa-compile.raw Mon Dec 18 10:02:29 2006
@@ -25,29 +25,32 @@
 
 use File::Spec;
 
-BEGIN {
+BEGIN {                          # see comments in "spamassassin.raw" for doco
   my @bin = File::Spec->splitpath($0);
   my $bin = ($bin[0] ? File::Spec->catpath(@bin[0..1]) : $bin[1])
             || File::Spec->curdir;
 
   if (-e $bin.'/lib/Mail/SpamAssassin.pm'
-        || !-e '@@INSTALLSITELIB@@/Mail/SpamAssassin.pm')
+        || !-e '@@INSTALLSITELIB@@/Mail/SpamAssassin.pm' )
   {
-    if ( $bin eq '../' && -e '../blib/lib/Mail/SpamAssassin.pm' ) {
-      unshift(@INC, '../blib/lib');
-    }
-    else {
-      foreach (qw(lib ../lib/site_perl
-                  ../lib/spamassassin ../share/spamassassin/lib))
+    my $searchrelative;
+    $searchrelative = 1;    # disabled during "make install": REMOVEFORINST
+    if ($searchrelative && $bin eq '../' && -e '../blib/lib/Mail/SpamAssassin.pm')
+    {
+      unshift ( @INC, '../blib/lib' );
+    } else {
+      foreach ( qw(lib ../lib/site_perl
+                ../lib/spamassassin ../share/spamassassin/lib))
       {
-        my $dir = File::Spec->catdir($bin, split('/', $_));
-        if(-f File::Spec->catfile($dir, "Mail", "SpamAssassin.pm")) {
-          unshift(@INC, $dir); last;
-        }
+        my $dir = File::Spec->catdir( $bin, split ( '/', $_ ) );
+        if ( -f File::Spec->catfile( $dir, "Mail", "SpamAssassin.pm" ) )
+        { unshift ( @INC, $dir ); last; }
       }
     }
   }
 }
+
+
 
 use strict;
 use warnings;

Modified: spamassassin/trunk/sa-learn.raw
URL: http://svn.apache.org/viewvc/spamassassin/trunk/sa-learn.raw?view=diff&rev=488376&r1=488375&r2=488376
==============================================================================
--- spamassassin/trunk/sa-learn.raw (original)
+++ spamassassin/trunk/sa-learn.raw Mon Dec 18 10:02:29 2006
@@ -36,37 +36,26 @@
 
 use lib '@@INSTALLSITELIB@@';                # substituted at 'make' time
 
-BEGIN {
-  # Locate locally installed SA libraries *without* using FindBin, which generates
-  # warnings and causes more trouble than its worth.  We don't need to be too
-  # smart about this BTW.
+BEGIN {                          # see comments in "spamassassin.raw" for doco
   my @bin = File::Spec->splitpath($0);
-  my $bin = ($bin[0] ? File::Spec->catpath(@bin[0..1]) : $bin[1])  # /home/jm/foo -> /home/jm
-            || File::Spec->curdir;                                 # foo          -> .
+  my $bin = ($bin[0] ? File::Spec->catpath(@bin[0..1]) : $bin[1])
+            || File::Spec->curdir;
 
-  # check to make sure it wasn't just installed in the normal way.
-  # note that ./lib/Mail/SpamAssassin.pm takes precedence, for
-  # building SpamAssassin on a machine where an old version is installed.
   if (-e $bin.'/lib/Mail/SpamAssassin.pm'
-        || !-e '@@INSTALLSITELIB@@/Mail/SpamAssassin.pm')
+        || !-e '@@INSTALLSITELIB@@/Mail/SpamAssassin.pm' )
   {
-    # Firstly, are we running "make test" in the "t" dir?  the test files
-    # *need* to use 'blib', so that 'use bytes' is removed for pre-5.6 perls
-    # beforehand by the preproc.  However, ./spamassassin does not, as the
-    # preproc will have stripped out the "use rule files from cwd" code from
-    # Mail::SpamAssassin.  So we want to use blib just for the t scripts.
-    if ( $bin eq '../' && -e '../blib/lib/Mail/SpamAssassin.pm' ) {
-      unshift(@INC, '../blib/lib');
-    }
-    else {
-      # These are common paths where the SA libs might be found.
-      foreach (qw(lib ../lib/site_perl
-                  ../lib/spamassassin ../share/spamassassin/lib))
+    my $searchrelative;
+    $searchrelative = 1;    # disabled during "make install": REMOVEFORINST
+    if ($searchrelative && $bin eq '../' && -e '../blib/lib/Mail/SpamAssassin.pm')
+    {
+      unshift ( @INC, '../blib/lib' );
+    } else {
+      foreach ( qw(lib ../lib/site_perl
+                ../lib/spamassassin ../share/spamassassin/lib))
       {
-        my $dir = File::Spec->catdir($bin, split('/', $_));
-        if(-f File::Spec->catfile($dir, "Mail", "SpamAssassin.pm")) {
-          unshift(@INC, $dir); last;
-        }
+        my $dir = File::Spec->catdir( $bin, split ( '/', $_ ) );
+        if ( -f File::Spec->catfile( $dir, "Mail", "SpamAssassin.pm" ) )
+        { unshift ( @INC, $dir ); last; }
       }
     }
   }

Modified: spamassassin/trunk/sa-update.raw
URL: http://svn.apache.org/viewvc/spamassassin/trunk/sa-update.raw?view=diff&rev=488376&r1=488375&r2=488376
==============================================================================
--- spamassassin/trunk/sa-update.raw (original)
+++ spamassassin/trunk/sa-update.raw Mon Dec 18 10:02:29 2006
@@ -47,37 +47,26 @@
 use strict;
 use warnings;
 
-BEGIN {
-  # Locate locally installed SA libraries *without* using FindBin, which generates
-  # warnings and causes more trouble than its worth.  We don't need to be too
-  # smart about this BTW.
+BEGIN {                          # see comments in "spamassassin.raw" for doco
   my @bin = File::Spec->splitpath($0);
-  my $bin = ($bin[0] ? File::Spec->catpath(@bin[0..1]) : $bin[1])  # /home/jm/foo -> /home/jm
-            || File::Spec->curdir;                                 # foo          -> .
+  my $bin = ($bin[0] ? File::Spec->catpath(@bin[0..1]) : $bin[1])
+            || File::Spec->curdir;
 
-  # check to make sure it wasn't just installed in the normal way.
-  # note that ./lib/Mail/SpamAssassin.pm takes precedence, for
-  # building SpamAssassin on a machine where an old version is installed.
   if (-e $bin.'/lib/Mail/SpamAssassin.pm'
-        || !-e '@@INSTALLSITELIB@@/Mail/SpamAssassin.pm')
+        || !-e '@@INSTALLSITELIB@@/Mail/SpamAssassin.pm' )
   {
-    # Firstly, are we running "make test" in the "t" dir?  the test files
-    # *need* to use 'blib', so that 'use bytes' is removed for pre-5.6 perls
-    # beforehand by the preproc.  However, ./spamassassin does not, as the
-    # preproc will have stripped out the "use rule files from cwd" code from
-    # Mail::SpamAssassin.  So we want to use blib just for the t scripts.
-    if ( $bin eq '../' && -e '../blib/lib/Mail/SpamAssassin.pm' ) {
-      unshift(@INC, '../blib/lib');
-    }
-    else {
-      # These are common paths where the SA libs might be found.
-      foreach (qw(lib ../lib/site_perl
-                  ../lib/spamassassin ../share/spamassassin/lib))
+    my $searchrelative;
+    $searchrelative = 1;    # disabled during "make install": REMOVEFORINST
+    if ($searchrelative && $bin eq '../' && -e '../blib/lib/Mail/SpamAssassin.pm')
+    {
+      unshift ( @INC, '../blib/lib' );
+    } else {
+      foreach ( qw(lib ../lib/site_perl
+                ../lib/spamassassin ../share/spamassassin/lib))
       {
-        my $dir = File::Spec->catdir($bin, split('/', $_));
-        if(-f File::Spec->catfile($dir, "Mail", "SpamAssassin.pm")) {
-          unshift(@INC, $dir); last;
-        }
+        my $dir = File::Spec->catdir( $bin, split ( '/', $_ ) );
+        if ( -f File::Spec->catfile( $dir, "Mail", "SpamAssassin.pm" ) )
+        { unshift ( @INC, $dir ); last; }
       }
     }
   }

Modified: spamassassin/trunk/spamassassin.raw
URL: http://svn.apache.org/viewvc/spamassassin/trunk/spamassassin.raw?view=diff&rev=488376&r1=488375&r2=488376
==============================================================================
--- spamassassin/trunk/spamassassin.raw (original)
+++ spamassassin/trunk/spamassassin.raw Mon Dec 18 10:02:29 2006
@@ -44,31 +44,29 @@
   # check to make sure it wasn't just installed in the normal way.
   # note that ./lib/Mail/SpamAssassin.pm takes precedence, for
   # building SpamAssassin on a machine where an old version is installed.
-  if ( -e $bin . '/lib/Mail/SpamAssassin.pm'
-    || !-e '@@INSTALLSITELIB@@/Mail/SpamAssassin.pm' )
+  if (-e $bin.'/lib/Mail/SpamAssassin.pm'
+        || !-e '@@INSTALLSITELIB@@/Mail/SpamAssassin.pm' )
   {
+    my $searchrelative;
+    $searchrelative = 1;    # disabled during "make install": REMOVEFORINST
 
     # Firstly, are we running "make test" in the "t" dir?  the test files
     # *need* to use 'blib', so that 'use bytes' is removed for pre-5.6 perls
     # beforehand by the preproc.  However, ./spamassassin does not, as the
     # preproc will have stripped out the "use rule files from cwd" code from
     # Mail::SpamAssassin.  So we want to use blib just for the t scripts.
-    if ( $bin eq '../' && -e '../blib/lib/Mail/SpamAssassin.pm' ) {
+    # This is disabled during the "make install" process.
+    if ($searchrelative && $bin eq '../' && -e '../blib/lib/Mail/SpamAssassin.pm')
+    {
       unshift ( @INC, '../blib/lib' );
-    }
-    else {
-
+    } else {
       # These are common paths where the SA libs might be found.
-      foreach (
-        qw(lib ../lib/site_perl
-        ../lib/spamassassin ../share/spamassassin/lib)
-        )
+      foreach ( qw(lib ../lib/site_perl
+                ../lib/spamassassin ../share/spamassassin/lib))
       {
         my $dir = File::Spec->catdir( $bin, split ( '/', $_ ) );
-        if ( -f File::Spec->catfile( $dir, "Mail", "SpamAssassin.pm" ) ) {
-          unshift ( @INC, $dir );
-          last;
-        }
+        if ( -f File::Spec->catfile( $dir, "Mail", "SpamAssassin.pm" ) )
+        { unshift ( @INC, $dir ); last; }
       }
     }
   }

Modified: spamassassin/trunk/spamd/spamd.raw
URL: http://svn.apache.org/viewvc/spamassassin/trunk/spamd/spamd.raw?view=diff&rev=488376&r1=488375&r2=488376
==============================================================================
--- spamassassin/trunk/spamd/spamd.raw (original)
+++ spamassassin/trunk/spamd/spamd.raw Mon Dec 18 10:02:29 2006
@@ -22,13 +22,14 @@
 my $LOCAL_STATE_DIR = '@@LOCAL_STATE_DIR@@';    # substituted at 'make' time
 use lib '@@INSTALLSITELIB@@';                   # substituted at 'make' time
 
-BEGIN {    # added by jm for use inside the distro
-  if ( -e '../blib/lib/Mail/SpamAssassin.pm' ) {
-    unshift ( @INC, '../blib/lib' );
-  }
-  else {
-    unshift ( @INC, '../lib' );
-  }
+# added by jm for use inside the distro
+# This is disabled during the "make install" process.
+BEGIN {
+  if ( -e '../blib/lib/Mail/SpamAssassin.pm' ) {    # REMOVEFORINST
+    unshift ( @INC, '../blib/lib' );                # REMOVEFORINST
+  } else {                                          # REMOVEFORINST
+    unshift ( @INC, '../lib' );                     # REMOVEFORINST
+  }                                                 # REMOVEFORINST
 }
 
 use strict;