aboutsummaryrefslogtreecommitdiffstats
path: root/rpmdrake.pm
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2003-04-17 14:15:00 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2003-04-17 14:15:00 +0000
commite86d4dc215c68104c71e173124d32e678640ae89 (patch)
tree4ab829ecace661ad81c14d4229a9c273e74ab5f4 /rpmdrake.pm
parentee11c56d392c8d5cf4c3705b3ed57fd342da55dc (diff)
downloadrpmdrake-e86d4dc215c68104c71e173124d32e678640ae89.tar
rpmdrake-e86d4dc215c68104c71e173124d32e678640ae89.tar.gz
rpmdrake-e86d4dc215c68104c71e173124d32e678640ae89.tar.bz2
rpmdrake-e86d4dc215c68104c71e173124d32e678640ae89.tar.xz
rpmdrake-e86d4dc215c68104c71e173124d32e678640ae89.zip
report more urpmi errors in the GUI
Diffstat (limited to 'rpmdrake.pm')
-rw-r--r--rpmdrake.pm26
1 files changed, 24 insertions, 2 deletions
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;
+}