[Bps-public-commit] r14996 - in Shipwright/branches/2.0: lib/Shipwright share/bin

sunnavy at bestpractical.com sunnavy at bestpractical.com
Mon Aug 11 09:19:22 EDT 2008


Author: sunnavy
Date: Mon Aug 11 09:19:21 2008
New Revision: 14996

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

Log:
 r15539 at sunnavys-mb:  sunnavy | 2008-08-11 20:23:06 +0800
 branch support for build


Modified: Shipwright/branches/2.0/lib/Shipwright/Build.pm
==============================================================================
--- Shipwright/branches/2.0/lib/Shipwright/Build.pm	(original)
+++ Shipwright/branches/2.0/lib/Shipwright/Build.pm	Mon Aug 11 09:19:21 2008
@@ -116,7 +116,7 @@
             File::Spec->catfile( 'shipwright', 'order.yml' ) )
           || [];
 
-        my ( $flags, $ktf );
+        my ( $flags, $ktf, $branches );
         if ( -e File::Spec->catfile( 'shipwright', 'flags.yml' ) ) {
 
             $flags = Shipwright::Util::LoadFile(
@@ -144,6 +144,12 @@
             $ktf = {};
         }
 
+        if ( -e File::Spec->catfile( 'shipwright', 'branches.yml' ) ) {
+
+            $branches = Shipwright::Util::LoadFile(
+                File::Spec->catfile( 'shipwright', 'branches.yml' ) );
+        }
+
         # calculate the real order
         if ( $self->only ) {
             @$order = grep { $self->only->{$_} } @$order;
@@ -177,7 +183,7 @@
         }
 
         for my $dist (@$order) {
-            $self->_install( $dist, $ktf );
+            $self->_install( $dist, $ktf, $branches );
             $self->_record($dist);
             chdir $self->build_base;
         }
@@ -196,6 +202,19 @@
     my $self = shift;
     my $dir  = shift;
     my $ktf  = shift;
+    my $branches = shift;
+
+    if ( $branches ) {
+            system(
+                "cp -r "
+                  . File::Spec->catdir( 'sources', $dir, split /\//,
+                    $branches->{$dir}[0] )
+                  . ' '
+                  . File::Spec->catdir( 'dists', $dir )
+              )
+              && die
+              "cp sources/$dir/$branches->{$dir}[0] to dists/$dir failed";
+    }
 
     chdir File::Spec->catfile( 'dists', $dir );
 

Modified: Shipwright/branches/2.0/share/bin/shipwright-builder
==============================================================================
--- Shipwright/branches/2.0/share/bin/shipwright-builder	(original)
+++ Shipwright/branches/2.0/share/bin/shipwright-builder	Mon Aug 11 09:19:21 2008
@@ -132,7 +132,7 @@
 my $order =
   ( YAML::Tiny->read( File::Spec->catfile( 'shipwright', 'order.yml' ) ) )->[0];
 
-my ( $flags, $ktf );
+my ( $flags, $ktf, $branches );
 
 if ( -e File::Spec->catfile( 'shipwright', 'flags.yml' ) ) {
     $flags =
@@ -154,6 +154,14 @@
     $ktf = {};
 }
 
+if ( -e File::Spec->catfile( 'shipwright', 'branches.yml' ) ) {
+    $branches = (
+        YAML::Tiny->read(
+            File::Spec->catfile( 'shipwright', 'branches.yml' )
+        )
+    )->[0];
+}
+
 # fill not specified but mandatory flags
 if ( $flags->{__mandatory} ) {
     for my $list ( values %{ $flags->{__mandatory} } ) {
@@ -189,12 +197,17 @@
     open $log, '>', 'clean.log' or die $!;
 
     system('rm -rf tmp_dists') && die "rm tmp_dists failed\n";
-
     print $log "removed tmp_dists";
 
-    for my $dist (@$order) {
-        clean($dist);
-        chdir $build_base;
+    if ($branches) {
+        system('rm -rf dists') && die "rm dists failed\n";
+        print $log "removed dists";
+    }
+    else {
+        for my $dist (@$order) {
+            clean($dist);
+            chdir $build_base;
+        }
     }
 
     unlink '__need_clean';
@@ -294,6 +307,7 @@
       File::Spec->catfile( $args{'install-base'}, 'tools',
         'shipwright-utility' );
 
+    mkpath 'dists';
     for my $dist (@$order) {
         install($dist);
         record($dist);
@@ -315,7 +329,18 @@
         chdir File::Spec->catfile( 'tmp_dists', $dir );
     }
     else {
-        chdir File::Spec->catfile( 'dists', $dir );
+        if ($branches) {
+            system(
+                "cp -r "
+                  . File::Spec->catdir( 'sources', $dir, split /\//,
+                    $branches->{$dir}[0] )
+                  . ' '
+                  . File::Spec->catdir( 'dists', $dir )
+              )
+              && die
+              "cp sources/$dir/$branches->{$dir}[0] to dists/$dir failed";
+        }
+        chdir File::Spec->catdir( 'dists', $dir );
     }
 
     my $skip_test = $args{'skip-test'} || $args{'skip-test-except-final'};



More information about the Bps-public-commit mailing list