diff options
author | Guillaume Cottenceau <gc@mandriva.com> | 2002-08-23 10:21:13 +0000 |
---|---|---|
committer | Guillaume Cottenceau <gc@mandriva.com> | 2002-08-23 10:21:13 +0000 |
commit | 4dfed1e77707836b7929e2e2cf205fb182ed45f1 (patch) | |
tree | ae82159ae057b1b508cffa1660681ba39ea7ed40 | |
parent | 4f58927bc12ca560f83fc2247c7dcbe17171e7f1 (diff) | |
download | rpmdrake-4dfed1e77707836b7929e2e2cf205fb182ed45f1.tar rpmdrake-4dfed1e77707836b7929e2e2cf205fb182ed45f1.tar.gz rpmdrake-4dfed1e77707836b7929e2e2cf205fb182ed45f1.tar.bz2 rpmdrake-4dfed1e77707836b7929e2e2cf205fb182ed45f1.tar.xz rpmdrake-4dfed1e77707836b7929e2e2cf205fb182ed45f1.zip |
when user does a multiple selection of packages to install, if
some packages require a new locale to install and they look like
i18n packages (eg they contain the same locale name in their
name), don't select them; it should fix the selection of all the
locales when user selects "KDE Workstation" or "Gnome
Workstation"; of course, still possible to select these packages
one by one
-rwxr-xr-x | rpmdrake | 25 |
1 files changed, 18 insertions, 7 deletions
@@ -195,18 +195,18 @@ sub run_treeview_dialog { my (undef, $size_free) = MDK::Common::System::df('/usr'); my $formatlistpkg = sub { myformatList(sort { uc($a) cmp uc($b) } @_) }; + my $is_locale_available = sub { + grep { $urpm->{depslist}[$_[0]]->flag_selected } keys %{$urpm->{provides}{$_[0]} || {}} and return 1; + my $found; + db->traverse_tag('name', [ $_ ], sub { $found ||= 1 }); + return $found; + }; my $callback_choices = sub { my ($urpm, $db, $state, $choices) = @_; foreach my $pkg (@$choices) { foreach ($pkg->requires_nosense) { /locales-/ or next; - foreach (keys %{$urpm->{provides}{$_} || {}}) { - $urpm->{depslist}[$_]->flag_selected or next; - return $pkg; - } - my $autochoice; - db->traverse_tag('name', [ $_ ], sub { $autochoice ||= $pkg }); - $autochoice and return $autochoice; + $is_locale_available->($_) and return $pkg; } } $choices->[interactive_list(_("Please choose"), _("One of the following packages is needed:"), map { my_fullname($_) } @$choices)]; @@ -344,6 +344,17 @@ or you already installed all of them.")); } else { if ($new_state) { $urpm->{state}{selected} = {}; + if (@nodes > 1) { + #- unselect i18n packages of which locales is not already present (happens when user clicks on KDE group) + my @bad_i18n_pkgs; + foreach my $sel (@nodes) { + foreach ($pkgs->{$sel}{pkg}->requires_nosense) { + /locales-([^-]+)/ or next; + $sel =~ /-$1[-_]/ && !$is_locale_available->($_) and push @bad_i18n_pkgs, $sel; + } + } + @nodes = difference2(\@nodes, \@bad_i18n_pkgs); + } slow_func($tree->window, sub { $urpm->resolve_requested(db, $urpm->{state}, { map { $pkgs->{$_}{pkg}->id => 1 } @nodes }, callback_choices => $callback_choices, no_flag_update => 1, keep_state => 1) }); |