From d7a3916b3eb8c9dda6c3c023b9e64e5616ece5ab Mon Sep 17 00:00:00 2001 From: Michael Palimaka Date: Thu, 13 Sep 2012 01:22:25 +1000 Subject: [PATCH] validate: related categories are no longer always required This drops all related category validation, with the exception of "Category1;Category2" (compare with "Category1 or Category 2). In the former case, if one category is present, validation is still performed to ensure that the other is too. See http://cgit.freedesktop.org/xdg/xdg-specs/commit?id=5a9f05d86973 See https://bugs.freedesktop.org/show_bug.cgi?id=35844 --- src/validate.c | 178 +++++++++++++++++++++++++++++++-------------------------- 1 file changed, 96 insertions(+), 82 deletions(-) diff --git a/src/validate.c b/src/validate.c index 047767e..e25b6ff 100644 --- a/src/validate.c +++ b/src/validate.c @@ -382,124 +382,122 @@ static struct { { "Settings", TRUE, FALSE, FALSE, { NULL } }, { "System", TRUE, FALSE, FALSE, { NULL } }, { "Utility", TRUE, FALSE, FALSE, { NULL } }, - { "Audio", FALSE, FALSE, FALSE, { "Development", NULL } }, - { "Video", FALSE, FALSE, FALSE, { "Development", NULL } }, - { "Building", FALSE, FALSE, FALSE, { "Development", NULL } }, - { "Debugger", FALSE, FALSE, FALSE, { "Development", NULL } }, - { "IDE", FALSE, FALSE, FALSE, { "Development", NULL } }, - { "GUIDesigner", FALSE, FALSE, FALSE, { "Development", NULL } }, - { "Profiling", FALSE, FALSE, FALSE, { "Development", NULL } }, - { "RevisionControl", FALSE, FALSE, FALSE, { "Development", NULL } }, - { "Translation", FALSE, FALSE, FALSE, { "Development", NULL } }, - { "Calendar", FALSE, FALSE, FALSE, { "Office", NULL } }, - { "ContactManagement", FALSE, FALSE, FALSE, { "Office", NULL } }, - { "Database", FALSE, FALSE, FALSE, { "Office", "Development", "AudioVideo", NULL } }, + { "Building", FALSE, FALSE, FALSE, { NULL } }, + { "Debugger", FALSE, FALSE, FALSE, { NULL } }, + { "IDE", FALSE, FALSE, FALSE, { NULL } }, + { "GUIDesigner", FALSE, FALSE, FALSE, { NULL } }, + { "Profiling", FALSE, FALSE, FALSE, { NULL } }, + { "RevisionControl", FALSE, FALSE, FALSE, { NULL } }, + { "Translation", FALSE, FALSE, FALSE, { NULL } }, + { "Calendar", FALSE, FALSE, FALSE, { NULL } }, + { "ContactManagement", FALSE, FALSE, FALSE, { NULL } }, + { "Database", FALSE, FALSE, FALSE, { NULL } }, { "Dictionary", FALSE, FALSE, FALSE, { "Office;TextTools", NULL } }, - { "Chart", FALSE, FALSE, FALSE, { "Office", NULL } }, + { "Chart", FALSE, FALSE, FALSE, { NULL } }, { "Email", FALSE, FALSE, FALSE, { "Office;Network", NULL } }, - { "Finance", FALSE, FALSE, FALSE, { "Office", NULL } }, - { "FlowChart", FALSE, FALSE, FALSE, { "Office", NULL } }, - { "PDA", FALSE, FALSE, FALSE, { "Office", NULL } }, + { "Finance", FALSE, FALSE, FALSE, { NULL } }, + { "FlowChart", FALSE, FALSE, FALSE, { NULL } }, + { "PDA", FALSE, FALSE, FALSE, { NULL } }, { "ProjectManagement", FALSE, FALSE, FALSE, { "Office;Development", NULL } }, - { "Presentation", FALSE, FALSE, FALSE, { "Office", NULL } }, - { "Spreadsheet", FALSE, FALSE, FALSE, { "Office", NULL } }, - { "WordProcessor", FALSE, FALSE, FALSE, { "Office", NULL } }, - { "2DGraphics", FALSE, FALSE, FALSE, { "Graphics", NULL } }, + { "Presentation", FALSE, FALSE, FALSE, { NULL } }, + { "Spreadsheet", FALSE, FALSE, FALSE, { NULL } }, + { "WordProcessor", FALSE, FALSE, FALSE, { NULL } }, + { "2DGraphics", FALSE, FALSE, FALSE, { NULL } }, { "VectorGraphics", FALSE, FALSE, FALSE, { "Graphics;2DGraphics", NULL } }, { "RasterGraphics", FALSE, FALSE, FALSE, { "Graphics;2DGraphics", NULL } }, - { "3DGraphics", FALSE, FALSE, FALSE, { "Graphics", NULL } }, - { "Scanning", FALSE, FALSE, FALSE, { "Graphics", NULL } }, + { "3DGraphics", FALSE, FALSE, FALSE, { NULL } }, + { "Scanning", FALSE, FALSE, FALSE, { NULL } }, { "OCR", FALSE, FALSE, FALSE, { "Graphics;Scanning", NULL } }, - { "Photography", FALSE, FALSE, FALSE, { "Graphics", "Office", NULL } }, - { "Publishing", FALSE, FALSE, FALSE, { "Graphics", "Office", NULL } }, - { "Viewer", FALSE, FALSE, FALSE, { "Graphics", "Office", NULL } }, - { "TextTools", FALSE, FALSE, FALSE, { "Utility", NULL } }, - { "DesktopSettings", FALSE, FALSE, FALSE, { "Settings", NULL } }, - { "HardwareSettings", FALSE, FALSE, FALSE, { "Settings", NULL } }, + { "Photography", FALSE, FALSE, FALSE, { NULL } }, + { "Publishing", FALSE, FALSE, FALSE, { NULL } }, + { "Viewer", FALSE, FALSE, FALSE, { NULL } }, + { "TextTools", FALSE, FALSE, FALSE, { NULL } }, + { "DesktopSettings", FALSE, FALSE, FALSE, { NULL } }, + { "HardwareSettings", FALSE, FALSE, FALSE, { NULL } }, { "Printing", FALSE, FALSE, FALSE, { "HardwareSettings;Settings", NULL } }, - { "PackageManager", FALSE, FALSE, FALSE, { "Settings", NULL } }, - { "Dialup", FALSE, FALSE, FALSE, { "Network", NULL } }, - { "InstantMessaging", FALSE, FALSE, FALSE, { "Network", NULL } }, - { "Chat", FALSE, FALSE, FALSE, { "Network", NULL } }, - { "IRCClient", FALSE, FALSE, FALSE, { "Network", NULL } }, - { "FileTransfer", FALSE, FALSE, FALSE, { "Network", NULL } }, - { "HamRadio", FALSE, FALSE, FALSE, { "Network", "Audio", NULL } }, - { "News", FALSE, FALSE, FALSE, { "Network", NULL } }, - { "P2P", FALSE, FALSE, FALSE, { "Network", NULL } }, - { "RemoteAccess", FALSE, FALSE, FALSE, { "Network", NULL } }, - { "Telephony", FALSE, FALSE, FALSE, { "Network", NULL } }, - { "TelephonyTools", FALSE, FALSE, FALSE, { "Utility", NULL } }, - { "VideoConference", FALSE, FALSE, FALSE, { "Network", NULL } }, - { "WebBrowser", FALSE, FALSE, FALSE, { "Network", NULL } }, - { "WebDevelopment", FALSE, FALSE, FALSE, { "Network", "Development", NULL } }, + { "PackageManager", FALSE, FALSE, FALSE, { NULL } }, + { "Dialup", FALSE, FALSE, FALSE, { NULL } }, + { "InstantMessaging", FALSE, FALSE, FALSE, { NULL } }, + { "Chat", FALSE, FALSE, FALSE, { NULL } }, + { "IRCClient", FALSE, FALSE, FALSE, { NULL } }, + { "FileTransfer", FALSE, FALSE, FALSE, { NULL } }, + { "HamRadio", FALSE, FALSE, FALSE, { NULL } }, + { "News", FALSE, FALSE, FALSE, { NULL } }, + { "P2P", FALSE, FALSE, FALSE, { NULL } }, + { "RemoteAccess", FALSE, FALSE, FALSE, { NULL } }, + { "Telephony", FALSE, FALSE, FALSE, { NULL } }, + { "TelephonyTools", FALSE, FALSE, FALSE, { NULL } }, + { "VideoConference", FALSE, FALSE, FALSE, { NULL } }, + { "WebBrowser", FALSE, FALSE, FALSE, { NULL } }, + { "WebDevelopment", FALSE, FALSE, FALSE, { NULL } }, { "Midi", FALSE, FALSE, FALSE, { "AudioVideo;Audio", NULL } }, { "Mixer", FALSE, FALSE, FALSE, { "AudioVideo;Audio", NULL } }, { "Sequencer", FALSE, FALSE, FALSE, { "AudioVideo;Audio", NULL } }, { "Tuner", FALSE, FALSE, FALSE, { "AudioVideo;Audio", NULL } }, { "TV", FALSE, FALSE, FALSE, { "AudioVideo;Video", NULL } }, - { "AudioVideoEditing", FALSE, FALSE, FALSE, { "Audio", "Video", "AudioVideo", NULL } }, - { "Player", FALSE, FALSE, FALSE, { "Audio", "Video", "AudioVideo", NULL } }, - { "Recorder", FALSE, FALSE, FALSE, { "Audio", "Video", "AudioVideo", NULL } }, - { "DiscBurning", FALSE, FALSE, FALSE, { "Audio", "Video", "AudioVideo", NULL } }, - { "ActionGame", FALSE, FALSE, FALSE, { "Game", NULL } }, - { "AdventureGame", FALSE, FALSE, FALSE, { "Game", NULL } }, - { "ArcadeGame", FALSE, FALSE, FALSE, { "Game", NULL } }, - { "BoardGame", FALSE, FALSE, FALSE, { "Game", NULL } }, - { "BlocksGame", FALSE, FALSE, FALSE, { "Game", NULL } }, - { "CardGame", FALSE, FALSE, FALSE, { "Game", NULL } }, - { "KidsGame", FALSE, FALSE, FALSE, { "Game", NULL } }, - { "LogicGame", FALSE, FALSE, FALSE, { "Game", NULL } }, - { "RolePlaying", FALSE, FALSE, FALSE, { "Game", NULL } }, - { "Simulation", FALSE, FALSE, FALSE, { "Game", NULL } }, - { "SportsGame", FALSE, FALSE, FALSE, { "Game", NULL } }, - { "StrategyGame", FALSE, FALSE, FALSE, { "Game", NULL } }, - { "Art", FALSE, FALSE, FALSE, { "Education", NULL } }, - { "Construction", FALSE, FALSE, FALSE, { "Education", NULL } }, + { "AudioVideoEditing", FALSE, FALSE, FALSE, { NULL } }, + { "Player", FALSE, FALSE, FALSE, { NULL } }, + { "Recorder", FALSE, FALSE, FALSE, { NULL } }, + { "DiscBurning", FALSE, FALSE, FALSE, { NULL } }, + { "ActionGame", FALSE, FALSE, FALSE, { NULL } }, + { "AdventureGame", FALSE, FALSE, FALSE, { NULL } }, + { "ArcadeGame", FALSE, FALSE, FALSE, { NULL } }, + { "BoardGame", FALSE, FALSE, FALSE, { NULL } }, + { "BlocksGame", FALSE, FALSE, FALSE, { NULL } }, + { "CardGame", FALSE, FALSE, FALSE, { NULL } }, + { "KidsGame", FALSE, FALSE, FALSE, { NULL } }, + { "LogicGame", FALSE, FALSE, FALSE, { NULL } }, + { "RolePlaying", FALSE, FALSE, FALSE, { NULL } }, + { "Simulation", FALSE, FALSE, FALSE, { NULL } }, + { "SportsGame", FALSE, FALSE, FALSE, { NULL } }, + { "StrategyGame", FALSE, FALSE, FALSE, { NULL } }, + { "Art", FALSE, FALSE, FALSE, { NULL } }, + { "Construction", FALSE, FALSE, FALSE, { NULL } }, { "Music", FALSE, FALSE, FALSE, { "AudioVideo;Education", NULL } }, - { "Languages", FALSE, FALSE, FALSE, { "Education", NULL } }, - { "Science", FALSE, FALSE, FALSE, { "Education", NULL } }, + { "Languages", FALSE, FALSE, FALSE, { NULL } }, + { "Science", FALSE, FALSE, FALSE, { NULL } }, { "ArtificialIntelligence", FALSE, FALSE, FALSE, { "Education;Science", NULL } }, { "Astronomy", FALSE, FALSE, FALSE, { "Education;Science", NULL } }, { "Biology", FALSE, FALSE, FALSE, { "Education;Science", NULL } }, { "Chemistry", FALSE, FALSE, FALSE, { "Education;Science", NULL } }, { "ComputerScience", FALSE, FALSE, FALSE, { "Education;Science", NULL } }, { "DataVisualization", FALSE, FALSE, FALSE, { "Education;Science", NULL } }, - { "Economy", FALSE, FALSE, FALSE, { "Education", NULL } }, + { "Economy", FALSE, FALSE, FALSE, { NULL } }, { "Electricity", FALSE, FALSE, FALSE, { "Education;Science", NULL } }, - { "Geography", FALSE, FALSE, FALSE, { "Education", NULL } }, + { "Geography", FALSE, FALSE, FALSE, { NULL } }, { "Geology", FALSE, FALSE, FALSE, { "Education;Science", NULL } }, { "Geoscience", FALSE, FALSE, FALSE, { "Education;Science", NULL } }, - { "History", FALSE, FALSE, FALSE, { "Education", NULL } }, + { "History", FALSE, FALSE, FALSE, { NULL } }, { "ImageProcessing", FALSE, FALSE, FALSE, { "Education;Science", NULL } }, - { "Literature", FALSE, FALSE, FALSE, { "Education", NULL } }, + { "Literature", FALSE, FALSE, FALSE, { NULL } }, { "Math", FALSE, FALSE, FALSE, { "Education;Science", NULL } }, { "NumericalAnalysis", FALSE, FALSE, FALSE, { "Education;Science;Math", NULL } }, { "MedicalSoftware", FALSE, FALSE, FALSE, { "Education;Science", NULL } }, { "Physics", FALSE, FALSE, FALSE, { "Education;Science", NULL } }, { "Robotics", FALSE, FALSE, FALSE, { "Education;Science", NULL } }, - { "Sports", FALSE, FALSE, FALSE, { "Education", NULL } }, + { "Sports", FALSE, FALSE, FALSE, { NULL } }, { "ParallelComputing", FALSE, FALSE, FALSE, { "Education;Science;ComputerScience", NULL } }, { "Amusement", FALSE, FALSE, FALSE, { NULL } }, - { "Archiving", FALSE, FALSE, FALSE, { "Utility", NULL } }, + { "Archiving", FALSE, FALSE, FALSE, { NULL } }, { "Compression", FALSE, FALSE, FALSE, { "Utility;Archiving", NULL } }, { "Electronics", FALSE, FALSE, FALSE, { NULL } }, - { "Emulator", FALSE, FALSE, FALSE, { "System", "Game", NULL } }, + { "Emulator", FALSE, FALSE, FALSE, { NULL } }, { "Engineering", FALSE, FALSE, FALSE, { NULL } }, - { "FileTools", FALSE, FALSE, FALSE, { "Utility", "System", NULL } }, + { "FileTools", FALSE, FALSE, FALSE, { NULL } }, { "FileManager", FALSE, FALSE, FALSE, { "System;FileTools", NULL } }, - { "TerminalEmulator", FALSE, FALSE, FALSE, { "System", NULL } }, - { "Filesystem", FALSE, FALSE, FALSE, { "System", NULL } }, - { "Monitor", FALSE, FALSE, FALSE, { "System", NULL } }, - { "Security", FALSE, FALSE, FALSE, { "Settings", "System", NULL } }, - { "Accessibility", FALSE, FALSE, FALSE, { "Settings", "Utility", NULL } }, - { "Calculator", FALSE, FALSE, FALSE, { "Utility", NULL } }, - { "Clock", FALSE, FALSE, FALSE, { "Utility", NULL } }, - { "TextEditor", FALSE, FALSE, FALSE, { "Utility", NULL } }, + { "TerminalEmulator", FALSE, FALSE, FALSE, { NULL } }, + { "Filesystem", FALSE, FALSE, FALSE, { NULL } }, + { "Monitor", FALSE, FALSE, FALSE, { NULL } }, + { "Security", FALSE, FALSE, FALSE, { NULL } }, + { "Accessibility", FALSE, FALSE, FALSE, { NULL } }, + { "Calculator", FALSE, FALSE, FALSE, { NULL } }, + { "Clock", FALSE, FALSE, FALSE, { NULL } }, + { "TextEditor", FALSE, FALSE, FALSE, { NULL } }, { "Documentation", FALSE, FALSE, FALSE, { NULL } }, { "Core", FALSE, FALSE, FALSE, { NULL } }, - { "KDE", FALSE, FALSE, FALSE, { "Qt", NULL } }, - { "GNOME", FALSE, FALSE, FALSE, { "GTK", NULL } }, - { "XFCE", FALSE, FALSE, FALSE, { "GTK", NULL } }, + { "KDE", FALSE, FALSE, FALSE, { NULL } }, + { "GNOME", FALSE, FALSE, FALSE, { NULL } }, + { "XFCE", FALSE, FALSE, FALSE, { NULL } }, { "GTK", FALSE, FALSE, FALSE, { NULL } }, { "Qt", FALSE, FALSE, FALSE, { NULL } }, { "Motif", FALSE, FALSE, FALSE, { NULL } }, @@ -1570,6 +1568,22 @@ handle_categories_key (kf_validator *kf, required_categories = g_strsplit (registered_categories[j].requires[k], ";", 0); + if (g_strrstr (registered_categories[j].requires[k], ";") != NULL) { + gboolean present = FALSE; + + for (l = 0; required_categories[l]; l++) { + if (g_hash_table_lookup (hashtable, required_categories[l])) { + present = TRUE; + } + } + + if (present == FALSE) { + g_strfreev (required_categories); + break; + } + + } + for (l = 0; required_categories[l]; l++) { if (!g_hash_table_lookup (hashtable, required_categories[l])) break; -- 1.7.12