[Bps-public-commit] r11329 - in Shipwright/trunk: share/bin

sunnavy at bestpractical.com sunnavy at bestpractical.com
Tue Apr 1 03:03:55 EDT 2008


Author: sunnavy
Date: Tue Apr  1 03:03:54 2008
New Revision: 11329

Modified:
   Shipwright/trunk/lib/Shipwright/Build.pm
   Shipwright/trunk/share/bin/shipwright-builder

Log:
don't wrap again when it's been wrapped already

Modified: Shipwright/trunk/lib/Shipwright/Build.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Build.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Build.pm	Tue Apr  1 03:03:54 2008
@@ -147,7 +147,7 @@
                 $self->perl || $^X,
                 File::Spec->catfile( '..', '..', 'scripts', $dir, 'build.pl' ),
                 '--install-base' => $self->install_base,
-                '--flags' => join( ',', keys %{ $self->flags } ),
+                '--flags'        => join( ',', keys %{ $self->flags } ),
                 $self->skip_test ? '--skip-test' : (),
                 $self->force     ? '--force'     : (),
             ]
@@ -203,16 +203,27 @@
 sub _wrapper {
     my $self = shift;
 
-    my %seen;
-
     my $sub = sub {
         my $file = $_;
         return unless $file and -f $file;
-        return if $seen{$File::Find::name}++;
         my $dir = ( File::Spec->splitdir($File::Find::dir) )[-1];
         mkdir File::Spec->catfile( $self->install_base,       "$dir-wrapped" )
           unless -d File::Spec->catfile( $self->install_base, "$dir-wrapped" );
 
+        # return if it's been wrapped already
+        if (
+            -e File::Spec->catfile( $self->install_base, "$dir-wrapped", $file )
+          )
+        {
+            $self->log->warn(
+                'found '
+                  . File::Spec->catfile( $self->install_base, "$dir-wrapped",
+                    $file )
+                  . ', skipping' . "\n"
+            );
+            return;
+        }
+
         my $type;
         if ( -T $file ) {
             open my $fh, '<', $file or die "can't open $file: $!";

Modified: Shipwright/trunk/share/bin/shipwright-builder
==============================================================================
--- Shipwright/trunk/share/bin/shipwright-builder	(original)
+++ Shipwright/trunk/share/bin/shipwright-builder	Tue Apr  1 03:03:54 2008
@@ -223,15 +223,15 @@
           '--install-base' => $args{'install-base'},
           '--flags'        => join( ',', keys %{ $args{flags} } ),
           $args{'skip-test'} ? '--skip-test' : (),
-          $args{'force'} ? '--force' : (),
-          $args{'clean'} ? '--clean' : ();
+          $args{'force'} ? '--force' : (), $args{'clean'} ? '--clean' : ();
         if ( system($cmd) ) {
             print $log "build $dir with failure: $!\n";
             die "build $dir with failure: $!\n";
         }
     }
     else {
-        my $cmds = cmds( File::Spec->catfile( '..', '..', 'scripts', $dir, 'build' ) );
+        my $cmds =
+          cmds( File::Spec->catfile( '..', '..', 'scripts', $dir, 'build' ) );
 
         for (@$cmds) {
             my ( $type, $cmd ) = @$_;
@@ -268,17 +268,25 @@
 sub wrap_bin {
     my $self = shift;
 
-    my %seen;
-
     my $sub = sub {
         my $file = $_;
-        return unless $file and -f $file;
-        return if $seen{$File::Find::name}++;
+        return unless -f $file;
         my $dir = ( File::Spec->splitdir($File::Find::dir) )[-1];
         mkdir File::Spec->catfile( $args{'install-base'}, "$dir-wrapped" )
           unless -d File::Spec->catfile( $args{'install-base'},
             "$dir-wrapped" );
 
+        # return if it's been wrapped already
+        if ( File::Spec->catfile( $args{'install-base'}, "$dir-wrapped", $file )
+          )
+        {
+            print $log 'found '
+              . File::Spec->catfile( $args{'install-base'}, "$dir-wrapped",
+                $file )
+              . ', skipping' . "\n";
+            return
+        }
+
         my $type;
         if ( -T $file ) {
             open my $fh, '<', $file or die "can't open $file: $!";
@@ -410,11 +418,12 @@
         $cmd = join ' ', $args{perl} || $^X,
           File::Spec->catfile( '..', '..', 'scripts', $dir, 'build.pl' ),
           '--install-base' => $args{'install-base'},
-          '--flags' => join( ',', keys %{ $args{flags} } ),
+          '--flags'        => join( ',', keys %{ $args{flags} } ),
           '--clean';
     }
     else {
-        my $cmds = cmds( File::Spec->catfile( '..', '..', 'scripts', $dir, 'build' ) );
+        my $cmds =
+          cmds( File::Spec->catfile( '..', '..', 'scripts', $dir, 'build' ) );
 
         for (@$cmds) {
             my ( $type, $c ) = @$_;



More information about the Bps-public-commit mailing list