[Bps-public-commit] r16823 - in Shipwright/branches/1.10: lib lib/Shipwright lib/Shipwright/Backend lib/Shipwright/Script lib/Shipwright/Source t

sunnavy at bestpractical.com sunnavy at bestpractical.com
Wed Nov 12 11:40:48 EST 2008


Author: sunnavy
Date: Wed Nov 12 11:40:48 2008
New Revision: 16823

Modified:
   Shipwright/branches/1.10/lib/Shipwright.pm
   Shipwright/branches/1.10/lib/Shipwright/Backend/Base.pm
   Shipwright/branches/1.10/lib/Shipwright/Backend/SVK.pm
   Shipwright/branches/1.10/lib/Shipwright/Backend/SVN.pm
   Shipwright/branches/1.10/lib/Shipwright/Build.pm
   Shipwright/branches/1.10/lib/Shipwright/Script/Import.pm
   Shipwright/branches/1.10/lib/Shipwright/Source.pm
   Shipwright/branches/1.10/lib/Shipwright/Source/CPAN.pm
   Shipwright/branches/1.10/lib/Shipwright/Test.pm
   Shipwright/branches/1.10/lib/Shipwright/Util.pm
   Shipwright/branches/1.10/t/05.util.t
   Shipwright/branches/1.10/t/71.script_cmds.t
   Shipwright/branches/1.10/t/hello/svk.t
   Shipwright/branches/1.10/t/hello/svn.t

Log:
merged 16814-16822 to 1.1

Modified: Shipwright/branches/1.10/lib/Shipwright.pm
==============================================================================
--- Shipwright/branches/1.10/lib/Shipwright.pm	(original)
+++ Shipwright/branches/1.10/lib/Shipwright.pm	Wed Nov 12 11:40:48 2008
@@ -15,8 +15,8 @@
 use Shipwright::Backend;
 use Shipwright::Source;
 use Shipwright::Build;
-use File::Temp qw/tempdir/;
-use File::Spec::Functions qw/catfile/;
+use File::Temp qw/tempfile/;
+use File::Spec::Functions qw/catfile tmpdir/;
 
 sub new {
     my $class = shift;
@@ -28,9 +28,7 @@
 
         # a better named log_file, in the name of repository
         my $info = join '', map { /\w/ ? $_ : '_' } split //, $args{repository};
-        $args{log_file} =
-          catfile( tempdir( 'shipwright_XXXXXX', CLEANUP => 1, TMPDIR => 1 ),
-            "shipwright_${info}.log" );
+        $args{log_file} = catfile( tmpdir(), "shipwright_$info.log" );
     }
 
     my $self = {

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	Wed Nov 12 11:40:48 2008
@@ -57,7 +57,8 @@
 
 sub initialize {
     my $self = shift;
-    my $dir = tempdir( 'shipwright_XXXXXX', CLEANUP => 1, TMPDIR => 1 );
+    my $dir =
+      tempdir( 'shipwright_backend_base_XXXXXX', CLEANUP => 1, TMPDIR => 1 );
 
     dircopy( Shipwright::Util->share_root, $dir );
 

Modified: Shipwright/branches/1.10/lib/Shipwright/Backend/SVK.pm
==============================================================================
--- Shipwright/branches/1.10/lib/Shipwright/Backend/SVK.pm	(original)
+++ Shipwright/branches/1.10/lib/Shipwright/Backend/SVK.pm	Wed Nov 12 11:40:48 2008
@@ -150,7 +150,8 @@
     my ($f) = $path =~ m{.*/(.*)$};
 
     if ($yml) {
-        my $dir = tempdir( 'shipwright_XXXXXX', CLEANUP => 1, TMPDIR => 1 );
+        my $dir =
+          tempdir( 'shipwright_backend_svk_XXXXXX', CLEANUP => 1, TMPDIR => 1 );
         my $file = catfile( $dir, $f );
 
         $self->checkout( path => $path, target => $file );
@@ -224,7 +225,8 @@
     my $path   = shift;
     my $latest = shift;
 
-    my $dir = tempdir( 'shipwright_XXXXXX', CLEANUP => 1, TMPDIR => 1 );
+    my $dir =
+      tempdir( 'shipwright_backend_svk_XXXXXX', CLEANUP => 1, TMPDIR => 1 );
     my $file = catfile( $dir, $path );
 
     $self->checkout(

Modified: Shipwright/branches/1.10/lib/Shipwright/Backend/SVN.pm
==============================================================================
--- Shipwright/branches/1.10/lib/Shipwright/Backend/SVN.pm	(original)
+++ Shipwright/branches/1.10/lib/Shipwright/Backend/SVN.pm	Wed Nov 12 11:40:48 2008
@@ -158,7 +158,8 @@
     }
 
     if ($yml) {
-        my $dir = tempdir( 'shipwright_XXXXXX', CLEANUP => 1, TMPDIR => 1 );
+        my $dir =
+          tempdir( 'shipwright_backend_svn_XXXXXX', CLEANUP => 1, TMPDIR => 1 );
         my $file = catfile( $dir, $f );
 
         $self->checkout(
@@ -233,7 +234,8 @@
     my $latest = shift;
 
     if ( $path =~ m{(.*)/(.*)$} ) {
-        my $dir = tempdir( 'shipwright_XXXXXX', CLEANUP => 1, TMPDIR => 1 );
+        my $dir =
+          tempdir( 'shipwright_backend_svn_XXXXXX', CLEANUP => 1, TMPDIR => 1 );
         my $file = catfile( $dir, $2 );
 
         $self->checkout(

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	Wed Nov 12 11:40:48 2008
@@ -35,7 +35,7 @@
     $self->log( Log::Log4perl->get_logger( ref $self ) );
 
     $self->{build_base} ||=
-      tempdir( 'shipwright_XXXXXX', CLEANUP => 1, TMPDIR => 1 );
+      tempdir( 'shipwright_build_XXXXXX', CLEANUP => 1, TMPDIR => 1 );
     rmdir $self->{build_base};
 
     $self->name('vessel') unless $self->name;
@@ -43,8 +43,8 @@
     $self->make('make') unless $self->make;
 
     unless ( $self->install_base ) {
-
         my $dir = tempdir( 'vessel_' . $self->name . '-XXXXXX', TMPDIR => 1 );
+        rmdir $dir;
         $self->install_base( catfile( $dir, $self->name ) );
     }
 
@@ -411,6 +411,7 @@
     Shipwright::Util::DumpFile( $installed_file, $installed );
 }
 
+
 1;
 
 __END__

Modified: Shipwright/branches/1.10/lib/Shipwright/Script/Import.pm
==============================================================================
--- Shipwright/branches/1.10/lib/Shipwright/Script/Import.pm	(original)
+++ Shipwright/branches/1.10/lib/Shipwright/Script/Import.pm	Wed Nov 12 11:40:48 2008
@@ -254,9 +254,9 @@
                     }
                     else {
                         $script_dir = tempdir(
-                            'shipwright_XXXXXX',
+                            'shipwright_script_import_XXXXXX',
                             CLEANUP => 1,
-                            TMPDIR  => 1
+                            TMPDIR  => 1,
                         );
                         if ( -e catfile( $s, '__require.yml' ) ) {
                             move(

Modified: Shipwright/branches/1.10/lib/Shipwright/Source.pm
==============================================================================
--- Shipwright/branches/1.10/lib/Shipwright/Source.pm	(original)
+++ Shipwright/branches/1.10/lib/Shipwright/Source.pm	Wed Nov 12 11:40:48 2008
@@ -11,7 +11,7 @@
 
 our %DEFAULT = ( follow => 1, );
 
-$DEFAULT{directory} = tempdir( 'shipwright_XXXXXX', CLEANUP => 0, TMPDIR => 1 );
+$DEFAULT{directory} = tempdir( 'shipwright_XXXXXX', CLEANUP => 1, TMPDIR => 1 );
 $DEFAULT{scripts_directory}  = catdir( $DEFAULT{directory}, '__scripts' );
 $DEFAULT{download_directory} = catdir( $DEFAULT{directory}, '__download' );
 $DEFAULT{map_path}           = catfile( $DEFAULT{directory}, 'map.yml' );

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	Wed Nov 12 11:40:48 2008
@@ -13,7 +13,7 @@
 
 use base qw/Shipwright::Source::Base/;
 
-my $cpan_dir = tempdir( 'shipwright_XXXXXX', CLEANUP => 1, TMPDIR => 1 );
+my $cpan_dir = tempdir( 'shipwright_cpan_XXXXXX', CLEANUP => 1, TMPDIR => 1 );
 unshift @INC, $cpan_dir;
 
 =head1 NAME

Modified: Shipwright/branches/1.10/lib/Shipwright/Test.pm
==============================================================================
--- Shipwright/branches/1.10/lib/Shipwright/Test.pm	(original)
+++ Shipwright/branches/1.10/lib/Shipwright/Test.pm	Wed Nov 12 11:40:48 2008
@@ -62,7 +62,7 @@
 =cut
 
 sub create_fs_repo {
-    return tempdir( 'shipwright_XXXXXX', CLEANUP => 1, TMPDIR => 1 );
+    return tempdir( 'shipwright_test_fs_XXXXXX', CLEANUP => 1, TMPDIR => 1 );
 }
 
 =head2 create_svk_repo 
@@ -73,7 +73,7 @@
 =cut
 
 sub create_svk_repo {
-    $ENV{SVKROOT} = tempdir( 'shipwright_XXXXXX', CLEANUP => 1, TMPDIR => 1 );
+    $ENV{SVKROOT} = tempdir( 'shipwright_test_svk_XXXXXX', CLEANUP => 1, TMPDIR => 1 );
     my $svk_root_local = catdir( $ENV{SVKROOT}, 'local' );
     system("svnadmin create $svk_root_local");
     system("svk depotmap -i");
@@ -88,7 +88,7 @@
 =cut
 
 sub create_svn_repo {
-    my $repo = tempdir( 'shipwright_XXXXXX', CLEANUP => 1, TMPDIR => 1 );
+    my $repo = tempdir( 'shipwright_test_svn_XXXXXX', CLEANUP => 1, TMPDIR => 1 );
     system("svnadmin create $repo") && confess "create repo failed: $!";
     return "file://$repo";
 }

Modified: Shipwright/branches/1.10/lib/Shipwright/Util.pm
==============================================================================
--- Shipwright/branches/1.10/lib/Shipwright/Util.pm	(original)
+++ Shipwright/branches/1.10/lib/Shipwright/Util.pm	Wed Nov 12 11:40:48 2008
@@ -4,8 +4,8 @@
 use strict;
 use Carp;
 use IPC::Run3;
-use File::Spec::Functions qw/catfile catdir splitpath splitdir/;
-use File::Temp qw/tempdir/;
+use File::Spec::Functions qw/catfile catdir splitpath splitdir tmpdir/;
+use File::Temp qw/tempfile/;
 use Cwd qw/abs_path/;
 
 use Shipwright;    # we need this to find where Shipwright.pm lives
@@ -137,9 +137,8 @@
 
 open $null_fh, '>', '/dev/null';
 
-$cpan_log_path =
-  catfile( tempdir( 'shipwright_XXXXXX', CLEANUP => 1, TMPDIR => 1 ),
-    'shipwright_cpan.log' );
+$cpan_log_path = catfile( tmpdir(), 'shipwright_cpan.log');
+
 open $cpan_fh, '>>', $cpan_log_path;
 $stdout_fh = select;
 

Modified: Shipwright/branches/1.10/t/05.util.t
==============================================================================
--- Shipwright/branches/1.10/t/05.util.t	(original)
+++ Shipwright/branches/1.10/t/05.util.t	Wed Nov 12 11:40:48 2008
@@ -44,7 +44,11 @@
 like( $@, qr/something wrong/i, 'run "ls lalala" results in death' );
 
 ( undef, $err ) = Shipwright::Util->run( [ 'ls', 'lalala' ], 1 );
-like( $err, qr/ls:/i, "run 'ls lalala' get warning if ignore_failure" );
+like(
+    $err,
+    qr/ls:|no such file/i,
+    "run 'ls lalala' get warning if ignore_failure"
+);
 
 my $hashref = { foo => 'bar' };
 my $string = <<EOF;

Modified: Shipwright/branches/1.10/t/71.script_cmds.t
==============================================================================
--- Shipwright/branches/1.10/t/71.script_cmds.t	(original)
+++ Shipwright/branches/1.10/t/71.script_cmds.t	Wed Nov 12 11:40:48 2008
@@ -5,12 +5,16 @@
 
 use Shipwright;
 use Shipwright::Test;
-
+use File::Spec::Functions qw/catdir tmpdir/;
+use File::Path qw/rmtree/;
 my $sw = Shipwright::Test->shipwright_bin;
 
 Shipwright::Test->init;
 
-my $repo = 'fs:' . create_fs_repo();
+my $repo         = 'fs:' . create_fs_repo();
+my $install_base = catdir( tmpdir(), 'vessel_71_scripts_cmds' );
+my $build_base   = catdir( tmpdir(), 'shipwright_build_71_scripts_cmds' );
+
 start_test($repo);
 
 SKIP: {
@@ -245,12 +249,21 @@
             'set mandatory flag man1',
         ],
         [
-            ['build'],
+            [
+                'build',       '--install-base',
+                $install_base, '--build-base',
+                $build_base
+            ],
             qr/run, run, Build\.PL.*run, run, Makefile\.PL/ms,
             'Build.PL and Makefile.PL are run',
         ],
         [
-            [ 'build', '--flags', 'configure' ],
+            [
+                'build',       '--flags',
+                'configure',   '--install-base',
+                $install_base, '--build-base',
+                $build_base
+            ],
             qr/run, run, configure/,
             'configure is run',
         ],
@@ -313,6 +326,10 @@
                 [ $^X, $sw, $cmd, '-r', $repo, @{ $item->[0] }, ],
                 @$item[ 1 .. $#$item ],
             );
+            if ( $cmd eq 'build' ) {
+                rmtree( $install_base );
+                rmtree( $build_base );
+            }
         }
         else {
 

Modified: Shipwright/branches/1.10/t/hello/svk.t
==============================================================================
--- Shipwright/branches/1.10/t/hello/svk.t	(original)
+++ Shipwright/branches/1.10/t/hello/svk.t	Wed Nov 12 11:40:48 2008
@@ -5,8 +5,9 @@
 use File::Temp qw/tempdir/;
 use File::Copy;
 use File::Copy::Recursive qw/dircopy/;
-use File::Spec::Functions qw/catfile catdir/;
-use Cwd;
+use File::Spec::Functions qw/catfile catdir updir/;
+use File::Path qw/rmtree/;
+use Cwd qw/getcwd abs_path/;
 
 use Test::More tests => 41;
 use Shipwright::Test qw/has_svk create_svk_repo/;
@@ -120,17 +121,18 @@
     }
 
     # install
-    my $install_dir = tempdir( 'shipwright_XXXXXX', CLEANUP => 1, TMPDIR => 1 );
-    $shipwright->build->run( install_base => $install_dir );
+    $shipwright->build->run();
 
     for (
-        catfile( $install_dir, 'lib', 'perl5', 'Acme', 'Hello.pm' ),
-        catfile( $install_dir, 'etc', 'shipwright-script-wrapper' ),
+        catfile( $shipwright->build->install_base, 'lib', 'perl5', 'Acme', 'Hello.pm' ),
+        catfile( $shipwright->build->install_base, 'etc', 'shipwright-script-wrapper' ),
       )
     {
         ok( -e $_, "$_ exists" );
     }
 
+    rmtree( abs_path(catdir( $shipwright->build->install_base, updir() )) );
+
     # import another dist
 
     chdir $cwd;
@@ -201,11 +203,15 @@
         $shipwright->backend->initialize();
         $shipwright->backend->export(
             target => $shipwright->build->build_base );
-        my $install_dir =
-          tempdir( 'shipwright_XXXXXX', CLEANUP => 1, TMPDIR => 1 );
-        $shipwright->build->run( install_base => $install_dir );
-        ok( -e catfile( $install_dir, 'etc', 'shipwright-script-wrapper' ),
-            'build with 0 packages ok' );
+        $shipwright->build->run();
+        ok(
+            -e catfile(
+                $shipwright->build->install_base, 'etc',
+                'shipwright-script-wrapper'
+            ),
+            'build with 0 packages ok'
+        );
+        rmtree( abs_path(catdir( $shipwright->build->install_base, updir() )) );
     }
 }
 

Modified: Shipwright/branches/1.10/t/hello/svn.t
==============================================================================
--- Shipwright/branches/1.10/t/hello/svn.t	(original)
+++ Shipwright/branches/1.10/t/hello/svn.t	Wed Nov 12 11:40:48 2008
@@ -5,10 +5,11 @@
 use File::Temp qw/tempdir/;
 use File::Copy;
 use File::Copy::Recursive qw/dircopy/;
-use File::Spec::Functions qw/catfile catdir/;
-use Cwd;
+use File::Spec::Functions qw/catfile catdir updir/;
+use Cwd qw/getcwd abs_path/;
 use Test::More tests => 17;
 use Shipwright::Test qw/has_svn create_svn_repo/;
+use File::Path qw/rmtree/;
 Shipwright::Test->init;
 
 SKIP: {
@@ -83,17 +84,25 @@
     }
 
     # install
-    my $install_dir = tempdir( 'shipwright_XXXXXX', CLEANUP => 1, TMPDIR => 1 );
-    $shipwright->build->run( install_base => $install_dir );
+    $shipwright->build->run();
 
     for (
-        catfile( $install_dir, 'lib', 'perl5', 'Acme', 'Hello.pm' ),
-        catfile( $install_dir, 'etc', 'shipwright-script-wrapper' ),
+        catfile(
+            $shipwright->build->install_base, 'lib',
+            'perl5',                          'Acme',
+            'Hello.pm'
+        ),
+        catfile(
+            $shipwright->build->install_base, 'etc',
+            'shipwright-script-wrapper'
+        ),
       )
     {
         ok( -e $_, "$_ exists" );
     }
 
+    rmtree( abs_path(catdir( $shipwright->build->install_base, updir() )) );
+
     # import another dist
 
     chdir $cwd;



More information about the Bps-public-commit mailing list