[Bps-public-commit] r15211 - in Shipwright/branches/1.10: . lib/Shipwright lib/Shipwright/Backend share/inc

sunnavy at bestpractical.com sunnavy at bestpractical.com
Mon Aug 18 04:50:38 EDT 2008


Author: sunnavy
Date: Mon Aug 18 04:50:36 2008
New Revision: 15211

Removed:
   Shipwright/branches/1.10/share/inc/
Modified:
   Shipwright/branches/1.10/MANIFEST
   Shipwright/branches/1.10/Makefile.PL
   Shipwright/branches/1.10/lib/Shipwright/Backend/Base.pm
   Shipwright/branches/1.10/lib/Shipwright/Build.pm
   Shipwright/branches/1.10/lib/Shipwright/Source/CPAN.pm

Log:
merge 15204@:15210@ to 1.10

Modified: Shipwright/branches/1.10/MANIFEST
==============================================================================
--- Shipwright/branches/1.10/MANIFEST	(original)
+++ Shipwright/branches/1.10/MANIFEST	Mon Aug 18 04:50:36 2008
@@ -61,7 +61,6 @@
 share/etc/shipwright-source-bash
 share/etc/shipwright-source-tcsh
 share/etc/shipwright-utility
-share/inc/YAML/Tiny.pm
 share/shipwright/flags.yml
 share/shipwright/known_test_failures.yml
 share/shipwright/map.yml

Modified: Shipwright/branches/1.10/Makefile.PL
==============================================================================
--- Shipwright/branches/1.10/Makefile.PL	(original)
+++ Shipwright/branches/1.10/Makefile.PL	Mon Aug 18 04:50:36 2008
@@ -25,6 +25,8 @@
 requires 'Module::CoreList' => 0;
 requires 'UNIVERSAL::require' => 0;
 requires 'version' => 0;
