tags 434989 +patch thanks On 07/07/28 08:26 +0100, Colin Tuckley said ... > linda croaks about packages adopting the new menu policy > especially about the renamed sections like Applications.
Attached patches fix this. The changes are as follows: - Migrate to the new menu structure (per menu-2.1.36 package) - Add warning second-level-section-bad for cases when the second level section _must_ have a leaf section associated with it - Add warning unknown-menu-leafsection for cases when the leaf (third) section is unknown - Correct msgid "top-level-section-bad_s" for grammar in en.po - Correctly list the exceptions for top level section in en.po - Add test cases for new warnings. - Extract the tests/binary_menu.tar.gz file and apply the second patch and re-pack into new tests/binary_menu.tar.gz for test cases to work Giridhar -- Y Giridhar Appaji Nag | http://www.appaji.net/
diff -Nur original/linda-0.3.26/checks/menu.py linda/linda-0.3.26/checks/menu.py --- original/linda-0.3.26/checks/menu.py 2006-05-16 18:25:03.000000000 +0530 +++ linda/linda-0.3.26/checks/menu.py 2007-11-16 16:42:39.655568000 +0530 @@ -49,25 +49,101 @@ if not found: self.signal_error('command-not-exist', [unquoted]) def check_section(self): - sections = {'Apps': ('Databases', 'Editors', 'Education', \ - 'Emulators', 'Graphics', 'Hamradio', 'Math', 'Net', \ - 'Programming', 'Science', 'Tools', 'Technical', 'Text', \ - 'Shells', 'Sound', 'Viewers', 'System'), 'Games': ('Adventure', \ - 'Arcade', 'Board', 'Card', 'Puzzles', 'Simulation', 'Sports', \ - 'Strategy', 'Tetris-like', 'Toys'), 'Help': (), 'Screen': \ - ('Lock', 'Save', 'Root-window'), 'WindowManagers': ('Modules'), \ - 'XShells': ()} + sections = { + 'Applications': { + 'Accessibility': (), + 'Amateur Radio': (), + 'Data Management': (), + 'Editors': (), + 'Education': (), + 'Emulators': (), + 'File Management': (), + 'Graphics': (), + 'Mobile Devices': (), + 'Network': ( + 'Communication', + 'File Transfer', + 'Monitoring', + 'Web Browsing', + 'Web News' + ), + 'Office': (), + 'Programming': (), + 'Project Management': (), + 'Science': ( + 'Astronomy', + 'Biology', + 'Chemistry', + 'Data Analysis', + 'Electronics', + 'Engineering', + 'Geoscience', + 'Mathematics', + 'Medicine', + 'Physics', + 'Social' + ), + 'Shells': (), + 'Sound': (), + 'System': ( + 'Administration', + 'Hardware', + 'Language Environment', + 'Monitoring', + 'Package Management', + 'Security' + ), + 'Terminal Emulators': (), + 'Text': (), + 'TV and Radio': (), + 'Viewers': (), + 'Video': (), + 'Web Development': () + }, + 'Games': { + 'Action': (), + 'Adventure': (), + 'Blocks': (), + 'Board': (), + 'Card': (), + 'Puzzles': (), + 'Simulation': (), + 'Strategy': (), + 'Tools': (), + 'Toys': () + }, + 'Help': {}, + 'Screen': { + 'Saving': (), + 'Locking': () + }, + 'Window Managers': {}, + 'FVWM Modules': {}, + 'Window Maker': {} + } for menu in self.menu_files.keys(): for stanza in self.menu_files[menu].menu_file: tmp_sect = unquote(stanza['fields']['section']).split('/') if sections.has_key(tmp_sect[0]): + sub_sections = sections[tmp_sect[0]] if len(tmp_sect) == 1: - if sections[tmp_sect[0]] and tmp_sect[0] != \ - "WindowManagers": + if len(sub_sections) != 0: self.signal_error('top-level-section-bad', \ [tmp_sect[0]]) - elif tmp_sect: - if tmp_sect[1] not in sections[tmp_sect[0]]: + elif len(tmp_sect) == 2: + if sub_sections.has_key(tmp_sect[1]): + if len(sub_sections[tmp_sect[1]]) != 0: + self.signal_error('second-level-section-bad', \ + [tmp_sect[1]]) + else: + self.signal_error('unknown-menu-subsection', \ + [tmp_sect[1]]) + else: + if sub_sections.has_key(tmp_sect[1]): + if tmp_sect[2] not in sub_sections[tmp_sect[1]]: + self.signal_error('unknown-menu-leafsection', \ + [tmp_sect[2]]); + else: self.signal_error('unknown-menu-subsection', \ [tmp_sect[1]]) else: diff -Nur original/linda-0.3.26/data/menu.data linda/linda-0.3.26/data/menu.data --- original/linda-0.3.26/data/menu.data 2006-01-14 13:55:54.000000000 +0530 +++ linda/linda-0.3.26/data/menu.data 2007-11-16 15:46:48.339462000 +0530 @@ -10,9 +10,15 @@ Tag: unknown-menu-section Type: Warning +Tag: second-level-section-bad +Type: Warning + Tag: unknown-menu-subsection Type: Warning +Tag: unknown-menu-leafsection +Type: Warning + Tag: menu-files-in-usr-lib-menu Type: Warning diff -Nur original/linda-0.3.26/munge_po linda/linda-0.3.26/munge_po --- original/linda-0.3.26/munge_po 2006-04-11 15:00:37.000000000 +0530 +++ linda/linda-0.3.26/munge_po 2007-11-16 15:53:13.180125000 +0530 @@ -98,7 +98,8 @@ 'devhelp-file-not-in-dir', 'bashism-in-maint', \ 'libdir-not-equal-dir', 'command-not-quoted', \ 'command-not-exist', 'unknown-menu-section', \ - 'unknown-menu-subsection', 'top-level-section-bad', \ + 'unknown-menu-subsection', 'unknown-menu-leafsection', \ + 'top-level-section-bad', 'second-level-section-bad', \ 'lib-not-in-shlibs', 'shlibs-sover-mismatch', 'no-shlib-file', \ 'menu-files-in-usr-lib-menu', 'non-free-truetype-font', \ 'duplicate-truetype-font', 'missing-section-in-source', \ diff -Nur original/linda-0.3.26/po/en.po linda/linda-0.3.26/po/en.po --- original/linda-0.3.26/po/en.po 2007-04-27 12:54:34.000000000 +0530 +++ linda/linda-0.3.26/po/en.po 2007-11-16 15:49:36.203064000 +0530 @@ -2200,13 +2200,13 @@ "/usr/lib/menu, and is not quoted correctly." msgid "top-level-section-bad_s" -msgstr "The menu file section %s should not a top-level section" +msgstr "The menu file section %s should not be a top-level section" msgid "top-level-section-bad_l" msgstr "" "The section shown above contained in a menu file should not be set to a " "top-level section, as Menu Policy forbids this. Current exceptions are " -"Help and XShells." +"Help, Window Managers, FVWM Modules and Window Maker." msgid "unknown-menu-section_s" msgstr "The menu file has section %s, which is unknown." @@ -2216,6 +2216,15 @@ "The menu file contains the section shown above, which is unknown. " "The current list is taken from Debian Menu Policy." +msgid "second-level-section-bad_s" +msgstr "The menu file section %s should not be a second-level section" + +msgid "second-level-section-bad_l" +msgstr "" +"The section shown above contained in a menu file should not be set to a " +"second-level section, as Menu Policy forbids this. This second-level" +"section needs a leaf section also." + msgid "unknown-menu-subsection_s" msgstr "The menu file has subsection %s, which is unknown." @@ -2224,6 +2233,14 @@ "The menu file contains the subsection shown above, which is unknown. " "The current list is taken from Debian Menu Policy." +msgid "unknown-menu-leafsection_s" +msgstr "The menu file has leafsection %s, which is unknown." + +msgid "unknown-menu-leafsection_l" +msgstr "" +"The menu file contains the leafsection shown above, which is unknown. " +"The current list is taken from Debian Menu Policy." + msgid "lib-not-in-shlibs_s" msgstr "The library %s is not in a shlibs file." diff -Nur original/linda-0.3.26/tests/binary_menu.py linda/linda-0.3.26/tests/binary_menu.py --- original/linda-0.3.26/tests/binary_menu.py 2006-05-16 13:37:53.000000000 +0530 +++ linda/linda-0.3.26/tests/binary_menu.py 2007-11-16 16:51:13.843517000 +0530 @@ -120,6 +120,22 @@ self.assert_('top-level-section-bad' in self.instance.err_dict.keys()) self.assertEqual(self.po_keys.compare(self.instance.err_dict, \ 'top-level-section-bad'), True) + self.instance.err_dict.clear() + self.instance.menu_files['/usr/lib/menu/paw'] = \ + MenuParser(os.path.join(self.instance.information['dir'], \ + 'paw.sl')) + method() + self.assert_('second-level-section-bad' in self.instance.err_dict.keys()) + self.assertEqual(self.po_keys.compare(self.instance.err_dict, \ + 'second-level-section-bad'), True) + self.instance.err_dict.clear() + self.instance.menu_files['/usr/lib/menu/paw'] = \ + MenuParser(os.path.join(self.instance.information['dir'], \ + 'paw.bl')) + method() + self.assert_('unknown-menu-leafsection' in self.instance.err_dict.keys()) + self.assertEqual(self.po_keys.compare(self.instance.err_dict, \ + 'unknown-menu-leafsection'), True) def test_check_quoting(self): "Check check_quoting() method of MenuCheck"
diff -Nur binary_menu.orig/icewm-lite binary_menu/icewm-lite --- binary_menu.orig/icewm-lite 2006-05-16 13:35:37.000000000 +0530 +++ binary_menu/icewm-lite 2007-11-16 13:16:37.306191000 +0530 @@ -1,4 +1,3 @@ - ?package(icewm-lite):command="/usr/bin/icewm-lite" needs="wm" \ - section="WindowManagers" title="IceWM-lite" \ + section="Window Managers" title="IceWM-lite" \ icon="/usr/share/icewm/icons/icewm_16x16.xpm" diff -Nur binary_menu.orig/paw binary_menu/paw --- binary_menu.orig/paw 2005-06-19 15:55:08.000000000 +0530 +++ binary_menu/paw 2007-11-16 13:06:42.000000000 +0530 @@ -1,5 +1,5 @@ ?package(paw):needs="text" \ - section="Apps/Science" \ + section="Applications/Science/Physics" \ title="PAW" \ longtitle="The Physics Analysis Workstation" \ icon="/usr/share/pixmaps/paw32x32.xpm" \ diff -Nur binary_menu.orig/paw.bl binary_menu/paw.bl --- binary_menu.orig/paw.bl 1970-01-01 05:30:00.000000000 +0530 +++ binary_menu/paw.bl 2007-11-16 13:18:05.084634000 +0530 @@ -0,0 +1,6 @@ +?package(paw):needs="text" \ + section="Applications/Science/Alchemy" \ + title="PAW" \ + longtitle="The Physics Analysis Workstation" \ + icon="/usr/share/pixmaps/paw32x32.xpm" \ + command="sh -c 'paw -d X11.dynamic -w `[ x${DISPLAY} = x ] ; echo $?`'" diff -Nur binary_menu.orig/paw.sl binary_menu/paw.sl --- binary_menu.orig/paw.sl 1970-01-01 05:30:00.000000000 +0530 +++ binary_menu/paw.sl 2007-11-16 16:33:42.390383000 +0530 @@ -0,0 +1,6 @@ +?package(paw):needs="text" \ + section="Applications/Science" \ + title="PAW" \ + longtitle="The Physics Analysis Workstation" \ + icon="/usr/share/pixmaps/paw32x32.xpm" \ + command="sh -c 'paw -d X11.dynamic -w `[ x${DISPLAY} = x ] ; echo $?`'" diff -Nur binary_menu.orig/xine-ui binary_menu/xine-ui --- binary_menu.orig/xine-ui 2005-04-03 05:14:10.000000000 +0530 +++ binary_menu/xine-ui 2007-11-16 13:04:57.000000000 +0530 @@ -1,3 +1,3 @@ -?package(xine-ui):needs=X11 section=Apps/Viewers\ +?package(xine-ui):needs=X11 section=Applications/Viewers\ title="xine media player" command="/usr/bin/xine" \ hints="Video" icon="/usr/share/xine/desktop/xine.xpm" diff -Nur binary_menu.orig/xine-ui.broken binary_menu/xine-ui.broken --- binary_menu.orig/xine-ui.broken 2005-04-07 13:41:11.000000000 +0530 +++ binary_menu/xine-ui.broken 2007-11-16 13:05:07.000000000 +0530 @@ -1,3 +1,3 @@ -?package(xine-ui):needs=X11 section=Apps/Foo\ +?package(xine-ui):needs=X11 section=Applications/Foo\ title="xine media player" command=/usr/bin/xine \ hints="Video" icon="/usr/share/xine/desktop/xine.xpm" diff -Nur binary_menu.orig/xine-ui.tl binary_menu/xine-ui.tl --- binary_menu.orig/xine-ui.tl 2005-04-07 13:50:05.000000000 +0530 +++ binary_menu/xine-ui.tl 2007-11-16 13:14:22.000000000 +0530 @@ -1,3 +1,3 @@ -?package(xine-ui):needs=X11 section=Apps\ +?package(xine-ui):needs=X11 section=Applications\ title="xine media player" command=/usr/bin/xine \ hints="Video" icon="/usr/share/xine/desktop/xine.xpm"
signature.asc
Description: Digital signature