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

lintian: r311 - trunk/lib



Author: djpig
Date: 2004-07-02 15:47:58 +0200 (Fri, 02 Jul 2004)
New Revision: 311

Modified:
   trunk/lib/Checker.pm
   trunk/lib/Util.pm
Log:
Fix the behaviour of failing tests, so that one failing test doesn't
terminate lintian but only causes skipping the current package.
This should now behave the same way as 1.23.0 did.


Modified: trunk/lib/Checker.pm
===================================================================
--- trunk/lib/Checker.pm	2004-07-01 17:54:03 UTC (rev 310)
+++ trunk/lib/Checker.pm	2004-07-02 13:47:58 UTC (rev 311)
@@ -52,7 +52,7 @@
 	my $type = shift;
 	my $name = shift;
 
-	# Will be set to 1 if error is encountered
+	# Will be set to 2 if error is encountered
 	my $return = 0;
 
 	print "N: Running check: $name ...\n" if $debug;
@@ -67,7 +67,12 @@
 
 	#print STDERR "Now running $name...\n";
 	$name =~ s/[-.]/_/g;
-	&{'Lintian::'.$name.'::run'}($pkg, $type);
+	eval { &{'Lintian::'.$name.'::run'}($pkg, $type) };
+	if ( $@ ) {
+	    print STDERR $@;
+	    print STDERR "internal error: cannot run $name check on package $pkg\n";
+	    $return = 2;
+	}
 
 	return $return;
 }

Modified: trunk/lib/Util.pm
===================================================================
--- trunk/lib/Util.pm	2004-07-01 17:54:03 UTC (rev 310)
+++ trunk/lib/Util.pm	2004-07-02 13:47:58 UTC (rev 311)
@@ -210,15 +210,15 @@
 # ------------------------
 
 sub fail {
+    $! = 2; # set return code outside eval()
     if ($_[0]) {
-	warn "internal error: $_[0]\n";
+	die "internal error: $_[0]\n";
     } elsif ($!) {
-	warn "internal error: $!\n";
+	die "internal error: $!\n";
     } else {
-	warn "internal error.\n";
+	die "internal error.\n";
     }
-    warn "$_[1]\n" if $_[1];
-    exit 2;
+    die "$_[1]\n" if $_[1];
 }
 
 1;



Reply to: