From e70af9c6aff2c57bd822415a1e3fd2b8cb994567 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 8 Jan 2008 14:29:16 +0000 Subject: when doing urpmi.addmedia on a remote medium, we first look for synthesis.hdlist.cz, but we should also download MD5SUM and check synthesis.hdlist.cz (the checking was only done on urpmi.update) --- NEWS | 3 +++ urpm/media.pm | 19 ++++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index dddcfef9..72ace196 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,9 @@ - urpmi.update, urpmi.addmedia, urpmi.removemedia: o drop option "-c" which used to clean /var/cache/urpmi/headers o enhancement: only parse updated synthesis +- urpmi.addmedia + o do check md5sum of downloaded synthesis + (the check was only done on urpmi.update) - urpmi: o do remove __db* on priority-upgrade (fix regression introduced in 4.10.15) diff --git a/urpm/media.pm b/urpm/media.pm index bdb43e33..5a807226 100644 --- a/urpm/media.pm +++ b/urpm/media.pm @@ -1171,6 +1171,7 @@ sub _update_medium__parse_if_unmodified__remote { unlink cachedir_with_synthesis($urpm, $medium); $options->{callback} and $options->{callback}('failed', $medium->{name}); }; + my $ok = 1; if (!_synthesis_dir($medium)) { my $err; _probe_with_try_list($urpm, $medium, sub { @@ -1190,6 +1191,9 @@ sub _update_medium__parse_if_unmodified__remote { $urpm->{error}(N("...retrieving failed: %s", $err)); return; }; + + $options->{nomd5sum} || _download_MD5SUM($urpm, $medium); + } else { if ($options->{force}) { unlink cachedir_with_synthesis($urpm, $medium); @@ -1203,15 +1207,16 @@ sub _update_medium__parse_if_unmodified__remote { ) or $error->(N("...copying failed")), return; } } - my $ok = get_synthesis__remote($urpm, $medium, $options->{callback}, $options->{quiet}); - $ok &&= !$options->{force} || check_synthesis_md5sum($urpm, $medium); + $ok = get_synthesis__remote($urpm, $medium, $options->{callback}, $options->{quiet}); + } - $options->{callback} and $options->{callback}('done', $medium->{name}); + $ok &&= !$options->{force} || check_synthesis_md5sum($urpm, $medium); - if (!$ok) { - _ignore_medium_on_parse_error($urpm, $medium); - return; - } + $options->{callback} and $options->{callback}('done', $medium->{name}); + + if (!$ok) { + _ignore_medium_on_parse_error($urpm, $medium); + return; } 1; } -- cgit v1.2.1