Author: rra
Date: 2007-07-24 04:30:09 +0200 (Tue, 24 Jul 2007)
New Revision: 930

Modified:
   trunk/checks/menu-format
   trunk/checks/menu-format.desc
   trunk/debian/changelog
   trunk/testset/binary/debian/menu
   trunk/testset/tags.binary
Log:
* checks/menu-format{.desc,}:
  + [RA] Switch to the new menu hierarchy, which will be in the next
    release of Policy.  Add specific checks for the major renamings to
    hopefully cut down on the confusion and provide some specific
    guidance.  Remove the code that allowed for applications to create
    new sub-menus, since the current menu documentation says not to do
    that.  (Closes: #431844)

Modified: trunk/checks/menu-format
===================================================================
--- trunk/checks/menu-format    2007-07-24 02:29:59 UTC (rev 929)
+++ trunk/checks/menu-format    2007-07-24 02:30:09 UTC (rev 930)
@@ -44,55 +44,77 @@
     );
 
 # 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 wm);
+# values are valid outside the Window Managers context (don't include wm here,
+# in other words).  It's case insensitive, use lower case here.
+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
 
 # This is a list of all valid section on the root menu.
-my @root_sections=qw(Apps Games Screen WindowManagers XShells Help);
+my @root_sections = ('Applications', 'Games', 'Help', 'Screen',
+                     'Window Managers', 'FVWM Modules', 'Window Maker');
 
 # This is a list of all valid sections a menu item or submenu can go in.
-# Note: toplevel sections that are by letter of policy allowed ('Apps',
-# 'Games' and 'Screen') are not included anyway, as their use is discouraged.
-my @sections=qw(
-               Apps/Databases
-               Apps/Editors
-               Apps/Education
-               Apps/Emulators
-               Apps/Graphics
-               Apps/Hamradio
-               Apps/Math
-               Apps/Net
-               Apps/Programming
-               Apps/Science
-               Apps/Tools
-               Apps/Technical
-               Apps/Text
-               Apps/Shells
-               Apps/Sound
-               Apps/Viewers
-               Apps/System
-               Games/Adventure
-               Games/Arcade
-               Games/Board
-               Games/Card
-               Games/Puzzles
-               Games/Simulation
-               Games/Sports
-               Games/Strategy
-               Games/Tetris-like
-               Games/Toys
-               Help
-               Screen/Lock
-               Screen/Save
-               Screen/Root-window
-               WindowManagers
-               WindowManagers/Modules
-               XShells
-              );
+my @sections = ('Applications/Accessibility',
+                'Applications/Amateur Radio',
+               'Applications/Data Management',
+               'Applications/Editors',
+               'Applications/Education',
+               'Applications/Emulators',
+                'Applications/File Management',
+               'Applications/Graphics',
+               'Applications/Mobile Devices',
+               'Applications/Network/Communication',
+                'Applications/Network/File Transfer',
+                'Applications/Network/Monitoring',
+                'Applications/Network/Web Browsing',
+                'Applications/Network/Web News',
+                'Applications/Office',
+               'Applications/Programming',
+                'Applications/Project Management',
+               'Applications/Science/Astronomy',
+                'Applications/Science/Biology',
+                'Applications/Science/Chemistry',
+                'Applications/Science/Data Analysis',
+                'Applications/Science/Electronics',
+                'Applications/Science/Engineering',
+                'Applications/Science/Geoscience',
+                'Applications/Science/Mathematics',
+                'Applications/Science/Medicine',
+                'Applications/Science/Physics',
+                'Applications/Science/Social',
+               'Applications/Shells',
+               'Applications/Sound',
+                'Applications/System/Administration',
+                'Applications/System/Hardware',
+                'Applications/System/Language Environment',
+                'Applications/System/Monitoring',
+                'Applications/System/Package Management',
+                'Applications/System/Security',
+                'Applications/Terminal Emulators',
+               'Applications/Text',
+                'Applications/TV and Radio',
+               'Applications/Video',
+               'Applications/Viewers',
+               'Applications/Web Development',
+                'Games/Action',
+               'Games/Adventure',
+                'Games/Blocks',
+               'Games/Board',
+               'Games/Card',
+               'Games/Puzzles',
+               'Games/Simulation',
+               'Games/Strategy',
+               'Games/Tools',
+               'Games/Toys',
+               'Help',
+               'Screen/Saving',
+                'Screen/Locking',
+                'Window Managers',
+                'FVWM Modules',
+                'Window Maker'
+               );
 
 # Path in which to search for binaries referenced in menu entries.
 my @path = qw(/usr/local/bin/ /usr/bin/ /bin/ /usr/X11R6/bin/ /usr/games/);
