diff options
author | Francois Pons <fpons@mandriva.com> | 2002-09-10 09:59:08 +0000 |
---|---|---|
committer | Francois Pons <fpons@mandriva.com> | 2002-09-10 09:59:08 +0000 |
commit | 91562f77629d09b715e19e43bf7ea9e0df39d19a (patch) | |
tree | 8bc375afa6fddd4329324d19629062fd9dd9c3d5 | |
parent | 915b7f6d6176969cdd1fc6d9551153649116a2a3 (diff) | |
download | drakx-backup-do-not-use-91562f77629d09b715e19e43bf7ea9e0df39d19a.tar drakx-backup-do-not-use-91562f77629d09b715e19e43bf7ea9e0df39d19a.tar.gz drakx-backup-do-not-use-91562f77629d09b715e19e43bf7ea9e0df39d19a.tar.bz2 drakx-backup-do-not-use-91562f77629d09b715e19e43bf7ea9e0df39d19a.tar.xz drakx-backup-do-not-use-91562f77629d09b715e19e43bf7ea9e0df39d19a.zip |
consolidate unselectAllPackages.
-rw-r--r-- | perl-install/pkgs.pm | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm index 765890922..c1239dd78 100644 --- a/perl-install/pkgs.pm +++ b/perl-install/pkgs.pm @@ -287,35 +287,33 @@ sub setPackageSelection($$$) { sub unselectAllPackages($) { my ($packages) = @_; - my %selected; + my (%keep_selected, %unselected); foreach (@{$packages->{depslist}}) { - unless ($_->flag_base || $_->flag_installed && $_->flag_selected) { + if ($_->flag_base || $_->flag_installed && $_->flag_selected) { + #- keep track of package that should be kept selected. + $keep_selected{$_->id} = undef; + } else { #- deselect all packages except base or packages that need to be upgraded. - $_->set_flag_requested(0); - $_->set_flag_required(0); - $selected{$_->id} = undef; + $unselected{$_->id} = undef; } } - if (%selected && %{$packages->{state} || {}}) { + if (%unselected) { my $state = $packages->{state} ||= {}; - $state->{selected} = \%selected; - $packages->resolve_requested($packages->{rpmdb}, $state, {}, keep_state => 1); - } -} -sub unselectAllPackagesIncludingUpgradable($) { - my ($packages, $removeUpgradeFlag) = @_; - my %selected; - foreach (@{$packages->{depslist}}) { - unless ($_->flag_base) { - $_->set_flag_requested(0); - $_->set_flag_required(0); - $selected{$_->id} = undef; + $packages->resolve_unrequested($packages->{rpmdb}, $state, \%unselected); + + my @l = keys %keep_selected; + foreach (@l) { + my $pkg = $packages->{depslist}[$_] or next; + if ($pkg->flag_available) { + delete $keep_selected{$_}; + } else { + log::l("unselectAllPackage unselected ".$pkg->fullname." which should be selected again"); + } + } + if (%keep_selected) { + $packages->resolve_requested($packages->{rpmdb}, $state, \%keep_selected, + callback_choices => \&packageCallbackChoices); } - } - if (%selected && %{$packages->{state} || {}}) { - my $state = $packages->{state} ||= {}; - $state->{selected} = \%selected; - $packages->resolve_requested($packages->{rpmdb}, $state, {}, keep_state => 1); } } |