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

Bug#367466: lintian: enhancement, check for missing menu files



Package: lintian
Version: 1.23.21
Severity: wishlist

I have an idea for a lintian enhancement. There are packages that
provide GUI programs (gtk,qt,etc.) that do not provide a menu file for
those programs, ideally they would all provide menu files.

Here is a patch that adds a test to the binaries check. It checks each
executable binary to see if it uses libX11 and if any do and the package
doesn't have a menu file it issues a warning. I have tested it on

1) a deb that has no menu file and a libX11 using executable and it
  correctly reports it.
2) a deb that has no menu file and libX11 using _libraries_ (libxt
  package) and it correctly does not report.
3) a deb that had a menu file and a libX11 using executable and it
  correctly does not report.

Can you think of any other cases where this test would mistakenly fail?
This is my first lintian patch, so let me know if I haven't done things
correctly.

Thanks,

-- 
Matt Taggart
taggart@debian.org

diff -ur lintian-1.23.21/checks/binaries lintian-1.23.21.new/checks/binaries
--- lintian-1.23.21/checks/binaries	2006-04-02 17:40:48.000000000 -0500
+++ lintian-1.23.21.new/checks/binaries	2006-05-16 01:57:38.000000000 -0500
@@ -31,6 +31,8 @@
 my $arch;
 my $dynsyms = 0;
 my $needs_depends_line = 0;
+my $has_x11 = 0;
+my $has_menu = 0;
 
 my %COMMENT;
 my %NOTE;
@@ -166,6 +168,11 @@
     m/^(.+?):\s+(.*)$/o or fail("an error in the file pkg is preventing lintian from checking this package: $_");
     my ($file,$info) = ($1,$2);
 
+    # check for menu file
+    if ($file =~ m,/usr/(lib|share)/menu/,) {
+    	$has_menu++;
+    }
+
     # binary or object file?
     next unless ($info =~ m/^[^,]*\bELF\b/) or ($info =~ m/\bcurrent ar archive\b/);
 
@@ -268,6 +275,10 @@
 	    if ($lib =~ m/^libc/o) {
 		$no_libc = 0;
 	    }
+	    # count executables that use X11
+	    if ( $info =~ m/executable/ and $lib =~ m/^libX11/o) {
+	    	$has_x11++;
+	    }
 	}
 
 	if ($no_libc and not $file =~ m,/libc\b,) {
@@ -281,6 +292,11 @@
 }
 close(IN);
 
+# did a binary use X11 and we don't have a menu file?
+if ($has_x11 and !$has_menu) {
+	tag "binary-uses-x11-no-menu", "";
+}
+
 if ($needs_depends_line) {
     if (not -e "fields/depends" and not -e "fields/pre-depends") {
 	tag "missing-depends-line", ""
diff -ur lintian-1.23.21/checks/binaries.desc lintian-1.23.21.new/checks/binaries.desc
--- lintian-1.23.21/checks/binaries.desc	2006-03-11 21:33:35.000000000 -0600
+++ lintian-1.23.21.new/checks/binaries.desc	2006-05-16 01:49:24.000000000 -0500
@@ -145,3 +145,11 @@
 Info: This appears to be an ELF file but objdump -T cannot parse it.
  If it is external debugging symbols for another file, it should be
  installed under /usr/lib/debug.
+
+Tag: binary-uses-x11-no-menu
+Type: warning
+Info: This package contains an executable linked against libX11, but does
+ not appear to have a menu file. This is a very basic test, if a package
+ does not have a menu file any executable that requires libX11 will cause
+ this warning. Please inspect your executables and determine if a menu
+ file is needed.

Reply to: