[Bps-public-commit] r16814 - in Shipwright/trunk: . lib lib/Shipwright/Backend lib/Shipwright/Script lib/Shipwright/Source

sunnavy at bestpractical.com sunnavy at bestpractical.com
Wed Nov 12 11:37:24 EST 2008


Author: sunnavy
Date: Wed Nov 12 11:37:22 2008
New Revision: 16814

Modified:
   Shipwright/trunk/   (props changed)
   Shipwright/trunk/lib/Shipwright.pm
   Shipwright/trunk/lib/Shipwright/Backend/Base.pm
   Shipwright/trunk/lib/Shipwright/Backend/SVK.pm
   Shipwright/trunk/lib/Shipwright/Backend/SVN.pm
   Shipwright/trunk/lib/Shipwright/Build.pm
   Shipwright/trunk/lib/Shipwright/Script/Import.pm
   Shipwright/trunk/lib/Shipwright/Source/CPAN.pm
   Shipwright/trunk/lib/Shipwright/Test.pm
   Shipwright/trunk/lib/Shipwright/Util.pm

Log:
 r17705 at sunnavys-mb:  sunnavy | 2008-11-12 20:40:34 +0800
 better named tmpfile


Modified: Shipwright/trunk/lib/Shipwright.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright.pm	(original)
+++ Shipwright/trunk/lib/Shipwright.pm	Wed Nov 12 11:37:22 2008
@@ -15,7 +15,7 @@
 use Shipwright::Backend;
 use Shipwright::Source;
 use Shipwright::Build;
-use File::Temp qw/tempdir/;
+use File::Temp qw/tempfile/;
 use File::Spec::Functions qw/catfile/;
 
 sub new {
@@ -28,9 +28,11 @@
 
         # 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} = tempfile(
+            "shipwright_${info}_XXXXXX",
+            TMPDIR => 1,
+            suffix => '.log',
+        );
     }
 
     my $self = {

Modified: Shipwright/trunk/lib/Shipwright/Backend/Base.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Backend/Base.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Backend/Base.pm	Wed Nov 12 11:37:22 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/trunk/lib/Shipwright/Backend/SVK.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Backend/SVK.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Backend/SVK.pm	Wed Nov 12 11:37:22 2008
@@ -110,7 +110,7 @@
 
             if ( $self->info( path => $path ) ) {
                 my $tmp_dir =
-                  tempdir( 'shipwright_XXXXXX', CLEANUP => 1, TMPDIR => 1 );
+                  tempdir( 'shipwright_backend_svk_XXXXXX', CLEANUP => 1, TMPDIR => 1 );
                 @cmd = (
                     [ 'rm', '-rf', "$tmp_dir" ],
                     [ 'svk', 'checkout', $self->repository . $path, $tmp_dir ],
@@ -177,7 +177,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 );
@@ -251,7 +252,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/trunk/lib/Shipwright/Backend/SVN.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Backend/SVN.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Backend/SVN.pm	Wed Nov 12 11:37:22 2008
@@ -174,7 +174,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(
@@ -249,7 +250,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/trunk/lib/Shipwright/Build.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Build.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Build.pm	Wed Nov 12 11:37:22 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;

Modified: Shipwright/trunk/lib/Shipwright/Script/Import.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Script/Import.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Script/Import.pm	Wed Nov 12 11:37:22 2008
@@ -262,9 +262,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/trunk/lib/Shipwright/Source/CPAN.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Source/CPAN.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Source/CPAN.pm	Wed Nov 12 11:37:22 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/trunk/lib/Shipwright/Test.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Test.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Test.pm	Wed Nov 12 11:37:22 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/trunk/lib/Shipwright/Util.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Util.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Util.pm	Wed Nov 12 11:37:22 2008
@@ -5,7 +5,7 @@
 use Carp;
 use IPC::Run3;
 use File::Spec::Functions qw/catfile catdir splitpath splitdir/;
-use File::Temp qw/tempdir/;
+use File::Temp qw/tempfile/;
 use Cwd qw/abs_path/;
 
 use Shipwright;    # we need this to find where Shipwright.pm lives
@@ -142,9 +142,12 @@
 
 open $null_fh, '>', '/dev/null';
 
-$cpan_log_path =
-  catfile( tempdir( 'shipwright_XXXXXX', CLEANUP => 1, TMPDIR => 1 ),
-    'shipwright_cpan.log' );
+$cpan_log_path = tempfile(
+    'shipwright_cpan_XXXXXX',
+    TMPDIR => 1,
+    suffix => '.log',
+);
+
 open $cpan_fh, '>>', $cpan_log_path;
 $stdout_fh = select;
 



More information about the Bps-public-commit mailing list