diff options
-rw-r--r-- | URPM/Resolve.pm | 55 | ||||
-rw-r--r-- | perl-URPM.spec | 8 |
2 files changed, 47 insertions, 16 deletions
diff --git a/URPM/Resolve.pm b/URPM/Resolve.pm index 8370249..33ab551 100644 --- a/URPM/Resolve.pm +++ b/URPM/Resolve.pm @@ -244,21 +244,28 @@ sub backtrack_selected { } } - #- at this point, dep cannot be resolved, this means we need to disable - #- all selection tree, re-enabling removed and obsoleted packages as well. - if (!$options{nodeps} && defined $dep->{from}) { - unless (exists $state->{rejected}{$dep->{from}->fullname}) { - #- package is not currently rejected, compute the closure now. - my @l = $options{keep_unrequested_dependencies} ? $urpm->disable_selected($db, $state, $dep->{from}) : - $urpm->disable_selected_unrequested_dependencies($db, $state, $dep->{from}); - foreach (@l) { - #- disable all these packages in order to avoid selecting them again. - $_->fullname eq $dep->{from}->fullname or - $state->{rejected}{$_->fullname}{backtrack}{closure}{$dep->{from}->fullname} = undef; + if (defined $dep->{from}) { + if ($options{nodeps}) { + #- try to keep unsatisfied dependencies in requested. + if (exists $state->{selected}{$dep->{from}->id}) { + push @{$state->{selected}{$dep->{from}->id}{unsatisfied}}, $dep->{required}; } + } else { + #- at this point, dep cannot be resolved, this means we need to disable + #- all selection tree, re-enabling removed and obsoleted packages as well. + unless (exists $state->{rejected}{$dep->{from}->fullname}) { + #- package is not currently rejected, compute the closure now. + my @l = $options{keep_unrequested_dependencies} ? $urpm->disable_selected($db, $state, $dep->{from}) : + $urpm->disable_selected_unrequested_dependencies($db, $state, $dep->{from}); + foreach (@l) { + #- disable all these packages in order to avoid selecting them again. + $_->fullname eq $dep->{from}->fullname or + $state->{rejected}{$_->fullname}{backtrack}{closure}{$dep->{from}->fullname} = undef; + } + } + #- the package is already rejected, we assume we can add another reason here! + push @{$state->{rejected}{$dep->{from}->fullname}{backtrack}{unsatisfied}}, $dep->{required}; } - #- the package is already rejected, we assume we can add another reason here! - push @{$state->{rejected}{$dep->{from}->fullname}{backtrack}{unsatisfied}}, $dep->{required}; } #- some packages may have been removed because of selection of this one. @@ -707,7 +714,7 @@ sub disable_selected_unrequested_dependencies { foreach (keys %required) { my $pkg = $urpm->{depslist}[$_] or next; foreach ($pkg->provides_nosense) { - foreach (keys %{$state->{whatrequires}{$_}}) { + foreach (keys %{$state->{whatrequires}{$_} || {}}) { my $p = $urpm->{depslist}[$_] or next; exists $required{$p->id} and next; exists $state->{selected}{$p->id} and $required{$pkg->id} = 1; @@ -722,6 +729,24 @@ sub disable_selected_unrequested_dependencies { @unselected_closure; } +#- compute selected size by removing any removed or obsoleted package. +sub selected_size { + my ($urpm, $state) = @_; + my $size; + + foreach (keys %{$state->{selected} || {}}) { + my $pkg = $urpm->{depslist}[$_]; + $size += $pkg->size; + } + + foreach (values %{$state->{rejected} || {}}) { + $_->{removed} || $_->{obsoleted} or next; + $size -= $_->{size}; + } + + $size; +} + #- compute installed flags for all package in depslist. sub compute_installed_flags { my ($urpm, $db) = @_; @@ -1009,7 +1034,7 @@ sub build_transaction_set { %set and push @{$state->{transaction}}, \%set; } } - } elsif (%{$state->{selected} || {}} || %{$state->{rejected} || {}}) { + } elsif (%{$state->{selected} || {}}) { push @{$state->{transaction}}, { upgrade => [ keys %{$state->{selected}} ], remove => [ grep { $state->{rejected}{$_}{removed} && !$state->{rejected}{$_}{obsoleted} } diff --git a/perl-URPM.spec b/perl-URPM.spec index 31f79de..47bff60 100644 --- a/perl-URPM.spec +++ b/perl-URPM.spec @@ -1,7 +1,7 @@ %define name perl-URPM %define real_name URPM %define version 0.91 -%define release 6mdk +%define release 7mdk %{expand:%%define rpm_version %(rpm -q --queryformat '%{VERSION}-%{RELEASE}' rpm)} @@ -51,6 +51,12 @@ rm -rf $RPM_BUILD_ROOT %changelog +* Thu Jun 26 2003 François Pons <fpons@mandrakesoft.com> 0.91-7mdk +- fixed possible transaction set build even for empty selection. +- fixed whatrequires hash abnormally populated (no problem raised). +- added unsatisfied information to selected hash when nodeps option + is given to URPM::resolve_requested. + * Thu Jun 19 2003 François Pons <fpons@mandrakesoft.com> 0.91-6mdk - make sure callback options are taken into account only if a reference is given. |