summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xxpi-repack46
1 files changed, 23 insertions, 23 deletions
diff --git a/xpi-repack b/xpi-repack
index f18580f..9b9663b 100755
--- a/xpi-repack
+++ b/xpi-repack
@@ -39,29 +39,29 @@ def remove_recursive(path):
def repack_xpi(script_name, package, upstream_version, xpi_file, verbose):
# extract xpi file
tmp_dir = tempfile.mkdtemp(prefix=script_name+".")
- extract_dir = package + "-" + upstream_version
- full_extract_dir = os.path.join(tmp_dir, extract_dir)
- subprocess.check_call(["xpi-unpack", xpi_file, full_extract_dir])
-
- # check, if source 3.0 (quilt) format is used
- extension = ".gz"
- if os.path.isfile("debian/source/format"):
- source_format = open("debian/source/format").readline().strip()
- if source_format == "3.0 (quilt)":
- extension = ".bz2"
-
- # pack source
- tar_file = package + "_" + upstream_version + ".orig.tar"
- full_tar_file = os.path.realpath(os.path.join(os.path.dirname(xpi_file),
- tar_file))
- cmd = ["tar", "-ca", "-C", tmp_dir, "-f", full_tar_file + extension,
- extract_dir]
- if verbose:
- print " ".join(cmd)
- subprocess.check_call(cmd)
-
- # remove temporary directory
- remove_recursive(tmp_dir)
+ try:
+ extract_dir = package + "-" + upstream_version
+ full_extract_dir = os.path.join(tmp_dir, extract_dir)
+ subprocess.check_call(["xpi-unpack", xpi_file, full_extract_dir])
+
+ # check, if source 3.0 (quilt) format is used
+ extension = ".gz"
+ if os.path.isfile("debian/source/format"):
+ source_format = open("debian/source/format").readline().strip()
+ if source_format == "3.0 (quilt)":
+ extension = ".bz2"
+
+ # pack source
+ directory = os.path.realpath(os.path.dirname(xpi_file))
+ tar_file = package + "_" + upstream_version + ".orig.tar" + extension
+ full_tar_file = os.path.join(directory, tar_file)
+ cmd = ["tar", "-ca", "-C", tmp_dir, "-f", full_tar_file, extract_dir]
+ if verbose:
+ print " ".join(cmd)
+ subprocess.check_call(cmd)
+ finally:
+ # remove temporary directory
+ remove_recursive(tmp_dir)
def get_source_package_name(script_name):