Author: BINGOS
Date: Sun Mar  8 06:32:42 2009
New Revision: 12577

Modified:
   CPANPLUS-Dist-Build/trunk/Changes
   CPANPLUS-Dist-Build/trunk/lib/CPANPLUS/Dist/Build.pm
   CPANPLUS-Dist-Build/trunk/lib/CPANPLUS/Dist/Build/Constants.pm

Log:
Ported the configure_requires functionality from CP::D::MM

Modified: CPANPLUS-Dist-Build/trunk/Changes
==============================================================================
--- CPANPLUS-Dist-Build/trunk/Changes   (original)
+++ CPANPLUS-Dist-Build/trunk/Changes   Sun Mar  8 06:32:42 2009
@@ -1,5 +1,9 @@
 Revision history for Perl extension CPANPLUS::Dist::Build.
 
+0.13_01 Sun Mar  8 13:32:01 GMT 2009
+
+  - Ported the 'configure_requires' functionality from CP::D::MM 
+
 0.12 Mon Mar  2 13:33:47 GMT 2009
 
   - Fixed the version number in ::Constants

Modified: CPANPLUS-Dist-Build/trunk/lib/CPANPLUS/Dist/Build.pm
==============================================================================
--- CPANPLUS-Dist-Build/trunk/lib/CPANPLUS/Dist/Build.pm        (original)
+++ CPANPLUS-Dist-Build/trunk/lib/CPANPLUS/Dist/Build.pm        Sun Mar  8 
06:32:42 2009
@@ -31,7 +31,7 @@
 
 local $Params::Check::VERBOSE = 1;
 
-$VERSION = '0.12';
+$VERSION = '0.13_01';
 
 =pod
 
@@ -222,7 +222,8 @@
     }
 
     my $args;
-    my( $force, $verbose, $buildflags, $perl);
+    my( $force, $verbose, $buildflags, $perl, $prereq_target, $prereq_format,
+        $prereq_build );
     {   local $Params::Check::ALLOW_UNKNOWN = 1;
         my $tmpl = {
             force           => {    default => $conf->get_conf('force'),
@@ -232,6 +233,10 @@
             perl            => {    default => $^X, store => \$perl },
             buildflags      => {    default => $conf->get_conf('buildflags'),
                                     store   => \$buildflags },
+            prereq_target   => {    default => '', store => \$prereq_target }, 
+            prereq_format   => {    default => '',
+                                    store   => \$prereq_format },   
+            prereq_build    => {    default => 0, store => \$prereq_build },
         };
 
         $args = check( $tmpl, \%hash ) or return;
@@ -267,6 +272,39 @@
 
     my $fail;
     RUN: {
+        # 0.85_01
+        ### we resolve 'configure requires' here, so we can run the 'perl
+        ### Makefile.PL' command
+        ### XXX for tests: mock f_c_r to something that *can* resolve and
+        ### something that *doesnt* resolve. Check the error log for ok
+        ### on this step or failure
+        ### XXX make a seperate tarball to test for this scenario: simply
+        ### containing a makefile.pl/build.pl for test purposes?
+        my $safe_ver = version->new('0.85_01');
+        if ( version->new($CPANPLUS::Internals::VERSION) >= $safe_ver )
+        {   my $configure_requires = $dist->find_configure_requires;     
+            my $ok = $dist->_resolve_prereqs(
+                            format          => $prereq_format,
+                            verbose         => $verbose,
+                            prereqs         => $configure_requires,
+                            target          => $prereq_target,
+                            force           => $force,
+                            prereq_build    => $prereq_build,
+                    );    
+    
+            unless( $ok ) {
+           
+                #### use $dist->flush to reset the cache ###
+                error( loc( "Unable to satisfy '%1' for '%2' " .
+                            "-- aborting install", 
+                            'configure_requires', $self->module ) );    
+                $dist->status->prepared(0);
+                $fail++; 
+                last RUN;
+            } 
+            ### end of prereq resolving ###
+        }
+
         # Wrap the exception that may be thrown here (should likely be
         # done at a much higher level).
         my $prep_output;

Modified: CPANPLUS-Dist-Build/trunk/lib/CPANPLUS/Dist/Build/Constants.pm
==============================================================================
--- CPANPLUS-Dist-Build/trunk/lib/CPANPLUS/Dist/Build/Constants.pm      
(original)
+++ CPANPLUS-Dist-Build/trunk/lib/CPANPLUS/Dist/Build/Constants.pm      Sun Mar 
 8 06:32:42 2009
@@ -9,7 +9,7 @@
     require Exporter;
     use vars    qw[$VERSION @ISA @EXPORT];
   
-    $VERSION    = '0.12';
+    $VERSION    = '0.13_01';
     @ISA        = qw[Exporter];
     @EXPORT     = qw[ BUILD_DIR BUILD ];
 }

Reply via email to