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

sunnavy at bestpractical.com sunnavy at bestpractical.com
Wed Jul 23 01:53:59 EDT 2008


Author: sunnavy
Date: Wed Jul 23 01:53:59 2008
New Revision: 14422

Modified:
   Shipwright/trunk/   (props changed)
   Shipwright/trunk/share/bin/shipwright-builder

Log:
 r14877 at sunnavys-mb:  sunnavy | 2008-07-23 13:53:36 +0800
 refactor builder


Modified: Shipwright/trunk/share/bin/shipwright-builder
==============================================================================
--- Shipwright/trunk/share/bin/shipwright-builder	(original)
+++ Shipwright/trunk/share/bin/shipwright-builder	Wed Jul 23 01:53:59 2008
@@ -95,10 +95,39 @@
     $args{only} = { map { $_ => 1 } split /\s*,\s*/, $args{only} };
 }
 
-if ( $args{'install-base'} ) {
-    $args{'install-base'} = File::Spec->rel2abs( $args{'install-base'} );
+$args{'install-base'} = get_install_base() unless $args{'install-base'};
+
+unless ( $args{name} ) {
+    if ( $build_base =~ m{([-.\w]+)[\\/]([.\d]+)$} ) {
+        $args{name} = "$1-$2";
+    }
+    elsif ( $build_base =~ m{([-.\w]+)$} ) {
+        $args{name} = $1;
+    }
 }
 
+unless ( $args{'install-base'} ) {
+    my $dir = tempdir( $args{name} . '-XXXXXX', DIR => File::Spec->tmpdir );
+    $args{'install-base'} = File::Spec->catfile( $dir, $args{name} );
+    print "no default install-base, will set it to $args{'install-base'}\n";
+}
+
+my $installed;
+my $installed_hash = {};
+my $installed_file =
+  File::Spec->catfile( $args{'install-base'}, 'installed.yml' );
+if ( -e $installed_file ) {
+    $installed =
+      YAML::Tiny->read(
+        File::Spec->catfile( $args{'install-base'}, 'installed.yml' ) );
+    $installed_hash = { map { $_ => 1 } @{ $installed->[0] } };
+}
+else {
+    $installed = YAML::Tiny->new;
+}
+
+$args{'install-base'} = File::Spec->rel2abs( $args{'install-base'} );
+
 # YAML::Tiny objects are array based.
 my $order =
   ( YAML::Tiny->read( File::Spec->catfile( 'shipwright', 'order.yml' ) ) )->[0];
@@ -107,15 +136,15 @@
 
 if ( -e File::Spec->catfile( 'shipwright', 'flags.yml' ) ) {
     $flags =
-      ( YAML::Tiny->read( File::Spec->catfile( 'shipwright', 'flags.yml' ) ) )->[0];
+      ( YAML::Tiny->read( File::Spec->catfile( 'shipwright', 'flags.yml' ) ) )
+      ->[0];
 }
 else {
     $flags = {};
 }
 
 if ( -e File::Spec->catfile( 'shipwright', 'known_test_failures.yml' ) ) {
-    $ktf =
-    (
+    $ktf = (
         YAML::Tiny->read(
             File::Spec->catfile( 'shipwright', 'known_test_failures.yml' )
         )
@@ -134,20 +163,6 @@
     }
 }
 
-my $installed;
-my $installed_hash = {};
-my $installed_file =
-  File::Spec->catfile( $args{'install-base'}, 'installed.yml' );
-if ( -e $installed_file ) {
-    $installed =
-      YAML::Tiny->read(
-        File::Spec->catfile( $args{'install-base'}, 'installed.yml' ) );
-    $installed_hash = { map { $_ => 1 } @{ $installed->[0] } };
-}
-else {
-    $installed = YAML::Tiny->new;
-}
-
 # calculate the real order
 if ( $args{only} ) {
     @$order = grep { $args{only}->{$_} } @$order;
@@ -168,7 +183,6 @@
 if ( $args{'only-test'} ) {
     open $log, '>', 'test.log' or die $!;
 
-    $args{'install-base'} = get_install_base() unless $args{'install-base'};
     test();
 }
 elsif ( $args{'clean'} ) {
@@ -178,8 +192,6 @@
 
     print $log "removed tmp_dists";
 
-    $args{'install-base'} = get_install_base() unless $args{'install-base'};
-
     for my $dist (@$order) {
         clean($dist);
         chdir $build_base;
@@ -224,23 +236,6 @@
         $CPAN::Config->{prerequisites_policy} = 'ignore';
     };
 
-    unless ( $args{name} ) {
-        if ( $build_base =~ m{([-.\w]+)[\\/]([.\d]+)$} ) {
-            $args{name} = "$1-$2";
-        }
-        elsif ( $build_base =~ m{([-.\w]+)$} ) {
-            $args{name} = $1;
-        }
-    }
-
-    unless ( $args{'install-base'} ) {
-        my $dir = tempdir( $args{name} . '-XXXXXX', DIR => File::Spec->tmpdir );
-        $args{'install-base'} = File::Spec->catfile( $dir, $args{name} );
-
-        print $log
-          "no default install-base, will set it to $args{'install-base'}\n";
-    }
-
     open my $fh, '>', '__install_base'
       or die "can't write to __install_base: $!";
     print $fh $args{'install-base'};
@@ -583,11 +578,6 @@
         chomp $install_base;
         return $install_base;
     }
-    else {
-        warn
-"can't find install-base automatically, you need to specify it manually.\n";
-    }
-
 }
 
 sub process_tmp_dists {



More information about the Bps-public-commit mailing list