summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2006-11-09 15:30:57 +0000
committerPascal Rigaux <pixel@mandriva.com>2006-11-09 15:30:57 +0000
commit5f68e6fb58c2fa833c0f5e414ed802035896d027 (patch)
tree26ce4d533177c81d6e44c52247a03ce4aa59e15c
parent6ece0640fe9514371694269835bf89985e327cc9 (diff)
downloadurpmi-5f68e6fb58c2fa833c0f5e414ed802035896d027.tar
urpmi-5f68e6fb58c2fa833c0f5e414ed802035896d027.tar.gz
urpmi-5f68e6fb58c2fa833c0f5e414ed802035896d027.tar.bz2
urpmi-5f68e6fb58c2fa833c0f5e414ed802035896d027.tar.xz
urpmi-5f68e6fb58c2fa833c0f5e414ed802035896d027.zip
simplify
-rw-r--r--urpm.pm16
1 files changed, 6 insertions, 10 deletions
diff --git a/urpm.pm b/urpm.pm
index aaf10f74..637345ef 100644
--- a/urpm.pm
+++ b/urpm.pm
@@ -3437,16 +3437,12 @@ sub get_updates_description {
sub parse_md5sum {
my ($urpm, $path, $basename) = @_;
$urpm->{log}(N("examining MD5SUM file"));
- my $fh = $urpm->open_safe('<', $path) or return undef;
- 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));
+
+ my ($retrieved_md5sum) = map {
+ my ($md5sum, $file) = m|(\S+)\s+(?:\./)?(\S+)|;
+ $file && $file eq $basename ? $md5sum : ();
+ } cat_($path) or $urpm->{log}(N("warning: md5sum for %s unavailable in MD5SUM file", $basename));
+
return $retrieved_md5sum;
}