diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2008-09-22 15:10:33 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2008-09-22 15:10:33 +0000 |
commit | 24aa6a3f929b169380d26b49a8987a91ffdfbdd7 (patch) | |
tree | 9155817d72b18eed5bccf2faa5aeeca47c2747f7 /urpm/media.pm | |
parent | 04e33808f89abcccba8556b6058c526626c26e22 (diff) | |
download | urpmi-24aa6a3f929b169380d26b49a8987a91ffdfbdd7.tar urpmi-24aa6a3f929b169380d26b49a8987a91ffdfbdd7.tar.gz urpmi-24aa6a3f929b169380d26b49a8987a91ffdfbdd7.tar.bz2 urpmi-24aa6a3f929b169380d26b49a8987a91ffdfbdd7.tar.xz urpmi-24aa6a3f929b169380d26b49a8987a91ffdfbdd7.zip |
create urpm::mirrors::try_probe() as a alternative solution to
urpm::mirrors::try() which ensure wrong path given by the user doesn't lead to
mirrors being all blacklisted
Diffstat (limited to 'urpm/media.pm')
-rw-r--r-- | urpm/media.pm | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/urpm/media.pm b/urpm/media.pm index 3149f92c..6e6272cb 100644 --- a/urpm/media.pm +++ b/urpm/media.pm @@ -753,7 +753,7 @@ sub add_medium { $medium->{media_info_dir} ||= 'media_info'; # this is a little ugly since MD5SUM will be downloaded again later, but it's small enough... - _download_MD5SUM_and_check($urpm, $medium) or return; + _download_MD5SUM_and_check($urpm, $medium, 'probe') or return; } if ($with_synthesis) { @@ -823,7 +823,7 @@ sub add_distrib_media { my $m = { mirrorlist => $options{mirrorlist}, url => $url }; my $parse_ok; - try__maybe_mirrorlist($urpm, $m, sub { + try__maybe_mirrorlist($urpm, $m, 'probe', sub { $distribconf = _new_distribconf_and_download($urpm, $m); $parse_ok = $distribconf && $distribconf->parse_mediacfg("$urpm->{cachedir}/partial/media.cfg"); $parse_ok; @@ -1274,9 +1274,9 @@ sub get_synthesis__local { } } sub get_synthesis__remote { - my ($urpm, $medium, $callback, $quiet) = @_; + my ($urpm, $medium, $callback, $quiet, $is_a_probe) = @_; - my $ok = try__maybe_mirrorlist($urpm, $medium, sub { + my $ok = try__maybe_mirrorlist($urpm, $medium, $is_a_probe, sub { urpm::download::sync_rel($urpm, $medium, [ _url_with_synthesis_rel($medium) ], quiet => $quiet, callback => $callback) && _check_synthesis(cachedir_with_synthesis($urpm, $medium)); @@ -1416,11 +1416,11 @@ sub _download_MD5SUM { } sub _download_MD5SUM_and_check { - my ($urpm, $medium) = @_; + my ($urpm, $medium, $is_a_probe) = @_; my ($err, $cachedir_MD5SUM); require urpm::mirrors; - try__maybe_mirrorlist($urpm, $medium, sub { + try__maybe_mirrorlist($urpm, $medium, $is_a_probe, sub { $cachedir_MD5SUM = _download_MD5SUM($urpm, $medium) or $err = $@; $cachedir_MD5SUM && urpm::md5sum::check_file($cachedir_MD5SUM); }) and return $cachedir_MD5SUM; @@ -1429,6 +1429,7 @@ sub _download_MD5SUM_and_check { $urpm->{error}(N("invalid MD5SUM file (downloaded from %s)", _synthesis_dir($medium))); } else { $urpm->{error}(N("...retrieving failed: %s", $err)); + $is_a_probe and $urpm->{error}(N("no metadata found for medium \"%s\"", $medium->{name})); } undef; } @@ -1447,7 +1448,7 @@ sub _update_medium__parse_if_unmodified__remote { #- file is present. if (!$options->{nomd5sum}) { - my $new_MD5SUM = _download_MD5SUM_and_check($urpm, $medium) or return; + my $new_MD5SUM = _download_MD5SUM_and_check($urpm, $medium, '') or return; if ($options->{force} < 2 && _is_statedir_MD5SUM_uptodate($urpm, $medium, $new_MD5SUM)) { _medium_is_up_to_date($urpm, $medium); return 'unmodified'; @@ -1501,7 +1502,7 @@ sub _update_medium__parse_if_unmodified__remote { ) or $error->(N("...copying failed")), return; } } - $ok = get_synthesis__remote($urpm, $medium, $options->{callback}, $options->{quiet}); + $ok = get_synthesis__remote($urpm, $medium, $options->{callback}, $options->{quiet}, ''); } $ok &&= check_synthesis_md5sum($urpm, $medium) if !$options->{force} && !$options->{nomd5sum}; @@ -1794,7 +1795,7 @@ sub _pick_mirror_if_needed { #- side-effects: #- + those of urpm::mirrors::try ($urpm->{mirrors_cache}, $medium->{url}) sub try__maybe_mirrorlist { - my ($urpm, $medium, $try) = @_; + my ($urpm, $medium, $is_a_probe, $try) = @_; if ($medium->{mirrorlist}) { $medium->{allow_metalink} //= urpm::download::use_metalink($urpm, $medium); @@ -1805,7 +1806,9 @@ sub try__maybe_mirrorlist { $try->(); } else { require urpm::mirrors; - urpm::mirrors::try($urpm, $medium, $try); + $is_a_probe + ? urpm::mirrors::try_probe($urpm, $medium, $try) + : urpm::mirrors::try($urpm, $medium, $try); } } else { $try->(); |