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

Bug#467642: new check for unneeded control scripts



Package: lintian
Version: 1.23.45
Severity: wishlist

Attached patch should enable lintian to warn against unneeded control
files. It adds a warning against (semantically) empty control files
and against some ancient checks. (I don't think package need still check
in preinst if the version of dpkg running is newer than from 1999).

Hochachtungsvoll,
	Bernhard R. Link
diff -rup lintian-1.23.45/checks/control-files lintian-1.23.45patched/checks/control-files
--- lintian-1.23.45/checks/control-files	2008-01-03 03:03:56.000000000 +0100
+++ lintian-1.23.45patched/checks/control-files	2008-02-26 17:45:18.000000000 +0100
@@ -103,12 +103,44 @@ while (<IN>) {
 	tag "control-file-has-bad-owner", "$file $owner != root/root";
     }
 
+    # actual content?
+    open(IN2, '<', "control/$file") or
+        fail("cannot open maintainer script control/$file for reading: $!");
+    my $has_content = 0;
+    while (<IN2>) {
+        next if m/^\#/;
+        next if m/^[[:space:]]*$/;
+	$has_content = 1;
+
+        if (m/dpkg[[:space:]]*--assert-support-predepends/) {
+            tag "ancient-predepends-check", "$file";
+        }
+        if (m/dpkg[[:space:]]*--assert-working-epoch/) {
+            tag "ancient-epoch-check", "$file";
+        }
+        if (m/dpkg[[:space:]]*--assert-long-filenames/) {
+            tag "ancient-long-filenames-check", "$file";
+        }
+        if (m/dpkg[[:space:]]*--assert-multi-conrep/) {
+            tag "ancient-multi-conrep-check", "$file";
+        }
+    }
+    close(IN2);
+    unless ($has_content) {
+        tag "empty-control-file", "$file";
+    }
+
 # for other maintainer scripts checks, see the scripts check
 }
 close IN;
 
 } # </run>
 
+sub check_control_script {
+  my ($script) = @_;
+
+}
+
 1;
 
 # vim: syntax=perl sw=4 ts=8
diff -rup lintian-1.23.45/checks/control-files.desc lintian-1.23.45patched/checks/control-files.desc
--- lintian-1.23.45/checks/control-files.desc	2008-01-03 02:59:17.000000000 +0100
+++ lintian-1.23.45patched/checks/control-files.desc	2008-02-26 17:47:23.000000000 +0100
@@ -26,3 +26,28 @@ Info: The postinst, postrm, preinst, and
 Tag: control-file-has-bad-owner
 Type: error
 Info: All control files should be owned by root/root.
+
+Tag: empty-control-file
+Type: warning
+Info: The package contains a control file with only comments and empty
+ lines. This should be removed instead.
+
+Tag: ancient-predepends-check
+Type: warning
+Info: The package calls dpkg --assert-support-predepends in a control
+ file. This always returns true since dpkg 1.1.0 released Feb 1996.
+
+Tag: ancient-epoch-check
+Type: warning
+Info: The package calls dpkg --assert-working-epoch in a control
+ file. This always returns true since dpkg 1.4.0.7 released Jan 1997.
+
+Tag: ancient-long-filenames-check
+Type: warning
+Info: The package calls dpkg --assert-long-filenames in a control
+ file. This always return true since dpkg 1.4.1.17 released Oct 1999.
+
+Tag: ancient-multi-conrep-check
+Type: warning
+Info: The package calls dpkg --assert-multi-conrep in a control
+ file. This always returns true since dpkg 1.4.1.19 released Oct 1999.

Reply to: