From 69fb2a40b53e18b47ba58ef7cae596aa77ddb24e Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Tue, 3 Jan 2006 18:54:17 +0000 Subject: There's no point in scanning all media for a matching MD5SUM, just directly look at the media we're updating. In case of multiple enabled media using the same hdlist, only one used to be correctly marked modified, so the changes of md5sum for others were silently ignored, and breakage ensued. --- urpm.pm | 84 ++++++++++++++++++++++++++++------------------------------------- 1 file changed, 36 insertions(+), 48 deletions(-) diff --git a/urpm.pm b/urpm.pm index ca34b86c..9250f8dc 100644 --- a/urpm.pm +++ b/urpm.pm @@ -1235,31 +1235,25 @@ this could happen if you mounted manually the directory when creating the medium #- the files are the same. #- If the local md5sum is the same as the distant md5sum, this means #- that there is no need to download the hdlist or synthesis file again. - if (defined $retrieved_md5sum) { - foreach (@{$urpm->{media}}) { - if ($_->{md5sum} && $_->{md5sum} eq $retrieved_md5sum) { - unlink "$urpm->{cachedir}/partial/$basename"; - #- the medium is now considered not modified. - $medium->{modified} = 0; - #- XXX we could link the new hdlist to the old one. - #- (However links need to be managed. see bug #12391.) - #- as previously done, just read synthesis file here, this is enough. - $urpm->{log}(N("examining synthesis file [%s]", - "$urpm->{statedir}/synthesis.$medium->{hdlist}")); - ($medium->{start}, $medium->{end}) = - $urpm->parse_synthesis("$urpm->{statedir}/synthesis.$medium->{hdlist}"); - unless (defined $medium->{start} && defined $medium->{end}) { - $urpm->{log}(N("examining hdlist file [%s]", "$urpm->{statedir}/$medium->{hdlist}")); - ($medium->{start}, $medium->{end}) = - $urpm->parse_hdlist("$urpm->{statedir}/$medium->{hdlist}", packing => 1); - unless (defined $medium->{start} && defined $medium->{end}) { - $urpm->{error}(N("problem reading hdlist or synthesis file of medium \"%s\"", - $medium->{name})); - $medium->{ignore} = 1; - } - } - #- no need to continue examining other md5sum. - last; + if (defined $retrieved_md5sum && $medium->{md5sum} eq $retrieved_md5sum) { + unlink "$urpm->{cachedir}/partial/$basename"; + #- the medium is now considered not modified. + $medium->{modified} = 0; + #- XXX we could link the new hdlist to the old one. + #- (However links need to be managed. see bug #12391.) + #- as previously done, just read synthesis file here, this is enough. + $urpm->{log}(N("examining synthesis file [%s]", + "$urpm->{statedir}/synthesis.$medium->{hdlist}")); + ($medium->{start}, $medium->{end}) = + $urpm->parse_synthesis("$urpm->{statedir}/synthesis.$medium->{hdlist}"); + unless (defined $medium->{start} && defined $medium->{end}) { + $urpm->{log}(N("examining hdlist file [%s]", "$urpm->{statedir}/$medium->{hdlist}")); + ($medium->{start}, $medium->{end}) = + $urpm->parse_hdlist("$urpm->{statedir}/$medium->{hdlist}", packing => 1); + unless (defined $medium->{start} && defined $medium->{end}) { + $urpm->{error}(N("problem reading hdlist or synthesis file of medium \"%s\"", + $medium->{name})); + $medium->{ignore} = 1; } } } @@ -1511,29 +1505,23 @@ this could happen if you mounted manually the directory when creating the medium #- files are the same. #- if local md5sum is the same as distant md5sum, this means there is no need to #- download hdlist or synthesis file again. - if (defined $retrieved_md5sum) { - foreach (@{$urpm->{media}}) { - if ($_->{md5sum} && $_->{md5sum} eq $retrieved_md5sum) { - unlink "$urpm->{cachedir}/partial/$basename"; - #- the medium is now considered not modified. - $medium->{modified} = 0; - #- XXX we could link the new hdlist to the old one. - #- (However links need to be managed. see bug #12391.) - #- as previously done, just read synthesis file here, this is enough. - $urpm->{log}(N("examining synthesis file [%s]", "$urpm->{statedir}/synthesis.$medium->{hdlist}")); - ($medium->{start}, $medium->{end}) = - $urpm->parse_synthesis("$urpm->{statedir}/synthesis.$medium->{hdlist}"); - unless (defined $medium->{start} && defined $medium->{end}) { - $urpm->{log}(N("examining hdlist file [%s]", "$urpm->{statedir}/$medium->{hdlist}")); - ($medium->{start}, $medium->{end}) = - $urpm->parse_hdlist("$urpm->{statedir}/$medium->{hdlist}", packing => 1); - unless (defined $medium->{start} && defined $medium->{end}) { - $urpm->{error}(N("problem reading synthesis file of medium \"%s\"", $medium->{name})); - $medium->{ignore} = 1; - } - } - #- no need to continue examining other md5sum. - last; + if (defined $retrieved_md5sum && $medium->{md5sum} eq $retrieved_md5sum) { + unlink "$urpm->{cachedir}/partial/$basename"; + #- the medium is now considered not modified. + $medium->{modified} = 0; + #- XXX we could link the new hdlist to the old one. + #- (However links need to be managed. see bug #12391.) + #- as previously done, just read synthesis file here, this is enough. + $urpm->{log}(N("examining synthesis file [%s]", "$urpm->{statedir}/synthesis.$medium->{hdlist}")); + ($medium->{start}, $medium->{end}) = + $urpm->parse_synthesis("$urpm->{statedir}/synthesis.$medium->{hdlist}"); + unless (defined $medium->{start} && defined $medium->{end}) { + $urpm->{log}(N("examining hdlist file [%s]", "$urpm->{statedir}/$medium->{hdlist}")); + ($medium->{start}, $medium->{end}) = + $urpm->parse_hdlist("$urpm->{statedir}/$medium->{hdlist}", packing => 1); + unless (defined $medium->{start} && defined $medium->{end}) { + $urpm->{error}(N("problem reading synthesis file of medium \"%s\"", $medium->{name})); + $medium->{ignore} = 1; } } } -- cgit v1.2.1