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

lintian: r39 - in trunk: checks debian testset testset/binary/debian



Author: jeroen
Date: 2004-02-15 01:21:39 +0100 (Sun, 15 Feb 2004)
New Revision: 39

Modified:
   trunk/checks/menu-format
   trunk/checks/menu-format.desc
   trunk/debian/changelog
   trunk/testset/binary/debian/menu
   trunk/testset/info_tags.binary
   trunk/testset/tags.binary
Log:
checks/menu-format
+ Missing required tags are now an error (and check name changed)
+ Check tag-quotation
+ Rewrite needs check properly, being more precise what is allowed
+ Complain about needs="dwww", as this is obsolete accordint to menu
  maintainer

Again, inspired from work by Bill Allombert


Modified: trunk/checks/menu-format
===================================================================
--- trunk/checks/menu-format	2004-02-14 16:12:01 UTC (rev 38)
+++ trunk/checks/menu-format	2004-02-15 00:21:39 UTC (rev 39)
@@ -40,10 +40,10 @@
 	hints
     );
 
-# This is a list of all known uses of the needs= tag.
+# These 'needs' tags are always valid, no matter the context, and no other
+# values are valid outside WindowManagers context
 # (It's case insensitive, use lower case here.).
-my @needs_tag_vals=qw(x11 text vc asmodule fvwmmodule fvwm2module fvwm95module
-		      fvwmother wm dwww wmaker);
+my @needs_tag_vals=qw(x11 text vc);
 
 # Authorative source of menu sections:
 # http://www.debian.org/doc/packaging-manuals/menu-policy/ch2#s2.1
@@ -262,6 +262,8 @@
 	# If the value was quoted, remove those quotes.
 	if ($value =~ m/^\"(.*)\"$/) {
 	    $value = $1;
+	} else {
+	    print "W: $pkg $type: unquoted-string-in-menu-item /usr/lib/menu/$menufile $1:$linecount\n";
 	}
 
 	# If the value has escaped characters, remove the
@@ -293,7 +295,11 @@
     # Test for important tags.
     foreach my $tag (@req_tags) {
 	unless ( exists($vals{$tag}) && defined($vals{$tag}) ) {
-	    print "W: $pkg $type: menu-item-missing-important-tag $tag /usr/lib/menu/$menufile:$linecount\n";
+	    print "E: $pkg $type: menu-item-missing-required-tag $tag /usr/lib/menu/$menufile:$linecount\n";
+	    # Just give up right away, if such an essential tag is missing,
+	    # chance is high the rest doesn't make sense either. And now all
+	    # following checks can assume those tags to be there
+	    return;
 	}
     }
 	
@@ -304,7 +310,6 @@
 	}
     }
     
-    if (exists($vals{'command'})) {
 	my @com=split(' ',$vals{'command'});
 	if ($com[0] eq "su-to-root") {
 	    print "E: $pkg $type: su-to-root-without-usr-sbin /usr/lib/menu/$menufile:$linecount\n";
@@ -322,7 +327,6 @@
 		print "E: $pkg $type: su-to-root-without--c /usr/lib/menu/$menufile:$linecount\n";
 	    }
 	}
-    }
 
     if (exists($vals{'icon'})) {
 	VerifyIcon($menufile, $linecount, $vals{'icon'}, 32);
@@ -334,29 +338,35 @@
 	VerifyIcon($menufile, $linecount, $vals{'icon16x16'}, 16);
     }
 
