diff options
-rw-r--r-- | urpm.pm | 94 |
1 files changed, 48 insertions, 46 deletions
@@ -1235,30 +1235,32 @@ 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. - 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}")); + 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_hdlist("$urpm->{statedir}/$medium->{hdlist}", packing => 1); + $urpm->parse_synthesis("$urpm->{statedir}/synthesis.$medium->{hdlist}"); unless (defined $medium->{start} && defined $medium->{end}) { - $urpm->{error}(N("problem reading hdlist or synthesis file of medium \"%s\"", - $medium->{name})); - $medium->{ignore} = 1; + $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; } - #- no need to continue examining other md5sum. - last; } } $medium->{modified} or next; @@ -1509,28 +1511,30 @@ 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. - 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}")); + 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_hdlist("$urpm->{statedir}/$medium->{hdlist}", packing => 1); + $urpm->parse_synthesis("$urpm->{statedir}/synthesis.$medium->{hdlist}"); unless (defined $medium->{start} && defined $medium->{end}) { - $urpm->{error}(N("problem reading synthesis file of medium \"%s\"", $medium->{name})); - $medium->{ignore} = 1; + $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; } - #- no need to continue examining other md5sum. - last; } } $medium->{modified} or next; @@ -3396,17 +3400,15 @@ sub get_updates_description { #- parse an MD5SUM file from a mirror sub parse_md5sum { my ($urpm, $path, $basename) = @_; - my $retrieved_md5sum; $urpm->{log}(N("examining MD5SUM file")); my $fh = $urpm->open_safe('<', $path) or return undef; - if ($fh) { - local $_; - while (<$fh>) { - my ($md5sum, $file) = m|(\S+)\s+(?:\./)?(\S+)| or next; - $file eq $basename and $retrieved_md5sum = $md5sum; - } - close $fh; + my $retrieved_md5sum; + local $_; + while (<$fh>) { + my ($md5sum, $file) = m|(\S+)\s+(?:\./)?(\S+)| or next; + $file eq $basename and $retrieved_md5sum = $md5sum; } + close $fh; defined $retrieved_md5sum or $urpm->{log}(N("warning: md5sum for %s unavailable in MD5SUM file", $basename)); return $retrieved_md5sum; |