[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

lintian: r259 - in trunk: debian frontend lib



Author: jeroen
Date: 2004-05-05 19:52:47 +0200 (Wed, 05 May 2004)
New Revision: 259

Modified:
   trunk/debian/changelog
   trunk/debian/control
   trunk/frontend/lintian
   trunk/lib/Util.pm
Log:
Switch to Digest::MD5 for checking md5 sums of files


Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2004-05-05 14:56:50 UTC (rev 258)
+++ trunk/debian/changelog	2004-05-05 17:52:47 UTC (rev 259)
@@ -31,6 +31,7 @@
       change to frontend/lintian on every version number change... Requires
       sed version 4 at build-time.
     + [JvW] Start depending on gettext.
+    + [JvW] Start depending on libdigest-perl, for using md5 on files.
 
   * frontend/lintian:
     + [JvW] Rewrite: checks are now plugins loaded into lintian, rather than

Modified: trunk/debian/control
===================================================================
--- trunk/debian/control	2004-05-05 14:56:50 UTC (rev 258)
+++ trunk/debian/control	2004-05-05 17:52:47 UTC (rev 259)
@@ -8,7 +8,7 @@
 
 Package: lintian
 Architecture: all
-Depends: perl, file, binutils, diffstat (>= 1.27-1), man-db (>= 2.3.20-1), gettext
+Depends: perl, libdigest-perl, file, binutils, diffstat (>= 1.27-1), man-db (>= 2.3.20-1), gettext
 Suggests: binutils-multiarch
 Description: Debian package checker
  Lintian dissects Debian packages and reports bugs and policy

Modified: trunk/frontend/lintian
===================================================================
--- trunk/frontend/lintian	2004-05-05 14:56:50 UTC (rev 258)
+++ trunk/frontend/lintian	2004-05-05 17:52:47 UTC (rev 259)
@@ -658,13 +658,8 @@
 	
 		# check md5sums
 		if ($check_md5sums or $file =~ /\.dsc$/) {
-		    my $MD5SUM = FileHandle->new;
-		    pipeline_open($MD5SUM, (sub { exec 'md5sum', $filename }))
-			or fail("cannot fork for md5sum: $!");
-		    my $real_md5sum = <$MD5SUM>;
+		    my $real_md5sum = get_md5_file($filename);
 
-		    close($MD5SUM) or fail("md5sum $filename exited with error $?");
-		    $real_md5sum =~ s/\s.*//s;
 		    if ($real_md5sum ne $md5sum) {
 			print "E: $arg_name: md5sum-mismatch-in-changes-file $file\n";
 		    }

Modified: trunk/lib/Util.pm
===================================================================
--- trunk/lib/Util.pm	2004-05-05 14:56:50 UTC (rev 258)
+++ trunk/lib/Util.pm	2004-05-05 17:52:47 UTC (rev 259)
@@ -29,10 +29,12 @@
 	get_deb_info
 	get_dsc_info
 	slurp_entire_file
+	get_file_md5
 	fail);
 
 use FileHandle;
 use Pipeline;
+use Digest::MD5;
 
 # general function to read dpkg control files
 # this function can parse output of `dpkg-deb -f', .dsc,
@@ -174,6 +176,15 @@
     return $_;
 }
 
+sub get_file_md5 {
+	my $file = shift;
+	open FILE, $file or fail("Couldn't open $file");
+	my $md5 = Digest::MD5->new;
+	$md5->addfile(*FILE);
+	close FILE or fail("Couldn't close $file");
+	return $md5->hexdigest;
+}
+
 # ------------------------
 
 sub fail {



Reply to: