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 | |
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')
-rw-r--r-- | URPM/Build.pm | 8 | ||||
-rw-r--r-- | URPM/Resolve.pm | 16 |
2 files changed, 16 insertions, 8 deletions
diff --git a/URPM/Build.pm b/URPM/Build.pm index 0dd97ba..40eb49a 100644 --- a/URPM/Build.pm +++ b/URPM/Build.pm @@ -1,5 +1,7 @@ package URPM; +# $Id$ + use strict; sub _get_tmp_dir () { @@ -444,9 +446,7 @@ sub build_synthesis { my ($urpm, %options) = @_; my ($ratio, @idlist); - @idlist = @{$options{idlist} || []} > 0 ? @{$options{idlist}} : - ($options{start} || 0 .. $options{end} || $#{$urpm->{depslist}}); - @idlist or return; + @idlist = $urpm->build_listid($options{start}, $options{end}, $options{idlist}) or return; $ratio = $options{ratio} || 9; $options{synthesis} || defined $options{fd} or die "invalid parameters given"; @@ -485,6 +485,8 @@ sub build_synthesis { sub build_base_files { my ($urpm, %options) = @_; + my @idlist = $urpm->build_listid($options{start}, $options{end}, $options{idlist}) or return; + if ($options{depslist}) { open my $fh, ">$options{depslist}"; foreach (0 .. $#{$urpm->{depslist}}) { 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 |