summaryrefslogtreecommitdiffstats
path: root/urpm
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2004-01-15 18:51:32 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2004-01-15 18:51:32 +0000
commitf407ed64ddf4070d54f0e631b0eee6ce070933a9 (patch)
tree55cae7001cf1d4b267ee426751b5410ec5731bfe /urpm
parent40d96654b8bae7dae990eeac3db8f7947bbf1810 (diff)
downloadurpmi-f407ed64ddf4070d54f0e631b0eee6ce070933a9.tar
urpmi-f407ed64ddf4070d54f0e631b0eee6ce070933a9.tar.gz
urpmi-f407ed64ddf4070d54f0e631b0eee6ce070933a9.tar.bz2
urpmi-f407ed64ddf4070d54f0e631b0eee6ce070933a9.tar.xz
urpmi-f407ed64ddf4070d54f0e631b0eee6ce070933a9.zip
more graphical feedback in urpmi --parallel --X (status, progress, etc)
Diffstat (limited to 'urpm')
-rw-r--r--urpm/parallel_ka_run.pm10
-rw-r--r--urpm/parallel_ssh.pm33
2 files changed, 31 insertions, 12 deletions
diff --git a/urpm/parallel_ka_run.pm b/urpm/parallel_ka_run.pm
index 2d3039eb..8961a65f 100644
--- a/urpm/parallel_ka_run.pm
+++ b/urpm/parallel_ka_run.pm
@@ -98,7 +98,7 @@ sub parallel_resolve_dependencies {
my (%avoided, %requested);
#- first propagate the synthesis file to all machine.
- $urpm->{log}("parallel_ka_run: mput $parallel->{options} -- '$synthesis' '$synthesis'");
+ $urpm->{ui_msg}("parallel_ka_run: mput $parallel->{options} -- '$synthesis' '$synthesis'", urpm::N("Propagating synthesis to nodes..."));
system "mput $parallel->{options} -- '$synthesis' '$synthesis'";
$? == 0 || $? == 256 or $urpm->{fatal}(1, urpm::N("mput failed, maybe a node is unreacheable"));
$parallel->{synthesis} = $synthesis;
@@ -149,7 +149,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 -v $parallel->{options} -- urpmq --synthesis $synthesis -fduc $line ".join(' ', keys %chosen));
+ $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)." |";
while (defined ($_ = <F>)) {
chomp;
@@ -192,13 +192,13 @@ sub parallel_resolve_dependencies {
sub parallel_install {
my ($parallel, $urpm, $remove, $install, $upgrade, %options) = @_;
- $urpm->{log}("parallel_ka_run: mput $parallel->{options} -- ".join(' ', values %$install, values %$upgrade)." $urpm->{cachedir}/rpms/");
+ $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/";
$? == 0 || $? == 256 or $urpm->{fatal}(1, urpm::N("mput failed, maybe a node is unreacheable"));
local (*F, $_);
my ($node, %bad_nodes);
- $urpm->{log}("parallel_ka_run: 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 -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} |";
while (defined ($_ = <F>)) {
chomp;
@@ -222,7 +222,7 @@ sub parallel_install {
} else {
my $line = $parallel->{line} . ($options{excludepath} ? " --excludepath '$options{excludepath}'" : "");
#- continue installation.
- $urpm->{log}("parallel_ka_run: rshp $parallel->{options} -- urpmi --no-locales --no-verify-rpm --auto --synthesis $parallel->{synthesis} $line");
+ $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;
}
}
diff --git a/urpm/parallel_ssh.pm b/urpm/parallel_ssh.pm
index 5d885e1b..e1ede130 100644
--- a/urpm/parallel_ssh.pm
+++ b/urpm/parallel_ssh.pm
@@ -1,4 +1,5 @@
package urpm::parallel_ssh;
+use Time::HiRes qw(gettimeofday);
#- parallel copy
sub parallel_register_rpms {
@@ -39,7 +40,7 @@ sub parallel_find_remove {
#- now try an iteration of urpme.
foreach my $node (keys %{$parallel->{nodes}}) {
- $urpm->{log}("parallel_ssh: ssh $node urpme --no-locales --auto $test".(join ' ', map { "'$_'" } @$l));
+ $urpm->{log}("parallel_ssh: ssh $node urpme --no-locales --auto $test".(join ' ', map { "'$_'" } @$l));
open F, "ssh 2>&1 $node urpme --no-locales --auto $test".(join ' ', map { "'$_'" } @$l)." |";
while (defined ($_ = <F>)) {
chomp;
@@ -102,7 +103,7 @@ sub parallel_resolve_dependencies {
#- first propagate the synthesis file to all machine.
foreach (keys %{$parallel->{nodes}}) {
- $urpm->{log}("parallel_ssh: scp -q '$synthesis' '$_:$synthesis'");
+ $urpm->{ui_msg}("parallel_ssh: scp -q '$synthesis' '$_:$synthesis'", urpm::N("Propagating synthesis to %s...", $_));
system "scp -q '$synthesis' '$_:$synthesis'";
$? == 0 or $urpm->{fatal}(1, urpm::N("scp failed on host %s", $_));
}
@@ -154,7 +155,7 @@ sub parallel_resolve_dependencies {
delete $state->{selected};
#- now try an iteration of urpmq.
foreach my $node (keys %{$parallel->{nodes}}) {
- $urpm->{log}("parallel_ssh: ssh $node urpmq --synthesis $synthesis -fduc $line ".join(' ', keys %chosen));
+ $urpm->{ui_msg}("parallel_ssh: ssh $node urpmq --synthesis $synthesis -fduc $line ".join(' ', keys %chosen), urpm::N("Resolving dependencies on %s...", $node));
open F, "ssh $node urpmq --synthesis $synthesis -fduc $line ".join(' ', keys %chosen)." |";
while (defined ($_ = <F>)) {
chomp;
@@ -199,7 +200,7 @@ sub parallel_install {
foreach (keys %{$parallel->{nodes}}) {
my $sources = join ' ', map { "'$_'" } values %$install, values %$upgrade;
- $urpm->{log}("parallel_ssh: scp $sources $_:$urpm->{cachedir}/rpms");
+ $urpm->{ui_msg}("parallel_ssh: scp $sources $_:$urpm->{cachedir}/rpms", urpm::N("Distributing files to %s...", $_));
system "scp $sources $_:$urpm->{cachedir}/rpms";
$? == 0 or $urpm->{fatal}(1, urpm::N("scp failed on host %s", $_));
}
@@ -207,7 +208,7 @@ sub parallel_install {
my %bad_nodes;
foreach my $node (keys %{$parallel->{nodes}}) {
local (*F, $_);
- $urpm->{log}("parallel_ssh: ssh $node urpmi --pre-clean --no-locales --test --no-verify-rpm --auto --synthesis $parallel->{synthesis} $parallel->{line}");
+ $urpm->{ui_msg}("parallel_ssh: ssh $node urpmi --pre-clean --no-locales --test --no-verify-rpm --auto --synthesis $parallel->{synthesis} $parallel->{line}", urpm::N("Verifying if install is possible on %s...", $node));
open F, "ssh $node urpmi --pre-clean --no-locales --test --no-verify-rpm --auto --synthesis $parallel->{synthesis} $parallel->{line} |";
while ($_ = <F>) {
$bad_nodes{$node} .= $_;
@@ -229,8 +230,26 @@ sub parallel_install {
my $line = $parallel->{line} . ($options{excludepath} ? " --excludepath $options{excludepath}" : "");
#- continue installation on each nodes.
foreach my $node (keys %{$parallel->{nodes}}) {
- $urpm->{log}("parallel_ssh: ssh $node urpmi --no-locales --no-verify-rpm --auto --synthesis $parallel->{synthesis} $line");
- system split " ", "ssh $node urpmi --no-locales --no-verify-rpm --auto --synthesis $parallel->{synthesis} $line";
+ $urpm->{ui_msg}("parallel_ssh: ssh $node urpmi --no-locales --no-verify-rpm --auto --synthesis $parallel->{synthesis} $line", urpm::N("Performing install on %s...", $node));
+ $urpm->{ui}{progress}->(0);
+ open F, "ssh $node urpmi --no-locales --no-verify-rpm --auto --synthesis $parallel->{synthesis} $line |";
+ local $/ = \1;
+ my $log;
+ my $last_time;
+ while ($_ = <F>) {
+ print;
+ $log .= $_;
+ /\n/ and $log = '';
+ if (my ($msg, $progress) = $log =~ /^\s*(\S+)\s+(#+)/) {
+ if ($urpm->{ui} && (gettimeofday() - $last_time > 0.15 || length($progress) == 50)) {
+ $urpm->{ui}{msg}->($msg =~ /\d+:(\S+)/ ? urpm::N("Installing %s on %s...", $1, $node)
+ : urpm::N("Preparing install on %s...", $node));
+ $urpm->{ui}{progress}->(length($progress)/50);
+ $last_time = gettimeofday();
+ }
+ }
+ }
+ close F;
}
}
}