aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-09-12 12:59:19 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-09-12 12:59:19 +0000
commitd506cdf4f182e29beef22b3c25b51cafce6e3637 (patch)
treec164a0ea12b6b4c11d5e22be1e21bdd48ba55e15
parent442333774fba5156a1ef20ca7bb4ac75adafdc81 (diff)
downloadperl-URPM-d506cdf4f182e29beef22b3c25b51cafce6e3637.tar
perl-URPM-d506cdf4f182e29beef22b3c25b51cafce6e3637.tar.gz
perl-URPM-d506cdf4f182e29beef22b3c25b51cafce6e3637.tar.bz2
perl-URPM-d506cdf4f182e29beef22b3c25b51cafce6e3637.tar.xz
perl-URPM-d506cdf4f182e29beef22b3c25b51cafce6e3637.zip
- add ability to merge {closure} fields in set_rejected (from $options{why})
- {from} is a fullname here - {why} is a hash - use set_rejected() to factorize code
-rw-r--r--URPM/Resolve.pm26
1 files changed, 13 insertions, 13 deletions
diff --git a/URPM/Resolve.pm b/URPM/Resolve.pm
index 98bf925..446e3ad 100644
--- a/URPM/Resolve.pm
+++ b/URPM/Resolve.pm
@@ -506,8 +506,12 @@ sub set_rejected {
#- keep track of what causes closure.
if ($options{from}) {
- my $unsatisfied = $rv->{closure}{$options{from}->fullname}{unsatisfied} ||= [];
- @$unsatisfied = uniq(@$unsatisfied, @{$options{why}});
+ my $closure = $rv->{closure}{$options{from}} ||= {};
+ if (my $l = delete $options{why}{unsatisfied}) {
+ my $unsatisfied = $closure->{unsatisfied} ||= [];
+ @$unsatisfied = uniq(@$unsatisfied, @$l);
+ }
+ $closure->{$_} = $options{why}{$_} foreach keys %{$options{why}};
}
#- set removed and obsoleted level.
@@ -538,11 +542,10 @@ sub resolve_rejected_ {
if (! $state->{rejected}{$pkg->fullname}) {
my @pkgs_todo = $pkg;
+ set_rejected($state, $pkg, %options);
+
#- keep track of size of package which are finally removed.
$state->{rejected}{$pkg->fullname}{size} = $pkg->size;
- foreach (qw(removed obsoleted)) {
- $options{$_} and $state->{rejected}{$pkg->fullname}{$_} = $options{$_};
- }
while (my $cp = shift @pkgs_todo) {
#- close what requires this property, but check with selected package requiring old properties.
@@ -561,7 +564,9 @@ sub resolve_rejected_ {
with_db_unsatisfied_requires($urpm, $db, $state, $n, sub {
my ($p, @l) = @_;
- my $rv = set_rejected($state, $p, %options, from => $pkg, why => \@l);
+ my $rv = set_rejected($state, $p, %options,
+ from => scalar $pkg->fullname,
+ why => { unsatisfied => \@l });
#- continue the closure unless already examined.
exists $rv->{size} and return;
@@ -574,14 +579,9 @@ sub resolve_rejected_ {
}
} else {
#- the package has already been rejected.
- foreach (qw(removed obsoleted)) {
- $options{$_} && (! exists $state->{rejected}{$pkg->fullname}{$_} ||
- $options{$_} <= $state->{rejected}{$pkg->fullname}{$_})
- and $state->{rejected}{$pkg->fullname}{$_} = $options{$_};
- }
+ #- but do update {closure} and {required}, {obsoleted}
+ set_rejected($state, $pkg, %options);
}
-
- $options{from} and $state->{rejected}{$pkg->fullname}{closure}{$options{from}} = $options{why};
}
# see resolve_requested__no_suggests below for information about usage