[Bps-public-commit] r10397 - in bpsbuilder/BPB/lib/BPB: .

sunnavy at bestpractical.com sunnavy at bestpractical.com
Fri Jan 18 15:54:50 EST 2008


Author: sunnavy
Date: Fri Jan 18 15:54:48 2008
New Revision: 10397

Modified:
   bpsbuilder/BPB/lib/BPB/Backend.pm
   bpsbuilder/BPB/lib/BPB/Backend/SVK.pm
   bpsbuilder/BPB/lib/BPB/Backend/SVN.pm
   bpsbuilder/BPB/lib/BPB/Util.pm

Log:
normally we will die if we gtt a failure when running a cmd

Modified: bpsbuilder/BPB/lib/BPB/Backend.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Backend.pm	(original)
+++ bpsbuilder/BPB/lib/BPB/Backend.pm	Fri Jan 18 15:54:48 2008
@@ -333,7 +333,7 @@
         }
 
         print "run tests $type: \n";
-        system($cmd);
+        system($cmd) && die "something wrong when execute $cmd: $?";
     }
 
 }

Modified: bpsbuilder/BPB/lib/BPB/Backend/SVK.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Backend/SVK.pm	(original)
+++ bpsbuilder/BPB/lib/BPB/Backend/SVK.pm	Fri Jan 18 15:54:48 2008
@@ -149,7 +149,10 @@
     my $self = shift;
     my %args = @_;
     $self->log->info( 'commit ' . $args{path} );
-    BPB::Util->run( $self->_cmd( commit => @_ ) );
+# have to omit the failure since we will get error if nothing need to commit,
+# which's harmless
+    BPB::Util->run( $self->_cmd( commit => @_ ), 1 );
+
 }
 
 # a cmd generating factory
@@ -365,7 +368,7 @@
     my $path = shift || '';
     if ( $self->info($path) ) {
         $self->log->info( "delete " . $self->repository . "/$path" );
-        BPB::Util->run( $self->_cmd( delete => path => $path ) );
+        BPB::Util->run( $self->_cmd( delete => path => $path ), 1 );
     }
 }
 

Modified: bpsbuilder/BPB/lib/BPB/Backend/SVN.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Backend/SVN.pm	(original)
+++ bpsbuilder/BPB/lib/BPB/Backend/SVN.pm	Fri Jan 18 15:54:48 2008
@@ -155,7 +155,7 @@
     my $self = shift;
     my %args = @_;
     $self->log->info( 'commit ' . $args{path} );
-    BPB::Util->run( $self->_cmd( commit => @_ ) );
+    BPB::Util->run( $self->_cmd( commit => @_ ), 1 );
 }
 
 # a cmd generating factory
@@ -364,7 +364,7 @@
     my $path = shift || '';
     if ( $self->info($path) ) {
         $self->log->info( "delete " . $self->repository . "/$path" );
-        BPB::Util->run( $self->_cmd( delete => path => $path ) );
+        BPB::Util->run( $self->_cmd( delete => path => $path ), 1 );
     }
 }
 
@@ -377,7 +377,8 @@
 sub info {
     my $self = shift;
     my $path = shift;
-    my ( $info, $err ) = BPB::Util->run( $self->_cmd( info => path => $path ) );
+    my ( $info, $err ) =
+      BPB::Util->run( $self->_cmd( info => path => $path ), 1 );
     if ($err) {
         $err =~ s/\s+$//;
         $self->log->warn($err);

Modified: bpsbuilder/BPB/lib/BPB/Util.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Util.pm	(original)
+++ bpsbuilder/BPB/lib/BPB/Util.pm	Fri Jan 18 15:54:48 2008
@@ -16,6 +16,7 @@
 sub run {
     my $class = shift;
     my $cmd   = shift;
+    my $ignore_failure = shift;
 
     my ( $out, $err );
     $log->info( "run cmd:\n" . join ' ', @$cmd );
@@ -25,7 +26,10 @@
 
     if ($?) {
         $log->error( 'failed to run ' . join( ' ', @$cmd ) . ":$?" );
+
+        die "something wrong :-(" unless $ignore_failure;
     }
+
     return ( $out, $err );
 
 }



More information about the Bps-public-commit mailing list