summaryrefslogtreecommitdiff
path: root/dh_xul-ext
diff options
context:
space:
mode:
Diffstat (limited to 'dh_xul-ext')
-rwxr-xr-xdh_xul-ext26
1 files changed, 20 insertions, 6 deletions
diff --git a/dh_xul-ext b/dh_xul-ext
index b51b3f7..1486c14 100755
--- a/dh_xul-ext
+++ b/dh_xul-ext
@@ -1,6 +1,6 @@
#!/usr/bin/python
-# Copyright (c) 2009-2011, Benjamin Drung <bdrung@debian.org>
+# Copyright (c) 2009-2012, Benjamin Drung <bdrung@debian.org>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
@@ -30,6 +30,7 @@ _VENDOR_ENV = "DH_XUL_EXT_VENDOR"
# error codes
COMMAND_LINE_SYNTAX_ERROR = 1
MULTIPLE_INSTALL_RDFS = 2
+INVALID_VERSION_RANGE = 3
FIREFOX_ID = "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
THUNDERBIRD_ID = "{3550f703-e582-4d05-9a08-453d09bdfdc6}"
@@ -158,7 +159,7 @@ def get_xul_apps(script_name, all_distros):
return xul_apps
-def _get_id_max_min_triple(install_rdf):
+def _get_id_max_min_triple(script_name, package, install_rdf):
"""create array of id_max_min triples"""
id_max_min = []
model = RDF.Model()
@@ -179,15 +180,28 @@ def _get_id_max_min_triple(install_rdf):
""", query_language="sparql")
results = query.execute(model)
# append to id_max_min tripe to array
+ failures = 0
for target in results:
- id_max_min.append ((target["id"].literal_value["string"],
- target["max"].literal_value["string"],
- target["min"].literal_value["string"]))
+ appid = target["id"].literal_value["string"]
+ max_version = target["max"].literal_value["string"]
+ min_version = target["min"].literal_value["string"]
+ id_max_min.append ((appid, max_version, min_version))
+ # Sanity check version range
+ if compare_versions(min_version, max_version) > 0:
+ msg = ("%s: %s contains an invalid version range for %s:\n"
+ "%s: minVersion <= maxVersion is required, but %s > %s.") % \
+ (script_name, package, appid, script_name, min_version,
+ max_version)
+ print >> sys.stderr, msg
+ failures += 1
+ if failures > 0:
+ sys.exit(INVALID_VERSION_RANGE)
+
return id_max_min
def get_supported_apps(script_name, xul_apps, install_rdf, package,
verbose=False):
- id_max_min = _get_id_max_min_triple(install_rdf)
+ id_max_min = _get_id_max_min_triple(script_name, package, install_rdf)
if verbose:
print "%s: %s supports %i XUL application(s):" % (script_name, package,
len(id_max_min))