summaryrefslogtreecommitdiffstats
path: root/urpm
diff options
context:
space:
mode:
Diffstat (limited to 'urpm')
-rw-r--r--urpm/parallel_ka_run.pm11
-rw-r--r--urpm/parallel_ssh.pm24
2 files changed, 10 insertions, 25 deletions
diff --git a/urpm/parallel_ka_run.pm b/urpm/parallel_ka_run.pm
index f65ced61..64e57231 100644
--- a/urpm/parallel_ka_run.pm
+++ b/urpm/parallel_ka_run.pm
@@ -86,7 +86,7 @@ sub parallel_resolve_dependencies {
my (%avoided, %requested);
#- first propagate the synthesis file to all machines
- $urpm->{ui_msg}("parallel_ka_run: $mput_command $parallel->{options} -- '$synthesis' '$synthesis'", N("Propagating synthesis to nodes..."));
+ $urpm->{log}("parallel_ka_run: $mput_command $parallel->{options} -- '$synthesis' '$synthesis'");
system($mput_command, $parallel->{options}, '--', $synthesis, $synthesis);
$? == 0 || $? == 256 or $urpm->{fatal}(1, N("mput failed, maybe a node is unreacheable"));
$parallel->{synthesis} = $synthesis;
@@ -137,7 +137,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), N("Resolving dependencies on nodes..."));
+ $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) . " |";
while (<$fh>) {
chomp;
@@ -180,14 +180,13 @@ 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/", N("Distributing files to nodes..."));
+ $urpm->{log}("parallel_ka_run: $mput_command $parallel->{options} -- " . join(' ', values %$install, values %$upgrade) . " $urpm->{cachedir}/rpms/");
system $mput_command, split(' ', $parallel->{options}), '--', values %$install, values %$upgrade, "$urpm->{cachedir}/rpms/";
$? == 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}",
- N("Verifying if install is possible on 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} |";
while (<$fh>) {
chomp;
@@ -211,7 +210,7 @@ sub parallel_install {
} 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", N("Installing packages on nodes..."));
+ $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;
}
}
diff --git a/urpm/parallel_ssh.pm b/urpm/parallel_ssh.pm
index fbb76888..dbfecea2 100644
--- a/urpm/parallel_ssh.pm
+++ b/urpm/parallel_ssh.pm
@@ -9,7 +9,6 @@ use strict;
use urpm::util;
use urpm::msg;
use urpm::parallel;
-use Time::HiRes qw(gettimeofday);
our @ISA = (); #- help perl_checker
@@ -89,7 +88,7 @@ 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", N("Propagating synthesis to %s...", $_));
+ $urpm->{log}("parallel_ssh: scp -q $synthesis $_:$synthesis");
system "scp", "-q", $synthesis, _host($_) . $synthesis;
$? == 0 or $urpm->{fatal}(1, N("scp failed on host %s (%d)", $_, $? >> 8));
}
@@ -142,7 +141,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", N("Resolving dependencies on %s...", $node));
+ $urpm->{log}("parallel_ssh: $command");
open my $fh, "$command |"
or $urpm->{fatal}(1, "Can't fork ssh: $!");
while (defined ($_ = <$fh>)) {
@@ -188,7 +187,7 @@ sub parallel_install {
foreach (keys %{$parallel->{nodes}}) {
my @sources = (values %$install, values %$upgrade);
- $urpm->{ui_msg}("parallel_ssh: scp @sources $_:$urpm->{cachedir}/rpms", N("Distributing files to %s...", $_));
+ $urpm->{log}("parallel_ssh: scp @sources $_:$urpm->{cachedir}/rpms");
if (_localhost($_)) {
my @f = grep { ! m!^$urpm->{cachedir}/rpms! } @sources;
@f and system 'cp' => @f, "$urpm->{cachedir}/rpms";
@@ -202,7 +201,7 @@ sub parallel_install {
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", N("Verifying if install is possible on %s...", $node));
+ $urpm->{log}("parallel_ssh: $command");
open my $fh, "$command |"
or $urpm->{fatal}(1, "Can't fork ssh: $!");
while ($_ = <$fh>) {
@@ -226,26 +225,13 @@ sub parallel_install {
#- 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", N("Performing install on %s...", $node));
- $urpm->{ui}{progress}->(0) if ref $urpm->{ui}{progress};
+ $urpm->{log}("parallel_ssh: $command");
open my $fh, "$command |"
or $urpm->{fatal}(1, "Can't fork ssh: $!");
local $/ = \1;
- my $log;
- my $last_time;
local $_;
while (<$fh>) {
print;
- $log .= $_;
- /\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+)/ ? 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();
- }
- }
}
close $fh;
}