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

Bug#353294: lintian: the probably-uses-debconf test fails too often



Package: lintian
Version: 1.23.15
Severity: minor
Tags: patch

Hi,

The probably_uses_debconf test (in check/po-debconf) still fails in
many cases, especially when the maintainer uses dh_installdebconf and
${misc:Depends} (for example, #352948 would have been avoided if the
test had not failed).

Please find attached two patches, they are different ways to fix the
problem:
* po-debconf.depends.diff adds different tests such as the presence of
  Build-Depends: po-debconf, the use of dh_installdebconf, ...
* po-debconf.strict.diff removes all the tests but the $has_templates
  test, and assume that the package uses Debconf if this test returns
  true.

While the first patch should avoid potential false-positives if a
maintainer uses a file 'debian/foo.templates' that is not related with
Debconf, I strongly recommend to use the second patch. There is currently
no false-positive (thanks to Denis Barbier who checked the source
packages), this patch greatly simplifies the check and is very
efficient to avoid false-negatives.

Cheers,

-- 
Thomas Huriaux
--- po-debconf	2006-01-02 10:19:16.000000000 +0100
+++ po-debconf.new	2006-02-15 13:20:24.000000000 +0100
@@ -42,12 +42,23 @@
 			if (m/^Depends:/i) {
 				$has_depends = 1
 					if m/\bdebconf(-[.\d]+)?\b/;
+			} elsif (m/^Build-Depends(-Indep)?:/i) {
+				$has_depends = 1
+					if m/\bpo-debconf(-[.\d]+)?\b/;
 			}
 		}
 		close(IN);
 	} elsif ($file =~ m/^(.+\.)?config(\..+)?$/) {
 	    $has_config = 1;
+	} elsif ($file =~ m/^rules$/) {
+		open (IN, "debfiles/rules")
+			or fail("Can't open debfiles/rules.");
+		while (<IN>) {
+			$has_depends = 1 if (m/^\s*dh_installdebconf/);
+		}
+		close(IN);
 	}
+	last if $has_depends;
 }
 closedir(DEB);
 
--- po-debconf.orig	2006-02-17 12:39:59.000000000 +0100
+++ po-debconf	2006-02-17 12:42:22.000000000 +0100
@@ -31,27 +31,17 @@
 # First, check wether this package seems to use debconf but not po-debconf
 opendir(DEB, 'debfiles')
 	or fail("Can't open debfiles directory.");
-my $has_template = my $has_depends = my $has_config = 0;
+my $has_template = 0;
 for my $file (readdir(DEB)) {
 	if ($file =~ m/^(.+\.)?templates(\..+)?$/) {
 # TODO: out of this loop, use fields/*?
 	        $has_template = 1;
-		open(IN,"debfiles/control")
-			or fail("Can't open debfiles/control.");
-		while (<IN>) {
-			if (m/^Depends:/i) {
-				$has_depends = 1
-					if m/\bdebconf(-[.\d]+)?\b/;
-			}
-		}
-		close(IN);
-	} elsif ($file =~ m/^(.+\.)?config(\..+)?$/) {
-	    $has_config = 1;
+		last;
 	}
 }
 closedir(DEB);
 
-my $probably_uses_debconf = $has_depends || ($has_template && $has_config);
+my $probably_uses_debconf = $has_template;
 
 #TODO: check whether all templates are named in TEMPLATES.pot
 if ( $probably_uses_debconf ) {

Attachment: signature.asc
Description: Digital signature


Reply to: