[PATCH] Extracting cgit groups from doap files
- From: Shaun McCance <shaunm recto localdomain>
- Subject: [PATCH] Extracting cgit groups from doap files
- Date: Sat, 18 Apr 2009 15:03:26 -0500
---
extract-doap-info | 49 +++++++++++++++++++++++++++++++++++++++
extract-doap-shortdesc | 18 --------------
find-cgit-repos.sh | 3 ++
post-receive-update-description | 3 +-
semi_rdf.py | 2 +-
5 files changed, 54 insertions(+), 21 deletions(-)
create mode 100755 extract-doap-info
delete mode 100755 extract-doap-shortdesc
diff --git a/extract-doap-info b/extract-doap-info
new file mode 100755
index 0000000..2daaddb
--- /dev/null
+++ b/extract-doap-info
@@ -0,0 +1,49 @@
+#!/usr/bin/python
+
+import os
+import sys
+
+script_path = os.path.realpath(os.path.abspath(sys.argv[0]))
+script_dir = os.path.dirname(script_path)
+sys.path.insert(0, script_dir)
+
+if len(sys.argv) < 2:
+ sys.exit(1)
+git_dir = sys.argv[1]
+
+import semi_rdf
+
+DOAP = "http://usefulinc.com/ns/doap#"
+GNOME = "http://api.gnome.org/doap-extensions#"
+
+groups = {
+ (GNOME + 'admin'): 'Administration Tools',
+ (GNOME + 'bindings'): 'Platform Bindings',
+ (GNOME + 'deprecated'): 'Deprecated Modules',
+ (GNOME + 'desktop'): 'Desktop',
+ (GNOME + 'development'): 'Development Tools',
+ (GNOME + 'infrastructure'): 'Infrastructure',
+ (GNOME + 'platform'): 'Platform',
+ (GNOME + 'productivity'): 'Productivity Tools'
+ }
+
+
+nodes = semi_rdf.read_rdf(sys.stdin)
+for node in nodes:
+ if node.name != (DOAP, "Project"):
+ continue
+
+ shortdesc = node.find_property((DOAP, "shortdesc"))
+ fd = open(os.path.join(git_dir, 'description'), 'w')
+ print >> fd, shortdesc
+ fd.close()
+
+ group = node.find_property((DOAP, "category"))
+ if isinstance(group, tuple) and len(group) == 3:
+ group = group[2]
+ group = groups.get(group, 'Other')
+ else:
+ group = 'Other'
+ fd = open(os.path.join(git_dir, 'gnome_group'), 'w')
+ print >> fd, group
+ fd.close()
diff --git a/extract-doap-shortdesc b/extract-doap-shortdesc
deleted file mode 100755
index 23bcaae..0000000
--- a/extract-doap-shortdesc
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/usr/bin/python
-
-import os
-import sys
-
-script_path = os.path.realpath(os.path.abspath(sys.argv[0]))
-script_dir = os.path.dirname(script_path)
-sys.path.insert(0, script_dir)
-
-import semi_rdf
-
-DOAP = "http://usefulinc.com/ns/doap#"
-
-nodes = semi_rdf.read_rdf(sys.stdin)
-for node in nodes:
- if node.name != (DOAP, "Project"):
- continue
- print node.find_property((DOAP, "shortdesc"))
diff --git a/find-cgit-repos.sh b/find-cgit-repos.sh
index 543721f..3c9dd15 100755
--- a/find-cgit-repos.sh
+++ b/find-cgit-repos.sh
@@ -19,6 +19,9 @@ function list_repos() {
else
pending=""
fi
+ if test -f $r/gnome_group; then
+ group=$(cat $r/gnome_group)
+ fi;
test -z "$group" || echo repo.group=$group
echo repo.url=$url
echo repo.name=$shortname
diff --git a/post-receive-update-description b/post-receive-update-description
index 9bcf419..9e57d52 100755
--- a/post-receive-update-description
+++ b/post-receive-update-description
@@ -17,8 +17,7 @@ update_description_from_file() {
return
fi
- shortdesc=$(git cat-file blob "$newrev:$path" | $BINDIR/extract-doap-shortdesc)
- echo $shortdesc > $GIT_DIR/description
+ git cat-file blob "$newrev:$path" | $BINDIR/extract-doap-info $GIT_DIR
$BINDIR/update-cgit
}
diff --git a/semi_rdf.py b/semi_rdf.py
index 9f113de..2d3ebc9 100755
--- a/semi_rdf.py
+++ b/semi_rdf.py
@@ -81,7 +81,7 @@ class RdfHandler(xml.sax.handler.ContentHandler):
if attrname == (XML, "lang"):
pass
elif attrname == (RDF, "resource"):
- resource = attrname
+ resource = attrname + (attributes.getValue(attrname),)
elif attrname == (RDF, "parseType"):
parseType = attributes.getValue(attrname)
if parseType == "resource":
--
1.6.0.6
--=-Q5BHAyvRTfQWJDo3C2ud
Content-Disposition: attachment; filename="doap-extensions"
Content-Type: text/plain; name="doap-extensions"; charset="UTF-8"
Content-Transfer-Encoding: 8bit
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:doap="http://usefulinc.com/ns/doap#"
xmlns:gnome="http://api.gnome.org/doap-extensions#"
>
<!-- Copyright © 2009 Shaun McCance <shaunm gnome org> -->
<owl:Ontology rdf:about="http://api.gnome.org/doap-extensions#">
<owl:imports rdf:resource="http://xmlns.com/foaf/0.1/index.rdf" />
<owl:imports rdf:resource="http://usefulinc.com/ns/doap#" />
<dc:title>DOAP Extensions for Gnome</dc:title>
<dc:description>Extensions for the Description of a Project (DOAP) vocabulary used for project tracking in the Gnome project.</dc:description>
<dc:creator>Shaun McCance</dc:creator>
<dc:format>application/rdf+xml</dc:format>
<dc:rights>Copyright © 2009 Shaun McCance</dc:rights>
<foaf:maker>
<foaf:Person>
<foaf:name>Shaun McCance</foaf:name>
<foaf:mbox rdf:resource="mailto:shaunm gnome org" />
</foaf:Person>
</foaf:maker>
</owl:Ontology>
<rdf:Property rdf:about="http://api.gnome.org/doap-extensions#userid">
<rdfs:isDefinedBy rdf:resource="http://api.gnome.org/doap-extensions#" />
<rdfs:label xml:lang="en">userid</rdfs:label>
<rdfs:comment xml:lang="en">The Gnome user id.</rdfs:comment>
<rdfs:domain rdf:resource="http://xmlns.com/foaf/0.1/Person" />
<rdfs:range rdf:resource="http://www.w3.org/2000/01/rdf-schema#Literal" />
</rdf:Property>
<rdf:Resource rdf:about="http://api.gnome.org/doap-extensions#admin">
<dc:title>Gnome Administration Tools</dc:title>
<dc:shortdesc>DOAP category for system administration tools in Gnome</dc:shortdesc>
</rdf:Resource>
<rdf:Resource rdf:about="http://api.gnome.org/doap-extensions#bindings">
<dc:title>Gnome Bindings</dc:title>
<dc:shortdesc>DOAP category for language bindings to the Gnome platform</dc:shortdesc>
</rdf:Resource>
<rdf:Resource rdf:about="http://api.gnome.org/doap-extensions#deprecated">
<dc:title>Gnome Deprecated</dc:title>
<dc:shortdesc>DOAP category for deprecated Gnome modules</dc:shortdesc>
</rdf:Resource>
<rdf:Resource rdf:about="http://api.gnome.org/doap-extensions#desktop">
<dc:title>Gnome Desktop</dc:title>
<dc:shortdesc>DOAP category for projects in the Gnome Desktop</dc:shortdesc>
</rdf:Resource>
<rdf:Resource rdf:about="http://api.gnome.org/doap-extensions#development">
<dc:title>Gnome Development Tools</dc:title>
<dc:shortdesc>DOAP category for development tools in Gnome</dc:shortdesc>
</rdf:Resource>
<rdf:Resource rdf:about="http://api.gnome.org/doap-extensions#infrastructure">
<dc:title>Gnome Infrastructure</dc:title>
<dc:shortdesc>DOAP category for infrastructure for the Gnome</dc:shortdesc>
</rdf:Resource>
<rdf:Resource rdf:about="http://api.gnome.org/doap-extensions#platform">
<dc:title>Gnome Developer Platform</dc:title>
<dc:shortdesc>DOAP category for projects in the Gnome Developer Platform</dc:shortdesc>
</rdf:Resource>
<rdf:Resource rdf:about="http://api.gnome.org/doap-extensions#productivity">
<dc:title>Gnome Productivity Applications</dc:title>
<dc:shortdesc>DOAP category for productivity applications in Gnome</dc:shortdesc>
</rdf:Resource>
</rdf:RDF>
--=-Q5BHAyvRTfQWJDo3C2ud--
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]