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

sunnavy at bestpractical.com sunnavy at bestpractical.com
Sun Jun 8 09:21:16 EDT 2008


Author: sunnavy
Date: Sun Jun  8 09:21:15 2008
New Revision: 13035

Modified:
   Shipwright/trunk/   (props changed)
   Shipwright/trunk/lib/Shipwright/Build.pm
   Shipwright/trunk/share/bin/shipwright-builder

Log:
 r13137 at sunnavys-mb:  sunnavy | 2008-06-08 21:20:45 +0800
 refactor a bit; fixed a perl link bug when a not containing perl vessel is installed on another vessel containing perl; also widen condition of detecting if perl exists in order: /^perl/


Modified: Shipwright/trunk/lib/Shipwright/Build.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Build.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Build.pm	Sun Jun  8 09:21:15 2008
@@ -96,12 +96,10 @@
     else {
         dircopy( 'etc', File::Spec->catfile( $self->install_base, 'etc' ) );
 
-        $self->order(
-            Shipwright::Util::LoadFile(
-                File::Spec->catfile( 'shipwright', 'order.yml' )
-              )
-              || []
-        );
+        my $order =
+          Shipwright::Util::LoadFile(
+            File::Spec->catfile( 'shipwright', 'order.yml' ) )
+          || [];
 
         my $flags;
         if ( -e File::Spec->catfile( 'shipwright', 'flags.yml' ) ) {
@@ -112,21 +110,24 @@
               || {};
         }
 
+        # calculate the real order
+        if ( $self->only ) {
+            @$order = grep { $self->only->{$_} } @$order;
+        }
+        else {
+            @$order =
+              grep {
+                ( $flags->{$_} ? $self->flags->{$_} : 1 )
+                  && !$self->skip->{$_}
+              } @$order;
+        }
+
         unless ( $self->perl && -e $self->perl ) {
             my $perl =
               File::Spec->catfile( $self->install_base, 'bin', 'perl' );
 
             # -e $perl makes sense when we install on to another vessel
-            if (
-                (
-                    ( grep { $_ eq 'perl' } @{ $self->order } )
-                    && (  $self->only
-                        ? $self->only->{perl}
-                        : !$self->skip->{perl} )
-                )
-                || -e $perl
-              )
-            {
+            if ( ( grep { /^perl/ } @{$order} ) || -e $perl ) {
                 $self->perl($perl);
             }
             else {
@@ -134,19 +135,8 @@
             }
         }
 
-        for my $dist ( @{ $self->order } ) {
-
-            # $flags->{$dist} is undef means 'default', will be installed
-            next
-              if $self->flags->{$dist} && !grep { $self->flags->{$_} }
-                  @{ $flags->{$dist} };
-
-            if ( $self->only ) {
-                $self->_install($dist) if $self->only->{$dist};
-            }
-            else {
-                $self->_install($dist) unless $self->skip->{$dist};
-            }
+        for my $dist ( @$order ) {
+            $self->_install($dist);
             chdir $self->build_base;
         }
 
@@ -278,8 +268,7 @@
     # if we have this $type(e.g. perl) installed and have that specific wrapper,
     # then link to it, else link to the normal one
         if (   $type
-            && grep( { $_ eq $type } @{ $self->order } )
-            && $self->only ? $self->only->{$type} : !$self->skip->{$type}
+            && -e File::Spec->catfile( '..', 'bin', $type )
             && -e File::Spec->catfile( '..', 'etc', "shipwright-$type-wrapper" )
           )
         {

Modified: Shipwright/trunk/share/bin/shipwright-builder
==============================================================================
--- Shipwright/trunk/share/bin/shipwright-builder	(original)
+++ Shipwright/trunk/share/bin/shipwright-builder	Sun Jun  8 09:21:15 2008
@@ -97,6 +97,16 @@
 my $flags =
   ( YAML::Tiny->read( File::Spec->catfile( 'shipwright', 'flags.yml' ) ) )->[0];
 
+# calculate the real order
+if ( $args{only} ) {
+    @$order = grep { $args{only}->{$_} } @$order;
+}
+else {
+    @$order =
+      grep { ( $flags->{$_} ? $args{flags}{$_} : 1 ) && !$args{skip}->{$_} }
+      @$order;
+}
+
 my $log;
 
 if ( $args{'only-test'} ) {
@@ -111,15 +121,7 @@
     $args{'install-base'} = get_install_base() unless $args{'install-base'};
 
     for my $dist (@$order) {
-        next
-          if $flags->{$dist} && !grep { $args{flags}{$_} } @{ $flags->{$dist} };
-
-        if ( $args{only} ) {
-            clean($dist) if $args{only}{$dist};
-        }
-        else {
-            clean($dist) unless $args{skip}{$dist};
-        }
+        clean($dist);
         chdir $build_base;
     }
 
@@ -185,15 +187,8 @@
     unless ( $args{perl} && -e $args{perl} ) {
         my $perl = File::Spec->catfile( $args{'install-base'}, 'bin', 'perl' );
 
-        # -e $perl makes sense when we install on to another vessel
-        if (
-            (
-                ( grep { $_ eq 'perl' } @$order )
-                && ( $args{only} ? $args{only}{perl} : !$args{skip}{perl} )
-            )
-            || -e $perl
-          )
-        {
+        # -e $perl makes sense when we install onto another vessel
+        if ( ( grep { /^perl/ } @$order ) || -e $perl ) {
             $args{perl} = $perl;
         }
     }
@@ -243,17 +238,7 @@
         'shipwright-utility' );
 
     for my $dist (@$order) {
-
-        # $flags->{$dist} is undef means 'default', will be installed
-        next
-          if $flags->{$dist} && !grep { $args{flags}{$_} } @{ $flags->{$dist} };
-
-        if ( $args{only} ) {
-            install($dist) if $args{only}{$dist};
-        }
-        else {
-            install($dist) unless $args{skip}{$dist};
-        }
+        install($dist);
         chdir $build_base;
     }
 
@@ -373,8 +358,7 @@
     # if we have this $type(e.g. perl) installed and have that specific wrapper,
     # then link to it, else link to the normal one
         if (   $type
-            && grep( { $_ eq $type } @$order )
-            && ( $args{only} ? $args{only}{$type} : !$args{skip}{$type} )
+            && -e File::Spec->catfile( '..', 'bin', $type )
             && -e File::Spec->catfile( '..', 'etc', "shipwright-$type-wrapper" )
           )
         {



More information about the Bps-public-commit mailing list