diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2008-07-09 20:42:27 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2008-07-09 20:42:27 +0000 |
commit | 9d3c0b101b9f56ffd2b9a236a636f0ad8b7216db (patch) | |
tree | 49a1cd07837a2d25518c5c056ede5d6bc0aa6944 /urpm | |
parent | 00b480d82156b3112054efb6dee33f6a206516b5 (diff) | |
download | urpmi-9d3c0b101b9f56ffd2b9a236a636f0ad8b7216db.tar urpmi-9d3c0b101b9f56ffd2b9a236a636f0ad8b7216db.tar.gz urpmi-9d3c0b101b9f56ffd2b9a236a636f0ad8b7216db.tar.bz2 urpmi-9d3c0b101b9f56ffd2b9a236a636f0ad8b7216db.tar.xz urpmi-9d3c0b101b9f56ffd2b9a236a636f0ad8b7216db.zip |
create scp_rpms() and use it
Diffstat (limited to 'urpm')
-rw-r--r-- | urpm/parallel_ssh.pm | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/urpm/parallel_ssh.pm b/urpm/parallel_ssh.pm index f0f882a3..4b11e8c7 100644 --- a/urpm/parallel_ssh.pm +++ b/urpm/parallel_ssh.pm @@ -19,8 +19,7 @@ sub _nolock { &_localhost ? '--nolock ' : '' } sub _ssh { &_localhost ? '' : "ssh $_[0] " } sub _host { &_localhost ? '' : "$_[0]:" } -#- parallel copy -sub parallel_register_rpms { +sub scp_rpms { my ($parallel, $urpm, @files) = @_; foreach my $host (keys %{$parallel->{nodes}}) { @@ -33,7 +32,13 @@ sub parallel_register_rpms { } $? == 0 or $urpm->{fatal}(1, N("scp failed on host %s (%d)", $host, $? >> 8)); } +} + +#- parallel copy +sub parallel_register_rpms { + my ($parallel, $urpm, @files) = @_; + scp_rpms($parallel, $urpm, @files); urpm::parallel::post_register_rpms($parallel, $urpm, @files); } @@ -185,17 +190,7 @@ sub parallel_resolve_dependencies { sub parallel_install { my ($parallel, $urpm, undef, $install, $upgrade, %options) = @_; - my @sources = (values %$install, values %$upgrade); - foreach my $host (keys %{$parallel->{nodes}}) { - $urpm->{log}("parallel_ssh: scp @sources $host:$urpm->{cachedir}/rpms"); - if (_localhost($host)) { - my @f = grep { ! m!^$urpm->{cachedir}/rpms! } @sources; - @f and system('cp', @f, "$urpm->{cachedir}/rpms"); - } else { - system('scp', @sources, "$host:$urpm->{cachedir}/rpms"); - } - $? == 0 or $urpm->{fatal}(1, N("scp failed on host %s (%d)", $host, $? >> 8)); - } + scp_rpms($parallel, $urpm, values %$install, values %$upgrade); my %bad_nodes; foreach my $node (keys %{$parallel->{nodes}}) { |