diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2007-09-12 12:03:29 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2007-09-12 12:03:29 +0000 |
commit | c33bc9fcce9e3365821fb0916628fdec892d0d30 (patch) | |
tree | 36d39097431c38eb2fdc72b79a99473878360315 | |
parent | fba702aaa443e5962640e003fef60c6417d40a42 (diff) | |
download | perl-URPM-c33bc9fcce9e3365821fb0916628fdec892d0d30.tar perl-URPM-c33bc9fcce9e3365821fb0916628fdec892d0d30.tar.gz perl-URPM-c33bc9fcce9e3365821fb0916628fdec892d0d30.tar.bz2 perl-URPM-c33bc9fcce9e3365821fb0916628fdec892d0d30.tar.xz perl-URPM-c33bc9fcce9e3365821fb0916628fdec892d0d30.zip |
create set_rejected() out of resolve_rejected_()
-rw-r--r-- | URPM/Resolve.pm | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/URPM/Resolve.pm b/URPM/Resolve.pm index a11fdcc..61d056f 100644 --- a/URPM/Resolve.pm +++ b/URPM/Resolve.pm @@ -498,6 +498,27 @@ sub backtrack_selected_psel_keep { $keep and push @{$state->{rejected}{$psel->fullname}{backtrack}{keep}}, @$keep; } + +sub set_rejected { + my ($state, $pkg, %options) = @_; + + my $rv = $state->{rejected}{$pkg->fullname} ||= {}; + + #- keep track of what causes closure. + if ($options{from}) { + my %d; @d{@{$rv->{closure}{$options{from}->fullname}{unsatisfied} ||= []}} = (); + push @{$rv->{closure}{$options{from}->fullname}{unsatisfied}}, grep { ! exists $d{$_} } @{$options{why}}; + } + + #- set removed and obsoleted level. + foreach (qw(removed obsoleted)) { + $options{$_} && (! exists $rv->{$_} || $options{$_} <= $rv->{$_}) + and $rv->{$_} = $options{$_}; + } + + $rv; +} + #- see resolve_rejected_ below sub resolve_rejected { my ($urpm, $db, $state, $pkg, %options) = @_; @@ -539,17 +560,8 @@ sub resolve_rejected_ { } with_db_unsatisfied_requires($urpm, $db, $state, $n, sub { my ($p, @l) = @_; - my $rv = $state->{rejected}{$p->fullname} ||= {}; - #- keep track of what causes closure. - my %d; @d{@{$rv->{closure}{$pkg->fullname}{unsatisfied} ||= []}} = (); - push @{$rv->{closure}{$pkg->fullname}{unsatisfied}}, grep { ! exists $d{$_} } @l; - - #- set removed and obsoleted level. - foreach (qw(removed obsoleted)) { - $options{$_} && (! exists $rv->{$_} || $options{$_} <= $rv->{$_}) - and $rv->{$_} = $options{$_}; - } + my $rv = set_rejected($state, $p, from => $pkg, why => \@l); #- continue the closure unless already examined. exists $rv->{size} and return; |