From 2aced5031d1cbf3c26cb53438a4f6e5460dec199 Mon Sep 17 00:00:00 2001 From: Alexander Sack Date: Wed, 16 Dec 2009 04:09:28 +0100 Subject: [ Alexander Sack ] * 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 --- debian/changelog | 8 ++++++++ debian/control | 1 + src/dh_xul-ext | 32 +++++++++++++++++++++++++------- 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 ] + * 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 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 -- cgit v1.2.3