summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-07-10 11:45:11 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-07-10 11:45:11 +0000
commit41cd26588f5e8f23073b07b0617a059fcba10b87 (patch)
treef51cac14256e0c7320d4f825981fc4539ce3e122
parente17a9420d4a2a9e6efefbc1bba998941ae08eb05 (diff)
downloadurpmi-41cd26588f5e8f23073b07b0617a059fcba10b87.tar
urpmi-41cd26588f5e8f23073b07b0617a059fcba10b87.tar.gz
urpmi-41cd26588f5e8f23073b07b0617a059fcba10b87.tar.bz2
urpmi-41cd26588f5e8f23073b07b0617a059fcba10b87.tar.xz
urpmi-41cd26588f5e8f23073b07b0617a059fcba10b87.zip
move parallel_find_remove() (=> avoid duplication)
-rw-r--r--urpm/parallel.pm38
-rw-r--r--urpm/parallel_ka_run.pm38
-rw-r--r--urpm/parallel_ssh.pm38
3 files changed, 38 insertions, 76 deletions
diff --git a/urpm/parallel.pm b/urpm/parallel.pm
index f9030698..0b6edba5 100644
--- a/urpm/parallel.pm
+++ b/urpm/parallel.pm
@@ -66,6 +66,44 @@ sub remove {
);
}
+#- parallel find_packages_to_remove
+sub parallel_find_remove {
+ my ($parallel, $urpm, $state, $l, %options) = @_;
+
+ my ($test, $pkgs) = urpm::parallel::find_remove_pre($urpm, $state, %options);
+ $pkgs and return @$pkgs;
+
+ my (%bad_nodes, %base_to_remove, %notfound);
+
+ #- now try an iteration of urpme.
+ $parallel->urpm_popen($urpm, 'urpme', "--auto $test" . join(' ', map { "'$_'" } @$l) . ' 2>&1', sub {
+ my ($node, $s) = @_;
+
+ urpm::parallel::parse_urpme_output($urpm, $state, $node, $s,
+ \%notfound, \%base_to_remove, \%bad_nodes, %options);
+ });
+
+ #- check base, which has been delayed until there.
+ if ($options{callback_base} && %base_to_remove) {
+ $options{callback_base}->($urpm, keys %base_to_remove) or return ();
+ }
+
+ #- build error list contains all the error returned by each node.
+ $urpm->{error_remove} = [ map {
+ my $msg = N("on node %s", $_);
+ map { "$msg, $_" } @{$bad_nodes{$_}};
+ } keys %bad_nodes ];
+
+ #- if at least one node has the package, it should be seen as unknown...
+ delete @notfound{map { /^(.*)-[^-]*-[^-]*$/ } keys %{$state->{rejected}}};
+ if (%notfound) {
+ $options{callback_notfound} && $options{callback_notfound}->($urpm, keys %notfound)
+ or delete $state->{rejected};
+ }
+
+ keys %{$state->{rejected}};
+}
+
sub post_register_rpms {
my ($parallel, $urpm, @files) = @_;
diff --git a/urpm/parallel_ka_run.pm b/urpm/parallel_ka_run.pm
index d8987f5b..3f5d1f79 100644
--- a/urpm/parallel_ka_run.pm
+++ b/urpm/parallel_ka_run.pm
@@ -72,44 +72,6 @@ sub parallel_register_rpms {
urpm::parallel::post_register_rpms($parallel, $urpm, @files);
}
-#- parallel find_packages_to_remove
-sub parallel_find_remove {
- my ($parallel, $urpm, $state, $l, %options) = @_;
-
- my ($test, $pkgs) = urpm::parallel::find_remove_pre($urpm, $state, %options);
- $pkgs and return @$pkgs;
-
- my (%bad_nodes, %base_to_remove, %notfound);
-
- #- now try an iteration of urpme.
- $parallel->urpm_popen($urpm, 'urpme', "--auto $test" . join(' ', map { "'$_'" } @$l) . ' 2>&1', sub {
- my ($node, $s) = @_;
-
- urpm::parallel::parse_urpme_output($urpm, $state, $node, $s,
- \%notfound, \%base_to_remove, \%bad_nodes, %options);
- });
-
- #- check base, which has been delayed until there.
- if ($options{callback_base} && %base_to_remove) {
- $options{callback_base}->($urpm, keys %base_to_remove) or return ();
- }
-
- #- build error list contains all the error returned by each node.
- $urpm->{error_remove} = [ map {
- my $msg = N("on node %s", $_);
- map { "$msg, $_" } @{$bad_nodes{$_}};
- } keys %bad_nodes ];
-
- #- if at least one node has the package, it should be seen as unknown...
- delete @notfound{map { /^(.*)-[^-]*-[^-]*$/ } keys %{$state->{rejected}}};
- if (%notfound) {
- $options{callback_notfound} && $options{callback_notfound}->($urpm, keys %notfound)
- or delete $state->{rejected};
- }
-
- keys %{$state->{rejected}};
-}
-
#- parallel resolve_dependencies
sub parallel_resolve_dependencies {
my ($parallel, $synthesis, $urpm, $state, $requested, %options) = @_;
diff --git a/urpm/parallel_ssh.pm b/urpm/parallel_ssh.pm
index 61cd0038..96e1d1c7 100644
--- a/urpm/parallel_ssh.pm
+++ b/urpm/parallel_ssh.pm
@@ -81,44 +81,6 @@ sub parallel_register_rpms {
urpm::parallel::post_register_rpms($parallel, $urpm, @files);
}
-#- parallel find_packages_to_remove
-sub parallel_find_remove {
- my ($parallel, $urpm, $state, $l, %options) = @_;
-
- my ($test, $pkgs) = urpm::parallel::find_remove_pre($urpm, $state, %options);
- $pkgs and return @$pkgs;
-
- my (%bad_nodes, %base_to_remove, %notfound);
-
- #- now try an iteration of urpme.
- $parallel->urpm_popen($urpm, 'urpme', "--auto $test" . join(' ', map { "'$_'" } @$l) . ' 2>&1', sub {
- my ($node, $s) = @_;
-
- urpm::parallel::parse_urpme_output($urpm, $state, $node, $s,
- \%notfound, \%base_to_remove, \%bad_nodes, %options);
- });
-
- #- check base, which has been delayed until there.
- if ($options{callback_base} && %base_to_remove) {
- $options{callback_base}->($urpm, keys %base_to_remove) or return ();
- }
-
- #- build error list contains all the error returned by each node.
- $urpm->{error_remove} = [ map {
- my $msg = N("on node %s", $_);
- map { "$msg, $_" } @{$bad_nodes{$_}};
- } keys %bad_nodes ];
-
- #- if at least one node has the package, it should be seen as unknown...
- delete @notfound{map { /^(.*)-[^-]*-[^-]*$/ } keys %{$state->{rejected}}};
- if (%notfound) {
- $options{callback_notfound} && $options{callback_notfound}->($urpm, keys %notfound)
- or delete $state->{rejected};
- }
-
- keys %{$state->{rejected}};
-}
-
#- parallel resolve_dependencies
sub parallel_resolve_dependencies {
my ($parallel, $synthesis, $urpm, $state, $requested, %options) = @_;