diff options
-rw-r--r-- | urpm/install.pm | 13 |
1 files changed, 10 insertions, 3 deletions
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}; |