summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-07-10 11:51:00 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-07-10 11:51:00 +0000
commit2e441e1aab564cadceed965b278c1d6761bbda0e (patch)
tree6631ff49dea849d06d2cd9fd6596b780d015a73e
parent3bf21d8574c51ae6fcf8cb29d3344ecab1887154 (diff)
downloadurpmi-2e441e1aab564cadceed965b278c1d6761bbda0e.tar
urpmi-2e441e1aab564cadceed965b278c1d6761bbda0e.tar.gz
urpmi-2e441e1aab564cadceed965b278c1d6761bbda0e.tar.bz2
urpmi-2e441e1aab564cadceed965b278c1d6761bbda0e.tar.xz
urpmi-2e441e1aab564cadceed965b278c1d6761bbda0e.zip
create a generic copy_to_dir() replacing _scp_rpms()
-rw-r--r--urpm/parallel_ssh.pm15
1 files changed, 8 insertions, 7 deletions
diff --git a/urpm/parallel_ssh.pm b/urpm/parallel_ssh.pm
index 96e1d1c7..4c2f7ab1 100644
--- a/urpm/parallel_ssh.pm
+++ b/urpm/parallel_ssh.pm
@@ -27,18 +27,19 @@ sub _scp {
or $urpm->{fatal}(1, N("scp failed on host %s (%d)", $host, $? >> 8));
}
-sub _scp_rpms {
- my ($parallel, $urpm, @files) = @_;
+sub copy_to_dir {
+ my ($parallel, $urpm, @para) = @_;
+ my $dir = pop @para;
foreach my $host (keys %{$parallel->{nodes}}) {
if (_localhost($host)) {
- if (my @f = grep { dirname($_) ne "$urpm->{cachedir}/rpms" } @files) {
+ if (my @f = grep { dirname($_) ne $dir } @para) {
$urpm->{log}("parallel_ssh: cp @f $urpm->{cachedir}/rpms");
- system('cp', @f, "$urpm->{cachedir}/rpms") == 0
+ system('cp', @f, $dir) == 0
or $urpm->{fatal}(1, N("cp failed on host %s (%d)", $host, $? >> 8));
}
} else {
- _scp($urpm, $host, @files, "$urpm->{cachedir}/rpms");
+ _scp($urpm, $host, @para, $dir);
}
}
}
@@ -77,7 +78,7 @@ sub urpm_popen {
sub parallel_register_rpms {
my ($parallel, $urpm, @files) = @_;
- _scp_rpms($parallel, $urpm, @files);
+ copy_to_dir($parallel, $urpm, @files, "$urpm->{cachedir}/rpms");
urpm::parallel::post_register_rpms($parallel, $urpm, @files);
}
@@ -116,7 +117,7 @@ sub parallel_resolve_dependencies {
sub parallel_install {
my ($parallel, $urpm, undef, $install, $upgrade, %options) = @_;
- _scp_rpms($parallel, $urpm, values %$install, values %$upgrade);
+ copy_to_dir($parallel, $urpm, values %$install, values %$upgrade, "$urpm->{cachedir}/rpms");
my %bad_nodes;
$parallel->urpm_popen($urpm, 'urpmi', "--pre-clean --test --no-verify-rpm --auto --synthesis $parallel->{synthesis} $parallel->{line}", sub {