summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--urpm/parallel_ka_run.pm31
-rw-r--r--urpm/parallel_ssh.pm29
2 files changed, 31 insertions, 29 deletions
diff --git a/urpm/parallel_ka_run.pm b/urpm/parallel_ka_run.pm
index a41500e4..55cf02d5 100644
--- a/urpm/parallel_ka_run.pm
+++ b/urpm/parallel_ka_run.pm
@@ -7,6 +7,7 @@ package urpm::parallel_ka_run;
use strict;
use urpm::util;
+use urpm::msg;
our @ISA = (); #- help perl_checker
@@ -29,7 +30,7 @@ sub parallel_register_rpms {
$urpm->{log}("parallel_ka_run: $mput_command $parallel->{options} -- @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"));
+ $? == 0 || $? == 256 or $urpm->{fatal}(1, N("mput failed, maybe a node is unreacheable"));
#- keep trace of direct files.
foreach (@files) {
@@ -66,7 +67,7 @@ sub parallel_find_remove {
/^\s*$/ and next;
/Checking to remove the following packages/ and next;
/To satisfy dependencies, the following packages are going to be removed/
- and $urpm->{fatal}(1, urpm::N("node %s has an old version of urpme, please upgrade", $node));
+ and $urpm->{fatal}(1, N("node %s has an old version of urpme, please upgrade", $node));
if (/unknown packages?:? (.*)/) {
#- keep in mind unknown package from the node, because it should not be a fatal error
#- if other node have it.
@@ -90,7 +91,7 @@ sub parallel_find_remove {
}
}
}
- close $fh or $urpm->{fatal}(1, urpm::N("rshp failed, maybe a node is unreacheable"));
+ close $fh or $urpm->{fatal}(1, N("rshp failed, maybe a node is unreacheable"));
#- check base, which has been delayed until there.
if ($options{callback_base} && %base_to_remove) {
@@ -100,7 +101,7 @@ sub parallel_find_remove {
#- build error list contains all the error returned by each node.
$urpm->{error_remove} = [];
foreach (keys %bad_nodes) {
- my $msg = urpm::N("on node %s", $_);
+ my $msg = N("on node %s", $_);
foreach (@{$bad_nodes{$_}}) {
push @{$urpm->{error_remove}}, "$msg, $_";
}
@@ -122,9 +123,9 @@ sub parallel_resolve_dependencies {
my (%avoided, %requested);
#- first propagate the synthesis file to all machine.
- $urpm->{ui_msg}("parallel_ka_run: $mput_command $parallel->{options} -- '$synthesis' '$synthesis'", urpm::N("Propagating synthesis to nodes..."));
+ $urpm->{ui_msg}("parallel_ka_run: $mput_command $parallel->{options} -- '$synthesis' '$synthesis'", 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"));
+ $? == 0 || $? == 256 or $urpm->{fatal}(1, N("mput failed, maybe a node is unreacheable"));
$parallel->{synthesis} = $synthesis;
#- compute command line of urpm? tools.
@@ -173,7 +174,7 @@ 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_command -v $parallel->{options} -- urpmq --synthesis $synthesis -fduc $line " . join(' ', keys %chosen), urpm::N("Resolving dependencies on nodes..."));
+ $urpm->{ui_msg}("parallel_ka_run: $rshp_command -v $parallel->{options} -- urpmq --synthesis $synthesis -fduc $line " . join(' ', keys %chosen), N("Resolving dependencies on nodes..."));
open my $fh, "$rshp_command -v $parallel->{options} -- urpmq --synthesis $synthesis -fduc $line " . join(' ', keys %chosen) . " |";
while (<$fh>) {
chomp;
@@ -203,7 +204,7 @@ sub parallel_resolve_dependencies {
$state->{selected}{$pkg->id}{$node} = $_;
}
}
- close $fh or $urpm->{fatal}(1, urpm::N("rshp failed, maybe a node is unreacheable"));
+ close $fh or $urpm->{fatal}(1, N("rshp failed, maybe a node is unreacheable"));
#- check for internal error of resolution.
$cont == 1 and die "internal distant urpmq error on choice not taken";
} while $cont;
@@ -216,14 +217,14 @@ sub parallel_resolve_dependencies {
sub parallel_install {
my ($parallel, $urpm, undef, $install, $upgrade, %options) = @_;
- $urpm->{ui_msg}("parallel_ka_run: $mput_command $parallel->{options} -- " . join(' ', values %$install, values %$upgrade) . " $urpm->{cachedir}/rpms/", urpm::N("Distributing files to nodes..."));
+ $urpm->{ui_msg}("parallel_ka_run: $mput_command $parallel->{options} -- " . join(' ', values %$install, values %$upgrade) . " $urpm->{cachedir}/rpms/", 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"));
+ $? == 0 || $? == 256 or $urpm->{fatal}(1, N("mput failed, maybe a node is unreacheable"));
local $_;
my ($node, %bad_nodes);
$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..."));
+ N("Verifying if install is possible on nodes..."));
open my $fh, "$rshp_command -v $parallel->{options} -- urpmi --pre-clean --no-locales --test --no-verify-rpm --auto --synthesis $parallel->{synthesis} $parallel->{line} |";
while (<$fh>) {
chomp;
@@ -233,21 +234,21 @@ sub parallel_install {
/Installation failed/ and $bad_nodes{$node} = '';
/Installation is possible/ and delete $bad_nodes{$node};
}
- close $fh or $urpm->{fatal}(1, urpm::N("rshp failed, maybe a node is unreacheable"));
+ close $fh or $urpm->{fatal}(1, N("rshp failed, maybe a node is unreacheable"));
foreach (keys %{$parallel->{nodes}}) {
exists $bad_nodes{$_} or next;
- $urpm->{error}(urpm::N("Installation failed on node %s", $_) . ":\n" . $bad_nodes{$_});
+ $urpm->{error}(N("Installation failed on node %s", $_) . ":\n" . $bad_nodes{$_});
}
%bad_nodes and return;
if ($options{test}) {
- $urpm->{error}(urpm::N("Installation is possible"));
+ $urpm->{error}(N("Installation is possible"));
1;
} else {
my $line = $parallel->{line} . ($options{excludepath} ? " --excludepath '$options{excludepath}'" : "");
#- continue installation.
- $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..."));
+ $urpm->{ui_msg}("parallel_ka_run: $rshp_command $parallel->{options} -- urpmi --no-locales --no-verify-rpm --auto --synthesis $parallel->{synthesis} $line", N("Installing packages on nodes..."));
system("$rshp_command $parallel->{options} -- urpmi --no-locales --no-verify-rpm --auto --synthesis $parallel->{synthesis} $line") == 0;
}
}
diff --git a/urpm/parallel_ssh.pm b/urpm/parallel_ssh.pm
index 69c93264..2f12c545 100644
--- a/urpm/parallel_ssh.pm
+++ b/urpm/parallel_ssh.pm
@@ -7,6 +7,7 @@ package urpm::parallel_ssh;
use strict;
use urpm::util;
+use urpm::msg;
use Time::HiRes qw(gettimeofday);
our @ISA = (); #- help perl_checker
@@ -30,7 +31,7 @@ sub parallel_register_rpms {
} else {
system 'scp' => @files, "$_:$urpm->{cachedir}/rpms";
}
- $? == 0 or $urpm->{fatal}(1, urpm::N("scp failed on host %s (%d)", $_, $? >> 8));
+ $? == 0 or $urpm->{fatal}(1, N("scp failed on host %s (%d)", $_, $? >> 8));
}
#- keep trace of direct files.
@@ -105,7 +106,7 @@ sub parallel_find_remove {
#- build error list contains all the error returned by each node.
$urpm->{error_remove} = [];
foreach (keys %bad_nodes) {
- my $msg = urpm::N("on node %s", $_);
+ my $msg = N("on node %s", $_);
foreach (@{$bad_nodes{$_}}) {
push @{$urpm->{error_remove}}, "$msg, $_";
}
@@ -127,9 +128,9 @@ sub parallel_resolve_dependencies {
#- first propagate the synthesis file to all machines
foreach (grep { !_localhost($_) } keys %{$parallel->{nodes}}) {
- $urpm->{ui_msg}("parallel_ssh: scp -q $synthesis $_:$synthesis", urpm::N("Propagating synthesis to %s...", $_));
+ $urpm->{ui_msg}("parallel_ssh: scp -q $synthesis $_:$synthesis", N("Propagating synthesis to %s...", $_));
system "scp", "-q", $synthesis, _host($_) . $synthesis;
- $? == 0 or $urpm->{fatal}(1, urpm::N("scp failed on host %s (%d)", $_, $? >> 8));
+ $? == 0 or $urpm->{fatal}(1, N("scp failed on host %s (%d)", $_, $? >> 8));
}
$parallel->{synthesis} = $synthesis;
@@ -180,7 +181,7 @@ sub parallel_resolve_dependencies {
#- now try an iteration of urpmq.
foreach my $node (keys %{$parallel->{nodes}}) {
my $command = _ssh($node) . "urpmq " . _nolock($node) . "--synthesis $synthesis -fduc $line " . join(' ', keys %chosen);
- $urpm->{ui_msg}("parallel_ssh: $command", urpm::N("Resolving dependencies on %s...", $node));
+ $urpm->{ui_msg}("parallel_ssh: $command", N("Resolving dependencies on %s...", $node));
open my $fh, "$command |"
or $urpm->{fatal}(1, "Can't fork ssh: $!");
while (defined ($_ = <$fh>)) {
@@ -210,7 +211,7 @@ sub parallel_resolve_dependencies {
$state->{selected}{$pkg->id}{$node} = $_;
}
}
- close $fh or $urpm->{fatal}(1, urpm::N("host %s does not have a good version of urpmi (%d)", $node, $? >> 8));
+ close $fh or $urpm->{fatal}(1, N("host %s does not have a good version of urpmi (%d)", $node, $? >> 8));
}
#- check for internal error of resolution.
$cont == 1 and die "internal distant urpmq error on choice not taken";
@@ -226,21 +227,21 @@ sub parallel_install {
foreach (keys %{$parallel->{nodes}}) {
my @sources = (values %$install, values %$upgrade);
- $urpm->{ui_msg}("parallel_ssh: scp @sources $_:$urpm->{cachedir}/rpms", urpm::N("Distributing files to %s...", $_));
+ $urpm->{ui_msg}("parallel_ssh: scp @sources $_:$urpm->{cachedir}/rpms", N("Distributing files to %s...", $_));
if (_localhost($_)) {
my @f = grep { ! m!^$urpm->{cachedir}/rpms! } @sources;
@f and system 'cp' => @f, "$urpm->{cachedir}/rpms";
} else {
system 'scp' => @sources, "$_:$urpm->{cachedir}/rpms";
}
- $? == 0 or $urpm->{fatal}(1, urpm::N("scp failed on host %s (%d)", $_, $? >> 8));
+ $? == 0 or $urpm->{fatal}(1, N("scp failed on host %s (%d)", $_, $? >> 8));
}
my %bad_nodes;
foreach my $node (keys %{$parallel->{nodes}}) {
local $_;
my $command = _ssh($node) . "urpmi --pre-clean --no-locales --test --no-verify-rpm --auto " . _nolock($node) . "--synthesis $parallel->{synthesis} $parallel->{line}";
- $urpm->{ui_msg}("parallel_ssh: $command", urpm::N("Verifying if install is possible on %s...", $node));
+ $urpm->{ui_msg}("parallel_ssh: $command", N("Verifying if install is possible on %s...", $node));
open my $fh, "$command |"
or $urpm->{fatal}(1, "Can't fork ssh: $!");
while ($_ = <$fh>) {
@@ -252,19 +253,19 @@ sub parallel_install {
}
foreach (keys %{$parallel->{nodes}}) {
exists $bad_nodes{$_} or next;
- $urpm->{error}(urpm::N("Installation failed on node %s", $_) . ":\n" . $bad_nodes{$_});
+ $urpm->{error}(N("Installation failed on node %s", $_) . ":\n" . $bad_nodes{$_});
}
keys %bad_nodes and return;
if ($options{test}) {
- $urpm->{error}(urpm::N("Installation is possible"));
+ $urpm->{error}(N("Installation is possible"));
1;
} else {
my $line = $parallel->{line} . ($options{excludepath} ? " --excludepath $options{excludepath}" : "");
#- continue installation on each node
foreach my $node (keys %{$parallel->{nodes}}) {
my $command = _ssh($node) . "urpmi --no-locales --no-verify-rpm --auto " . _nolock($node) . "--synthesis $parallel->{synthesis} $line";
- $urpm->{ui_msg}("parallel_ssh: $command", urpm::N("Performing install on %s...", $node));
+ $urpm->{ui_msg}("parallel_ssh: $command", N("Performing install on %s...", $node));
$urpm->{ui}{progress}->(0) if ref $urpm->{ui}{progress};
open my $fh, "$command |"
or $urpm->{fatal}(1, "Can't fork ssh: $!");
@@ -278,8 +279,8 @@ sub parallel_install {
/\n/ and $log = '';
if (my ($msg, $progress) = $log =~ /^\s*(\S+)\s+(#+)/) {
if ($urpm->{ui} && (gettimeofday() - $last_time > 0.15 || length($progress) == 45)) {
- $urpm->{ui_msg}->($msg =~ /\d+:(\S+)/ ? urpm::N("Installing %s on %s...", $1, $node)
- : urpm::N("Preparing install on %s...", $node));
+ $urpm->{ui_msg}->($msg =~ /\d+:(\S+)/ ? N("Installing %s on %s...", $1, $node)
+ : N("Preparing install on %s...", $node));
$urpm->{ui}{progress}->(length($progress)/45) if ref $urpm->{ui}{progress};
$last_time = gettimeofday();
}