summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-11-17 10:08:44 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2005-11-17 10:08:44 +0000
commit476e99a5bf82b9aab2dcf276829faee13e93b97b (patch)
tree847df59650541003f98d91c924ca2a481e47136d
parentde9b72a67f5009406763075c07095402f9bd2cb7 (diff)
downloadurpmi-476e99a5bf82b9aab2dcf276829faee13e93b97b.tar
urpmi-476e99a5bf82b9aab2dcf276829faee13e93b97b.tar.gz
urpmi-476e99a5bf82b9aab2dcf276829faee13e93b97b.tar.bz2
urpmi-476e99a5bf82b9aab2dcf276829faee13e93b97b.tar.xz
urpmi-476e99a5bf82b9aab2dcf276829faee13e93b97b.zip
Factorize command names
-rw-r--r--urpm/parallel_ka_run.pm33
1 files changed, 18 insertions, 15 deletions
diff --git a/urpm/parallel_ka_run.pm b/urpm/parallel_ka_run.pm
index 4b2a10f4..6e073134 100644
--- a/urpm/parallel_ka_run.pm
+++ b/urpm/parallel_ka_run.pm
@@ -2,12 +2,15 @@ package urpm::parallel_ka_run;
use strict;
+our $mput_command = 'mput';
+our $rshp_command = 'rshp';
+
#- parallel copy
sub parallel_register_rpms {
my ($parallel, $urpm, @files) = @_;
- $urpm->{log}("parallel_ka_run: mput $parallel->{options} -- ".join(' ', @files)." $urpm->{cachedir}/rpms/");
- system "mput", split(' ', $parallel->{options}), '--', @files, "$urpm->{cachedir}/rpms/";
+ $urpm->{log}("parallel_ka_run: $mput_command $parallel->{options} -- ".join(' ', @files)." $urpm->{cachedir}/rpms/");
+ system $mput_command, split(' ', $parallel->{options}), '--', @files, "$urpm->{cachedir}/rpms/";
$? == 0 || $? == 256 or $urpm->{fatal}(1, urpm::N("mput failed, maybe a node is unreacheable"));
#- keep trace of direct files.
@@ -37,8 +40,8 @@ sub parallel_find_remove {
}
#- now try an iteration of urpmq.
- $urpm->{log}("parallel_ka_run: rshp -v $parallel->{options} -- urpme --no-locales --auto $test".(join ' ', map { "'$_'" } @$l));
- open F, "rshp -v $parallel->{options} -- urpme --no-locales --auto $test".join(' ', map { "'$_'" } @$l)." 2>&1 |";
+ $urpm->{log}("parallel_ka_run: $rshp_command -v $parallel->{options} -- urpme --no-locales --auto $test".(join ' ', map { "'$_'" } @$l));
+ open F, "$rshp_command -v $parallel->{options} -- urpme --no-locales --auto $test".join(' ', map { "'$_'" } @$l)." 2>&1 |";
while (defined ($_ = <F>)) {
chomp;
s/<([^>]*)>.*:->:(.*)/$2/ and $node = $1;
@@ -100,8 +103,8 @@ sub parallel_resolve_dependencies {
my (%avoided, %requested);
#- first propagate the synthesis file to all machine.
- $urpm->{ui_msg}("parallel_ka_run: mput $parallel->{options} -- '$synthesis' '$synthesis'", urpm::N("Propagating synthesis to nodes..."));
- system "mput $parallel->{options} -- '$synthesis' '$synthesis'";
+ $urpm->{ui_msg}("parallel_ka_run: $mput_command $parallel->{options} -- '$synthesis' '$synthesis'", urpm::N("Propagating synthesis to nodes..."));
+ system "$mput_command $parallel->{options} -- '$synthesis' '$synthesis'";
$? == 0 || $? == 256 or $urpm->{fatal}(1, urpm::N("mput failed, maybe a node is unreacheable"));
$parallel->{synthesis} = $synthesis;
@@ -151,8 +154,8 @@ sub parallel_resolve_dependencies {
#- the following state should be cleaned for each iteration.
delete $state->{selected};
#- now try an iteration of urpmq.
- $urpm->{ui_msg}("parallel_ka_run: rshp -v $parallel->{options} -- urpmq --synthesis $synthesis -fduc $line ".join(' ', keys %chosen), urpm::N("Resolving dependencies on nodes..."));
- open F, "rshp -v $parallel->{options} -- urpmq --synthesis $synthesis -fduc $line ".join(' ', keys %chosen)." |";
+ $urpm->{ui_msg}("parallel_ka_run: $rshp_command -v $parallel->{options} -- urpmq --synthesis $synthesis -fduc $line ".join(' ', keys %chosen), urpm::N("Resolving dependencies on nodes..."));
+ open F, "$rshp_command -v $parallel->{options} -- urpmq --synthesis $synthesis -fduc $line ".join(' ', keys %chosen)." |";
while (defined ($_ = <F>)) {
chomp;
s/<([^>]*)>.*:->:(.*)/$2/ and $node = $1;
@@ -194,14 +197,15 @@ sub parallel_resolve_dependencies {
sub parallel_install {
my ($parallel, $urpm, $remove, $install, $upgrade, %options) = @_;
- $urpm->{ui_msg}("parallel_ka_run: mput $parallel->{options} -- ".join(' ', values %$install, values %$upgrade)." $urpm->{cachedir}/rpms/", urpm::N("Distributing files to nodes..."));
- system "mput", split(' ', $parallel->{options}), '--', values %$install, values %$upgrade, "$urpm->{cachedir}/rpms/";
+ $urpm->{ui_msg}("parallel_ka_run: $mput_command $parallel->{options} -- ".join(' ', values %$install, values %$upgrade)." $urpm->{cachedir}/rpms/", urpm::N("Distributing files to nodes..."));
+ system $mput_command, split(' ', $parallel->{options}), '--', values %$install, values %$upgrade, "$urpm->{cachedir}/rpms/";
$? == 0 || $? == 256 or $urpm->{fatal}(1, urpm::N("mput failed, maybe a node is unreacheable"));
local (*F, $_);
my ($node, %bad_nodes);
- $urpm->{ui_msg}("parallel_ka_run: rshp -v $parallel->{options} -- urpmi --pre-clean --no-locales --test --no-verify-rpm --auto --synthesis $parallel->{synthesis} $parallel->{line}", urpm::N("Verifying if install is possible on nodes..."));
- open F, "rshp -v $parallel->{options} -- urpmi --pre-clean --no-locales --test --no-verify-rpm --auto --synthesis $parallel->{synthesis} $parallel->{line} |";
+ $urpm->{ui_msg}("parallel_ka_run: $rshp_command -v $parallel->{options} -- urpmi --pre-clean --no-locales --test --no-verify-rpm --auto --synthesis $parallel->{synthesis} $parallel->{line}",
+ urpm::N("Verifying if install is possible on nodes..."));
+ open F, "$rshp_command -v $parallel->{options} -- urpmi --pre-clean --no-locales --test --no-verify-rpm --auto --synthesis $parallel->{synthesis} $parallel->{line} |";
while (defined ($_ = <F>)) {
chomp;
s/<([^>]*)>.*:->:(.*)/$2/ and $node = $1;
@@ -224,12 +228,11 @@ sub parallel_install {
} else {
my $line = $parallel->{line} . ($options{excludepath} ? " --excludepath '$options{excludepath}'" : "");
#- continue installation.
- $urpm->{ui_msg}("parallel_ka_run: rshp $parallel->{options} -- urpmi --no-locales --no-verify-rpm --auto --synthesis $parallel->{synthesis} $line", urpm::N("Installing packages on nodes..."));
- system("rshp $parallel->{options} -- urpmi --no-locales --no-verify-rpm --auto --synthesis $parallel->{synthesis} $line") == 0;
+ $urpm->{ui_msg}("parallel_ka_run: $rshp_command $parallel->{options} -- urpmi --no-locales --no-verify-rpm --auto --synthesis $parallel->{synthesis} $line", urpm::N("Installing packages on nodes..."));
+ system("$rshp_command $parallel->{options} -- urpmi --no-locales --no-verify-rpm --auto --synthesis $parallel->{synthesis} $line") == 0;
}
}
-
#- allow bootstrap from urpmi code directly (namespace is urpm).
package urpm;
sub handle_parallel_options {