From 1b9fc74443a32bed1a877f19aafff3efe28093d8 Mon Sep 17 00:00:00 2001 From: Francois Pons Date: Mon, 21 Jul 2003 14:50:18 +0000 Subject: fixed setSelectedFromCompssList (updated with newer perl-URPM interface), more need to be done. maybe increased speed of unselectAllPackages. --- perl-install/pkgs.pm | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) (limited to 'perl-install') diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm index c7ce0e1bb..74cf1e870 100644 --- a/perl-install/pkgs.pm +++ b/perl-install/pkgs.pm @@ -296,27 +296,21 @@ sub setPackageSelection($$$) { sub unselectAllPackages($) { my ($packages) = @_; - my (%keep_selected, %unselected); + my %keep_selected; foreach (@{$packages->{depslist}}) { if ($_->flag_base || $_->flag_installed && $_->flag_selected) { #- keep track of package that should be kept selected. $keep_selected{$_->id} = $_; } else { #- deselect all packages except base or packages that need to be upgraded. - $unselected{$_->id} = $_; - } - } - if (%unselected) { - my $state = $packages->{state} ||= {}; - $packages->disable_selected($packages->{rpmdb}, $state, values %unselected); - - if (my @l = $packages->resolve_requested($packages->{rpmdb}, $state, \%keep_selected, - callback_choices => \&packageCallbackChoices)) { - foreach (@l) { - log::l("unselectAllPackage unselected ".$_->fullname." which has been selected again"); - } + $_->set_flag_required(0); + $_->set_flag_requested(0); } } + #- clean staten, in order to start with a brand new set... + $packages->{state} = {}; + $packages->resolve_requested($packages->{rpmdb}, $packages->{state}, \%keep_selected, + callback_choices => \&packageCallbackChoices); } sub psUpdateHdlistsDeps { @@ -573,16 +567,14 @@ sub setSelectedFromCompssList { #- determine the packages that will be selected when #- selecting $p. the packages are not selected. my $state = $packages->{state} ||= {}; - $state->{selected} = {}; my @l = $packages->resolve_requested($packages->{rpmdb}, $state, packageRequest($packages, $p) || {}, callback_choices => \&packageCallbackChoices); #- this enable an incremental total size. my $old_nb = $nb; - foreach (keys %{$state->{selected}}) { - my $p = $packages->{depslist}[$_] or next; - $nb += $p->size; + foreach (@l) { + $nb += $_->size; } if ($max_size && $nb > $max_size) { $nb = $old_nb; -- cgit v1.2.1