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

Benjamin Drung bdrung at debian.org
Sat Apr 21 22:57:12 UTC 2012


The following commit has been merged in the master branch:
commit 17b68c335ca24379a3f41b720b4e80559d6719ec
Author: Benjamin Drung <bdrung at debian.org>
Date:   Sun Apr 22 00:55:25 2012 +0200

    xpi-repack: Fail nicely if debian/control is missing.
    
    LP: #900687

diff --git a/xpi-repack b/xpi-repack
index 8bf5dae..f6705a2 100755
--- a/xpi-repack
+++ b/xpi-repack
@@ -61,7 +61,12 @@ def repack_xpi(package, upstream_version, xpi_file, verbose):
     # remove temporary directory
     remove_recursive(full_extract_dir)
 
-def get_source_package_name():
+def get_source_package_name(script_name):
+    if not os.path.isfile("debian/control"):
+        sys.stderr.write(script_name + ": Error: debian/control file is "
+                         "missing. Please execute the script in a Debian "
+                         "source package or provide a source package name.\n")
+        sys.exit(1)
     lines = open("debian/control").readlines()
     package_lines = filter(lambda x: x.find("Source:") >= 0, lines)
     packages = map(lambda x: x[x.find(":")+1:].strip(), package_lines)
@@ -108,11 +113,11 @@ def main():
         else:
             assert False, "unhandled option"
 
-    if package is None:
-        package = get_source_package_name()
-
     script_name = os.path.basename(sys.argv[0])
 
+    if package is None:
+        package = get_source_package_name(script_name)
+
     if len(args) == 0:
         print >> sys.stderr, "%s: Error: No xpi file specified." % (script_name)
         sys.exit(COMMAND_LINE_SYNTAX_ERROR)

-- 
Collection of development scripts used for XUL extensions.



More information about the Pkg-mozext-commits mailing list