[Bps-public-commit] r11352 - in Shipwright/trunk/lib: . Shipwright/Script

sunnavy at bestpractical.com sunnavy at bestpractical.com
Tue Apr 1 20:55:09 EDT 2008


Author: sunnavy
Date: Tue Apr  1 20:55:07 2008
New Revision: 11352

Modified:
   Shipwright/trunk/lib/Shipwright.pm
   Shipwright/trunk/lib/Shipwright/Build.pm
   Shipwright/trunk/lib/Shipwright/Script/Build.pm

Log:
added perl arg for build cmd

Modified: Shipwright/trunk/lib/Shipwright.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright.pm	(original)
+++ Shipwright/trunk/lib/Shipwright.pm	Tue Apr  1 20:55:07 2008
@@ -39,6 +39,8 @@
 
 build part:
 
+    perl: the path of perl that runs the cmds in scripts/foo/build(.pl)
+          default is $^X, the one that is running shipwright
     skip: hashref of which the keys are the skipped dists when install
           default is undefined
     skip_test: skip test or not. default is false

Modified: Shipwright/trunk/lib/Shipwright/Build.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Build.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Build.pm	Tue Apr  1 20:55:07 2008
@@ -110,6 +110,26 @@
                 File::Spec->catfile( 'shipwright', 'flags.yml' ) );
         }
 
+        unless ( $self->perl && -e $self->perl ) {
+            my $perl =
+              File::Spec->catfile( $self->install_base, 'bin', 'perl' );
+
+            # -e $perl makes sense when we install on to another vessel
+            if (
+                (
+                    ( grep { $_ eq 'perl' } @{ $self->order } )
+                    && !$self->skip->{perl}
+                )
+                || -e $perl
+              )
+            {
+                $self->perl($perl);
+            }
+            else {
+                $self->perl($^X);
+            }
+        }
+
         for my $dist ( @{ $self->order } ) {
 
             # $flags->{$dist} is undef means 'default', will be installed
@@ -144,7 +164,7 @@
             "found build.pl for $dir, will install $dir using that");
         Shipwright::Util->run(
             [
-                $self->perl || $^X,
+                $self->perl,
                 File::Spec->catfile( '..', '..', 'scripts', $dir, 'build.pl' ),
                 '--install-base' => $self->install_base,
                 '--flags'        => join( ',', keys %{ $self->flags } ),
@@ -229,7 +249,7 @@
             open my $fh, '<', $file or die "can't open $file: $!";
             my $shebang = <$fh>;
             my $base    = quotemeta $self->install_base;
-            my $perl    = quotemeta $self->perl || $^X;
+            my $perl    = quotemeta $self->perl;
 
             if ( $shebang =~ m{$perl} ) {
                 $type = 'perl';
@@ -282,7 +302,7 @@
 
     return unless $text;
 
-    my $perl          = $self->perl || $^X;
+    my $perl          = $self->perl;
     my $perl_archname = `$perl -MConfig -e 'print \$Config{archname}'`;
     my $install_base  = $self->install_base;
     $text =~ s/%%PERL%%/$perl/g;

Modified: Shipwright/trunk/lib/Shipwright/Script/Build.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Script/Build.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Script/Build.pm	Tue Apr  1 20:55:07 2008
@@ -7,7 +7,7 @@
 use base qw/App::CLI::Command Class::Accessor::Fast Shipwright::Script/;
 __PACKAGE__->mk_accessors(
     qw/repository log_level install_base build_base skip skip_test only_test
-      force log_file flags name/
+      force log_file flags name perl/
 );
 
 use Shipwright;
@@ -27,6 +27,7 @@
         'skip-test'      => 'skip_test',
         'only-test'      => 'only_test',
         'force'          => 'force',
+        'perl'           => 'perl',
     );
 }
 
@@ -61,7 +62,7 @@
     my $shipwright = Shipwright->new(
         map { $_ => $self->$_ }
           qw/repository log_level log_file skip skip_test
-          flags name force only_test install_base/
+          flags name force only_test install_base perl/
     );
 
     $shipwright->backend->export( target => $shipwright->build->build_base );
@@ -89,6 +90,7 @@
    --only-test        just test(the running script is t/test)
    --flags            specify flags
    --name             specify the name of the project
+   --perl             specify the path of perl that run the cmds in scripts/
 
 =head1 AUTHOR
 



More information about the Bps-public-commit mailing list