summaryrefslogtreecommitdiffstats
path: root/urpm
diff options
context:
space:
mode:
Diffstat (limited to 'urpm')
-rw-r--r--urpm/download.pm16
-rw-r--r--urpm/mirrors.pm2
2 files changed, 13 insertions, 5 deletions
diff --git a/urpm/download.pm b/urpm/download.pm
index 03b2eac0..bb6f6cd6 100644
--- a/urpm/download.pm
+++ b/urpm/download.pm
@@ -63,11 +63,11 @@ sub preferred_downloader {
my ($urpm, $medium, $use_metalink) = @_;
my @available = urpm::download::available_ftp_http_downloaders();
- my @metalink_downloaders;
+ my @metalink_downloaders = urpm::download::available_metalink_downloaders();
+ my $metalink_disabled = !$$use_metalink && $medium->{disable_metalink};
- if ($$use_metalink) {
+ if (($$use_metalink) && !$metalink_disabled) {
#- If metalink is used, only aria2 is available as other downloaders doesn't support metalink
- @metalink_downloaders = urpm::download::available_metalink_downloaders();
unshift @available, @metalink_downloaders;
}
@@ -82,6 +82,14 @@ sub preferred_downloader {
$urpm->{log}(N("%s is not available, falling back on %s", $requested_downloader, $preferred));
}
}
+ # in some cases, we may want not to use metalink (aria2) since it can
+ # cause issues, see #53434 for example
+ if ($metalink_disabled && member($preferred, @metalink_downloaders)) {
+ $urpm->{log}("not using $preferred since metalink has been disabled");
+ my @no_metalink = urpm::util::difference2(\@available, \@metalink_downloaders);
+ $preferred = $no_metalink[0];
+ }
+
if ($$use_metalink && !member($preferred, @metalink_downloaders)) {
$warned{not_using_metalink}++ or
$urpm->{log}($requested_downloader eq $preferred ?
@@ -896,7 +904,7 @@ sub sync_rel_one {
sub sync_url {
my ($urpm, $url, %options) = @_;
- sync_rel_one($urpm, { url => dirname($url), $options{'allow-metalink'}?('allow-metalink' => $options{'allow-metalink'}):() }, basename($url), %options);
+ sync_rel_one($urpm, { url => dirname($url), disable_metalink => $options{disable_metalink} }, basename($url), %options);
}
sub sync_rel_to {
diff --git a/urpm/mirrors.pm b/urpm/mirrors.pm
index ac0a1d83..c9223fa7 100644
--- a/urpm/mirrors.pm
+++ b/urpm/mirrors.pm
@@ -274,7 +274,7 @@ sub _mirrors_raw {
my ($urpm, $url) = @_;
$urpm->{log}(N("getting mirror list from %s", $url));
- my @l = urpm::download::get_content($urpm, $url, "allow_metalink" => 0) or $urpm->{error}("mirror list not found");
+ my @l = urpm::download::get_content($urpm, $url, disable_metalink => 1) or $urpm->{error}("mirror list not found");
@l;
}