[Bps-public-commit] r9987 - bpsbuilder/BPB/lib/BPB

sunnavy at bestpractical.com sunnavy at bestpractical.com
Tue Dec 18 02:58:26 EST 2007


Author: sunnavy
Date: Tue Dec 18 02:58:26 2007
New Revision: 9987

Modified:
   bpsbuilder/BPB/lib/BPB/Build.pm

Log:
_build can have %%PERL%% and %%INSTALL_BASE%% now :)

Modified: bpsbuilder/BPB/lib/BPB/Build.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Build.pm	(original)
+++ bpsbuilder/BPB/lib/BPB/Build.pm	Tue Dec 18 02:58:26 2007
@@ -14,6 +14,7 @@
 use File::Copy::Recursive qw/dircopy/;
 use File::Copy qw/move/;
 use File::Find qw/find/;
+use File::Slurp;
 
 sub new {
     my $class = shift;
@@ -62,6 +63,7 @@
     my @commands;
 
     if ( -f '_build' ) {
+        $self->_substitute('_build');
         chmod '0755', '_build';
         system( './_build' );
     }
@@ -131,6 +133,20 @@
 }
 
 
+sub _substitute {
+    my $self = shift;
+    my $file = shift;
+    return unless $file;
+
+    my $text = read_file( $file );
+    my $perl = $self->perl;
+    my $install_base = $self->install_base;
+    $text =~ s/%%PERL%%/$perl/g;
+    $text =~ s/%%INSTALL_BASE%%/$install_base/g;
+    write_file( $file, $text );
+}
+
+
 1;
 
 __END__



More information about the Bps-public-commit mailing list