diff options
author | Olivier Thauvin <nanardon@mandriva.org> | 2004-11-25 14:28:02 +0000 |
---|---|---|
committer | Olivier Thauvin <nanardon@mandriva.org> | 2004-11-25 14:28:02 +0000 |
commit | cb4d4260f8cd9013672e4cf91d1a7fbd90486367 (patch) | |
tree | fd4597561083e61c0c47ceba25a5aef41b33ade1 /URPM/Resolve.pm | |
parent | 14d502eb16305a1133c5d0fea18b660018e063bb (diff) | |
download | perl-URPM-cb4d4260f8cd9013672e4cf91d1a7fbd90486367.tar perl-URPM-cb4d4260f8cd9013672e4cf91d1a7fbd90486367.tar.gz perl-URPM-cb4d4260f8cd9013672e4cf91d1a7fbd90486367.tar.bz2 perl-URPM-cb4d4260f8cd9013672e4cf91d1a7fbd90486367.tar.xz perl-URPM-cb4d4260f8cd9013672e4cf91d1a7fbd90486367.zip |
- allow to use an array of id instead (start .. end) in functions.
Diffstat (limited to 'URPM/Resolve.pm')
-rw-r--r-- | URPM/Resolve.pm | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/URPM/Resolve.pm b/URPM/Resolve.pm index 67e9f55..0077bad 100644 --- a/URPM/Resolve.pm +++ b/URPM/Resolve.pm @@ -1,5 +1,7 @@ package URPM; +# $Id$ + use strict; sub min { my $n = shift; $_ < $n and $n = $_ foreach @_; $n } @@ -980,10 +982,10 @@ sub request_packages_to_upgrade { my ($urpm, $db, $_state, $requested, %options) = @_; my (%provides, %names, %skip, %requested, %obsoletes, @obsoleters); + my @idlist = $urpm->build_listid($options{start}, $options{end}, $options{idlist}) or return; + #- build direct access to best package according to name. - foreach my $pkg (@{$urpm->{depslist}}) { - defined $options{start} && $pkg->id < $options{start} and next; - defined $options{end} && $pkg->id > $options{end} and next; + foreach my $pkg (@{$urpm->{depslist}}[@idlist]) { if ($pkg->is_arch_compat) { foreach ($pkg->provides) { @@ -1142,12 +1144,16 @@ sub build_transaction_set { #- clean transaction set. $state->{transaction} = []; + my %selected_id; + @selected_id{$urpm->build_listid($options{start}, $options{end}, $options{idlist})} = (); + 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) + ($urpm->has_dependence($state, $b, $a) && 2)] } - grep { (! defined $options{start} || $_ >= $options{start}) && - (! defined $options{end} || $_ <= $options{end}) } keys %{$state->{selected}}; + (keys(%selected_id) > 0 ? + (grep { exists($selected_id{$_}) } keys %{$state->{selected}}) : + keys %{$state->{selected}}); #- second step consists of re-applying resolve_requested in the same #- order computed in first step and to update a list of package to |