[Bps-public-commit] r11111 - Shipwright/trunk/share/bin

sunnavy at bestpractical.com sunnavy at bestpractical.com
Wed Mar 19 01:03:48 EDT 2008


Author: sunnavy
Date: Wed Mar 19 01:03:46 2008
New Revision: 11111

Modified:
   Shipwright/trunk/share/bin/shipwright-builder

Log:
handle $args{perl} stuff better: 1. ony use $args{perl} if the $args{perl} really exists; 2. $^X returns "perl" on darwin, which is not good for -e test

Modified: Shipwright/trunk/share/bin/shipwright-builder
==============================================================================
--- Shipwright/trunk/share/bin/shipwright-builder	(original)
+++ Shipwright/trunk/share/bin/shipwright-builder	Wed Mar 19 01:03:46 2008
@@ -77,15 +77,6 @@
     open $log, '>', 'clean.log' or die $!;
 
     $args{'install-base'} = get_install_base() unless $args{'install-base'};
-    unless ( $args{perl} ) {
-        if ( -e File::Spec->catfile( $args{'install-base'}, 'bin', 'perl' ) ) {
-            $args{perl} =
-              File::Spec->catfile( $args{'install-base'}, 'bin', 'perl' );
-        }
-        else {
-            $args{perl} = $^X;
-        }
-    }
 
     for my $dist (@$order) {
         unless ( grep { $dist eq $_ } @{ $args{skip} } ) {
@@ -125,16 +116,13 @@
     print $fh $args{'install-base'};
     close $fh;
 
-    unless ( $args{perl} ) {
+    unless ( $args{perl} && -e $args{perl} ) {
         if ( ( grep { $_ eq 'perl' } @$order )
             && !( grep { $_ eq 'perl' } @{ $args{skip} } ) )
         {
             $args{perl} =
               File::Spec->catfile( $args{'install-base'}, 'bin', 'perl' );
         }
-        else {
-            $args{perl} = $^X;
-        }
     }
 
     {
@@ -304,14 +292,19 @@
     my $install_base  = $args{'install-base'};
     $text =~ s/%%INSTALL_BASE%%/$install_base/g;
 
-    my $perl = $args{'perl'} || $^X;
+    my $perl;
 
-    if ( -e $perl ) {
-        # we only need to substitute below stuff if $perl exists;
-        my $perl_archname = `$perl -MConfig -e 'print \$Config{archname}'`;
-        $text =~ s/%%PERL%%/$perl/g;
-        $text =~ s/%%PERL_ARCHNAME%%/$perl_archname/g;
+    if ( $args{perl} && -e $args{perl} ) {
+        $perl = $args{perl};
     }
+    else {
+        $perl = $^X;
+    }
+
+    my $perl_archname = `$perl -MConfig -e 'print \$Config{archname}'`;
+    $text =~ s/%%PERL%%/$perl/g;
+    $text =~ s/%%PERL_ARCHNAME%%/$perl_archname/g;
+    
 
     return $text;
 }



More information about the Bps-public-commit mailing list