summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@mandriva.com>2010-05-11 13:17:27 +0000
committerChristophe Fergeau <cfergeau@mandriva.com>2010-05-11 13:17:27 +0000
commit4e406249fe1d8226250af2b338d55e0c5f6c7dbb (patch)
tree5159ee7a8de274f32b7eff9377722672b6403487
parent0fd505bb964ae8c7a1f75548628c85fcf1ad0405 (diff)
downloadurpmi-4e406249fe1d8226250af2b338d55e0c5f6c7dbb.tar
urpmi-4e406249fe1d8226250af2b338d55e0c5f6c7dbb.tar.gz
urpmi-4e406249fe1d8226250af2b338d55e0c5f6c7dbb.tar.bz2
urpmi-4e406249fe1d8226250af2b338d55e0c5f6c7dbb.tar.xz
urpmi-4e406249fe1d8226250af2b338d55e0c5f6c7dbb.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 )
-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 4b558b14..4b0604ea 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;