[sysadmin-bin] simplify list of valid categories and tell user which categories are valid



commit e3c11ca3a0ddf2cbb556968c55e7cea8ffe41b7a
Author: Olav Vitters <olav vitters nl>
Date:   Sun Aug 3 00:41:40 2014 +0200

    simplify list of valid categories and tell user which categories are valid

 git/validate-doap |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/git/validate-doap b/git/validate-doap
index 54d137b..e011986 100755
--- a/git/validate-doap
+++ b/git/validate-doap
@@ -16,13 +16,13 @@ DOAP = "http://usefulinc.com/ns/doap#";
 FOAF = "http://xmlns.com/foaf/0.1/";
 GNOME = "http://api.gnome.org/doap-extensions#";
 
-groups = {
-    (GNOME + 'core'): 'core',
-    (GNOME + 'core-apps'): 'core-apps',
-    (GNOME + 'apps'): 'apps',
-    (GNOME + 'deprecated'): 'deprecated',
-    (GNOME + 'infrastructure'): 'infrastructure',
-    }
+valid_groups = set((
+    'core',
+    'core-apps',
+    'apps',
+    'deprecated',
+    'infrastructure',
+))
 
 def die(message):
     print >>sys.stderr, "---"
@@ -74,8 +74,8 @@ for node in nodes:
         if not is_resource(group):
             die("Invalid doap:category property (should be an URL)")
 
-        if not group in groups:
-            die("doap:category property should be one of the standard GNOME categories")
+        if group.startswith(GNOME) or group[len(GNOME):] not in valid_groups:
+            die("doap:category property should be one of: %s" % ",".join(sorted(valid_groups)))
 
     have_maintainer = False
     for (n, l, v) in node.properties:


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