From faf71981ca6290846622e30166aaa7af5aff362d Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Wed, 28 Mar 2012 18:42:31 +0000 Subject: (fast_open_urpmi_db) catch early errors too, thus enable to display a graphical error message when debug environment does not exist --- NEWS | 2 ++ Rpmdrake/open_db.pm | 14 +++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index 9190a60c..f22c9fdc 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,5 @@ +- display a graphical error message when debug environment does not exist + Version 5.32 - 26 March 2012, Thierry Vignaud - rpmdrake: diff --git a/Rpmdrake/open_db.pm b/Rpmdrake/open_db.pm index ee75badd..f5c76213 100644 --- a/Rpmdrake/open_db.pm +++ b/Rpmdrake/open_db.pm @@ -78,12 +78,18 @@ sub open_rpm_db { # do not pay the urpm::media::configure() heavy cost: sub fast_open_urpmi_db() { my $urpm = urpm->new; + my $error_happened; + $urpm->{fatal} = sub { + $error_happened = 1; + interactive_msg(N("Fatal error"), + N("A fatal error occurred: %s.", $_[1])); + }; + urpm::set_files($urpm, $::rpmdrake_options{'urpmi-root'}[0]) if $::rpmdrake_options{'urpmi-root'}[0]; $::rpmdrake_options{'rpm-root'}[0] ||= $::rpmdrake_options{'urpmi-root'}[0]; urpm::args::set_root($urpm, $::rpmdrake_options{'rpm-root'}[0]) if $::rpmdrake_options{'rpm-root'}[0]; urpm::args::set_debug($urpm) if $::rpmdrake_options{debug}; $urpm->get_global_options; - my $error_happened; $urpm->{options}{wait_lock} = $::rpmdrake_options{'wait-lock'}; $urpm->{options}{'verify-rpm'} = !$::rpmdrake_options{'no-verify-rpm'} if defined $::rpmdrake_options{'no-verify-rpm'}; $urpm->{options}{auto} = $::rpmdrake_options{auto} if defined $::rpmdrake_options{auto}; @@ -97,12 +103,6 @@ sub fast_open_urpmi_db() { $urpm::args::options{justdb} = $::rpmdrake_options{justdb}; - $urpm->{fatal} = sub { - $error_happened = 1; - interactive_msg(N("Fatal error"), - N("A fatal error occurred: %s.", $_[1])); - }; - urpm::media::read_config($urpm, 0); foreach (@{$urpm->{media}}) { next if $_->{ignore}; -- cgit v1.2.1