summaryrefslogtreecommitdiffstats
path: root/urpm/media.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-09-23 15:54:24 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-09-23 15:54:24 +0000
commitab25ce721b7bf62841c6d9c1ded8a762fb717784 (patch)
treeacb3d6303153823b69308219646ba8c5b65214c4 /urpm/media.pm
parent0ff68bc2ce17ed97d22575c250c1d569638c1801 (diff)
downloadurpmi-ab25ce721b7bf62841c6d9c1ded8a762fb717784.tar
urpmi-ab25ce721b7bf62841c6d9c1ded8a762fb717784.tar.gz
urpmi-ab25ce721b7bf62841c6d9c1ded8a762fb717784.tar.bz2
urpmi-ab25ce721b7bf62841c6d9c1ded8a762fb717784.tar.xz
urpmi-ab25ce721b7bf62841c6d9c1ded8a762fb717784.zip
- use "versioned" media_info files
(needed for aria2 to handle mirrors not having some media_info/*) it fixes: - downloading parts of media_info file from different mirrors and failing to obtain a valid result - checking md5sum of media_info files
Diffstat (limited to 'urpm/media.pm')
-rw-r--r--urpm/media.pm26
1 files changed, 26 insertions, 0 deletions
diff --git a/urpm/media.pm b/urpm/media.pm
index aea565ef..34ae11d6 100644
--- a/urpm/media.pm
+++ b/urpm/media.pm
@@ -1189,6 +1189,22 @@ sub _download_pubkey {
sub _download_media_info_file {
my ($urpm, $medium, $prefix, $suffix, $options) = @_;
+ my $versioned_prefix = do {
+ my $version = urpm::md5sum::versioned_media_info_file($urpm, $medium, "$prefix$suffix");
+ $version and $options->{is_versioned} = 1;
+ $version ? "$version-$prefix" : $prefix;
+ };
+
+ my $tmp = _download_media_info_file_raw($urpm, $medium,
+ $versioned_prefix, $suffix, $options) or return;
+ my $result = dirname($tmp) . "/$prefix$suffix";
+ $tmp eq $result or rename($tmp, $result) or return;
+ $result;
+}
+
+sub _download_media_info_file_raw {
+ my ($urpm, $medium, $prefix, $suffix, $options) = @_;
+
my $name = "$prefix$suffix";
my $result_file = "$urpm->{cachedir}/partial/$name";
my $found;
@@ -1717,6 +1733,14 @@ sub _retrieve_media_info_file_and_check_MD5SUM {
1;
}
+sub _download_temp_md5sum_and_parse {
+ my ($urpm, $medium) = @_;
+
+ $urpm->{debug}("downloading MD5SUM to know updated versioned metadata filename") if $urpm->{debug};
+ my $md5sum_file = _download_MD5SUM($urpm, $medium);
+ urpm::md5sum::parse($md5sum_file);
+}
+
sub _any_media_info__or_download {
my ($urpm, $medium, $prefix, $suffix, $quiet, $o_callback) = @_;
@@ -1733,6 +1757,8 @@ sub _any_media_info__or_download {
_maybe_in_statedir_MD5SUM($urpm, $medium, "$prefix$suffix") or return;
+ $medium->{parsed_md5sum} ||= _download_temp_md5sum_and_parse($urpm, $medium);
+
my $file_in_partial =
_download_media_info_file($urpm, $medium, $prefix, $suffix,
{ quiet => $quiet, callback => $o_callback }) or return;