[Bps-public-commit] r10150 - bpsbuilder/BPB/lib/BPB/Backend
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Thu Dec 27 04:43:40 EST 2007
Author: sunnavy
Date: Thu Dec 27 04:43:40 2007
New Revision: 10150
Modified:
bpsbuilder/BPB/lib/BPB/Backend/SVK.pm
Log:
added scripts dir, all the build scripts will live there
Modified: bpsbuilder/BPB/lib/BPB/Backend/SVK.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Backend/SVK.pm (original)
+++ bpsbuilder/BPB/lib/BPB/Backend/SVK.pm Thu Dec 27 04:43:40 2007
@@ -7,6 +7,7 @@
use CPAN::DistnameInfo;
use BPB::Config;
use File::Temp qw/tempdir/;
+use File::Copy qw/copy/;
# our project's own files will be in //local/test/main
# all the dependance packages will be in //local/test/deps
@@ -31,23 +32,22 @@
sub initialize {
my $self = shift;
my $dir = tempdir( CLEANUP => 1 );
- for (qw/bpb dists etc bin/) {
+ for (qw/bpb dists etc bin scripts/) {
mkdir File::Spec->catfile( $dir, $_ );
}
- open my $order, '>', File::Spec->catfile( $dir, 'bpb', 'order.yml' );
+ open my $order, '>', File::Spec->catfile( $dir, 'bpb', 'order.yml' );
close $order;
- open my $wrapper, '>', File::Spec->catfile( $dir, 'etc',
- 'bpb-script-wrapper' );
+ open my $wrapper, '>',
+ File::Spec->catfile( $dir, 'etc', 'bpb-script-wrapper' );
print $wrapper $BPB::Backend::WRAPPER;
close $wrapper;
- open my $builder, '>', File::Spec->catfile( $dir, 'bin',
- 'bpb-builder' );
+ open my $builder, '>', File::Spec->catfile( $dir, 'bin', 'bpb-builder' );
print $builder $BPB::Backend::BUILDER;
close $builder;
- $self->delete; # clean repository in case it exists
+ $self->delete; # clean repository in case it exists
$self->import( source => $dir, _initialize => 1 );
}
@@ -59,7 +59,7 @@
my $self = shift;
return unless @_;
my %args = @_;
- my $cmd = $self->_cmd( import => %args );
+ my $cmd = $self->_cmd( import => %args );
$self->_run($cmd);
$self->_update_order( source => $args{source} ) unless $args{_initialize};
}
@@ -95,7 +95,7 @@
my $type = shift;
my %args = @_;
$args{extra} ||= [];
- $args{path} ||= '';
+ $args{path} ||= '';
for ( @{ $REQUIRE_OPTIONS{$type} } ) {
croak "$type need option $_" unless $args{$_};
@@ -108,8 +108,8 @@
$cmd = join ' ', 'svk', 'checkout', '--detach', $args{target};
}
else {
- $cmd = join ' ', 'svk', 'checkout',
- $self->repository . $args{path}, $args{target};
+ $cmd = join ' ', 'svk', 'checkout', $self->repository . $args{path},
+ $args{target};
}
}
elsif ( $type eq 'import' ) {
@@ -123,8 +123,18 @@
my $name = $args{source};
$name =~ s!^.*/(.+)/?$!$1.tar.gz!;
$name = CPAN::DistnameInfo->new($name)->dist;
- $cmd = join ' ', 'svk', 'import', $args{source},
- $self->repository . "/dists/$name";
+
+ if ( my $script_dir = $args{build_script} ) {
+ $cmd = join ' ', 'svk', 'import', $script_dir,
+ $self->repository . "/scripts/$name/";
+ }
+ else {
+ my $name = $args{source};
+ $name =~ s!^.*/(.+)/?$!$1.tar.gz!;
+ $name = CPAN::DistnameInfo->new($name)->dist;
+ $cmd = join ' ', 'svk', 'import', $args{source},
+ $self->repository . "/dists/$name";
+ }
}
}
elsif ( $type eq 'commit' ) {
@@ -132,8 +142,8 @@
$args{path};
}
elsif ( $type eq 'delete' ) {
- $cmd = join ' ', 'svk', 'delete', $self->repository, '-m', q{'} .
- 'delete repository' . q{'};
+ $cmd = join ' ', 'svk', 'delete', $self->repository, '-m',
+ q{'} . 'delete repository' . q{'};
}
else {
croak "invalid command";
@@ -169,10 +179,10 @@
}
sub order {
- my $self = shift;
- my $cmd = 'svk cat ' . $self->repository . '/bpb/order.yml';
+ my $self = shift;
+ my $cmd = 'svk cat ' . $self->repository . '/bpb/order.yml';
my $string = `$cmd`;
- return BPB::Config::Load( $string );
+ return BPB::Config::Load($string);
}
sub _run {
@@ -183,7 +193,7 @@
sub delete {
my $self = shift;
- my $cmd = $self->_cmd( 'delete' );
+ my $cmd = $self->_cmd('delete');
$self->_run($cmd);
}
More information about the Bps-public-commit
mailing list