From 7597276b16fe9048a87bb13d99c3171be720c08b Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Wed, 20 Oct 2004 16:37:41 +0000 Subject: Factorize md5sum function. Reinit retrieved MD5SUM. --- urpm/util.pm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'urpm/util.pm') diff --git a/urpm/util.pm b/urpm/util.pm index 01121284..eb2fc912 100644 --- a/urpm/util.pm +++ b/urpm/util.pm @@ -5,7 +5,9 @@ use Exporter; our @ISA = 'Exporter'; our @EXPORT = qw(quotespace unquotespace remove_internal_name - reduce_pathname offset_pathname); + reduce_pathname offset_pathname + md5sum +); #- quoting/unquoting a string that may be containing space chars. sub quotespace { my $x = $_[0] || ''; $x =~ s/(\s)/\\$1/g; $x } @@ -70,6 +72,12 @@ sub offset_pathname { $result . join('/', reverse @corrections); } +sub md5sum { + #- Use an external command to avoid depending on perl + my ($file) = @_; + return( (split ' ', `md5sum '$file'`)[0] ); +} + 1; __END__ -- cgit v1.2.1