diff options
author | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2005-03-10 14:29:10 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2005-03-10 14:29:10 +0000 |
commit | 4f1973e21f577f0e908d722421f2c61135ab9704 (patch) | |
tree | 50965216473b349aff50d73b060ab96bb94a22e4 | |
parent | 42e551c708aed332e1e76a5de7cccdb7362b3c58 (diff) | |
download | urpmi-4f1973e21f577f0e908d722421f2c61135ab9704.tar urpmi-4f1973e21f577f0e908d722421f2c61135ab9704.tar.gz urpmi-4f1973e21f577f0e908d722421f2c61135ab9704.tar.bz2 urpmi-4f1973e21f577f0e908d722421f2c61135ab9704.tar.xz urpmi-4f1973e21f577f0e908d722421f2c61135ab9704.zip |
Add a retry option to urpmi and urpmi.cfg (bug #1174)
-rw-r--r-- | man/C/urpmi.8 | 2 | ||||
-rw-r--r-- | man/C/urpmi.cfg.5 | 5 | ||||
-rw-r--r-- | urpm.pm | 19 | ||||
-rw-r--r-- | urpm/args.pm | 1 | ||||
-rw-r--r-- | urpm/cfg.pm | 1 | ||||
-rw-r--r-- | urpm/download.pm | 3 |
6 files changed, 30 insertions, 1 deletions
diff --git a/man/C/urpmi.8 b/man/C/urpmi.8 index d50d5afc..bfda8390 100644 --- a/man/C/urpmi.8 +++ b/man/C/urpmi.8 @@ -123,6 +123,8 @@ Try to limit the download speed, \fIrate\fP is given in bytes/sec. This option i not active by default. .IP "\fB\--resume\fP" Resume transfer of partially-downloaded files. +.IP "\fB\--retry\fP \fItimes\fP" +Retries to download files over FTP or HTTP the specified number of times. .IP "\fB\--proxy\fP \fIproxyhost[:port|1080]\fP" Use specified HTTP proxy. .IP "\fB\--proxy-user\fP \fIuser:password\fP" diff --git a/man/C/urpmi.cfg.5 b/man/C/urpmi.cfg.5 index 34825da1..d656bd68 100644 --- a/man/C/urpmi.cfg.5 +++ b/man/C/urpmi.cfg.5 @@ -100,6 +100,11 @@ transaction). Setting this value to 0 disable the split of transaction. .B downloader Specify which download program to use: \fBwget\fP or \fBcurl\fP. +.TP +.B retry +Specify how many times the downloader should retry in case of non-permanent +errors. + .SS Medium description A medium is described as follows : @@ -149,6 +149,7 @@ sub read_config { pre-clean priority-upgrade resume + retry split-length split-level verify-rpm @@ -757,6 +758,7 @@ sub add_distrib_media { quiet => 1, limit_rate => $options{limit_rate}, compress => $options{compress}, + retry => $urpm->{options}{retry}, proxy => get_proxy(), }, reduce_pathname("$url/$distrib_root/hdlists"), @@ -1373,6 +1375,7 @@ this could happen if you mounted manually the directory when creating the medium compress => $options{compress}, proxy => get_proxy($medium->{name}), media => $medium->{name}, + retry => $urpm->{options}{retry}, }, reduce_pathname("$medium->{url}/reconfig.urpmi"), ); @@ -1396,6 +1399,7 @@ this could happen if you mounted manually the directory when creating the medium limit_rate => $options{limit_rate}, compress => $options{compress}, proxy => get_proxy($medium->{name}), + retry => $urpm->{options}{retry}, media => $medium->{name}, }; eval { $urpm->{sync}($syncopts, reduce_pathname("$medium->{url}/media_info/descriptions")) }; @@ -1428,6 +1432,7 @@ this could happen if you mounted manually the directory when creating the medium compress => $options{compress}, proxy => get_proxy($medium->{name}), media => $medium->{name}, + retry => $urpm->{options}{retry}, }, reduce_pathname("$medium->{url}/$medium->{with_hdlist}/../MD5SUM"), ); @@ -1510,6 +1515,7 @@ this could happen if you mounted manually the directory when creating the medium callback => $options{callback}, proxy => get_proxy($medium->{name}), media => $medium->{name}, + retry => $urpm->{options}{retry}, }, reduce_pathname("$medium->{url}/$with_hdlist"), ); @@ -1553,6 +1559,7 @@ this could happen if you mounted manually the directory when creating the medium callback => $options{callback}, proxy => get_proxy($medium->{name}), media => $medium->{name}, + retry => $urpm->{options}{retry}, }, reduce_pathname("$medium->{url}/$medium->{with_hdlist}"), ); @@ -1620,6 +1627,7 @@ this could happen if you mounted manually the directory when creating the medium compress => $options{compress}, proxy => get_proxy($medium->{name}), media => $medium->{name}, + retry => $urpm->{options}{retry}, }, $_ ); @@ -1648,6 +1656,7 @@ this could happen if you mounted manually the directory when creating the medium compress => $options{compress}, proxy => get_proxy($medium->{name}), media => $medium->{name}, + retry => $urpm->{options}{retry}, }, $_, ); @@ -2054,7 +2063,14 @@ sub register_rpms { unlink "$urpm->{cachedir}/partial/$basename"; eval { $urpm->{log}(N("retrieving rpm file [%s] ...", $_)); - $urpm->{sync}({ dir => "$urpm->{cachedir}/partial", quiet => 1, proxy => get_proxy() }, $_); + $urpm->{sync}( + { + dir => "$urpm->{cachedir}/partial", + quiet => 1, + proxy => get_proxy(), + }, + $_, + ); $urpm->{log}(N("...retrieving done")); $_ = "$urpm->{cachedir}/partial/$basename"; }; @@ -2749,6 +2765,7 @@ sub download_packages_of_distant_media { callback => $options{callback}, proxy => get_proxy($urpm->{media}[$_]{name}), media => $urpm->{media}[$_]{name}, + retry => $urpm->{options}{retry}, }, values %distant_sources, ); diff --git a/urpm/args.pm b/urpm/args.pm index bc90e660..84c62cfe 100644 --- a/urpm/args.pm +++ b/urpm/args.pm @@ -85,6 +85,7 @@ my %options_spec = ( curl => sub { $urpm->{options}{downloader} = 'curl' }, 'limit-rate=s' => sub { $urpm->{options}{'limit-rate'} = $_[1] }, 'resume!' => sub { $urpm->{options}{resume} = $_[1] }, + 'retry=s' => sub { $urpm->{options}{retry} = $_[1] }, 'proxy=s' => sub { my (undef, $value) = @_; my ($proxy, $port) = $value =~ m,^(?:http://)?([^:/]+(:\d+)?)/*$, diff --git a/urpm/cfg.pm b/urpm/cfg.pm index 7fad1eed..bf3baea8 100644 --- a/urpm/cfg.pm +++ b/urpm/cfg.pm @@ -148,6 +148,7 @@ sub load_config ($;$) { |split-(?:level|length) |priority-upgrade |downloader + |retry )\s*:\s*['"]?(.*?)['"]?$/x and $config{$medium}{$1} = $2, next; /^key[-_]ids\s*:\s*['"]?(.*?)['"]?$/ diff --git a/urpm/download.pm b/urpm/download.pm index bcbc9105..3ce9ffde 100644 --- a/urpm/download.pm +++ b/urpm/download.pm @@ -192,6 +192,7 @@ sub sync_wget { ($options->{limit_rate} ? "--limit-rate=$options->{limit_rate}" : ()), ($options->{resume} ? "--continue" : ()), ($options->{proxy} ? set_proxy({ type => "wget", proxy => $options->{proxy} }) : ()), + ($options->{retry} ? ('-t', $options->{retry}) : ()), ($options->{callback} ? ("--progress=bar:force", "-o", "-") : $options->{quiet} ? "-q" : @{[]}), "--retr-symlinks", @@ -266,6 +267,7 @@ sub sync_curl { open my $curl, join(" ", map { "'$_'" } "/usr/bin/curl", ($options->{limit_rate} ? ("--limit-rate", $options->{limit_rate}) : ()), ($options->{proxy} ? set_proxy({ type => "curl", proxy => $options->{proxy} }) : ()), + ($options->{retry} ? ('--retry', $options->{retry}) : ()), "--stderr", "-", # redirect everything to stdout "--disable-epsv", "--connect-timeout", $CONNECT_TIMEOUT, @@ -323,6 +325,7 @@ sub sync_curl { ($options->{limit_rate} ? ("--limit-rate", $options->{limit_rate}) : ()), ($options->{resume} ? ("--continue-at", "-") : ()), ($options->{proxy} ? set_proxy({ type => "curl", proxy => $options->{proxy} }) : ()), + ($options->{retry} ? ('--retry', $options->{retry}) : ()), ($options->{quiet} && !$options->{verbose} ? "-s" : @{[]}), "-k", $location_trusted ? "--location-trusted" : @{[]}, |