summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-09-03 13:31:37 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-09-03 13:31:37 +0000
commit94cfc57850981b85f9fc027621a3439e9d36eb9b (patch)
tree47c2b83cc6f5968824537933de69ac3c6a768cce
parent20e09e364291f0b52f751c736282a790aad7442c (diff)
downloadurpmi-94cfc57850981b85f9fc027621a3439e9d36eb9b.tar
urpmi-94cfc57850981b85f9fc027621a3439e9d36eb9b.tar.gz
urpmi-94cfc57850981b85f9fc027621a3439e9d36eb9b.tar.bz2
urpmi-94cfc57850981b85f9fc027621a3439e9d36eb9b.tar.xz
urpmi-94cfc57850981b85f9fc027621a3439e9d36eb9b.zip
create urpm::download::sync_url() and use it
-rw-r--r--urpm.pm2
-rw-r--r--urpm/download.pm8
-rw-r--r--urpm/media.pm4
3 files changed, 10 insertions, 4 deletions
diff --git a/urpm.pm b/urpm.pm
index 34745d7a..5eacb51a 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -280,7 +280,7 @@ sub register_rpms {
my $basename = basename($_);
unlink "$urpm->{cachedir}/partial/$basename";
$urpm->{log}(N("retrieving rpm file [%s] ...", $_));
- if (urpm::download::sync($urpm, undef, [$_], quiet => 1)) {
+ if (urpm::download::sync_url($urpm, $_, quiet => 1)) {
$urpm->{log}(N("...retrieving done"));
$_ = "$urpm->{cachedir}/partial/$basename";
} else {
diff --git a/urpm/download.pm b/urpm/download.pm
index 244d6d72..c36cf62a 100644
--- a/urpm/download.pm
+++ b/urpm/download.pm
@@ -769,6 +769,12 @@ sub sync_rel {
sync($urpm, $medium, \@files, %options);
}
+sub sync_url {
+ my ($urpm, $url, %options) = @_;
+
+ sync($urpm, undef, [$url], %options);
+}
+
#- $medium can be undef
#- known options: quiet, resume, callback
sub sync {
@@ -801,7 +807,7 @@ sub get_content {
my $file = "$urpm->{cachedir}/partial/" . basename($url);
unlink $file; # prevent "partial file" errors
- urpm::download::sync($urpm, undef, [ $url ], quiet => 1) or return;
+ sync_url($urpm, $url, quiet => 1) or return;
my @l = cat_($file);
unlink $file;
diff --git a/urpm/media.pm b/urpm/media.pm
index 269626fc..ca7e8c4b 100644
--- a/urpm/media.pm
+++ b/urpm/media.pm
@@ -906,8 +906,8 @@ sub _new_distribconf_and_download {
$distribconf->settree('mandriva');
$urpm->{log}(N("retrieving media.cfg file..."));
- urpm::download::sync($urpm, undef,
- [ reduce_pathname($distribconf->getfullpath(undef, 'infodir') . '/media.cfg') ],
+ urpm::download::sync_url($urpm,
+ reduce_pathname($distribconf->getfullpath(undef, 'infodir') . '/media.cfg'),
quiet => 1) or return;
$distribconf;
}