summaryrefslogtreecommitdiffstats
path: root/urpm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-07-08 18:23:23 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-07-08 18:23:23 +0000
commit938f1fedeb29abfdd39064bc47a29dcc1e3fd27d (patch)
tree36b679902ad54295f19deed29f46a7fe739ac9ac /urpm
parent71bc780c6c0f5ca856b26f869263b3dbc40ed1c8 (diff)
downloadurpmi-938f1fedeb29abfdd39064bc47a29dcc1e3fd27d.tar
urpmi-938f1fedeb29abfdd39064bc47a29dcc1e3fd27d.tar.gz
urpmi-938f1fedeb29abfdd39064bc47a29dcc1e3fd27d.tar.bz2
urpmi-938f1fedeb29abfdd39064bc47a29dcc1e3fd27d.tar.xz
urpmi-938f1fedeb29abfdd39064bc47a29dcc1e3fd27d.zip
pass a blist to _download_packages_of_distant_media()
Diffstat (limited to 'urpm')
-rw-r--r--urpm/get_pkgs.pm22
1 files changed, 10 insertions, 12 deletions
diff --git a/urpm/get_pkgs.pm b/urpm/get_pkgs.pm
index ecd28e8d..09a352bb 100644
--- a/urpm/get_pkgs.pm
+++ b/urpm/get_pkgs.pm
@@ -175,7 +175,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 %distant_sources;
+ my %blist_distant = (%$blist, list => {});
#- examine all files to know what can be indexed on multiple media.
while (my ($i, $url) = each %{$blist->{list}}) {
@@ -189,14 +189,14 @@ sub download_packages_of_distant_media {
$errors{$i} = [ $local_file, 'missing' ];
}
} elsif ($url =~ m!^([^:]*):/(.*/([^/]*\.rpm))\Z!) {
- $distant_sources{$i} = "$1:/$2"; #- will download now
+ $blist_distant{list}{$i} = "$1:/$2"; #- will download now
} else {
$urpm->{error}(N("malformed URL: [%s]", $url));
}
}
- if (%distant_sources) {
- _download_packages_of_distant_media($urpm, $sources, \%errors, $blist, \%distant_sources, %options);
+ if (%{$blist_distant{list}}) {
+ _download_packages_of_distant_media($urpm, $sources, \%errors, \%blist_distant, %options);
}
}
@@ -210,9 +210,7 @@ sub download_packages_of_distant_media {
sub _download_packages_of_distant_media {
- my ($urpm, $sources, $errors, $blist, $distant_sources, %options) = @_;
-
- my %distant_sources = %$distant_sources;
+ my ($urpm, $sources, $errors, $blist, %options) = @_;
my $cachedir = $urpm->{cachedir};
if (! -w "$cachedir/partial") {
@@ -226,7 +224,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 %distant_sources ],
+ if (urpm::download::sync($urpm, $blist->{media}, [ values %{$blist->{list}} ],
dir => "$cachedir/partial", quiet => $options{quiet},
resume => $urpm->{options}{resume}, callback => $options{callback})) {
$urpm->{log}(N("...retrieving done"));
@@ -238,16 +236,16 @@ 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 $i (keys %distant_sources) {
- my ($filename) = $distant_sources{$i} =~ m|/([^/]*\.rpm)$|;
+ foreach my $i (keys %{$blist->{list}}) {
+ my ($filename) = $blist->{list}{$i} =~ m|/([^/]*\.rpm)$|;
if ($filename && -s "$cachedir/partial/$filename") {
if (my $rpm = verify_partial_rpm_and_move($urpm, $cachedir, $filename)) {
$sources->{$i} = $rpm;
} else {
- $errors->{$i} = [ $distant_sources{$i}, 'bad' ];
+ $errors->{$i} = [ $blist->{list}{$i}, 'bad' ];
}
} else {
- $errors->{$i} = [ $distant_sources{$i}, 'missing' ];
+ $errors->{$i} = [ $blist->{list}{$i}, 'missing' ];
}
}
}