[Bps-public-commit] r10058 - in bpsbuilder/BPB/lib/BPB: .

sunnavy at bestpractical.com sunnavy at bestpractical.com
Mon Dec 24 03:43:11 EST 2007


Author: sunnavy
Date: Mon Dec 24 03:43:11 2007
New Revision: 10058

Modified:
   bpsbuilder/BPB/lib/BPB/Build.pm
   bpsbuilder/BPB/lib/BPB/Script/Import.pm

Log:
rename _build to __build, and always generate __build

Modified: bpsbuilder/BPB/lib/BPB/Build.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Build.pm	(original)
+++ bpsbuilder/BPB/lib/BPB/Build.pm	Mon Dec 24 03:43:11 2007
@@ -6,8 +6,7 @@
 
 use base qw/Class::Accessor::Fast/;
 
-__PACKAGE__->mk_accessors(
-    qw/install_base perl build_base skip_test commands/);
+__PACKAGE__->mk_accessors(qw/install_base perl build_base skip_test commands/);
 
 use File::Spec;
 use File::Temp qw/tempdir/;
@@ -41,8 +40,7 @@
     dircopy( 'etc', File::Spec->catfile( $self->install_base, 'etc' ) );
 
     chmod 0755,
-      File::Spec->catfile( $self->install_base, 'etc',
-        'bpb-script-wrapper' );
+      File::Spec->catfile( $self->install_base, 'etc', 'bpb-script-wrapper' );
 
     my $order =
       BPB::Config::LoadFile( File::Spec->catfile( 'bpb', 'order.yml' ) );
@@ -62,51 +60,57 @@
     my $dir  = shift;
     chdir File::Spec->catfile( 'dists', $dir );
 
-    my @commands;
     my $lib =
-        " -I" . File::Spec->catfile( $self->install_base, 'lib', 'perl5' ) . 
-        " -I" . File::Spec->catfile( $self->install_base, 'lib', 'perl5',
-            $Config{archname} );
-
-    if ( -f '_build' ) {
-        $self->_substitute('_build');
-        chmod 0755, '_build';
-        system( './_build' );
-    }
-    elsif ( -f 'configure' ) {
-        @commands = (
-            './configure --prefix=' . $self->install_base,
-            'make', 'make install'
-        );
-    }
-    elsif ( -f 'Build.PL' ) {
-        push @commands,
-          $self->perl . $lib . " Build.PL --install_base=" . $self->install_base;
-        unless ( $self->skip_test ) {
-            push @commands, "./Build test";
-        }
-        push @commands, "./Build install";
-    }
-    elsif ( -f 'Makefile.PL' ) {
-        push @commands,
-          $self->perl . $lib . " Makefile.PL INSTALL_BASE=" . $self->install_base;
-        unless ( $self->skip_test ) {
-            push @commands, 'make test';
-        }
+        " -I" 
+      . File::Spec->catfile( $self->install_base, 'lib', 'perl5' ) . " -I"
+      . File::Spec->catfile( $self->install_base, 'lib', 'perl5',
+        $Config{archname} );
 
-        push @commands, "make install";
+    if ( -f '__build' ) {
+        $self->_substitute('__build');
     }
     else {
-        warn "I have no idea how to build this distribution";
-    }
 
-    $self->_run($_) for @commands;
-}
+        my @commands;
+        if ( -f 'configure' ) {
+            @commands = (
+                './configure --prefix=' . $self->install_base,
+                'make', 'make install'
+            );
+        }
+        elsif ( -f 'Build.PL' ) {
+            push @commands,
+              $self->perl 
+              . $lib
+              . " Build.PL --install_base="
+              . $self->install_base;
+            unless ( $self->skip_test ) {
+                push @commands, "./Build test";
+            }
+            push @commands, "./Build install";
+        }
+        elsif ( -f 'Makefile.PL' ) {
+            push @commands,
+              $self->perl 
+              . $lib
+              . " Makefile.PL INSTALL_BASE="
+              . $self->install_base;
+            unless ( $self->skip_test ) {
+                push @commands, 'make test';
+            }
 
-sub _run {
-    my $self = shift;
-    my $cmd  = shift;
-    system($cmd);
+            push @commands, "make install";
+        }
+        else {
+            warn "I have no idea how to build this distribution";
+        }
+
+        open my $fh, '>', '__build' or die $@;
+        print $fh $_, "\n" for @commands;
+        close $fh;
+    }
+    chmod 0755, '__build';
+    system('./__build');
 }
 
 sub _wrapper {
@@ -119,12 +123,11 @@
         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" );
-        move( $file =>
-              File::Spec->catfile( $self->install_base, "$dir-wrapped" ) )
-          or die $!;
+        mkdir File::Spec->catfile( $self->install_base,       "$dir-wrapped" )
+          unless -d File::Spec->catfile( $self->install_base, "$dir-wrapped" );
+        move(
+            $file => File::Spec->catfile( $self->install_base, "$dir-wrapped" )
+        ) or die $!;
         link File::Spec->catfile( $self->install_base, 'etc',
             'bpb-script-wrapper' ) => $file
           or die $!;
@@ -138,21 +141,19 @@
     }
 }
 
-
 sub _substitute {
     my $self = shift;
     my $file = shift;
     return unless $file;
 
-    my $text = read_file( $file );
-    my $perl = $self->perl;
+    my $text         = read_file($file);
+    my $perl         = $self->perl;
     my $install_base = $self->install_base;
     $text =~ s/%%PERL%%/$perl/g;
     $text =~ s/%%INSTALL_BASE%%/$install_base/g;
     write_file( $file, $text );
 }
 
-
 1;
 
 __END__

Modified: bpsbuilder/BPB/lib/BPB/Script/Import.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Script/Import.pm	(original)
+++ bpsbuilder/BPB/lib/BPB/Script/Import.pm	Mon Dec 24 03:43:11 2007
@@ -40,7 +40,7 @@
 
     $self->source( $bpb->source->run );
 
-    copy( $self->build_script, File::Spec->catfile( $self->source, '_build' ))
+    copy( $self->build_script, File::Spec->catfile( $self->source, '__build' ))
         if $self->build_script;
 
     $self->import_req( $self->source, $bpb );



More information about the Bps-public-commit mailing list