[Bps-public-commit] r10230 - in bpsbuilder/BPB/lib/BPB: . Backend
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Thu Jan 3 06:05:03 EST 2008
Author: sunnavy
Date: Thu Jan 3 06:05:03 2008
New Revision: 10230
Modified:
bpsbuilder/BPB/lib/BPB/Backend/SVK.pm
bpsbuilder/BPB/lib/BPB/Backend/SVN.pm
bpsbuilder/BPB/lib/BPB/Build.pm
bpsbuilder/BPB/lib/BPB/Source/CPAN.pm
bpsbuilder/BPB/lib/BPB/Source/Compressed.pm
bpsbuilder/BPB/lib/BPB/Source/Directory.pm
bpsbuilder/BPB/lib/BPB/Source/FTP.pm
bpsbuilder/BPB/lib/BPB/Source/HTTP.pm
bpsbuilder/BPB/lib/BPB/Source/SVK.pm
bpsbuilder/BPB/lib/BPB/Source/SVN.pm
Log:
log sth. is good ;)
Modified: bpsbuilder/BPB/lib/BPB/Backend/SVK.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Backend/SVK.pm (original)
+++ bpsbuilder/BPB/lib/BPB/Backend/SVK.pm Thu Jan 3 06:05:03 2008
@@ -47,6 +47,7 @@
close $builder;
$self->delete; # clean repository in case it exists
+ $self->log->info( 'initialize ' . $self->repository );
$self->import(
source => $dir,
_initialize => 1,
@@ -65,8 +66,20 @@
my $name = $args{source};
$name =~ s{^.*/(.+)/?$}{$1.tar.gz};
$name = CPAN::DistnameInfo->new($name)->dist;
+
+ unless ( $args{_initialize} ) {
+ if ( $args{build_script} ) {
+ $self->delete("scripts/$name");
+ $self->log->info(
+ "import $args{source}'s scripts to " . $self->repository );
+ }
+ else {
+ $self->delete("dists/$name");
+ $self->log->info( "import $args{source} to " . $self->repository );
+ $self->_add_to_order( source => $args{source} );
+ }
+ }
BPB::Util->run( $self->_cmd( import => %args, name => $name ) );
- $self->_add_to_order( source => $args{source} ) unless $args{_initialize};
}
=head2 export
@@ -75,8 +88,12 @@
sub export {
my $self = shift;
- BPB::Util->run( $self->_cmd( checkout => @_ ) );
- BPB::Util->run( $self->_cmd( checkout => @_, detach => 1 ) );
+ my %args = @_;
+ my $path = $args{path} || '';
+ $self->log->info(
+ 'export ' . $self->repository . "/$path to $args{target}" );
+ BPB::Util->run( $self->_cmd( checkout => %args ) );
+ BPB::Util->run( $self->_cmd( checkout => %args, detach => 1 ) );
}
=head2 checkout
@@ -85,11 +102,17 @@
sub checkout {
my $self = shift;
- BPB::Util->run( $self->_cmd( checkout => @_ ) );
+ my %args = @_;
+ my $path = $args{path} || '';
+ $self->log->info(
+ 'export ' . $self->repository . "/$path to $args{target}" );
+ BPB::Util->run( $self->_cmd( checkout => %args ) );
}
sub commit {
my $self = shift;
+ my %args = @_;
+ $self->log->info( 'commit ' . $args{path} );
BPB::Util->run( $self->_cmd( commit => @_ ) );
}
@@ -172,13 +195,15 @@
$name = CPAN::DistnameInfo->new($name)->dist;
unless ( grep { /^$name$/ } @$order ) {
+ $self->log->info( "add $name to order for " . $self->repository );
push @$order, $name;
$self->order($order);
}
}
sub update_order {
- my $self = shift;
+ my $self = shift;
+ $self->log->info( "update order for " . $self->repository );
my $cmd = 'svk ls ' . $self->repository . '/scripts';
my @dists = `$cmd`;
chomp @dists;
@@ -230,15 +255,19 @@
sub delete {
my $self = shift;
- my $path = shift;
- BPB::Util->run( $self->_cmd( delete => path => $path ) )
- if $self->info($path);
+ my $path = shift || '';
+ if ( $self->info($path) ) {
+ $self->log->info( "delete " . $self->repository . "/$path" );
+ BPB::Util->run( $self->_cmd( delete => path => $path ) );
+ }
}
sub info {
my $self = shift;
my $path = shift;
- my ($info) = BPB::Util->run( $self->_cmd( info => path => $path ), 1 );
+ my ( $info, $err ) =
+ BPB::Util->run( $self->_cmd( info => path => $path ), 1 );
+ $self->log->warn($err) if $err;
return $info;
}
Modified: bpsbuilder/BPB/lib/BPB/Backend/SVN.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Backend/SVN.pm (original)
+++ bpsbuilder/BPB/lib/BPB/Backend/SVN.pm Thu Jan 3 06:05:03 2008
@@ -47,6 +47,7 @@
close $builder;
$self->delete; # clean repository in case it exists
+ $self->log->info( 'initialize ' . $self->repository );
$self->import(
source => $dir,
comment => 'create project',
@@ -65,14 +66,20 @@
my $name = $args{source};
$name =~ s{^.*/(.+)/?$}{$1.tar.gz};
$name = CPAN::DistnameInfo->new($name)->dist;
- if ( $args{build_script} ) {
- $self->delete("scripts/$name");
- }
- else {
- $self->delete("dists/$name");
+
+ unless ( $args{_initialize} ) {
+ if ( $args{build_script} ) {
+ $self->delete("scripts/$name");
+ $self->log->info(
+ "import $args{source}'s scripts to " . $self->repository );
+ }
+ else {
+ $self->delete("dists/$name");
+ $self->log->info( "import $args{source} to " . $self->repository );
+ $self->_add_to_order( source => $args{source} );
+ }
}
BPB::Util->run( $self->_cmd( import => %args, name => $name ) );
- $self->_add_to_order( source => $args{source} ) unless $args{_initialize};
}
=head2 export
@@ -81,7 +88,11 @@
sub export {
my $self = shift;
- BPB::Util->run( $self->_cmd( export => @_ ) );
+ my %args = @_;
+ my $path = $args{path} || '';
+ $self->log->info(
+ 'export ' . $self->repository . "/$path to $args{target}" );
+ BPB::Util->run( $self->_cmd( export => %args ) );
}
=head2 checkout
@@ -90,11 +101,17 @@
sub checkout {
my $self = shift;
+ my %args = @_;
+ my $path = $args{path} || '';
+ $self->log->info(
+ 'export ' . $self->repository . "/$path to $args{target}" );
BPB::Util->run( $self->_cmd( checkout => @_ ) );
}
sub commit {
my $self = shift;
+ my %args = @_;
+ $self->log->info( 'commit ' . $args{path} );
BPB::Util->run( $self->_cmd( commit => @_ ) );
}
@@ -174,13 +191,15 @@
$name = CPAN::DistnameInfo->new($name)->dist;
unless ( grep { /^$name$/ } @$order ) {
+ $self->log->info( "add $name to order for " . $self->repository );
push @$order, $name;
$self->order($order);
}
}
sub update_order {
- my $self = shift;
+ my $self = shift;
+ $self->log->info( "update order for " . $self->repository );
my $cmd = 'svn ls ' . $self->repository . '/scripts';
my @dists = `$cmd`;
chomp @dists;
@@ -232,17 +251,23 @@
sub delete {
my $self = shift;
- my $path = shift;
- BPB::Util->run( $self->_cmd( delete => path => $path ) )
- if $self->info($path);
+ my $path = shift || '';
+ if ( $self->info($path) ) {
+ $self->log->info( "delete " . $self->repository . "/$path" );
+ BPB::Util->run( $self->_cmd( delete => path => $path ) );
+ }
}
sub info {
my $self = shift;
my $path = shift;
my ( $info, $err ) = BPB::Util->run( $self->_cmd( info => path => $path ) );
- return $info unless $err;
- return;
+ if ($err) {
+ $err =~ s/\s+$//;
+ $self->log->warn($err);
+ return;
+ }
+ return $info;
}
1;
Modified: bpsbuilder/BPB/lib/BPB/Build.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Build.pm (original)
+++ bpsbuilder/BPB/lib/BPB/Build.pm Thu Jan 3 06:05:03 2008
@@ -34,6 +34,8 @@
$self->$_( $args{$_} ) if $args{$_};
}
+ $self->log->info( 'run build to install to ' . $self->install_base );
+
mkdir $self->install_base unless -e $self->install_base;
chdir $self->build_base;
Modified: bpsbuilder/BPB/lib/BPB/Source/CPAN.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Source/CPAN.pm (original)
+++ bpsbuilder/BPB/lib/BPB/Source/CPAN.pm Thu Jan 3 06:05:03 2008
@@ -49,6 +49,7 @@
sub run {
my $self = shift;
+ $self->log->info("prepare to run source: " . $self->source );
$self->_run;
my $compressed = BPB::Source::Compressed->new(%$self);
$compressed->run(@_);
Modified: bpsbuilder/BPB/lib/BPB/Source/Compressed.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Source/Compressed.pm (original)
+++ bpsbuilder/BPB/lib/BPB/Source/Compressed.pm Thu Jan 3 06:05:03 2008
@@ -13,6 +13,8 @@
sub run {
my $self = shift;
+ $self->log->info(
+ 'run source ' . ( $self->name || $self->path ) . ': ' . $self->source );
my $ret = $self->SUPER::run(@_);
$self->_follow(
File::Spec->catfile( $self->directory, $self->name || $self->path ) )
Modified: bpsbuilder/BPB/lib/BPB/Source/Directory.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Source/Directory.pm (original)
+++ bpsbuilder/BPB/lib/BPB/Source/Directory.pm Thu Jan 3 06:05:03 2008
@@ -14,7 +14,9 @@
sub new {
my $class = shift;
my $self = $class->SUPER::new(@_);
- $self->{source} =~ s{/$}{}; # trim the last / to let cp work as we like
+ my $s = $self->source;
+ $s =~ s{/$}{}; # trim the last / to let cp work as we like
+ $self->source($s);
return $self;
}
@@ -24,6 +26,8 @@
sub run {
my $self = shift;
+ $self->log->info(
+ 'run source ' . ( $self->name || $self->path ) . ': ' . $self->source );
$self->SUPER::run(@_);
$self->_follow(
File::Spec->catfile( $self->directory, $self->name || $self->path ) )
@@ -38,8 +42,10 @@
sub _cmd {
my $self = shift;
- return ['cp', '-r', $self->source,
- File::Spec->catfile( $self->directory, $self->name || $self->path )];
+ return [
+ 'cp', '-r', $self->source,
+ File::Spec->catfile( $self->directory, $self->name || $self->path )
+ ];
}
1;
Modified: bpsbuilder/BPB/lib/BPB/Source/FTP.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Source/FTP.pm (original)
+++ bpsbuilder/BPB/lib/BPB/Source/FTP.pm Thu Jan 3 06:05:03 2008
@@ -14,6 +14,7 @@
sub run {
my $self = shift;
+ $self->log->info("prepare to run source: " . $self->source );
$self->SUPER::run();
my $compressed = BPB::Source::Compressed->new( %$self );
$compressed->run();
Modified: bpsbuilder/BPB/lib/BPB/Source/HTTP.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Source/HTTP.pm (original)
+++ bpsbuilder/BPB/lib/BPB/Source/HTTP.pm Thu Jan 3 06:05:03 2008
@@ -14,6 +14,7 @@
sub run {
my $self = shift;
+ $self->log->info("prepare to run source: " . $self->source );
$self->SUPER::run();
my $compressed = BPB::Source::Compressed->new( %$self );
$compressed->run();
Modified: bpsbuilder/BPB/lib/BPB/Source/SVK.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Source/SVK.pm (original)
+++ bpsbuilder/BPB/lib/BPB/Source/SVK.pm Thu Jan 3 06:05:03 2008
@@ -22,6 +22,7 @@
sub run {
my $self = shift;
+ $self->log->info("prepare to run source: " . $self->source );
$self->_run;
my $s;
if ( $self->_is_compressed ) {
Modified: bpsbuilder/BPB/lib/BPB/Source/SVN.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Source/SVN.pm (original)
+++ bpsbuilder/BPB/lib/BPB/Source/SVN.pm Thu Jan 3 06:05:03 2008
@@ -22,6 +22,7 @@
sub run {
my $self = shift;
+ $self->log->info("prepare to run source: " . $self->source );
$self->_run;
my $s;
if ( $self->_is_compressed ) {
More information about the Bps-public-commit
mailing list