-    # Check the needs tag.
-    if ((not $needs_tag_vals_hash{lc($vals{'needs'})}) and
-	$vals{'needs'} ne $pkg) {
-	print "W: $pkg $type: menu-item-needs-tag-has-unknown-value $vals{'needs'} /usr/lib/menu/$menufile:$linecount\n";
-	return;		# don't check section tag for weird needs values.
-    }
-	
-    # Check the section tag.
-    my $section;
-    if (exists($vals{'section'}) && defined($vals{'section'})) {
-	$section = $vals{'section'};
+    # Sanitize the section tag
+    my $section = $vals{'section'};
 	$section =~ tr:/:/:s;	# eliminate duplicate slashes.
 	$section =~ s:/$::;	# remove trailing slash.
+	
+    # Check the needs tag.
+    my $needs = lc($vals{'needs'}); # needs is case insensitive.
+
+    if ($needs eq "dwww") {
+	print "W: $pkg $type: menu-item-needs-dwww /usr/lib/menu/$menufile:$linecount\n";
     }
-	
-    if ($vals{'needs'} eq 'dwww') {
-	# dwww entries are really just variants of doc-base, so we don't check
-	# their sections until a policy on documentation structure is defined.
-    } elsif (! defined($section)) {
-	# If the section tag does not exist then the item will go
-	# right in the root menu, which is just Evil.
-	print "E: $pkg $type: menu-item-adds-to-root-menu /usr/lib/menu/$menufile:$linecount\n";
+    if ($section =~ m:^WindowManagers/Modules:) {
+	# WM/Modules: needs must not be the regular ones nor wm
+	if ($needs_tag_vals_hash{$needs} or $needs eq "wm") {
+	    print "E: $pkg $type: non-wm-module-in-wm-modules-menu-section $needs /usr/lib/menu/$menufile:$linecount\n";
+	}
+    } elsif ($section =~ m:^WindowManagers:) {
+	# Other WM sections: needs must be wm
+        if ($needs ne 'wm') {
+	    print "E: $pkg $type: non-wm-in-windowmanager-menu-section $needs /usr/lib/menu/$menufile:$linecount\n";
+	}
     } else {
+	# Any other section: just only the general ones
+	if (not $needs_tag_vals_hash{$needs}) {
+	    print "W: $pkg $type: menu-item-needs-tag-has-unknown-value $needs /usr/lib/menu/$menufile:$linecount\n";
+	}
+    }
+
+    # Check the section tag
 	# Check for historical changes in the section tree.
 	if ($section =~ m:^Apps/Games:) {
 	    print "W: $pkg $type: menu-item-uses-apps-games-section /usr/lib/menu/$menufile:$linecount\n";
@@ -388,7 +398,6 @@
 		print "W: $pkg $type: menu-item-creates-new-section $vals{section} /usr/lib/menu/$menufile:$linecount\n";
 	    }
 	}
-    }
 }
 
 
@@ -448,3 +457,5 @@
     print "W: $pkg $type: menu-icon-cannot-be-parsed $icon: looking for $parse\n";
     return;
 }
+
+# vim: ts=8 sw=4

Modified: trunk/checks/menu-format.desc
===================================================================
--- trunk/checks/menu-format.desc	2004-02-14 16:12:01 UTC (rev 38)
+++ trunk/checks/menu-format.desc	2004-02-15 00:21:39 UTC (rev 39)
@@ -43,9 +43,9 @@
 Info: The menu item contains two instances of the same tag. This is just a
  waste of space, as menu will only use one of them.
 
-Tag: menu-item-missing-important-tag
-Type: warning
-Info: The menu item has a line that is missing an important tag. It's likely
+Tag: menu-item-missing-required-tag
+Type: error
+Info: The menu item has a line that is missing a required tag. It's likely
  that the line will have no effect without this tag. <tt>install-menu</tt> may
  report this as an error during package installation.
 
@@ -150,3 +150,28 @@
  .
  Therefore, the absolute pathname to su-to-root is still required for Sarge
  packages.
