From c61b40ec8a61b54a5df408b7e965afc74d461766 Mon Sep 17 00:00:00 2001 From: Florent Villard Date: Sun, 13 Aug 2006 14:23:36 +0000 Subject: add a keep_svn_release to use this action both at maintainer upload and final upload --- lib/Youri/Upload/Action/Send.pm | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/Youri/Upload/Action/Send.pm b/lib/Youri/Upload/Action/Send.pm index 77c3b2a..0f18766 100644 --- a/lib/Youri/Upload/Action/Send.pm +++ b/lib/Youri/Upload/Action/Send.pm @@ -14,6 +14,7 @@ This action plugin ensures installation of new package revisions. use warnings; use strict; use Carp; +use File::Basename; use base qw/Youri::Upload::Action/; sub _init { @@ -24,16 +25,15 @@ sub _init { user => '', ssh_key => '', verbose => '', + keep_svn_release => '', @_ ); croak "undefined upload host" unless $options{uphost}; croak "undefined ssh key" unless $options{ssh_key}; - $self->{_perms} = $options{perms}; - $self->{_user} = $options{user}; - $self->{_uphost} = $options{uphost}; - $self->{_ssh_key} = $options{ssh_key}; - $self->{_verbose} = $options{verbose}; + foreach my $var ('perms', 'user', 'uphost', 'ssh_key', 'verbose', 'keep_svn_release') { + $self->{"_$var"} = $options{$var}; + } return $self; } @@ -46,7 +46,12 @@ sub run { my $dest = $repository->get_upload_dir($package, $target, $define); print "Sending file $file to $dest\n" if $self->{_verbose}; - my ($base) = $file =~ /.*\/(?:@\d+:)?([^\/]*)/; + my $base; + if ($self->{_keep_svn_release}) { + $base = basename($file) + } else { + ($base) = $file =~ /.*\/(?:@\d+:)?([^\/]*)/ + } my $cmd = "scp -i $self->{_ssh_key} $file $self->{_user}\@$self->{_uphost}:/$dest$base.new"; my $cmd2 = "ssh -i $self->{_ssh_key} $self->{_user}\@$self->{_uphost} \"mv /$dest$base.new /$dest$base\""; -- cgit v1.2.1