[sysadmin-bin] doap: require description and programming-language by default



commit d7385c1b54ec30304afc8b72db96ab40ad90a565
Author: Olav Vitters <olav vitters nl>
Date:   Sun Aug 3 01:07:46 2014 +0200

    doap: require description and programming-language by default

 git/validate-doap |   25 ++++++++++++++++++++-----
 1 files changed, 20 insertions(+), 5 deletions(-)
---
diff --git a/git/validate-doap b/git/validate-doap
index e011986..1456e46 100755
--- a/git/validate-doap
+++ b/git/validate-doap
@@ -23,6 +23,11 @@ valid_groups = set((
     'deprecated',
     'infrastructure',
 ))
+# groups/categories which don't require an extensive doap file
+lax_groups = set((
+    'deprecated',
+    'infrastructure',
+))
 
 def die(message):
     print >>sys.stderr, "---"
@@ -63,12 +68,11 @@ for node in nodes:
     if seen_project:
         die("Multiple doap:Project nodes")
 
-    shortdesc = node.find_property((DOAP, "shortdesc"))
-    if not shortdesc:
-        die("Missing required doap:shortdesc property")
-    if not is_literal(shortdesc):
-        die("Invalid doap:shortdesc property (should be a string literal)")
+    required_literal_properties = [
+        "shortdesc"
+    ]
 
+    # check the group/category is valid (if specified)
     group = node.find_property((DOAP, "category"))
     if group:
         if not is_resource(group):
@@ -77,6 +81,17 @@ for node in nodes:
         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)))
 
+    # doap files should have enough fields
+    # (unless group is not specified or one of the lax groups)
+    if group and group not in lax_groups:
+        required_literal_properties.extend(("programming-language", "description"))
+
+    # ensure required string literal properties exist
+    for prop in required_literal_properties:
+        prop_value = node.find_property((DOAP, ))
+        if not prog_value or not is_literal(prog_value):
+            die("%s property is required and should be a string literal" % prop)
+
     have_maintainer = False
     for (n, l, v) in node.properties:
         if n == (DOAP, "maintainer"):


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