summaryrefslogtreecommitdiffstats
path: root/urpm/main_loop.pm
diff options
context:
space:
mode:
authorMichael Scherer <misc@mandriva.org>2010-01-22 01:35:42 +0000
committerMichael Scherer <misc@mandriva.org>2010-01-22 01:35:42 +0000
commit5aaa7fd06f6cebde9ce82dc8115d3c129dfbe157 (patch)
tree3433d4c729ffeb1c6f17b869dc04d8e63e4d2711 /urpm/main_loop.pm
parent04c8159aaedaa6f54a391f9572655e9b6329d5d3 (diff)
downloadurpmi-5aaa7fd06f6cebde9ce82dc8115d3c129dfbe157.tar
urpmi-5aaa7fd06f6cebde9ce82dc8115d3c129dfbe157.tar.gz
urpmi-5aaa7fd06f6cebde9ce82dc8115d3c129dfbe157.tar.bz2
urpmi-5aaa7fd06f6cebde9ce82dc8115d3c129dfbe157.tar.xz
urpmi-5aaa7fd06f6cebde9ce82dc8115d3c129dfbe157.zip
- use a anonymous subroutine, so perl will rebind variables declared outside of the subroutine.
This bug prevent rpmdrake from installing two set of packages ( bug #54842 )
Diffstat (limited to 'urpm/main_loop.pm')
-rw-r--r--urpm/main_loop.pm10
1 files changed, 6 insertions, 4 deletions
diff --git a/urpm/main_loop.pm b/urpm/main_loop.pm
index 70aecfe2..d3b908df 100644
--- a/urpm/main_loop.pm
+++ b/urpm/main_loop.pm
@@ -60,7 +60,9 @@ urpm::cdrom::copy_packages_of_removable_media($urpm,
$callbacks->{copy_removable});
$callbacks->{post_removable} and $callbacks->{post_removable}->();
-sub download_packages {
+# use a anonymous subroutine, as it force perl to rebind external variables, like
+# $callbacks and $urpm, as showed by warnings.pm. Fix #54842
+my $download_packages = sub {
my ($blists, $sources) = @_;
my @error_sources;
urpm::get_pkgs::download_packages_of_distant_media($urpm,
@@ -96,7 +98,7 @@ sub download_packages {
}
(\@error_sources, \@msgs);
-}
+};
if (exists $urpm->{options}{'download-all'}) {
if ($urpm->{options}{'download-all'}) {
@@ -118,7 +120,7 @@ if (exists $urpm->{options}{'download-all'}) {
foreach my $blist (@$blists) {
foreach my $pkg (keys %{$blist->{pkgs}}) {
my $blist_one = [{ pkgs => { $pkg => $blist->{pkgs}{$pkg} }, medium => $blist->{medium} }];
- my ($error_sources) = download_packages($blist_one, \%sources);
+ my ($error_sources) = &$download_packages($blist_one, \%sources);
if (@$error_sources) {
return 10;
}
@@ -159,7 +161,7 @@ foreach my $set (@{$state->{transaction} || []}) {
urpm::install::prepare_transaction($urpm, $set, $blists, \%sources);
#- first, filter out what is really needed to download for this small transaction.
- my ($error_sources, $msgs) = download_packages($transaction_blists, $transaction_sources);
+ my ($error_sources, $msgs) = &$download_packages($transaction_blists, $transaction_sources);
if (@$error_sources) {
$nok++;
my $go_on;