+
+Tag: menu-item-needs-dwww
+Type: warning
+Info: The menu item has needs=dwww. This is deprecated. Instead, you should
+ register your documentation with doc-base, and dwww entries will be 
+ automatically generated.
+
+Tag: non-wm-in-windowmanager-menu-section
+Type: error
+Info: The menu item is in the WindowManager section but does not needs=wm.
+ Either it is a window manager and it should needs=wm, either it isn't and
+ then it must be moved in another section.
+
+Tag: non-wm-module-in-wm-module-menu-section
+Type: error
+Info: The menu item is in the WindowManager/Modules section but does not use
+ a window-manager specific needs, like needs="fvwmmodule", or needs="wmmaker".
+ You should make it needs the window manager it is a module for and add
+ support in the window-manager menu-method.
+
+Tag: unquoted-string-in-menu-item
+Type: warning
+Info: The menu item includes a tag with an unquoted string like section=Games
+ instead of section="Games". This is deprecated. Use a quoted string instead.
+Ref: menu 3.1

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2004-02-14 16:12:01 UTC (rev 38)
+++ trunk/debian/changelog	2004-02-15 00:21:39 UTC (rev 39)
@@ -34,9 +34,14 @@
      + Drop menu-icon-has-bad-colors, it doesn't apply anymore (Closes: #199341)
      + Menu sub-policy 3.6.0 added two sections (Closes: #207529)
      + Added three checks for correct su-to-root usage (Closes: #188095)
-       (based on patch by Bill Allombert <ballombe@debian.org>)
      + Understand icon32x32 and icon16x16 (Closes: #200046)
-       (based on patch by Bill Allombert <ballombe@debian.org>)
+     + Missing required tags are now an error (and check name changed)
+     + Check tag-quotation
+     + Rewrite needs check properly, being more precise what is allowed
+     + Complain about needs="dwww", as this is obsolete accordint to menu
+       maintainer
+       (parts menu-format updates based on patch by Bill Allombert
+       <ballombe@debian.org>)
    * checks/scripts
      + Recognise the 'tcl' interpreter, not the same as tclsh (Closes: #230182)
 

Modified: trunk/testset/binary/debian/menu
===================================================================
--- trunk/testset/binary/debian/menu	2004-02-14 16:12:01 UTC (rev 38)
+++ trunk/testset/binary/debian/menu	2004-02-15 00:21:39 UTC (rev 39)
@@ -1,5 +1,5 @@
 ?package(binary):needs=text title="Hello World" command="/usr/bin/hello"
 ?package(binary):needs=text section="Apps/System" title="Run cfdisk (0)" command="/usr/sbin/su-to-root cfdisk"
-?package(binary):needs=text section="Apps/System" title="Run cfdisk (1)" command="/usr/sbin/su-to-root -p cfdisk"
-?package(binary):needs=text section="Apps/System" title="Run cfdisk (2)" command="su-to-root -c cfdisk"
-?package(binary):needs=text section="Apps/System" title="Run cfdisk (3)" command="/usr/bin/su-to-root cfdisk"
+?package(binary):needs="text" section="Apps/System" title="Run cfdisk (1)" command="/usr/sbin/su-to-root -p cfdisk"
+?package(binary):needs="x11" section="WindowManagers" title="Run xfdisk" command="su-to-root -c xfdisk"
+?package(binary):needs="wm" section="Apps/System" title="Run fdisk-wm" command="/usr/bin/su-to-root cfdisk"

Modified: trunk/testset/info_tags.binary
===================================================================
--- trunk/testset/info_tags.binary	2004-02-14 16:12:01 UTC (rev 38)
+++ trunk/testset/info_tags.binary	2004-02-15 00:21:39 UTC (rev 39)
@@ -57,19 +57,21 @@
 N:   command 'dpkg-statoverride' gives admins more flexibility. Please see
 N:   the documentation of suidmanager and dpkg-statoverride for details.
 N:
-W: binary: menu-item-missing-important-tag section /usr/lib/menu/binary:1
+W: binary: unquoted-string-in-menu-item /usr/lib/menu/binary needs:1
 N:
-N:   The menu item has a line that is missing an important tag. It's likely
+N:   The menu item includes a tag with an unquoted string like
+N:   section=Games instead of section="Games". This is deprecated. Use a
+N:   quoted string instead.
+N:   
+N:   Refer to menu 3.1 for details.
+N:
+E: binary: menu-item-missing-required-tag section /usr/lib/menu/binary:1
+N:
+N:   The menu item has a line that is missing a required tag. It's likely
 N:   that the line will have no effect without this tag. install-menu may
 N:   report this as an error during package installation.
 N:
-E: binary: menu-item-adds-to-root-menu /usr/lib/menu/binary:1
-N:
-N:   The menu item has a line that specifies a section that will put a menu
-N:   item right in the root menu. Packages should never add items directly
-N:   to the root menu. Note that if you specify an empty section, this
-N:   error will pop up, as it will if you specify a section of "/".
-N:
+W: binary: unquoted-string-in-menu-item /usr/lib/menu/binary needs:2
 E: binary: su-to-root-without--c /usr/lib/menu/binary:2
 N:
 N:   The menu item command uses su-to-root without the -c flag. This is a
@@ -85,6 +87,12 @@
 N:   Therefore, the absolute pathname to su-to-root is still required for
 N:   Sarge packages.
 N:
+E: binary: non-wm-in-windowmanager-menu-section x11 /usr/lib/menu/binary:4
+N:
+N:   The menu item is in the WindowManager section but does not needs=wm.
+N:   Either it is a window manager and it should needs=wm, either it isn't
+N:   and then it must be moved in another section.
+N:
 E: binary: su-to-root-with-usr-bin /usr/lib/menu/binary:5
 N:
 N:   The menu item command use su-to-root using /usr/bin/su-to-root.
@@ -96,6 +104,12 @@
 N:   Therefore, the absolute pathname to su-to-root is still required for
 N:   Sarge packages.
 N:
+W: binary: menu-item-needs-tag-has-unknown-value wm /usr/lib/menu/binary:5
+N:
+N:   The menu item has a line that has a needs= field with a strange value.
+N:   This may be intentional, but it's probably a typo that will make menu
+N:   ignore the line.
+N:
 E: binary: unstripped-binary-or-object ./usr/bin/hello
 N:
 N:   The package installs an unstripped binary or object file.

Modified: trunk/testset/tags.binary
===================================================================
--- trunk/testset/tags.binary	2004-02-14 16:12:01 UTC (rev 38)
+++ trunk/testset/tags.binary	2004-02-15 00:21:39 UTC (rev 39)
@@ -5,12 +5,15 @@
 E: binary: postinst-does-not-call-updatemenus usr/lib/menu/binary
 E: binary: postrm-does-not-call-updatemenus usr/lib/menu/binary
 E: binary: suidregister-used-in-maintainer-script postinst
-W: binary: menu-item-missing-important-tag section /usr/lib/menu/binary:1
-E: binary: menu-item-adds-to-root-menu /usr/lib/menu/binary:1
+W: binary: unquoted-string-in-menu-item /usr/lib/menu/binary needs:1
+E: binary: menu-item-missing-required-tag section /usr/lib/menu/binary:1
+W: binary: unquoted-string-in-menu-item /usr/lib/menu/binary needs:2
 E: binary: su-to-root-without--c /usr/lib/menu/binary:2
 E: binary: su-to-root-without--c /usr/lib/menu/binary:3
 E: binary: su-to-root-without-usr-sbin /usr/lib/menu/binary:4
+E: binary: non-wm-in-windowmanager-menu-section x11 /usr/lib/menu/binary:4
 E: binary: su-to-root-with-usr-bin /usr/lib/menu/binary:5
+W: binary: menu-item-needs-tag-has-unknown-value wm /usr/lib/menu/binary:5
 E: binary: unstripped-binary-or-object ./usr/bin/hello
 E: binary: statically-linked-binary ./usr/bin/hello-static
 E: binary: changelog-file-not-compressed changelog



Reply to: