[Bps-public-commit] r12963 - in Shipwright/trunk: . lib/Shipwright/Script

sunnavy at bestpractical.com sunnavy at bestpractical.com
Fri Jun 6 10:11:14 EDT 2008


Author: sunnavy
Date: Fri Jun  6 10:11:06 2008
New Revision: 12963

Modified:
   Shipwright/trunk/   (props changed)
   Shipwright/trunk/lib/Shipwright/Build.pm
   Shipwright/trunk/lib/Shipwright/Script/Build.pm

Log:
 r13055 at sunnavys-mb:  sunnavy | 2008-06-06 21:57:32 +0800
 added only arg for build cmd


Modified: Shipwright/trunk/lib/Shipwright/Build.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Build.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Build.pm	Fri Jun  6 10:11:06 2008
@@ -8,7 +8,7 @@
 
 __PACKAGE__->mk_accessors(
     qw/install_base perl build_base skip_test commands log
-      skip only_test force order flags name/
+      skip only_test force order flags name only/
 );
 
 use File::Spec;
@@ -103,11 +103,14 @@
               || []
         );
 
-
         if ( -e File::Spec->catfile( 'shipwright', 'flags.yml' ) ) {
 
-            $self->flags( Shipwright::Util::LoadFile(
-                File::Spec->catfile( 'shipwright', 'flags.yml' ) ) || {} );
+            $self->flags(
+                Shipwright::Util::LoadFile(
+                    File::Spec->catfile( 'shipwright', 'flags.yml' )
+                  )
+                  || {}
+            );
         }
 
         unless ( $self->perl && -e $self->perl ) {
@@ -118,7 +121,7 @@
             if (
                 (
                     ( grep { $_ eq 'perl' } @{ $self->order } )
-                    && !$self->skip->{perl}
+                    && $self->only ? $self->only->{perl} : !$self->skip->{perl}
                 )
                 || -e $perl
               )
@@ -129,6 +132,7 @@
                 $self->perl($^X);
             }
         }
+        die -e $self->perl;
 
         for my $dist ( @{ $self->order } ) {
 
@@ -137,8 +141,11 @@
               if $self->flags->{$dist} && !grep { $self->flags->{$_} }
                   @{ $self->flags->{$dist} };
 
-            unless ( $self->skip && $self->skip->{$dist} ) {
-                $self->_install($dist);
+            if ( $self->only ) {
+                $self->_install($dist) if $self->only->{$dist};
+            }
+            else {
+                $self->_install($dist) unless $self->skip->{$dist};
             }
             chdir $self->build_base;
         }
@@ -183,7 +190,7 @@
 
         for (@cmds) {
             my ( $type, $cmd );
-            next unless /\S/ && /^(?!#)\w+/; # skip commented and blank lines
+            next unless /\S/ && /^(?!#)\w+/;    # skip commented and blank lines
 
             if (/^(\S+):\s*(.*)/) {
                 $type = $1;
@@ -272,7 +279,7 @@
     # then link to it, else link to the normal one
         if (   $type
             && grep( { $_ eq $type } @{ $self->order } )
-            && !( $self->skip && $self->skip->{$type} )
+            && $self->only ? $self->only->{$type} : !$self->skip->{$type}
             && -e File::Spec->catfile( '..', 'etc', "shipwright-$type-wrapper" )
           )
         {

Modified: Shipwright/trunk/lib/Shipwright/Script/Build.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Script/Build.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Script/Build.pm	Fri Jun  6 10:11:06 2008
@@ -7,7 +7,7 @@
 use base qw/App::CLI::Command Class::Accessor::Fast Shipwright::Script/;
 __PACKAGE__->mk_accessors(
     qw/repository log_level install_base build_base skip skip_test only_test
-      force log_file flags name perl/
+      force log_file flags name perl only/
 );
 
 use Shipwright;
@@ -21,6 +21,7 @@
         'install-base=s' => 'install_base',
         'name=s'         => 'name',
         'skip=s'         => 'skip',
+        'only=s'         => 'only',
         'flags=s'        => 'flags',
         'skip-test'      => 'skip_test',
         'only-test'      => 'only_test',
@@ -51,6 +52,11 @@
     }
 
     $self->skip( { map { $_ => 1 } split /\s*,\s*/, $self->skip || '' } );
+
+    if ( $self->only ) {
+        $self->only( { map { $_ => 1 } split /\s*,\s*/, $self->only } );
+    }
+
     $self->flags(
         {
             default => 1,
@@ -61,7 +67,7 @@
     my $shipwright = Shipwright->new(
         map { $_ => $self->$_ }
           qw/repository log_level log_file skip skip_test
-          flags name force only_test install_base perl/
+          flags name force only_test install_base perl only/
     );
 
     $shipwright->backend->export( target => $shipwright->build->build_base );
@@ -86,6 +92,7 @@
    --log-file         specify the log file
    --install-base     specify install base. default is an autocreated temp dir
    --skip             specify dists which'll be skipped
+   --only             specify dists which'll be installed only
    --skip-test        specify whether to skip test
    --only-test        just test(the running script is t/test)
    --flags            specify flags



More information about the Bps-public-commit mailing list