From c5dead167a9b7a2ab4e4e226283a379074e8a238 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 8 Jul 2008 17:55:46 +0000 Subject: create _hash_intersect_list() and use it --- urpm/install.pm | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'urpm') diff --git a/urpm/install.pm b/urpm/install.pm index ca28e894..bebcdd09 100644 --- a/urpm/install.pm +++ b/urpm/install.pm @@ -17,14 +17,21 @@ eval { }; +sub _hash_intersect_list { + my ($h, $l) = @_; + my %h; + foreach (@$l) { + exists $h->{$_} and $h{$_} = $h->{$_}; + } + \%h; +} + #- prepare transaction. sub prepare_transaction { my ($_urpm, $set, $list, $sources, $transaction_list, $transaction_sources) = @_; foreach (0..$#$list) { - foreach my $id (@{$set->{upgrade}}) { - exists $list->[$_]{$id} and $transaction_list->[$_]{$id} = $list->[$_]{$id}; - } + $transaction_list->[$_] = _hash_intersect_list($list->[$_], $set->{upgrade}); } foreach my $id (@{$set->{upgrade}}) { exists $sources->{$id} and $transaction_sources->{$id} = $sources->{$id}; -- cgit v1.2.1