bug 903620 - rework JS shell packaging as a Python script. r=glandium
authorTed Mielczarek <ted@mielczarek.org>
Thu, 06 Feb 2014 13:22:35 -0500
changeset 167392 480f92acc087
parent 167391 d37dcd149e8c
child 167393 774f7cb40af5
push id39447
push usertmielczarek@mozilla.com
push date2014-02-07 00:55 +0000
treeherdermozilla-inbound@e4ad64c00537 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs903620
milestone30.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 903620 - rework JS shell packaging as a Python script. r=glandium
toolkit/mozapps/installer/dozip.py
toolkit/mozapps/installer/packager.mk
new file mode 100644
--- /dev/null
+++ b/toolkit/mozapps/installer/dozip.py
@@ -0,0 +1,42 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# This script creates a zip file, but will also strip any binaries
+# it finds before adding them to the zip.
+
+from mozpack.files import FileFinder
+from mozpack.copier import Jarrer
+from mozpack.errors import errors
+
+import argparse
+import buildconfig
+import mozpack.path as mozpath
+import os
+import sys
+import tempfile
+
+def main(args):
+    parser = argparse.ArgumentParser()
+    parser.add_argument("--base-dir",
+                        default=os.path.join(buildconfig.topobjdir,
+                                             "dist", "bin"),
+                        help="Store paths relative to this directory")
+    parser.add_argument("zip", help="Path to zip file to write")
+    parser.add_argument("input", nargs="+",
+                        help="Path to files to add to zip")
+    args = parser.parse_args(args)
+
+    jarrer = Jarrer(optimize=False)
+
+    with errors.accumulate():
+        finder = FileFinder(args.base_dir)
+        for i in args.input:
+            path = mozpath.relpath(i, args.base_dir)
+            for p, f in finder.find(path):
+                jarrer.add(p, f)
+        jarrer.copy(args.zip)
+
+
+if __name__ == '__main__':
+    main(sys.argv[1:])
--- a/toolkit/mozapps/installer/packager.mk
+++ b/toolkit/mozapps/installer/packager.mk
@@ -128,17 +128,17 @@ else
 JSSHELL_BINS += \
   $(DIST)/bin/libicudata.so.$(MOZ_ICU_VERSION) \
   $(DIST)/bin/libicui18n.so.$(MOZ_ICU_VERSION) \
   $(DIST)/bin/libicuuc.so.$(MOZ_ICU_VERSION) \
   $(NULL)
 endif # Darwin
 endif # WINNT
 endif # MOZ_STATIC_JS
-MAKE_JSSHELL  = $(ZIP) -9j $(PKG_JSSHELL) $(JSSHELL_BINS)
+MAKE_JSSHELL  = $(PYTHON) $(topsrcdir)/toolkit/mozapps/installer/dozip.py $(PKG_JSSHELL) $(abspath $(JSSHELL_BINS))
 endif # LIBXUL_SDK
 
 _ABS_DIST = $(abspath $(DIST))
 JARLOG_DIR = $(abspath $(DEPTH)/jarlog/)
 JARLOG_FILE_AB_CD = $(JARLOG_DIR)/$(AB_CD).log
 
 TAR_CREATE_FLAGS := --exclude=.mkdir.done $(TAR_CREATE_FLAGS)
 CREATE_FINAL_TAR = $(TAR) -c --owner=0 --group=0 --numeric-owner \