From 4d8847f644759eda266bbef5a72a792ea7f7d535 Mon Sep 17 00:00:00 2001 From: Francois Pons Date: Thu, 19 Jun 2003 14:24:58 +0000 Subject: 0.91-6mdk --- URPM/Resolve.pm | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'URPM/Resolve.pm') diff --git a/URPM/Resolve.pm b/URPM/Resolve.pm index b1f66d3..8370249 100644 --- a/URPM/Resolve.pm +++ b/URPM/Resolve.pm @@ -219,7 +219,8 @@ sub backtrack_selected { dep => $dep, alternatives => $packages, %options) <= 0) { #- keep in mind a backtrack has happening here... $state->{rejected}{$_->fullname}{backtrack} ||= - { exists $dep->{promote} ? (promote => $dep->{promote}) : @{[]} }; + { exists $dep->{promote} ? (promote => $dep->{promote}) : @{[]}, + exists $dep->{psel} ? (psel => $dep->{psel}) : @{[]} }; #- backtrack callback should return a strictly positive value if the selection of the new #- package is prefered over the currently selected package. next; @@ -518,7 +519,7 @@ sub resolve_requested { @{$packages->{$p->name}}; if (length $best) { - push @properties, { required => $best, promote => $n }; + push @properties, { required => $best, promote => $n, psel => $pkg }; } else { #- no package have been found, we may need to remove the package examined unless #- there exists a package that provided the unsatisfied requires. @@ -535,7 +536,7 @@ sub resolve_requested { } if (@best == @l) { - push @properties, map { +{ required => $_, promote => $n } } @best; + push @properties, map { +{ required => $_, promote => $n, psel => $pkg } } @best; } else { $urpm->resolve_rejected($db, $state, $p, removed => 1, unsatisfied => \@properties, @@ -968,6 +969,9 @@ sub has_dependence { sub build_transaction_set { my ($urpm, $db, $state, %options) = @_; + #- clean transaction set. + $state->{transaction} = []; + if ($options{split_length}) { #- first step consists of sorting packages according to dependencies. my @sorted = sort { ($a <=> $b, -1, +1, 0)[($urpm->has_dependence($state, $a, $b) && 1) + @@ -1005,13 +1009,12 @@ sub build_transaction_set { %set and push @{$state->{transaction}}, \%set; } } - } else { - #- no split is necessary, simply extract from current selection. - $state->{transaction} = [ { - upgrade => [ keys %{$state->{selected}} ], - remove => [ grep { $state->{rejected}{$_}{removed} && !$state->{rejected}{$_}{obsoleted} } - keys %{$state->{rejected}} ], - } ]; + } elsif (%{$state->{selected} || {}} || %{$state->{rejected} || {}}) { + push @{$state->{transaction}}, { + upgrade => [ keys %{$state->{selected}} ], + remove => [ grep { $state->{rejected}{$_}{removed} && !$state->{rejected}{$_}{obsoleted} } + keys %{$state->{rejected}} ], + }; } $state->{transaction}; -- cgit v1.2.1