[Bps-public-commit] r10285 - bpsbuilder/BPB/lib/BPB

sunnavy at bestpractical.com sunnavy at bestpractical.com
Fri Jan 11 07:59:21 EST 2008


Author: sunnavy
Date: Fri Jan 11 07:59:21 2008
New Revision: 10285

Modified:
   bpsbuilder/BPB/lib/BPB/Backend.pm

Log:
better name for log file handle

Modified: bpsbuilder/BPB/lib/BPB/Backend.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Backend.pm	(original)
+++ bpsbuilder/BPB/lib/BPB/Backend.pm	Fri Jan 11 07:59:21 2008
@@ -70,8 +70,12 @@
 my %args;
 GetOptions( \%args, 'install-base=s', 'perl=s', 'skip=s', 'skip-test' );
 
+unlink 'build.log' if -e 'build.log';
+open my $log, '>', 'build.log' or die $!;
+
 unless ( $args{'install-base'} ) {
-    die 'need install-base option';
+    $args{'install-base'} = tempdir;
+    print $log "no default install-base, will set it to $args{'install-base'}\n";
 }
 
 $args{perl} ||= 'perl';
@@ -87,8 +91,6 @@
       . $ENV{LD_LIBRARY_PATH};
 }
 
-open my $fh, '>', 'build.log' or die $!;
-close $fh;
 
 mkdir $args{'install-base'} unless -e $args{'install-base'};
 
@@ -111,6 +113,8 @@
 }
 
 wrap_bin();
+print "install finished, the dists are at $args{'install-base'}\n";
+print $log "install finished, the dists are at $args{'install-base'}\n";
 
 sub install {
     my $dir = shift;
@@ -127,11 +131,9 @@
       . File::Spec->catfile( $args{'install-base'}, 'lib', 'perl5',
         $Config{archname} );
 
-    open my $fh, '>>', '../../build.log' or die $!;
-
     if ( !-f '__build' ) {
         warn "I have no idea how to build this distribution";
-        print $fh "build $dir with failure: don't know how to build.\n";
+        print $log "build $dir with failure: don't know how to build.\n";
     }
     else {
         substitute('__build');
@@ -154,19 +156,24 @@
                 $cmd  = $_;
             }
 
-            next if $args{'skip-test'} && $type eq 'test';
+            if ($args{'skip-test'} && $type eq 'test') {
+                print $log "skip build $type part in $dir\n";
+                next;
+            };
+
+            print $log "build $type part in $dir\n";
 
             if ( system($cmd) ) {
-                print $fh "build $dir with failure when run $type: $!\n";
+                print $log "build $dir with failure when run $type: $!\n";
                 $error = 1;
             }
         }
 
         if ($error) {
-            print $fh "build $dir with failure!\n";
+            print $log "build $dir with failure!\n";
         }
         else {
-            print $fh "build $dir with success!\n";
+            print $log "build $dir with success!\n";
         }
     }
 }



More information about the Bps-public-commit mailing list