From 8ad950845520ffb10eb8b6e73f42c3b7de528856 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Wed, 12 Sep 2007 14:57:57 +0000 Subject: create _remove_rejected_from() --- URPM/Resolve.pm | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'URPM') diff --git a/URPM/Resolve.pm b/URPM/Resolve.pm index c0d8778..36930db 100644 --- a/URPM/Resolve.pm +++ b/URPM/Resolve.pm @@ -498,6 +498,21 @@ sub backtrack_selected_psel_keep { $keep and push @{$state->{rejected}{$psel->fullname}{backtrack}{keep}}, @$keep; } +#- side-effects: $state->{rejected} +sub _remove_rejected_from { + my ($state, $fullname, $from_fullname) = @_; + + my $rv = $state->{rejected}{$fullname} or return; + exists $rv->{closure}{$from_fullname} or return; + delete $rv->{closure}{$from_fullname}; + if (%{$rv->{closure}}) { + 0; + } else { + delete $state->{rejected}{$fullname}; + 1; + } +} + #- side-effects: $state->{rejected} sub _set_rejected_from { my ($state, $pkg, $from_pkg) = @_; @@ -1093,10 +1108,7 @@ sub disable_selected { while (my $fullname = shift @rejected_todo) { my @rejecteds = keys %{$state->{rejected}}; foreach (@rejecteds) { - exists $state->{rejected}{$_} && exists $state->{rejected}{$_}{closure}{$fullname} or next; - delete $state->{rejected}{$_}{closure}{$fullname}; - unless (%{$state->{rejected}{$_}{closure}}) { - delete $state->{rejected}{$_}; + if (_remove_rejected_from($state, $_, $fullname)) { push @rejected_todo, $_; } } -- cgit v1.2.1