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

sunnavy at bestpractical.com sunnavy at bestpractical.com
Mon Jan 7 00:54:19 EST 2008


Author: sunnavy
Date: Mon Jan  7 00:54:18 2008
New Revision: 10257

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

Log:
we can skip some dists when build by set skip arg, e.g. --skip Dist1,Dist2

Modified: bpsbuilder/BPB/lib/BPB.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB.pm	(original)
+++ bpsbuilder/BPB/lib/BPB.pm	Mon Jan  7 00:54:18 2008
@@ -59,13 +59,21 @@
                     name   => $args{source_name},
                 )
             );
-            $self->source->log(Log::Log4perl->get_logger( ref $self->source ));
+            $self->source->log(
+                Log::Log4perl->get_logger( ref $self->source ) );
         }
 
-        $self->build( BPB::Build->new( %{ $self->config->name->{build} } ) );
+        $self->build(
+            BPB::Build->new(
+                %{ $self->config->name->{build} },
+                scalar @{ $args{build_skip} }
+                ? ( skip => $args{build_skip} )
+                : (),
+            )
+        );
 
         for my $comp (qw/backend build/) {
-            $self->$comp->log(Log::Log4perl->get_logger( ref $self->$comp ));
+            $self->$comp->log( Log::Log4perl->get_logger( ref $self->$comp ) );
         }
 
     }

Modified: bpsbuilder/BPB/lib/BPB/Build.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Build.pm	(original)
+++ bpsbuilder/BPB/lib/BPB/Build.pm	Mon Jan  7 00:54:18 2008
@@ -7,7 +7,7 @@
 use base qw/Class::Accessor::Fast/;
 
 __PACKAGE__->mk_accessors(
-    qw/install_base perl build_base skip_test commands log/);
+    qw/install_base perl build_base skip_test commands log skip/);
 
 use File::Spec;
 use File::Temp qw/tempdir/;
@@ -15,7 +15,6 @@
 use File::Copy qw/move copy/;
 use File::Find qw/find/;
 use File::Slurp;
-use Config;
 
 sub new {
     my $class = shift;
@@ -48,9 +47,10 @@
     my $order =
       BPB::Config::LoadFile( File::Spec->catfile( 'bpb', 'order.yml' ) );
 
-    for (@$order) {
-        s/::/-/g;
-        $self->_install($_);
+    for my $dist (@$order) {
+        unless ( grep { $dist eq $dist } @{ $self->skip } ) {
+            $self->_install($dist);
+        }
         chdir $self->build_base;
     }
 
@@ -70,7 +70,7 @@
     $self->_substitute('__build');
 
     chmod 0755, '__build';
-    system( './__build' );
+    system('./__build');
 }
 
 sub _wrapper {
@@ -93,11 +93,11 @@
           or die $!;
     };
 
-    my @dirs = 
-        grep { -d $_ }
-          map { File::Spec->catfile( $self->install_base, $_ ) }
-          qw/bin sbin libexec/;
-    find( $sub, @dirs) if @dirs;
+    my @dirs =
+      grep { -d $_ }
+      map { File::Spec->catfile( $self->install_base, $_ ) }
+      qw/bin sbin libexec/;
+    find( $sub, @dirs ) if @dirs;
 }
 
 sub _substitute {

Modified: bpsbuilder/BPB/lib/BPB/Script/Build.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Script/Build.pm	(original)
+++ bpsbuilder/BPB/lib/BPB/Script/Build.pm	Mon Jan  7 00:54:18 2008
@@ -5,7 +5,7 @@
 use Carp;
 
 use base qw/App::CLI::Command Class::Accessor::Fast/;
-__PACKAGE__->mk_accessors(qw/config name install_base build_base/);
+__PACKAGE__->mk_accessors(qw/config name install_base build_base skip/);
 
 use BPB;
 
@@ -14,6 +14,7 @@
         'n|name=s'         => 'name',
         'c|config=s'       => 'config',
         'i|install-base=s' => 'install_base',
+        'skip=s'           => 'skip',
     );
 }
 
@@ -24,7 +25,13 @@
 
     die "need name arg" unless $self->name;
 
-    my $bpb = BPB->new( config => $self->config, name => $self->name );
+    $self->skip( [ split /,\s*/, $self->skip || '' ] );
+
+    my $bpb = BPB->new(
+        config     => $self->config,
+        name       => $self->name,
+        build_skip => $self->skip,
+    );
     $bpb->backend->export( target => $bpb->build->build_base );
     $bpb->build->run( map { $_ => $self->$_ } qw/install_base/ );
 }
@@ -45,6 +52,7 @@
    --config(-c)       specify which config.yml we'll use
    --name(-n)         specify the project's name
    --install-base(-i) specify install base. overide the item in config.yml
+   --skip             specify dists which'll be skipped
 
 =head1 AUTHOR
 



More information about the Bps-public-commit mailing list