From e86d4dc215c68104c71e173124d32e678640ae89 Mon Sep 17 00:00:00 2001 From: Guillaume Cottenceau Date: Thu, 17 Apr 2003 14:15:00 +0000 Subject: report more urpmi errors in the GUI --- rpmdrake.pm | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'rpmdrake.pm') diff --git a/rpmdrake.pm b/rpmdrake.pm index 35ecda87..47c7ebb7 100644 --- a/rpmdrake.pm +++ b/rpmdrake.pm @@ -44,8 +44,12 @@ ugtk2::add_icon_path('/usr/share/rpmdrake/icons'); c::bind_textdomain_codeset('rpmdrake', 'UTF8'); sub translate { my ($s) = @_; - my $r = $s ? c::dgettext('rpmdrake', $s) : ''; - c::set_tagged_utf8($r); + my $r = ''; + if ($s) { + $r = c::dgettext('rpmdrake', $s); + $r eq $s and $r = Locale::gettext::iconv(c::dgettext('urpmi', $s), undef, "UTF-8"); + c::set_tagged_utf8($r); + } $r; } sub sprintf_fixutf8 { @@ -403,3 +407,21 @@ sub update_sources_interactive { } return 0; } + +sub add_medium_and_check { + my ($urpm, $msg, $options) = splice @_, 0, 3; + standalone::explanations("Adding medium @_"); + my $wait = wait_msg($msg); + $urpm->add_medium(@_); + my @error_msgs; + local $urpm->{fatal} = sub { push @error_msgs, $_[1] }; + local $urpm->{error} = sub { push @error_msgs, $_[0] }; + update_sources($urpm, %$options, noclean => 1); + remove_wait_msg($wait); + my ($medium) = grep { $_->{name} eq $_[0] } @{$urpm->{media}}; + $medium or interactive_msg('rpmdrake', N("Unable to create medium.")); + $medium->{modified} and interactive_msg('rpmdrake', + N("Unable to update medium; it will be automatically disabled.\n\nErrors:\n%s", + join("\n", @error_msgs))); + $urpm->write_config; +} -- cgit v1.2.1