@@ -226,7 +248,7 @@
        tag "pkg-not-in-package-test", "$pkg_test $fullname";
     }
     $line =~ s/^\?package\(.*?\)://;
-       
+
     # Now collect all the tag=value pairs. I've heavily commented
     # the killer regexp that's responsible.
     #
@@ -279,7 +301,7 @@
 
        $vals{$tag} = $value;
     }
-       
+
     # This is not really a no-op. Note the use of the /c
     # switch - this makes perl keep track of the current
     # search position. Notice, we did it above in the loop,
@@ -288,7 +310,7 @@
     # string we matched. So the point of this line is to allow
     # trailing whitespace on the end of a line.
     $line =~ m/\s*/ogc;
-       
+
     # If that loop didn't match up to end of line, we have a
     # problem..
     if (pos($line) < length($line)) {
@@ -296,9 +318,9 @@
        # Give up now, before things just blow up in our face.
        return;
     }
-       
+
     # Now validate the data in the menu file.
-       
+
     # Test for important tags.
     foreach my $tag (@req_tags) {
        unless ( exists($vals{$tag}) && defined($vals{$tag}) ) {
@@ -309,7 +331,7 @@
            return;
        }
     }
-       
+
     # Make sure all tags are known.
     foreach my $tag (keys %vals) {
        if (! $known_tags_hash{$tag}) {
@@ -321,7 +343,7 @@
     my $section = $vals{'section'};
     $section =~ tr:/:/:s;      # eliminate duplicate slashes.
     $section =~ s:/$::;                # remove trailing slash.
-       
+
     # Read the file index:
     my %file_index;
     open(FILE_INDEX,"index") or fail("cannot open index file index: $!");
@@ -370,7 +392,7 @@
        if ($cmd
            && !($file_index{".$cmd"} || grep {$file_index{".".$_.$cmd}} @path)
            && ($tested_packages < 2)
-           && ($section !~ m:^WindowManagers/Modules:));
+           && ($section !~ m:^(WindowManagers/Modules|FVWM Modules|Window 
Maker):));
 
     if (exists($vals{'icon'})) {
        VerifyIcon($menufile, $fullname, $linecount, $vals{'icon'}, 32);
@@ -385,12 +407,12 @@
     # Check the needs tag.
     my $needs = lc($vals{'needs'}); # needs is case insensitive.
 
-    if ($section =~ m:^WindowManagers/Modules:) {
+    if ($section =~ m:^(WindowManagers/Modules|FVWM Modules|Window Maker):) {
        # WM/Modules: needs must not be the regular ones nor wm
        if ($needs_tag_vals_hash{$needs} or $needs eq "wm") {
            tag "non-wm-module-in-wm-modules-menu-section", "$needs 
$fullname:$linecount";
        }
-    } elsif ($section =~ m:^WindowManagers:) {
+    } elsif ($section =~ m:^Window ?Managers:) {
        # Other WM sections: needs must be wm
         if ($needs ne 'wm') {
            tag "non-wm-in-windowmanager-menu-section", "$needs 
$fullname:$linecount";
@@ -405,37 +427,31 @@
     }
 
     # Check the section tag
-       # Check for historical changes in the section tree.
-       if ($section =~ m:^Apps/Games:) {
-           tag "menu-item-uses-apps-games-section", "$fullname:$linecount";
-           $section =~ s:^Apps/::;
-       }
+    # Check for historical changes in the section tree.
+    if ($section =~ m:^Apps/Games:) {
+        tag "menu-item-uses-apps-games-section", "$fullname:$linecount";
+        $section =~ s:^Apps/::;
+    }
+    if ($section =~ m:^Apps/:) {
+        tag "menu-item-uses-apps-section", "$fullname:$linecount";
+        $section =~ s:^Apps/:Applications/:;
+    }
+    if ($section =~ m:^WindowManagers:) {
+        tag "menu-item-uses-windowmanagers-section", "$fullname:$linecount";
+        $section =~ s:^WindowManagers:Window Managers:;
+    }
 
-       # Check for Evil new root sections.
-       my ($rootsection) = $section =~ m:([^/]*):;
-       if (not $root_sections_hash{$rootsection}) {
-           if (not $rootsection =~ m/$pkg/i) {
-               tag "menu-item-creates-new-root-section", "$rootsection 
$fullname:$linecount";
-           }
-       } else {
-           # Check to see if the section is valid.
-           # It's ok to subdivide existing sections,
-           # the section just has to be rooted at
-           # a valid section.
-           my $s = undef;
-           my $ok = undef;
-           foreach (split(m:/:, $section)) {
-               $s .= "/" if $s;
-               $s .= $_;
-               if ($sections_hash{$s}) {
-                   $ok = 1;
-                   last;
-               }
-           }
-           if (! $ok) {
-               tag "menu-item-creates-new-section", "$vals{section} 
$fullname:$linecount";
-           }
-       }
+    # Check for Evil new root sections.
+    my ($rootsection) = $section =~ m:([^/]*):;
+    if (not $root_sections_hash{$rootsection}) {
+        if (not $rootsection =~ m/$pkg/i) {
+            tag "menu-item-creates-new-root-section", "$rootsection 
$fullname:$linecount";
+        }
+    } else {
+        if (not $sections_hash{$section}) {
+            tag "menu-item-creates-new-section", "$vals{section} 
$fullname:$linecount";
+        }
+    }
 }
 
 
@@ -476,7 +492,7 @@
     my $height = $2 + 0;
     my $numcolours = $3 + 0;
     my $cpp = $4 + 0;
-    
+
     if ($width > $size || $height > $size) {
        tag "menu-icon-too-big", "$icon: ${width}x${height} > ${size}x${size}";
     }

Modified: trunk/checks/menu-format.desc
===================================================================
--- trunk/checks/menu-format.desc       2007-07-24 02:29:59 UTC (rev 929)
+++ trunk/checks/menu-format.desc       2007-07-24 02:30:09 UTC (rev 930)
@@ -86,24 +86,31 @@
 Info: The menu item has a line that specifies a section under "Apps/Games".
  This section has been moved to just "Games".
 
+Tag: menu-item-uses-apps-section
+Type: warning
+Info: The menu item has a line that specifies a section under "Apps".
+ This section has been moved to "Applications".
+
+Tag: menu-item-uses-windowmanagers-section
+Type: warning
+Info: The menu item has a line that specifies a section under
+ "WindowManagers".  This section has been moved to "Window Managers".
+
 Tag: menu-item-creates-new-section
 Type: warning
-Info: The menu item has a line that specifies a new section to put a menu 
- entry in. This may be ok, but most menu entries should go in one of the 
- sections listed in the menu documentation.
- .
- Note that most root sections have to be subsectioned, and should not be
- used as sections directly.
- .
- See: http://www.debian.org/doc/packaging-manuals/menu-policy/ch2#s2.1
+Info: The menu item has a line that specifies an unknown section or uses a
+ section that is intended only as a menu root, not as a section that
+ applications should use directly.  Check the spelling of the section and
+ check the section against the list in the menu policy.  (The menu
+ sections changed as of June of 2007.)
 Ref: Debian Menu sub-policy 2.1
 
 Tag: menu-item-creates-new-root-section
 Type: error
 Info: The menu item has a line that specifies a new section to put a menu
- entry in, and this section appears right in the root menu. This is almost
- certainly an error, no new sections should be added to the root menu
- without discussion with the author of menu.
+ entry in, and this section appears right in the root menu.  This is
+ almost certainly an error.  No new sections should be added to the root
+ menu without discussion with the author of menu.
 
 Tag: menu-icon-not-in-xpm-format
 Type: error
@@ -157,16 +164,16 @@
 
 Tag: non-wm-in-windowmanager-menu-section
 Type: error
-Info: The menu item is in the WindowManager section but does not needs=wm.
+Info: The menu item is in the Window Manager 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.
+Info: The menu item is in the FVWM Modules or Window Maker 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

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2007-07-24 02:29:59 UTC (rev 929)
+++ trunk/debian/changelog      2007-07-24 02:30:09 UTC (rev 930)
@@ -7,8 +7,13 @@
       Cristau.  (Closes: #433516)
   * checks/files{.desc,}:
     + [RA] Check for .git directories in binary packages.
-  * checks/menu-format:
-    + [RA] wm is a valid needs value.  Thanks, Nico Golde.
+  * checks/menu-format{.desc,}:
+    + [RA] Switch to the new menu hierarchy, which will be in the next
+      release of Policy.  Add specific checks for the major renamings to
+      hopefully cut down on the confusion and provide some specific
+      guidance.  Remove the code that allowed for applications to create
+      new sub-menus, since the current menu documentation says not to do
+      that.  (Closes: #431844)
   * checks/scripts:
     + [RA] If rm output is redirected to /dev/null, don't think that rm is
       removing /dev/null.  Thanks, Robert Luberda.  (Closes: #431259)
@@ -30,7 +35,7 @@
     + [RA] Add \w+-backports to the known distribution list.  Thanks,
       Vincent Danjean.  (Closes: #432268)
 
- -- Russ Allbery <[EMAIL PROTECTED]>  Mon, 23 Jul 2007 11:52:38 -0700
+ -- Russ Allbery <[EMAIL PROTECTED]>  Mon, 23 Jul 2007 19:29:32 -0700
 
 lintian (1.23.32) unstable; urgency=low
 

Modified: trunk/testset/binary/debian/menu
===================================================================
--- trunk/testset/binary/debian/menu    2007-07-24 02:29:59 UTC (rev 929)
+++ trunk/testset/binary/debian/menu    2007-07-24 02:30:09 UTC (rev 930)
@@ -1,11 +1,18 @@
 ?package(binary):needs=text title="Hello World" command="/usr/bin/hello"
-?package(binary):needs=text section="Apps/System" title="Run cfdisk (0)" 
command="/usr/bin/su-to-root cfdisk"
-?package(binary):needs="text" section="Apps/System" title="Run cfdisk (1)" 
command="sux -p cfdisk"
-?package(binary):needs="x11" section="WindowManagers" title="Run xfdisk" 
command="/usr/sbin/su-to-root -c xfdisk"
-?package(binary):needs="wm" section="Apps/System" title="Run fdisk-wm" 
command="su-to-root -c hello"
-?package(binary):section="Apps/System" title="I'm not root!" 
command="su-to-root -c imnothere"
+?package(binary):needs=text section="Applications/System" title="Run cfdisk 
(0)" command="/usr/bin/su-to-root cfdisk"
+?package(binary):needs="text" section="Applications/System/Hardware" 
title="Run cfdisk (1)" command="sux -p cfdisk"
+?package(binary):needs="x11" section="Window Managers" title="Run xfdisk" 
command="/usr/sbin/su-to-root -c xfdisk"
+?package(binary):needs="wm" section="Applications/System/Administration" 
title="Run fdisk-wm" command="su-to-root -c hello"
+?package(binary):section="Apps/Games" title="I'm not root!" 
command="su-to-root -c imnothere"
 ?package(binary):needs="text" section="Apps/System" title="I'm not here!" 
command="/imnothere"
-?package(binary,other-binary):needs="text" section="Apps/System" title="more 
than one required" command="other-bin -s omething"
+?package(binary,other-binary):\
+ needs="text"\
+ section="Applications/Shells"\
+ title="more than one required"\
+ command="other-bin -s omething"
 ?package(binary):needs="wmmodule" section="WindowManagers/Modules" 
title="somemodule" command="ModuleCmd"
-?package(binary):needs="text" section="Apps/System" title="I'm not in 
/usr/bin!" command="iminusrbin"
-?package(binary):needs="text" section="Apps/System" title="I'm not root!" 
command="su-to-root -c imnothere"
+?package(binary):needs="wmmodule" section="FVWM Modules" title="somemodule" 
command="ModuleCmd"
+?package(binary):needs="text" section="Applications/System/Administration" 
title="I'm not in /usr/bin!" command="iminusrbin"
+?package(binary):needs="text"\
+ section="Applications/System/Administration"\
+ title="I'm not root!" command="su-to-root -c imnothere"

Modified: trunk/testset/tags.binary
===================================================================
--- trunk/testset/tags.binary   2007-07-24 02:29:59 UTC (rev 929)
+++ trunk/testset/tags.binary   2007-07-24 02:30:09 UTC (rev 930)
@@ -53,13 +53,23 @@
 W: binary: file-in-unusual-dir usr/bar
 W: binary: file-in-unusual-dir usr/bar2
 W: binary: file-in-unusual-dir usr/foo
-W: binary: menu-command-not-in-package /usr/lib/menu/binary:11 imnothere
+W: binary: menu-command-not-in-package /usr/lib/menu/binary:18 imnothere
 W: binary: menu-command-not-in-package /usr/lib/menu/binary:7 /imnothere
-W: binary: menu-command-not-in-package /usr/share/menu/binary:11 imnothere
+W: binary: menu-command-not-in-package /usr/share/menu/binary:18 imnothere
 W: binary: menu-command-not-in-package /usr/share/menu/binary:7 /imnothere
 W: binary: menu-file-in-usr-lib usr/lib/menu/binary
+W: binary: menu-item-creates-new-section Applications/System 
/usr/lib/menu/binary:2
+W: binary: menu-item-creates-new-section Applications/System 
/usr/share/menu/binary:2
+W: binary: menu-item-creates-new-section Apps/System /usr/lib/menu/binary:7
+W: binary: menu-item-creates-new-section Apps/System /usr/share/menu/binary:7
+W: binary: menu-item-creates-new-section WindowManagers/Modules 
/usr/lib/menu/binary:13
+W: binary: menu-item-creates-new-section WindowManagers/Modules 
/usr/share/menu/binary:13
 W: binary: menu-item-needs-tag-has-unknown-value wm /usr/lib/menu/binary:5
 W: binary: menu-item-needs-tag-has-unknown-value wm /usr/share/menu/binary:5
+W: binary: menu-item-uses-apps-section /usr/lib/menu/binary:7
+W: binary: menu-item-uses-apps-section /usr/share/menu/binary:7
+W: binary: menu-item-uses-windowmanagers-section /usr/lib/menu/binary:13
+W: binary: menu-item-uses-windowmanagers-section /usr/share/menu/binary:13
 W: binary: old-fsf-address-in-copyright-file
 W: binary: package-contains-hardlink usr/bar2 -> usr/share/baz
 W: binary: package-contains-upstream-install-documentation 
usr/share/doc/binary/INSTALL


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to