summaryrefslogtreecommitdiffstats
path: root/urpm/get_pkgs.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-07-08 18:15:28 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-07-08 18:15:28 +0000
commitfa84fb2c2a75f89763fbebc992e5a5317c2a4977 (patch)
treee4535cd8f32a5941165fabaf9ddf4dd4fdc21299 /urpm/get_pkgs.pm
parent646de7067306de16958f9248b4f01ca730ca5c52 (diff)
downloadurpmi-fa84fb2c2a75f89763fbebc992e5a5317c2a4977.tar
urpmi-fa84fb2c2a75f89763fbebc992e5a5317c2a4977.tar.gz
urpmi-fa84fb2c2a75f89763fbebc992e5a5317c2a4977.tar.bz2
urpmi-fa84fb2c2a75f89763fbebc992e5a5317c2a4977.tar.xz
urpmi-fa84fb2c2a75f89763fbebc992e5a5317c2a4977.zip
create _download_packages_of_distant_media() out of download_packages_of_distant_media()
Diffstat (limited to 'urpm/get_pkgs.pm')
-rw-r--r--urpm/get_pkgs.pm38
1 files changed, 23 insertions, 15 deletions
diff --git a/urpm/get_pkgs.pm b/urpm/get_pkgs.pm
index 7be7f33b..7e768ee4 100644
--- a/urpm/get_pkgs.pm
+++ b/urpm/get_pkgs.pm
@@ -195,8 +195,27 @@ sub download_packages_of_distant_media {
}
}
- my $cachedir = $urpm->{cachedir};
- if (%distant_sources && ! -w "$cachedir/partial") {
+ if (%distant_sources) {
+ _download_packages_of_distant_media($urpm, $sources, \%errors, $blist, \%distant_sources, %options);
+ }
+ }
+
+ #- clean failed download which have succeeded.
+ delete @errors{keys %$sources};
+
+ push @$error_sources, values %errors;
+
+ 1;
+}
+
+
+sub _download_packages_of_distant_media {
+ my ($urpm, $sources, $errors, $blist, $distant_sources, %options) = @_;
+
+ my %distant_sources = %$distant_sources;
+
+ my $cachedir = $urpm->{cachedir};
+ if (! -w "$cachedir/partial") {
if (my $userdir = urpm::userdir($urpm)) {
$cachedir = $userdir;
mkdir "$cachedir/partial";
@@ -206,8 +225,6 @@ sub download_packages_of_distant_media {
}
}
- #- download files from the current medium.
- if (%distant_sources) {
$urpm->{log}(N("retrieving rpm files from medium \"%s\"...", $blist->{media}{name}));
if (urpm::download::sync($urpm, $blist->{media}, [ values %distant_sources ],
dir => "$cachedir/partial", quiet => $options{quiet},
@@ -226,21 +243,12 @@ sub download_packages_of_distant_media {
if (my $rpm = verify_partial_rpm_and_move($urpm, $cachedir, $filename)) {
$sources->{$i} = $rpm;
} else {
- $errors{$i} = [ $distant_sources{$i}, 'bad' ];
+ $errors->{$i} = [ $distant_sources{$i}, 'bad' ];
}
} else {
- $errors{$i} = [ $distant_sources{$i}, 'missing' ];
+ $errors->{$i} = [ $distant_sources{$i}, 'missing' ];
}
}
- }
- }
-
- #- clean failed download which have succeeded.
- delete @errors{keys %$sources};
-
- push @$error_sources, values %errors;
-
- 1;
}
1;