summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-07-08 17:55:46 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-07-08 17:55:46 +0000
commitc5dead167a9b7a2ab4e4e226283a379074e8a238 (patch)
treece6ded3ef4aecc84f4e83ad4338e183ec40b21d6
parentdcacfc8d3c498345dad04ae090ac1cc29bf94dc5 (diff)
downloadurpmi-c5dead167a9b7a2ab4e4e226283a379074e8a238.tar
urpmi-c5dead167a9b7a2ab4e4e226283a379074e8a238.tar.gz
urpmi-c5dead167a9b7a2ab4e4e226283a379074e8a238.tar.bz2
urpmi-c5dead167a9b7a2ab4e4e226283a379074e8a238.tar.xz
urpmi-c5dead167a9b7a2ab4e4e226283a379074e8a238.zip
create _hash_intersect_list() and use it
-rw-r--r--urpm/install.pm13
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};