summaryrefslogtreecommitdiffstats
path: root/urpm/download.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-10-21 16:22:38 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-10-21 16:22:38 +0000
commite1b77dc67dc7c350c5d3e6acd451785a9c78f340 (patch)
tree017302f0d6301141e1fd3771ba072a695ba2b011 /urpm/download.pm
parent01508b09ee68c55499c1b1a5ea658bb03204b96c (diff)
downloadurpmi-e1b77dc67dc7c350c5d3e6acd451785a9c78f340.tar
urpmi-e1b77dc67dc7c350c5d3e6acd451785a9c78f340.tar.gz
urpmi-e1b77dc67dc7c350c5d3e6acd451785a9c78f340.tar.bz2
urpmi-e1b77dc67dc7c350c5d3e6acd451785a9c78f340.tar.xz
urpmi-e1b77dc67dc7c350c5d3e6acd451785a9c78f340.zip
- urpmi, gurpmi
o allow "retry" on aria2 download failure
Diffstat (limited to 'urpm/download.pm')
-rw-r--r--urpm/download.pm15
1 files changed, 12 insertions, 3 deletions
diff --git a/urpm/download.pm b/urpm/download.pm
index c7de59db..d7387645 100644
--- a/urpm/download.pm
+++ b/urpm/download.pm
@@ -685,7 +685,15 @@ sub sync_aria2 {
_parse_aria2_output($options, $aria2, $aria2_pid, $medium, $rel_files);
chdir $cwd;
- close $aria2 or _error('aria2');
+ if (!close $aria2) {
+ my $raw_msg = _error_msg('aria2');
+ my $msg = N("Failed to download %s", $rel_files->[0]);
+ if ($options->{ask_retry} && $options->{ask_retry}($raw_msg, $msg)) {
+ $options->{is_retry} = 1;
+ goto &sync_aria2;
+ }
+ die $raw_msg;
+ }
}
sub _parse_aria2_output {
@@ -704,7 +712,8 @@ sub _parse_aria2_output {
$file = $medium->{mirrorlist} ?
$medium->{mirrorlist} . ': ' . $medium->{'with-dir'} . "/$rel_files->[0]" :
"$medium->{url}/$rel_files->[0]";
- propagate_sync_callback($options, 'start', $file);
+ propagate_sync_callback($options, 'start', $file)
+ if !delete $options->{is_retry};
}
if ($buf =~ m!^\[#\d*\s+\S+:([\d\.]+\w*).([\d\.]+\w*)\S([\d]+)\S+\s+\S+\s*([\d\.]+)\s\w*:([\d\.]+\w*/\w)\s\w*:(\d+\w*)\]$!) {
my ($total, $percent, $speed, $eta) = ($2, $3, $5, $6);
@@ -882,7 +891,7 @@ sub sync_rel_to {
#- deprecated, use sync_url() or sync_rel() instead
#-
#- $medium can be undef
-#- known options: quiet, resume, callback
+#- known options: quiet, resume, callback, ask_retry
sub sync {
my ($urpm, $medium, $files, %options) = @_;