summaryrefslogtreecommitdiffstats
path: root/urpm
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-10-20 16:37:41 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-10-20 16:37:41 +0000
commit7597276b16fe9048a87bb13d99c3171be720c08b (patch)
tree75dd7dd0af1ba30576cb41631c0ac8452fa10dc9 /urpm
parente75f56f807050196afe64d494e55d634ea83b2c2 (diff)
downloadurpmi-7597276b16fe9048a87bb13d99c3171be720c08b.tar
urpmi-7597276b16fe9048a87bb13d99c3171be720c08b.tar.gz
urpmi-7597276b16fe9048a87bb13d99c3171be720c08b.tar.bz2
urpmi-7597276b16fe9048a87bb13d99c3171be720c08b.tar.xz
urpmi-7597276b16fe9048a87bb13d99c3171be720c08b.zip
Factorize md5sum function. Reinit retrieved MD5SUM.
Diffstat (limited to 'urpm')
-rw-r--r--urpm/util.pm10
1 files changed, 9 insertions, 1 deletions
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__