[Pkg-mozext-commits] [SCM] Collection of development scripts used for XUL extensions. branch, master, updated. 0.23-76-ga757d41

Benjamin Drung bdrung at debian.org
Fri Dec 7 00:55:16 UTC 2012


The following commit has been merged in the master branch:
commit a757d416250b382058407db0d611c14337c18451
Author: Benjamin Drung <bdrung at debian.org>
Date:   Fri Dec 7 01:54:32 2012 +0100

    dh_xul-ext: Fail if minVersion is greater than maxVersion.
    
    Closes: #650348

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 at debian.org>
+Copyright: 2009-2012, Benjamin Drung <bdrung at 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 at debian.org>
+# Copyright (c) 2009-2012, Benjamin Drung <bdrung at 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))

-- 
Collection of development scripts used for XUL extensions.



More information about the Pkg-mozext-commits mailing list