aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xrpmdrake60
1 files changed, 46 insertions, 14 deletions
diff --git a/rpmdrake b/rpmdrake
index bfe4bdab..29b5e47f 100755
--- a/rpmdrake
+++ b/rpmdrake
@@ -198,6 +198,12 @@ sub run_treeview_dialog {
my ($urpm, $db, $state, $choices) = @_;
$choices->[interactive_list(_("Please choose"), _("One of the following packages is needed:"), map { my_fullname($_) } @$choices)];
};
+ my $choices_auto;
+ my $callback_choices_auto = sub {
+ my ($urpm, $db, $state, $choices) = @_;
+ member(my_fullname($_), @$choices_auto) and return $_ foreach @$choices;
+ return $choices->[0]; #- theoretically unreachable, but at least try to fallback on something usable
+ };
{
my @base = qw(basesystem);
my %basepackages;
@@ -248,10 +254,15 @@ sub run_treeview_dialog {
if ($MODE eq 'update') {
@keys = grep { my ($name) = split_fullname($_);
member($descriptions->{$name}{importance}, @$mandrakeupdate_wanted_categories) } @keys;
- int(@keys) or $add_node->('', _("(none)")), interactive_msg(_("No update"),
+ if (@keys == 0) {
+ $add_node->('', _("(none)"));
+ my $explanation_only_once if 0;
+ $explanation_only_once or interactive_msg(_("No update"),
_("The list of updates is void. This means that either there is
no available update for the packages installed on your computer,
or you already installed all of them."));
+ $explanation_only_once = 1;
+ }
}
@elems = map { [ $_, !$flat && ctreefy($pkgs->{$_}{pkg}->group) ] } @keys;
}
@@ -321,15 +332,28 @@ or you already installed all of them."));
$urpm->{state}{selected} = {};
slow_func($tree->window,
sub { $urpm->resolve_requested(db, $urpm->{state}, { map { $pkgs->{$_}{pkg}->id => 1 } @nodes },
- callback_choices => $callback_choices)});
- $urpm->deselect_unwanted_packages($urpm->{state}{selected});
- if (%{$urpm->{state}{ask_unselect} || {}}) {
- delete @{$urpm->{state}{selected}}{keys %{delete $urpm->{state}{ask_unselect}}};
+ callback_choices => $callback_choices, no_flag_update => 1, keep_state => 1) });
+ my $pkg_sel_after_selection = sub {
+ $urpm->deselect_unwanted_packages($urpm->{state}{selected});
+ if (%{$urpm->{state}{ask_unselect} || {}}) {
+ delete @{$urpm->{state}{selected}}{keys %{delete $urpm->{state}{ask_unselect}}};
+ }
+ @nodes_with_deps = map { my_fullname($urpm->{depslist}[$_]) } keys %{$urpm->{state}{selected}};
+ };
+ $pkg_sel_after_selection->();
+ if (!$deps_msg->(_("Additional packages needed"),
+ _("To satisfy dependencies, the following package(s) also need\nto be installed:\n\n"),
+ \@nodes, \@nodes_with_deps)) {
+ @nodes_with_deps = ();
+ goto packages_selection_ok;
}
- @nodes_with_deps = map { my_fullname($urpm->{depslist}[$_]) } keys %{$urpm->{state}{selected}};
- $deps_msg->(_("Additional packages needed"),
- _("To satisfy dependencies, the following package(s) also need\nto be installed:\n\n"),
- \@nodes, \@nodes_with_deps);
+
+ $choices_auto = \@nodes_with_deps;
+ $urpm->{state}{selected} = {};
+ slow_func($tree->window,
+ sub { $urpm->resolve_requested(db, $urpm->{state}, { map { $pkgs->{$_}{pkg}->id => 1 } @nodes },
+ callback_choices => $callback_choices_auto) });
+ $pkg_sel_after_selection->();
if (my @cant = difference2(\@nodes, \@nodes_with_deps)) {
interactive_msg(_("Some packages can't be installed"),
_("Sorry, the following package(s) can't be selected:\n\n") . $formatlistpkg->(@cant));
@@ -338,17 +362,25 @@ or you already installed all of them."));
$pkgs->{$_}{pkg}->set_flag_required(0);
}
}
+ packages_selection_ok:
} else {
$urpm->{state}{unselected} = {};
slow_func($tree->window,
sub { $urpm->resolve_unrequested(db, $urpm->{state},
- { map { $pkgs->{$_}{pkg}->id => undef } @nodes }) });
+ { map { $pkgs->{$_}{pkg}->id => undef } @nodes },
+ no_flag_update => 1) });
@nodes_with_deps = map { my_fullname($urpm->{depslist}[$_]) } keys %{$urpm->{state}{unselected}};
- if (my @deps = difference2(\@nodes_with_deps, \@nodes)) {
- interactive_msg(_("Some packages need to be removed"),
- _("Because of their dependencies, the following package(s) must be\nunselected now:\n\n").
- $formatlistpkg->(@deps))
+ if (!$deps_msg->(_("Some packages need to be removed"),
+ _("Because of their dependencies, the following package(s) must be\nunselected now:\n\n"),
+ \@nodes, \@nodes_with_deps)) {
+ @nodes_with_deps = ();
+ goto packages_unselection_ok;
}
+ slow_func($tree->window,
+ sub { $urpm->resolve_unrequested(db, $urpm->{state},
+ { map { $pkgs->{$_}{pkg}->id => undef } @nodes }) });
+ @nodes_with_deps = map { my_fullname($urpm->{depslist}[$_]) } keys %{$urpm->{state}{unselected}};
+ packages_unselection_ok:
}
}