summaryrefslogtreecommitdiffstats
path: root/urpm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-07-08 17:59:25 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-07-08 17:59:25 +0000
commitec49bc330577f2b7535ad658ab0608ecace5a9a2 (patch)
treed8e13b167269a5f89873ee5fe903b46112a0fddb /urpm
parentc5dead167a9b7a2ab4e4e226283a379074e8a238 (diff)
downloadurpmi-ec49bc330577f2b7535ad658ab0608ecace5a9a2.tar
urpmi-ec49bc330577f2b7535ad658ab0608ecace5a9a2.tar.gz
urpmi-ec49bc330577f2b7535ad658ab0608ecace5a9a2.tar.bz2
urpmi-ec49bc330577f2b7535ad658ab0608ecace5a9a2.tar.xz
urpmi-ec49bc330577f2b7535ad658ab0608ecace5a9a2.zip
urpm::install::prepare_transaction() now returns the computed values instead of
modifying the parameters
Diffstat (limited to 'urpm')
-rw-r--r--urpm/install.pm14
-rw-r--r--urpm/main_loop.pm8
2 files changed, 9 insertions, 13 deletions
diff --git a/urpm/install.pm b/urpm/install.pm
index bebcdd09..db15ae09 100644
--- a/urpm/install.pm
+++ b/urpm/install.pm
@@ -26,16 +26,14 @@ sub _hash_intersect_list {
\%h;
}
-#- prepare transaction.
sub prepare_transaction {
- my ($_urpm, $set, $list, $sources, $transaction_list, $transaction_sources) = @_;
+ my ($_urpm, $set, $list, $sources) = @_;
- foreach (0..$#$list) {
- $transaction_list->[$_] = _hash_intersect_list($list->[$_], $set->{upgrade});
- }
- foreach my $id (@{$set->{upgrade}}) {
- exists $sources->{$id} and $transaction_sources->{$id} = $sources->{$id};
- }
+ my @transaction_list = map {
+ _hash_intersect_list($_, $set->{upgrade});
+ } @$list;
+
+ \@transaction_list, _hash_intersect_list($sources, $set->{upgrade});
}
sub build_transaction_set_ {
diff --git a/urpm/main_loop.pm b/urpm/main_loop.pm
index 6f0d702f..790cdffd 100644
--- a/urpm/main_loop.pm
+++ b/urpm/main_loop.pm
@@ -83,19 +83,17 @@ my @errors;
my $exit_code = 0;
foreach my $set (@{$state->{transaction} || []}) {
- my $transaction_sources = {};
- my @transaction_list;
#- put a blank line to separate with previous transaction or user question.
print "\n" if $options{verbose} >= 0;
- #- prepare transaction...
- urpm::install::prepare_transaction($urpm, $set, $list, \%sources, \@transaction_list, $transaction_sources);
+ my ($transaction_list, $transaction_sources) =
+ urpm::install::prepare_transaction($urpm, $set, $list, \%sources);
#- first, filter out what is really needed to download for this small transaction.
my @error_sources;
urpm::get_pkgs::download_packages_of_distant_media($urpm,
- \@transaction_list,
+ $transaction_list,
$transaction_sources,
\@error_sources,
quiet => $options{verbose} < 0,