From b899cb44370cd85a650fb00975b67e7b825d6073 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 8 Jul 2008 19:37:43 +0000 Subject: migrate _download_packages_of_distant_media() to use blist->{pkgs} instead of blist->{list} --- urpm/get_pkgs.pm | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'urpm/get_pkgs.pm') diff --git a/urpm/get_pkgs.pm b/urpm/get_pkgs.pm index 682fe20d..726b244f 100644 --- a/urpm/get_pkgs.pm +++ b/urpm/get_pkgs.pm @@ -176,7 +176,7 @@ sub download_packages_of_distant_media { #- get back all ftp and http accessible rpm files into the local cache foreach my $blist (@$blists) { - my %blist_distant = (%$blist, list => {}); + my %blist_distant = (%$blist, pkgs => {}); #- examine all files to know what can be indexed on multiple media. while (my ($id, $url) = each %{$blist->{list}}) { @@ -190,13 +190,13 @@ sub download_packages_of_distant_media { $errors{$id} = [ $local_file, 'missing' ]; } } elsif ($url =~ m!^([^:]*):/(.*/([^/]*\.rpm))\Z!) { - $blist_distant{list}{$id} = "$1:/$2"; #- will download now + $blist_distant{pkgs}{$id} = $blist->{pkgs}{$id}; } else { $urpm->{error}(N("malformed URL: [%s]", $url)); } } - if (%{$blist_distant{list}}) { + if (%{$blist_distant{pkgs}}) { _download_packages_of_distant_media($urpm, $sources, \%errors, \%blist_distant, %options); } } @@ -225,7 +225,7 @@ sub _download_packages_of_distant_media { } $urpm->{log}(N("retrieving rpm files from medium \"%s\"...", $blist->{media}{name})); - if (urpm::download::sync($urpm, $blist->{media}, [ values %{$blist->{list}} ], + if (urpm::download::sync($urpm, $blist->{media}, [ urpm::blist_to_urls($blist) ], dir => "$cachedir/partial", quiet => $options{quiet}, resume => $urpm->{options}{resume}, callback => $options{callback})) { $urpm->{log}(N("...retrieving done")); @@ -237,9 +237,10 @@ sub _download_packages_of_distant_media { #- there have been problems downloading them at least once, this #- is necessary to keep track of failing downloads in order to #- present the error to the user. - foreach my $id (keys %{$blist->{list}}) { - my $url = $blist->{list}{$id}; - my ($filename) = $url =~ m|/([^/]*\.rpm)$|; + foreach my $id (keys %{$blist->{pkgs}}) { + my $pkg = $blist->{pkgs}{$id}; + my $filename = $pkg->filename; + my $url = urpm::blist_pkg_to_url($blist, $pkg); if ($filename && -s "$cachedir/partial/$filename") { if (my $rpm = verify_partial_rpm_and_move($urpm, $cachedir, $filename)) { $sources->{$id} = $rpm; -- cgit v1.2.1