summaryrefslogtreecommitdiffstats
path: root/urpm
diff options
context:
space:
mode:
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__