[Bps-public-commit] r10444 - in bpsbuilder/Shipwright/lib/Shipwright: .

sunnavy at bestpractical.com sunnavy at bestpractical.com
Wed Jan 23 08:17:29 EST 2008


Author: sunnavy
Date: Wed Jan 23 08:17:28 2008
New Revision: 10444

Modified:
   bpsbuilder/Shipwright/lib/Shipwright/Build.pm
   bpsbuilder/Shipwright/lib/Shipwright/Script/Build.pm

Log:
added force arg for Build.pm

Modified: bpsbuilder/Shipwright/lib/Shipwright/Build.pm
==============================================================================
--- bpsbuilder/Shipwright/lib/Shipwright/Build.pm	(original)
+++ bpsbuilder/Shipwright/lib/Shipwright/Build.pm	Wed Jan 23 08:17:28 2008
@@ -8,7 +8,7 @@
 
 __PACKAGE__->mk_accessors(
     qw/install_base perl build_base skip_test commands log
-      skip skip_test only_test/
+      skip skip_test only_test force/
 );
 
 use File::Spec;
@@ -79,8 +79,8 @@
     else {
         dircopy( 'etc', File::Spec->catfile( $self->install_base, 'etc' ) );
 
-        my $order =
-          Shipwright::Config::LoadFile( File::Spec->catfile( 'shipwright', 'order.yml' ) );
+        my $order = Shipwright::Config::LoadFile(
+            File::Spec->catfile( 'shipwright', 'order.yml' ) );
 
         for my $dist (@$order) {
             unless ( grep { $dist eq $_ } @{ $self->skip || [] } ) {
@@ -109,8 +109,6 @@
 
     chdir File::Spec->catfile( 'dists', $dir );
 
-    my $error;
-
     for (@cmds) {
         my ( $type, $cmd );
         next unless /\S/;
@@ -124,7 +122,7 @@
             $cmd  = $_;
         }
 
-        if ($self->skip_test && $type eq 'test') {
+        if ( $self->skip_test && $type eq 'test') {
             $self->log->info("skip build $type part in $dir");
             next;
         }
@@ -133,16 +131,17 @@
 
         if ( system($cmd) ) {
             $self->log->error("build $dir with failure when run $type: $!");
-            $error = 1;
+            if ( $self->force && $type eq 'error' ) {
+                $self->log->error(
+"although tests failed, will install anyway since we have force arg\n" );
+            }
+            else {
+                die "install failed";
+            }
         }
     }
 
-    if ($error) {
-        $self->log->error("build $dir with failure!");
-    }
-    else {
-        $self->log->info("build $dir with success!");
-    }
+    $self->log->info("build $dir with success!");
 }
 
 
@@ -217,7 +216,10 @@
             $cmd  = $_;
         }
         $self->log->info("run tests $type:");
-        system($cmd);
+        if ( system($cmd) ) {
+            $self->log->error( "tests failed" );
+            die;
+        }
     }
 }
 

Modified: bpsbuilder/Shipwright/lib/Shipwright/Script/Build.pm
==============================================================================
--- bpsbuilder/Shipwright/lib/Shipwright/Script/Build.pm	(original)
+++ bpsbuilder/Shipwright/lib/Shipwright/Script/Build.pm	Wed Jan 23 08:17:28 2008
@@ -6,7 +6,7 @@
 
 use base qw/App::CLI::Command Class::Accessor::Fast/;
 __PACKAGE__->mk_accessors(
-    qw/config name install_base build_base skip skip_test only_test/);
+    qw/config name install_base build_base skip skip_test only_test force/);
 
 use Shipwright;
 
@@ -21,6 +21,7 @@
         'skip=s'           => 'skip',
         'skip-test'        => 'skip_test',
         'only-test'        => 'only_test',
+        'force'            => 'force',
     );
 }
 
@@ -43,7 +44,8 @@
     );
     $shipwright->backend->export( target => $shipwright->build->build_base );
     $shipwright->build->skip_test(1) if $self->skip_test;
-    $shipwright->build->run( map { $_ => $self->$_ } qw/install_base only_test/ );
+    $shipwright->build->run( map { $_ => $self->$_ }
+          qw/install_base only_test force/ );
 }
 
 1;



More information about the Bps-public-commit mailing list