[Bps-public-commit] r10431 - bpsbuilder/Shipwright/lib/Shipwright/Source

sunnavy at bestpractical.com sunnavy at bestpractical.com
Tue Jan 22 14:22:56 EST 2008


Author: sunnavy
Date: Tue Jan 22 14:22:55 2008
New Revision: 10431

Modified:
   bpsbuilder/Shipwright/lib/Shipwright/Source/Base.pm

Log:
automatically add Module::Build or ExtUtils::MakeMaker as build_requires once we find it is necessary, ExtUtils::MakeMaker need 6.31 or later since we want the INSTALL_BASE arg ;)

Modified: bpsbuilder/Shipwright/lib/Shipwright/Source/Base.pm
==============================================================================
--- bpsbuilder/Shipwright/lib/Shipwright/Source/Base.pm	(original)
+++ bpsbuilder/Shipwright/lib/Shipwright/Source/Base.pm	Tue Jan 22 14:22:55 2008
@@ -57,13 +57,17 @@
 
         if ( -e 'Build.PL' ) {
             Shipwright::Util->run( [ $^X, 'Build.PL' ] );
-            my $source =
-              read_file( File::Spec->catfile( '_build', 'prereqs' ) );
+            my $source = read_file( File::Spec->catfile( '_build', 'prereqs' ) )
+              or die "can't read _build/prereqs: $!";
             my $eval .= '$require = ' . $source;
             eval $eval or die "eval error: $@";
 
-            unless ( $require->{build_requires}{'Module::Build'} ) {
-                $require->{build_requires} = { 'Module::Build' => 0 };
+            $source = read_file( File::Spec->catfile('Build.PL') )
+              or die "can't read Build.PL: $!";
+            if ( $source =~ /use Module::Build/ ) {
+                unless ( $require->{build_requires}{'Module::Build'} ) {
+                    $require->{build_requires} = { 'Module::Build' => 0 };
+                }
             }
             Shipwright::Util->run( [ './Build', 'realclean' ] );
         }
@@ -79,6 +83,18 @@
                 $require->{requires}{$_} = delete $require->{$_};
             }
 
+            $source = read_file('Makefile.PL')
+              or die "can't read Makefile.PL: $!";
+
+            if ( grep { /use ExtUtils::MakeMaker/ } $source ) {
+                unless ( defined $require->{requires}{'ExtUtils::MakeMaker'}
+                    && $require->{requires}{'ExtUtils::MakeMaker'} >= 6.31 )
+                {
+                    $require->{build_requires} =
+                      { 'ExtUtils::MakeMaker' => 6.31 };
+                }
+            }
+
       # Makefile doesn't have recommends or build_requires stuff, we need to fix
       # that accroding to META.yml
             my $meta_path = File::Spec->catfile( $path, 'META.yml' );



More information about the Bps-public-commit mailing list