summaryrefslogtreecommitdiffstats
path: root/urpm/parallel_ka_run.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-07-09 20:24:38 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-07-09 20:24:38 +0000
commit9049ea87250e6dfb64fced6c390a8b85ab14931f (patch)
tree3555e05935788f8215fa9e5494fe1d7416c0257a /urpm/parallel_ka_run.pm
parent5df4814b12d8ba6570dc9f0a026947c324972651 (diff)
downloadurpmi-9049ea87250e6dfb64fced6c390a8b85ab14931f.tar
urpmi-9049ea87250e6dfb64fced6c390a8b85ab14931f.tar.gz
urpmi-9049ea87250e6dfb64fced6c390a8b85ab14931f.tar.bz2
urpmi-9049ea87250e6dfb64fced6c390a8b85ab14931f.tar.xz
urpmi-9049ea87250e6dfb64fced6c390a8b85ab14931f.zip
create rshp_command() and use it to remove duplication of the {log}
Diffstat (limited to 'urpm/parallel_ka_run.pm')
-rw-r--r--urpm/parallel_ka_run.pm19
1 files changed, 11 insertions, 8 deletions
diff --git a/urpm/parallel_ka_run.pm b/urpm/parallel_ka_run.pm
index 64e57231..4b3c2277 100644
--- a/urpm/parallel_ka_run.pm
+++ b/urpm/parallel_ka_run.pm
@@ -25,6 +25,13 @@ if (!$rshp_command) {
}
$rshp_command ||= 'rshp';
+sub rshp_command {
+ my ($urpm, $para) = @_;
+
+ $urpm->{log}("parallel_ka_run: $rshp_command $para");
+ "$rshp_command $para";
+}
+
#- parallel copy
sub parallel_register_rpms {
my ($parallel, $urpm, @files) = @_;
@@ -46,8 +53,7 @@ sub parallel_find_remove {
my (%bad_nodes, %base_to_remove, %notfound);
#- now try an iteration of urpme.
- my $command = "$rshp_command -v $parallel->{options} -- urpme --no-locales --auto $test" . join(' ', map { "'$_'" } @$l);
- $urpm->{log}("parallel_ka_run: $command");
+ my $command = rshp_command($urpm, "-v $parallel->{options} -- urpme --no-locales --auto $test" . join(' ', map { "'$_'" } @$l));
open my $fh, "$command 2>&1 |";
while (my $s = <$fh>) {
@@ -137,8 +143,7 @@ sub parallel_resolve_dependencies {
#- the following state should be cleaned for each iteration.
delete $state->{selected};
#- now try an iteration of urpmq.
- $urpm->{log}("parallel_ka_run: $rshp_command -v $parallel->{options} -- urpmq --synthesis $synthesis -fduc $line " . join(' ', keys %chosen));
- open my $fh, "$rshp_command -v $parallel->{options} -- urpmq --synthesis $synthesis -fduc $line " . join(' ', keys %chosen) . " |";
+ open my $fh, rshp_command($urpm, "-v $parallel->{options} -- urpmq --synthesis $synthesis -fduc $line " . join(' ', keys %chosen)) . " |";
while (<$fh>) {
chomp;
($node, $_) = _parse_rshp_output($_) or next;
@@ -186,8 +191,7 @@ sub parallel_install {
local $_;
my ($node, %bad_nodes);
- $urpm->{log}("parallel_ka_run: $rshp_command -v $parallel->{options} -- urpmi --pre-clean --no-locales --test --no-verify-rpm --auto --synthesis $parallel->{synthesis} $parallel->{line}");
- open my $fh, "$rshp_command -v $parallel->{options} -- urpmi --pre-clean --no-locales --test --no-verify-rpm --auto --synthesis $parallel->{synthesis} $parallel->{line} |";
+ open my $fh, rshp_command($urpm, "-v $parallel->{options} -- urpmi --pre-clean --no-locales --test --no-verify-rpm --auto --synthesis $parallel->{synthesis} $parallel->{line}") . ' |';
while (<$fh>) {
chomp;
($node, $_) = _parse_rshp_output($_) or next;
@@ -210,8 +214,7 @@ sub parallel_install {
} else {
my $line = $parallel->{line} . ($options{excludepath} ? " --excludepath '$options{excludepath}'" : "");
#- continue installation.
- $urpm->{log}("parallel_ka_run: $rshp_command $parallel->{options} -- urpmi --no-locales --no-verify-rpm --auto --synthesis $parallel->{synthesis} $line");
- system("$rshp_command $parallel->{options} -- urpmi --no-locales --no-verify-rpm --auto --synthesis $parallel->{synthesis} $line") == 0;
+ system(rshp_command($urpm, "$parallel->{options} -- urpmi --no-locales --no-verify-rpm --auto --synthesis $parallel->{synthesis} $line")) == 0;
}
}