+requires 'Module::Info' => 0;
+requires 'YAML::Tiny' => 0;
 
 if ( can_cc() ) {
     requires( 'YAML::Syck' => 0.71 );

Modified: Shipwright/branches/1.10/lib/Shipwright/Backend/Base.pm
==============================================================================
--- Shipwright/branches/1.10/lib/Shipwright/Backend/Base.pm	(original)
+++ Shipwright/branches/1.10/lib/Shipwright/Backend/Base.pm	Mon Aug 18 04:50:36 2008
@@ -7,6 +7,7 @@
 use Shipwright::Util;
 use File::Temp qw/tempdir/;
 use File::Copy qw/copy/;
+use File::Path;
 use File::Copy::Recursive qw/dircopy/;
 use List::MoreUtils qw/uniq/;
 
@@ -60,6 +61,13 @@
 
     dircopy( Shipwright::Util->share_root, $dir );
 
+    # copy YAML/Tiny.pm to inc/
+    my $yaml_tiny_path = catfile( $dir, 'inc', 'YAML' );
+    mkpath $yaml_tiny_path;
+    require Module::Info;
+    copy( Module::Info->new_from_module('YAML::Tiny')->file, $yaml_tiny_path )
+      or die "copy YAML/Tiny.pm failed: $!";
+    
     # share_root can't keep empty dirs, we have to create them manually
     for (qw/dists scripts t/) {
         mkdir catfile( $dir, $_ );

Modified: Shipwright/branches/1.10/lib/Shipwright/Build.pm
==============================================================================
--- Shipwright/branches/1.10/lib/Shipwright/Build.pm	(original)
+++ Shipwright/branches/1.10/lib/Shipwright/Build.pm	Mon Aug 18 04:50:36 2008
@@ -68,8 +68,11 @@
     $ENV{PERL_MM_USE_DEFAULT} = 1;
 
     require CPAN;
-    eval { require CPAN::Config; }
-      or warn("can't require CPAN::Config: $@");
+    require Module::Info;
+    if ( Module::Info->new_from_module('CPAN::Config') ) {
+        # keep original CPAN::Config info
+        require CPAN::Config;
+    }
 
     # we don't want any prereqs any more!
     $CPAN::Config->{prerequisites_policy} = 'ignore';

Modified: Shipwright/branches/1.10/lib/Shipwright/Source/CPAN.pm
==============================================================================
--- Shipwright/branches/1.10/lib/Shipwright/Source/CPAN.pm	(original)
+++ Shipwright/branches/1.10/lib/Shipwright/Source/CPAN.pm	Mon Aug 18 04:50:36 2008
@@ -10,12 +10,11 @@
 use File::Temp qw/tempdir/;
 use File::Spec::Functions qw/catfile catdir/;
 use File::Slurp;
-use UNIVERSAL::require;
 use CPAN::DistnameInfo;
 
 use base qw/Shipwright::Source::Base/;
 
-my $cpan_dir = tempdir( 'shipwright_XXXXXX',  CLEANUP => 1 , TMPDIR => 1);
+my $cpan_dir = tempdir( 'shipwright_XXXXXX', CLEANUP => 1, TMPDIR => 1 );
 unshift @INC, $cpan_dir;
 
 =head1 NAME
@@ -32,19 +31,24 @@
     my $class = shift;
     my $self  = $class->SUPER::new(@_);
 
-    CPAN::Config->use;
+    require Module::Info;
+    if ( Module::Info->new_from_module('CPAN::Config') ) {
+
+        # keep original CPAN::Config info
+        require CPAN::Config;
+    }
 
     mkdir catfile( $cpan_dir, 'CPAN' );
     my $config_file = catfile( $cpan_dir, 'CPAN', 'MyConfig.pm' );
 
     unless ( -f $config_file ) {
-        $CPAN::Config->{cpan_home} = catfile($cpan_dir);
-        $CPAN::Config->{build_dir} = catfile( $cpan_dir, 'build' );
-        $CPAN::Config->{histfile} =
-          catfile( $cpan_dir, 'histfile' );
-        $CPAN::Config->{keep_source_where} =
-          catfile( $cpan_dir, 'sources' );
-        $CPAN::Config->{prefs_dir} = catfile( $cpan_dir, 'prefs' );
+
+        # hack $CPAN::Config, mostly to make cpan stuff temporary
+        $CPAN::Config->{cpan_home}         = catfile($cpan_dir);
+        $CPAN::Config->{build_dir}         = catfile( $cpan_dir, 'build' );
+        $CPAN::Config->{histfile}          = catfile( $cpan_dir, 'histfile' );
+        $CPAN::Config->{keep_source_where} = catfile( $cpan_dir, 'sources' );
+        $CPAN::Config->{prefs_dir}         = catfile( $cpan_dir, 'prefs' );
         $CPAN::Config->{prerequisites_policy} = 'follow';
         $CPAN::Config->{urllist}              = [];
         write_file( $config_file,
@@ -78,7 +82,7 @@
 
     my ( $source, $distribution );
 
-    Shipwright::Util->select( 'cpan' );
+    Shipwright::Util->select('cpan');
 
     if ( $self->source =~ /\.tar\.gz$/ ) {
 
@@ -129,23 +133,19 @@
 
     my $name = CPAN::DistnameInfo->new( $distribution->{ID} )->dist;
 
-
     if ( $name eq 'perl' ) {
         die 'perl itself contains ' . $self->source . ', will not process';
     }
 
     $distribution->get;
 
-    Shipwright::Util->select( 'stdout' );
+    Shipwright::Util->select('stdout');
 
     $self->name( 'cpan-' . $name );
     $self->_update_map( $self->source, 'cpan-' . $name );
 
     $self->source(
-        catfile(
-            $CPAN::Config->{keep_source_where},
-            'authors', 'id', $source
-        )
+        catfile( $CPAN::Config->{keep_source_where}, 'authors', 'id', $source )
     );
     return 1;
 }



More information about the Bps-public-commit mailing list