[Bps-public-commit] Shipwright branch, master, updated. ad066dc7c5f0937d5f28ded3776ae8ecf59662b2

? sunnavy sunnavy at bestpractical.com
Fri Jun 11 03:07:21 EDT 2010


The branch, master has been updated
       via  ad066dc7c5f0937d5f28ded3776ae8ecf59662b2 (commit)
       via  ce22abe1579c6d95e1288a3dbf68e5c8fbbc5c49 (commit)
      from  f35406f76bd8447f5cd93d3816beb11952d4b8f6 (commit)

Summary of changes:
 META.yml                      |    2 +-
 Makefile.PL                   |    2 +-
 lib/Shipwright/Source/Base.pm |   16 +++++++++-------
 share/bin/shipwright-utility  |   11 ++++++++---
 4 files changed, 19 insertions(+), 12 deletions(-)

- Log -----------------------------------------------------------------
commit ce22abe1579c6d95e1288a3dbf68e5c8fbbc5c49
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Jun 11 12:12:38 2010 +0800

    don't clear fs repository if build fails

diff --git a/META.yml b/META.yml
index 9d25e83..1b121ed 100644
--- a/META.yml
+++ b/META.yml
@@ -37,7 +37,7 @@ requires:
   File::Path: 2.07
   File::Slurp: 0
   File::Spec: 0
-  File::Temp: 0
+  File::Temp: 0.18
   File::Which: 0
   IO::Uncompress::Bunzip2: 0
   IO::Uncompress::RawInflate: 2.012
diff --git a/Makefile.PL b/Makefile.PL
index babc325..b432bac 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -14,7 +14,7 @@ requires 'Algorithm::Dependency::Source::HoA' => 0;
 requires 'CPAN' => 1.9205;
 requires 'CPAN::DistnameInfo' => 0;
 requires 'Class::Accessor::Fast' => 0;
-requires 'File::Temp' => 0;
+requires 'File::Temp' => 0.18;
 requires 'File::Copy' => 0;
 requires 'File::Copy::Recursive' => 0;
 requires 'File::Spec' => 0;
diff --git a/share/bin/shipwright-utility b/share/bin/shipwright-utility
index 1b7d443..5b23871 100755
--- a/share/bin/shipwright-utility
+++ b/share/bin/shipwright-utility
@@ -109,13 +109,13 @@ use warnings;
 use File::Spec::Functions;
 use Config;
 use Cwd;
-use File::Temp 'tempdir';
+use File::Temp;
 my $bin_quote = $^O =~ /MSWin/ ? q{"} : q{'};
 my $bin_ext = $Config{_exe};
 
 
 my $cwd = getcwd;
-my $dir = tempdir( CLEANUP => 1, TMPDIR => 1 );
+my $dir = File::Temp->newdir( CLEANUP => 1, TMPDIR => 1 );
 chdir $dir;
 my $tar_cmd = which('tar');
 if ( $^O =~ /MSWin/ || ! $tar_cmd ) {
@@ -142,7 +142,12 @@ else {
 }
 
 chdir 'fs';
-system( $^X, catfile( 'bin', 'shipwright-builder' ), @ARGV );
+if ( system( $^X, catfile( 'bin', 'shipwright-builder' ), @ARGV ) ) {
+    # error happens
+    $dir->unlink_on_destroy(0);
+    die "error occurred: the repository dir $dir is not cleaned up";
+}
+
 chdir $cwd;
 
 sub which {

commit ad066dc7c5f0937d5f28ded3776ae8ecf59662b2
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Fri Jun 11 15:07:48 2010 +0800

    feature named "-core" has special meaning

diff --git a/lib/Shipwright/Source/Base.pm b/lib/Shipwright/Source/Base.pm
index 544696e..52ce05b 100644
--- a/lib/Shipwright/Source/Base.pm
+++ b/lib/Shipwright/Source/Base.pm
@@ -259,6 +259,7 @@ sub shipwright_recommends {
 
 sub shipwright_feature {
     my ( $name, @mods ) = @_;
+    my $type = $name && $name ne '-core' ? 'recommends' : 'requires';
     for ( my $i = 0 ; $i < @mods ; $i++ ) {
         if ( $mods[$i] eq '-default' ) {
             $i++;    # skip the -default value
@@ -266,11 +267,11 @@ sub shipwright_feature {
         elsif ( $mods[ $i + 1 ] =~ /^[\d\.]*$/ ) {
 
             # index $i+1 is a version
-            $shipwright_req->{recommends}{ $mods[$i] } = $mods[ $i + 1 ] || 0;
+            $shipwright_req->{$type}{ $mods[$i] } = $mods[ $i + 1 ] || 0;
             $i++;
         }
         else {
-            $shipwright_req->{recommends}{ $mods[$i] } = 0;
+            $shipwright_req->{$type}{ $mods[$i] } = 0;
         }
     }
     goto &feature;
@@ -279,6 +280,7 @@ sub shipwright_feature {
 sub shipwright_features {
     my @args = @_;
     while ( my ( $name, $mods ) = splice( @_, 0, 2 ) ) {
+        my $type = $name && $name ne '-core' ? 'recommends' : 'requires';
         for ( my $i = 0; $i < @$mods; $i++ ) {
             if ( $mods->[$i] eq '-default' ) {
                 $i++;
@@ -295,16 +297,16 @@ sub shipwright_features {
 # );
                for ( my $j = 0; $j < @{$mods->[$i]}; $j++ ) {
                     if ( ref $mods->[$i][$j] eq 'ARRAY' ) {
-                        $shipwright_req->{recommends}{$mods->[$i][$j][0]} 
+                        $shipwright_req->{$type}{$mods->[$i][$j][0]} 
                             = $mods->[$i][$j][1] || 0;
                     }
                     elsif ( $mods->[$i][$j+1] =~ /^[\d\.]*$/ ) {
-                        $shipwright_req->{recommends}{$mods->[$i][$j]} 
+                        $shipwright_req->{$type}{$mods->[$i][$j]} 
                             = $mods->[$i][$j+1] || 0;
                         $j++;
                     }
                     else {
-                        $shipwright_req->{recommends}{$mods->[$i][$j]} = 0;
+                        $shipwright_req->{$type}{$mods->[$i][$j]} = 0;
                     }
                 }
                 
@@ -313,11 +315,11 @@ sub shipwright_features {
 
             if ( $mods->[$i+1] =~ /^[\d\.]*$/ ) {
                 # index $i+1 is a version
-                $shipwright_req->{recommends}{$mods->[$i]} = $mods->[$i+1] || 0;
+                $shipwright_req->{$type}{$mods->[$i]} = $mods->[$i+1] || 0;
                 $i++;
             }
             else {
-                $shipwright_req->{recommends}{$mods->[$i]} = 0;
+                $shipwright_req->{$type}{$mods->[$i]} = 0;
             }
         }
     }

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list