summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Drung <bdrung@debian.org>2012-12-07 01:54:32 +0100
committerBenjamin Drung <bdrung@debian.org>2012-12-07 01:54:32 +0100
commita757d416250b382058407db0d611c14337c18451 (patch)
tree503decf6bb8404343cabdd24c28880f9a60835bd
parent88346138245f9a73a19bb6ee14110be32921ab2d (diff)
dh_xul-ext: Fail if minVersion is greater than maxVersion.
Closes: #650348
-rw-r--r--debian/copyright2
-rwxr-xr-xdh_xul-ext26
2 files changed, 21 insertions, 7 deletions
diff --git a/debian/copyright b/debian/copyright
index f1ac5f7..9ee3e8f 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -3,7 +3,7 @@ Upstream-Name: mozilla-devscripts
Source: git://git.debian.org/pkg-mozext/mozilla-devscripts.git
Files: *
-Copyright: 2009-2011, Benjamin Drung <bdrung@debian.org>
+Copyright: 2009-2012, Benjamin Drung <bdrung@debian.org>
License: ISC
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
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))