summaryrefslogtreecommitdiff
path: root/src/dh_xul-ext
diff options
context:
space:
mode:
Diffstat (limited to 'src/dh_xul-ext')
-rwxr-xr-xsrc/dh_xul-ext50
1 files changed, 34 insertions, 16 deletions
diff --git a/src/dh_xul-ext b/src/dh_xul-ext
index 8c8034a..17c8b68 100755
--- a/src/dh_xul-ext
+++ b/src/dh_xul-ext
@@ -26,6 +26,8 @@ import os
import subprocess
import sys
+from moz_version import compare_versions, convert_debian_to_moz_version
+
from rdflib import Namespace
from rdflib.Graph import Graph
@@ -34,6 +36,7 @@ COMMAND_LINE_SYNTAX_ERROR = 1
MULTIPLE_INSTALL_RDFs = 2
def get_xul_apps():
+ # TODO: patch packages
return [("xulrunner-1.9", "", "toolkit@mozilla.org", "1.9.0.*"),
("xulrunner-1.9.1", "1.9.1.5+nobinonly-0ubuntu0.9.10.1", "toolkit@mozilla.org", "1.9.1.*"),
("firefox-3.6", "3.6~b1-0ubuntu1", "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}", "3.6.*"),
@@ -41,7 +44,7 @@ def get_xul_apps():
("firefox-3.5", "3.5.3+build1+nobinonly-0ubuntu6", "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}", "3.5.*"),
("abrowser-3.5", "3.5.3+build1+nobinonly-0ubuntu6", "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}", "3.5.*"),
("firefox-3.0", "3.0.0.14", "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}", "3.0.*"),
- ("thunderbird-3.0", "3.0-0ubuntu1", "{3550f703-e582-4d05-9a08-453d09bdfdc6}", "3.0,*"),
+ ("thunderbird-3.0", "3.0-0ubuntu1", "{3550f703-e582-4d05-9a08-453d09bdfdc6}", "3.0.*"),
("thunderbird", "2.0.0.14", "{3550f703-e582-4d05-9a08-453d09bdfdc6}", "2.*")]
packages = list()
for filename in glob.glob("/var/lib/apt/lists/*_Packages"):
@@ -79,7 +82,7 @@ def get_xul_apps():
xul_eol = line[line.find(":")+1:].strip()
return sorted(packages)
-def get_supported_apps(xul_apps, install_rdf, package):
+def get_supported_apps(xul_apps, install_rdf, package, verbose=False):
# create array of id_max_min triples
id_max_min = []
rdf_graph = Graph()
@@ -101,18 +104,33 @@ def get_supported_apps(xul_apps, install_rdf, package):
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
-#CHECK_VERSION = $(shell \
-# moz-version -cs "$($(2)_eol)" ge $(call TARGET_VERSION,$(1),minVersion) && \
-# moz-version -cs "$($(2)_sol)" le $(call TARGET_VERSION,$(1),maxVersion) && \
-# echo $(2))
+ if verbose:
+ print "%s: %i supported XUL applications:" % (sys.argv[0], len(id_max_min))
+ for (appid, max_version, min_version) in id_max_min:
+ print "%s %s to %s" % (appid, min_version, max_version)
+
+ # find supported apps/packages
+ supported_apps = list()
+ for (package_name, version, xul_appid, xul_eol) in xul_apps:
+ supported_app = filter(lambda x: x[0] == xul_appid, id_max_min)
+ if len(supported_app) == 1:
+ # package is supported by extension
+ (appid, max_version, min_version) = supported_app.pop()
+ xul_sol = convert_debian_to_moz_version(version)
+ if compare_versions(xul_sol, max_version) <= 0:
+ if compare_versions(xul_eol, min_version) >= 0:
+ supported_apps.append(package_name)
+ if verbose:
+ print "%s: %s supports %s." % (sys.argv[0], package, package_name)
+ elif verbose:
+ print "%s: %s does not support %s (any more)." % (sys.argv[0], package, package_name)
+ elif verbose:
+ print "%s: %s does not support %s (yet)." % (sys.argv[0], package, package_name)
+ elif len(supported_app) > 1:
+ print "%s: Found error in %s. There are multiple entries for application ID %s." % \
+ (sys.argv[0], install_rdf, xul_appid)
-#XPI_RECOMMENDS = $(strip $(foreach id,$(XPI_TARGET_EMIDs), \
-# $(foreach package,$(packages_$(id)),$(call CHECK_VERSION,$(id),$(package)))))
- return ["firefox-3.5", "abrowser-3.5", "firefox-3.0"]
+ return supported_apps
def get_all_packages():
lines = open("debian/control").readlines()
@@ -168,7 +186,7 @@ def find_install_rdfs(package):
dirs = filter(lambda d: not os.path.islink(os.path.join(root, d)), dirs)
return install_rdfs
-def generate_substvars(xul_apps, package):
+def generate_substvars(xul_apps, package, verbose=False):
install_rdfs = find_install_rdfs(package)
if len(install_rdfs) == 0:
# this package does not contain a xul extension
@@ -189,7 +207,7 @@ def generate_substvars(xul_apps, package):
# remove existing varibles
lines = filter(lambda s: not s.startswith("xpi:"), lines)
- packages = get_supported_apps(xul_apps, install_rdf, package)
+ packages = get_supported_apps(xul_apps, install_rdf, package, verbose)
lines.append("xpi:Recommends=" + " | ".join(packages) + "\n")
lines.append("xpi:Enhances=" + ", ".join(sorted(packages)) + "\n")
packages = get_provided_package_names(package, packages)
@@ -237,4 +255,4 @@ if __name__ == "__main__":
print xul_app[0] + " " + xul_app[1] + " (" + xul_app[2] + ")"
for package in packages:
- generate_substvars(xul_apps, package)
+ generate_substvars(xul_apps, package, verbose)