summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Sack <asac@ubuntu.com>2009-12-16 04:09:28 +0100
committerAlexander Sack <asac@ubuntu.com>2009-12-16 04:09:28 +0100
commit2aced5031d1cbf3c26cb53438a4f6e5460dec199 (patch)
tree0ae99faab6d133196ba7244f2e2f597ca8cfa09f
parent2664bca2f6b30f0f96178f69981418b48a7314b4 (diff)
[ Alexander Sack <asac@ubuntu.com> ]
* dh_xul-ext: - convert xpath expression to python/rdflib; extract (id, max, min) triples for all targetApplications in get_supported_apps; in turn add python-rdflib to Depends - update src/dh_xul-ext - update debian/control
-rw-r--r--debian/changelog8
-rw-r--r--debian/control1
-rwxr-xr-xsrc/dh_xul-ext32
3 files changed, 34 insertions, 7 deletions
diff --git a/debian/changelog b/debian/changelog
index 3ee10fd..6cbcc15 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -27,6 +27,14 @@ mozilla-devscripts (0.19) UNRELEASED; urgency=low
- update src/Makefile
- update src/xpi.mk
+ [ Alexander Sack <asac@ubuntu.com> ]
+ * dh_xul-ext:
+ - convert xpath expression to python/rdflib; extract (id, max, min)
+ triples for all targetApplications in get_supported_apps; in turn
+ add python-rdflib to Depends
+ - update src/dh_xul-ext
+ - update debian/control
+
-- Benjamin Drung <bdrung@ubuntu.com> Sun, 13 Dec 2009 20:02:31 +0100
mozilla-devscripts (0.18) unstable; urgency=low
diff --git a/debian/control b/debian/control
index a78d406..60c436d 100644
--- a/debian/control
+++ b/debian/control
@@ -19,6 +19,7 @@ Depends: dpkg-dev,
fakeroot,
libxml-xpath-perl,
python,
+ python-rdflib
quilt,
unzip,
wget,
diff --git a/src/dh_xul-ext b/src/dh_xul-ext
index 15177dc..e9c4276 100755
--- a/src/dh_xul-ext
+++ b/src/dh_xul-ext
@@ -26,6 +26,9 @@ import os
import subprocess
import sys
+from rdflib import Namespace
+from rdflib.Graph import Graph
+
# error codes
COMMAND_LINE_SYNTAX_ERROR = 1
MULTIPLE_INSTALL_RDFs = 2
@@ -68,13 +71,28 @@ def get_xul_apps():
return sorted(packages)
def get_supported_apps(xul_apps, install_rdf, package):
- # TODO
-## data for XPI_RECOMMENDS/CHECK_VERSION magic - targetApplication min-/maxVersions
-## call parameters_
-## 1- target app id
-## 2- maxVersion | minVersion
-#TARGET_VERSION = $(shell xpath -q -e '//em:targetApplication/Description[em:id="$(1)" or @em:id="$(1)"]/em:$(2)/text() | //em:targetApplication/Description[em:id="$(1)" or @em:id="$(1)"]/@em:$(2) | //RDF:Description[@em:id="$(1)"]/em:$(2)/text() | //RDF:Description[@em:id="$(1)"]/@em:$(2)' $(install_dir)/install.rdf | sed -e 's/.*"\(.*\)"/\1/')
-
+ # create array of id_max_min triples
+ id_max_min = []
+ rdf_graph = Graph()
+ rdf_graph.parse(install_rdf)
+ results = rdf_graph.query(
+ """
+ SELECT ?id ?max ?min
+ WHERE {
+ ?x1 em:targetApplication ?x2 .
+ ?x2 em:id ?id .
+ OPTIONAL {
+ ?x2 em:maxVersion ?max .
+ ?x2 em:minVersion ?min .
+ } .
+ }
+ """, initNs=dict(em=Namespace("http://www.mozilla.org/2004/em-rdf#")))
+
+ # append to id_max_min tripe to array
+ for target in results:
+ id_max_min.append (( str(target[0]), str(target[1]), str (target[2]) ))
+
+# TODO - figure out apps etc.
## call parameters_
## 1- target app id
## 2- package name