summaryrefslogtreecommitdiffstats
path: root/perl-install/install
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mageia.org>2012-12-06 16:13:32 +0000
committerThierry Vignaud <tv@mageia.org>2012-12-06 16:13:32 +0000
commit018303607f11609fa8c7900a359b0d55c96bb3ab (patch)
tree405eacc355acca4b411f22c2ff3cc05a646057c3 /perl-install/install
parent02e1899aad9f954102e43e54364769efdbef0a55 (diff)
downloaddrakx-018303607f11609fa8c7900a359b0d55c96bb3ab.tar
drakx-018303607f11609fa8c7900a359b0d55c96bb3ab.tar.gz
drakx-018303607f11609fa8c7900a359b0d55c96bb3ab.tar.bz2
drakx-018303607f11609fa8c7900a359b0d55c96bb3ab.tar.xz
drakx-018303607f11609fa8c7900a359b0d55c96bb3ab.zip
(start_pushing_error,popup_errors,error) factorize "background" error handling
Diffstat (limited to 'perl-install/install')
-rw-r--r--perl-install/install/any.pm10
-rw-r--r--perl-install/install/pkgs.pm17
2 files changed, 19 insertions, 8 deletions
diff --git a/perl-install/install/any.pm b/perl-install/install/any.pm
index 6f211c991..d73d3ed44 100644
--- a/perl-install/install/any.pm
+++ b/perl-install/install/any.pm
@@ -325,20 +325,14 @@ sub setPackages {
my ($suppl_method, $copy_rpms_on_disk);
{
- my @errors;
- local $urpm->{error} = sub {
- log::l("urpmi error: $_[0]");
- push @errors, @_;
- };
+ install::pkgs::start_pushing_error();
($suppl_method, $copy_rpms_on_disk) = install::media::get_media($o, $media, $urpm);
if ($suppl_method) {
1 while $o->selectSupplMedia;
}
install::media::update_media($urpm);
- if (@errors) {
- $::o->ask_warn(undef, N("An error occurred:") . "\n\n" . join("\n", @errors));
- }
+ install::pkgs::popup_errors();
}
# actually read synthesis now we have all the ones we want:
diff --git a/perl-install/install/pkgs.pm b/perl-install/install/pkgs.pm
index cf35328d4..b01ae5165 100644
--- a/perl-install/install/pkgs.pm
+++ b/perl-install/install/pkgs.pm
@@ -371,6 +371,19 @@ sub unselectAllPackages {
_resolve_requested_and_check($packages, $packages->{state}, \%keep_selected);
}
+
+my (@errors, $push_errors);
+sub start_pushing_error() {
+ $push_errors = 1;
+}
+
+sub popup_errors() {
+ if (@errors) {
+ $::o->ask_warn(undef, N("An error occurred:") . "\n\n" . join("\n", @errors));
+ }
+ undef $push_errors;
+}
+
sub empty_packages {
my ($o_keep_unrequested_dependencies) = @_;
my $packages = urpm->new;
@@ -389,6 +402,10 @@ sub empty_packages {
};
$packages->{error} = sub {
log::l("urpmi error: $_[0]");
+ if ($push_errors) {
+ push @errors, @_;
+ return;
+ }
$::o->ask_warn(undef, N("An error occurred:") . "\n\n" . $_[0]);
};
$packages->{root} = $::prefix;