aboutsummaryrefslogtreecommitdiffstats
path: root/genhdlist2
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2020-01-17 00:27:01 +0100
committerThierry Vignaud <thierry.vignaud@gmail.com>2020-01-17 11:12:15 +0100
commit53624bcd2bbc6fd91c7a487b0703ddf427e312de (patch)
tree6d54b4483958295863601e612dc91ea2c088aff1 /genhdlist2
parent03996585be4cdb7088d0bc0b40913f1fc844de25 (diff)
downloadrpmtools-53624bcd2bbc6fd91c7a487b0703ddf427e312de.tar
rpmtools-53624bcd2bbc6fd91c7a487b0703ddf427e312de.tar.gz
rpmtools-53624bcd2bbc6fd91c7a487b0703ddf427e312de.tar.bz2
rpmtools-53624bcd2bbc6fd91c7a487b0703ddf427e312de.tar.xz
rpmtools-53624bcd2bbc6fd91c7a487b0703ddf427e312de.zip
switch from md5sum to Digest::MD5
performance & memory usage are similar It helps gaining support on more platforms for CPAN testers, especially for urpmi This show that maybe creating an helper in a support module wouldn't hurt...
Diffstat (limited to 'genhdlist2')
-rwxr-xr-xgenhdlist212
1 files changed, 11 insertions, 1 deletions
diff --git a/genhdlist2 b/genhdlist2
index c7b98d3..04c95b7 100755
--- a/genhdlist2
+++ b/genhdlist2
@@ -2,6 +2,7 @@
our ($VERSION) = q(Id: genhdlist2 20460 2006-11-23 13:19:11Z pixel ) =~ /(\d+\.\d+)/;
+use Cwd;
use URPM;
use List::Util 'any';
use MDV::Packdrakeng;
@@ -427,8 +428,17 @@ sub generate_versioned_media_info {
sub generate_md5sum {
my ($media_info_dir, $media_info_files) = @_;
+ require Digest::MD5;
print "updating $media_info_dir/MD5SUM\n" if $verbose >= 0;
- my $m = `cd '$media_info_dir' ; /usr/bin/md5sum @$media_info_files`;
+ my $cwd = getcwd();
+ chdir($media_info_dir);
+ my $m;
+ foreach my $fn (@$media_info_files) {
+ open(my $fh, '<', $fn) or die "Can't open '$fn': $!";
+ binmode($fh);
+ $m .= Digest::MD5->new->addfile($fh)->hexdigest . " $fn\n";
+ }
+ chdir($cwd);
unlink "$media_info_dir/MD5SUM"; # ensure no hard link is used
open(my $f, '>', "$media_info_dir/MD5SUM") or die "Can't write MD5SUM: $!\n";
print $f $m;