aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcelo Leitner <mrl@mandriva.com>2007-06-14 18:23:13 +0000
committerMarcelo Leitner <mrl@mandriva.com>2007-06-14 18:23:13 +0000
commit9626b8c731d43802fb69902b742f63d173d69aea (patch)
tree201c3619af488ef25a922dd473131a95dffbcb4f
parentd480228e0790da9f0512a24481dab3eec5a496ca (diff)
downloadmga-youri-submit-9626b8c731d43802fb69902b742f63d173d69aea.tar
mga-youri-submit-9626b8c731d43802fb69902b742f63d173d69aea.tar.gz
mga-youri-submit-9626b8c731d43802fb69902b742f63d173d69aea.tar.bz2
mga-youri-submit-9626b8c731d43802fb69902b742f63d173d69aea.tar.xz
mga-youri-submit-9626b8c731d43802fb69902b742f63d173d69aea.zip
- As this action is unique, avoid too much flexibility and simplify the code.
- Use . for hidding temporary files instead of .new suffix.
-rw-r--r--lib/Youri/Submit/Action/Sendcache.pm18
1 files changed, 7 insertions, 11 deletions
diff --git a/lib/Youri/Submit/Action/Sendcache.pm b/lib/Youri/Submit/Action/Sendcache.pm
index 1d52100..8d9cf94 100644
--- a/lib/Youri/Submit/Action/Sendcache.pm
+++ b/lib/Youri/Submit/Action/Sendcache.pm
@@ -26,13 +26,12 @@ sub _init {
ssh_key => '',
verbose => '',
root => '',
- keep_svn_release => '',
@_
);
croak "undefined upload host" unless $options{uphost};
croak "undefined ssh key" unless $options{ssh_key};
- foreach my $var ('perms', 'user', 'uphost', 'ssh_key', 'verbose', 'root', 'keep_svn_release') {
+ foreach my $var ('perms', 'user', 'uphost', 'ssh_key', 'verbose', 'root') {
$self->{"_$var"} = $options{$var};
}
@@ -48,17 +47,14 @@ sub run {
$dest =~ s!$repository->{_upload_root}/$repository->{_queue}!$self->{_root}!;
print "Sending file $file to $dest\n" if $self->{_verbose};
- my $base;
- if ($self->{_keep_svn_release}) {
- $base = basename($file)
- } else {
- ($base) = $file =~ /.*\/(?:@\d+:)?([^\/]*)/
- }
- my $destfile = "$dest$base";
+ my $destfile = "$dest".basename($file);
$destfile =~ s,/[^/_]+_([^/]+)$,/$1,;
+ $destfile =~ s,/@\d+:,/,;
+ my $destfilehidden = $destfile;
+ $destfilehidden =~ s,/([^/]+)$,/.$1,;
- my $cmd = "scp -i $self->{_ssh_key} $file $self->{_user}\@$self->{_uphost}:/$destfile.new";
- my $cmd2 = "ssh -i $self->{_ssh_key} $self->{_user}\@$self->{_uphost} \"mv /$destfile.new /$destfile\"";
+ my $cmd = "scp -i $self->{_ssh_key} $file $self->{_user}\@$self->{_uphost}:/$destfilehidden";
+ my $cmd2 = "ssh -i $self->{_ssh_key} $self->{_user}\@$self->{_uphost} \"mv /$destfilehidden /$destfile\"";
print "Submit::Action::Send: doing $cmd\n$cmd2\n" if 1 || $self->{_verbose};
if (!$self->{_test}) {
if (!system($cmd)) {