[Bps-public-commit] r18846 - Shipwright/trunk/share/bin

sunnavy at bestpractical.com sunnavy at bestpractical.com
Thu Mar 19 01:40:16 EDT 2009


Author: sunnavy
Date: Thu Mar 19 01:40:16 2009
New Revision: 18846

Modified:
   Shipwright/trunk/share/bin/shipwright-builder

Log:
added verbose arg so we can have cleaner screen

Modified: Shipwright/trunk/share/bin/shipwright-builder
==============================================================================
--- Shipwright/trunk/share/bin/shipwright-builder	(original)
+++ Shipwright/trunk/share/bin/shipwright-builder	Thu Mar 19 01:40:16 2009
@@ -33,6 +33,7 @@
     'noclean',                'only=s',
     'with=s',                 'noclean-after-install',
     'make=s',                 'branches=s',
+    'verbose',
   );
 
 my $USAGE = <<'END';
@@ -51,6 +52,8 @@
   --force                   Install this vessel, even if some tests fail
   --advanced-help           Show additional command-line options you're
                             less likely to use.
+  --verbose                 more output to stdout.
+
 
 
 END
@@ -210,6 +213,14 @@
 @$order = grep { !$installed_hash->{$_} } @$order;
 
 my $log;
+my $build_log_file = abs_path( 'build.log' );
+my $system_cmd_pipe;
+if ( $args{'verbose'} ) {
+    $system_cmd_pipe = '';
+}
+else {
+    $system_cmd_pipe = " >>$build_log_file 2>&1";
+}
 
 if ( $args{'only-test'} ) {
     open $log, '>', 'test.log' or confess $!;
@@ -230,7 +241,7 @@
 sub install {
 
     # for install
-    open $log, '>', 'build.log' or confess $!;
+    open $log, '>', $build_log_file or confess $!;
 
     # set clean flag again
     if ( $args{'noclean-after-install'} ) {
@@ -395,7 +406,7 @@
           '--flags'        => join( ',', keys %{ $args{flags} } ),
           $skip_test ? '--skip-test' : (), $args{'force'} ? '--force' : (),
           $args{'clean'} ? '--clean' : ();
-        if ( system($cmd) ) {
+        if ( system($cmd . $system_cmd_pipe) ) {
             print $log "build $dir with failure.\n";
             confess "build $dir with failure.\n";
         }
@@ -414,8 +425,8 @@
 
             print $log "build $type part in $dir with cmd: $cmd\n";
 
-            print "running shipwright build command: $cmd\n";
-            if ( system($cmd) ) {
+            print $log "running shipwright build command: $cmd\n";
+            if ( system($cmd . $system_cmd_pipe) ) {
                 print $log "build $dir $type part with failure.\n";
                 if ( $type eq 'test' ) {
                     if ( $args{force} ) {
@@ -444,7 +455,7 @@
     }
 
     print $log "build $dir with success!\n";
-    print '=' x 80, "\n";
+    print '=' x 80, "\n" if $args{verbose};
 }
 
 sub wrap_bin {
@@ -657,7 +668,7 @@
         print $log "clean $dir with success.\n";
     }
 
-    print '=' x 80, "\n";
+    print '=' x 80, "\n" if $args{verbose};
 }
 
 sub get_install_base {



More information about the Bps-public-commit mailing list