summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2006-01-03 17:19:05 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2006-01-03 17:19:05 +0000
commit4806e45df2ddeb07821a7c6e92e6c4708dea550a (patch)
tree10f3cf0eb83a26300e831968c2f7414a24560505
parent932583718f7e08962424aeb22b47bab0b6e37bfb (diff)
downloadurpmi-4806e45df2ddeb07821a7c6e92e6c4708dea550a.tar
urpmi-4806e45df2ddeb07821a7c6e92e6c4708dea550a.tar.gz
urpmi-4806e45df2ddeb07821a7c6e92e6c4708dea550a.tar.bz2
urpmi-4806e45df2ddeb07821a7c6e92e6c4708dea550a.tar.xz
urpmi-4806e45df2ddeb07821a7c6e92e6c4708dea550a.zip
Don't bother comparing all md5sums if we haven't gotten it from the mirror
-rw-r--r--urpm.pm94
1 files changed, 48 insertions, 46 deletions
diff --git a/urpm.pm b/urpm.pm
index 9810bde0..89575bf6 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -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;