[Bps-public-commit] r10396 - bpsbuilder/BPB/lib/BPB/Source
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Fri Jan 18 15:14:00 EST 2008
Author: sunnavy
Date: Fri Jan 18 15:13:57 2008
New Revision: 10396
Modified:
bpsbuilder/BPB/lib/BPB/Source/Base.pm
bpsbuilder/BPB/lib/BPB/Source/Compressed.pm
bpsbuilder/BPB/lib/BPB/Source/Directory.pm
Log:
no version numbers in names of dist dirs in source dir
Modified: bpsbuilder/BPB/lib/BPB/Source/Base.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Source/Base.pm (original)
+++ bpsbuilder/BPB/lib/BPB/Source/Base.pm Fri Jan 18 15:13:57 2008
@@ -106,9 +106,6 @@
opendir my $dir, $self->directory;
my @sources = readdir $dir;
- # remove version number
- s/-\d[.\w]+$// for @sources;
-
close $dir;
my $name;
@@ -197,15 +194,27 @@
my $cmd = [
'cp',
$file{$_},
- File::Spec->catfile(
- $self->directory, $self->name || $self->path, $_
- )
+ File::Spec->catfile( $self->directory,
+ $self->name || $self->just_name( $self->path ), $_ )
];
BPB::Util->run($cmd);
}
}
}
+=head2 just_name
+
+trim the version stuff from dist name
+
+=cut
+
+sub just_name {
+ my $self = shift;
+ my $name = shift;
+ require CPAN::DistnameInfo;
+ return CPAN::DistnameInfo->new( "$name.tar.gz" )->dist;
+}
+
1;
__END__
Modified: bpsbuilder/BPB/lib/BPB/Source/Compressed.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Source/Compressed.pm (original)
+++ bpsbuilder/BPB/lib/BPB/Source/Compressed.pm Fri Jan 18 15:13:57 2008
@@ -17,9 +17,12 @@
'run source ' . ( $self->name || $self->path ) . ': ' . $self->source );
my $ret = $self->SUPER::run(@_);
$self->_follow(
- File::Spec->catfile( $self->directory, $self->name || $self->path ) )
- if $self->follow;
- return File::Spec->catfile( $self->directory, $self->name || $self->path );
+ File::Spec->catfile(
+ $self->directory, $self->name || $self->just_name( $self->path )
+ )
+ ) if $self->follow;
+ return File::Spec->catfile( $self->directory,
+ $self->name || $self->just_name( $self->path ) );
}
=head2 path
@@ -64,13 +67,34 @@
push @cmds, [ 'tar', $arg, $self->source, '-C', $self->directory ];
if ( $self->name && $self->name ne $self->path ) {
+ if ( -e File::Spec->catfile( $self->directory, $self->name ) ) {
+ push @cmds,
+ [
+ 'rm', '-rf',
+ File::Spec->catfile( $self->directory, $self->path )
+ ],
+
+ }
+ else {
+ push @cmds,
+ [
+ 'mv',
+ File::Spec->catfile( $self->directory, $self->path ),
+ File::Spec->catfile( $self->directory, $self->name )
+ ];
+ }
+ }
+ else {
push @cmds,
[
'mv',
File::Spec->catfile( $self->directory, $self->path ),
- File::Spec->catfile( $self->directory, $self->name )
+ File::Spec->catfile(
+ $self->directory, $self->just_name( $self->path )
+ )
];
}
+
return @cmds;
}
Modified: bpsbuilder/BPB/lib/BPB/Source/Directory.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Source/Directory.pm (original)
+++ bpsbuilder/BPB/lib/BPB/Source/Directory.pm Fri Jan 18 15:13:57 2008
@@ -30,9 +30,12 @@
'run source ' . ( $self->name || $self->path ) . ': ' . $self->source );
$self->SUPER::run(@_);
$self->_follow(
- File::Spec->catfile( $self->directory, $self->name || $self->path ) )
- if $self->follow;
- return File::Spec->catfile( $self->directory, $self->name || $self->path );
+ File::Spec->catfile(
+ $self->directory, $self->name || $self->just_name( $self->path )
+ )
+ ) if $self->follow;
+ return File::Spec->catfile( $self->directory,
+ $self->name || $self->just_name( $self->path ) );
}
=head2 path
@@ -49,8 +52,10 @@
sub _cmd {
my $self = shift;
return [
- 'cp', '-r', $self->source,
- File::Spec->catfile( $self->directory, $self->name || $self->path )
+ 'cp', '-r',
+ $self->source,
+ File::Spec->catfile( $self->directory,
+ $self->name || $self->just_name( $self->path ) );
];
}
More information about the Bps-public-commit
mailing list