Bug 1426528: Pass paths to extra dmg files explicitly when packing; r?Build draft
authorTom Prince <mozilla@hocat.ca>
Thu, 21 Dec 2017 13:38:35 -0700
changeset 714288 c25b315d565fcd9d30496a2f8c4a901d1d2f0b35
parent 714287 751e343f0bc258c5bf149945a05250d89b591174
child 714289 e8e7552122a6a6927d3ab454c5605333adba5818
push id93889
push userbmo:mozilla@hocat.ca
push dateFri, 22 Dec 2017 06:09:18 +0000
reviewersBuild
bugs1426528
milestone59.0a1
Bug 1426528: Pass paths to extra dmg files explicitly when packing; r?Build MozReview-Commit-ID: FKwZcNycUW8
browser/installer/Makefile.in
python/mozbuild/mozbuild/action/make_dmg.py
python/mozbuild/mozpack/dmg.py
toolkit/mozapps/installer/upload-files.mk
--- a/browser/installer/Makefile.in
+++ b/browser/installer/Makefile.in
@@ -94,19 +94,19 @@ ifdef NECKO_WIFI
 DEFINES += -DNECKO_WIFI
 endif
 
 ifdef MAKENSISU
 DEFINES += -DHAVE_MAKENSISU=1
 endif
 
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
-MOZ_PKG_MAC_DSSTORE=branding/dsstore
-MOZ_PKG_MAC_BACKGROUND=branding/background.png
-MOZ_PKG_MAC_ICON=branding/disk.icns
+MOZ_PKG_MAC_DSSTORE=$(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/dsstore
+MOZ_PKG_MAC_BACKGROUND=$(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/background.png
+MOZ_PKG_MAC_ICON=$(topsrcdir)/$(MOZ_BRANDING_DIRECTORY)/disk.icns
 MOZ_PKG_MAC_EXTRA=--symlink '/Applications:/ '
 endif
 
 include $(topsrcdir)/toolkit/mozapps/installer/signing.mk
 include $(topsrcdir)/toolkit/mozapps/installer/packager.mk
 
 ifeq (bundle, $(MOZ_FS_LAYOUT))
 BINPATH = $(_BINPATH)
--- a/python/mozbuild/mozbuild/action/make_dmg.py
+++ b/python/mozbuild/mozbuild/action/make_dmg.py
@@ -1,37 +1,40 @@
 # 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/.
 
 from __future__ import print_function
 
-from mozbuild.base import MozbuildObject
 from mozpack import dmg
 
-import os
+import argparse
 import sys
 
 
-def make_dmg(source_directory, output_dmg):
-    build = MozbuildObject.from_environment()
+def main(args):
+    parser = argparse.ArgumentParser(
+        description='Explode a DMG into its relevant files')
+
+    parser.add_argument('--dsstore', help='DSStore file from')
+    parser.add_argument('--background', help='Background file from')
+    parser.add_argument('--icon', help='Icon file from')
+    parser.add_argument('--volume-name', help='Disk image volume name')
+
+    parser.add_argument('inpath', metavar='PATH_IN',
+                        help='Location of files to pack')
+    parser.add_argument('dmgfile', metavar='DMG_OUT',
+                        help='DMG File to create')
+
+    options = parser.parse_args(args)
+
     extra_files = [
-        (os.path.join(build.distdir, 'branding', 'dsstore'), '.DS_Store'),
-        (os.path.join(build.distdir, 'branding', 'background.png'),
-         '.background/background.png'),
-        (os.path.join(build.distdir, 'branding', 'disk.icns'),
-         '.VolumeIcon.icns'),
+        (options.dsstore, '.DS_Store'),
+        (options.background, '.background/background.png'),
+        (options.icon, '.VolumeIcon.icns'),
     ]
-    volume_name = build.substs['MOZ_APP_DISPLAYNAME']
-    dmg.create_dmg(source_directory, output_dmg, volume_name, extra_files)
-
+    dmg.create_dmg(options.inpath, options.dmgfile, options.volume_name, extra_files)
 
-def main(args):
-    if len(args) != 2:
-        print('Usage: make_dmg.py <source directory> <output dmg>',
-              file=sys.stderr)
-        return 1
-    make_dmg(args[0], args[1])
     return 0
 
 
 if __name__ == '__main__':
     sys.exit(main(sys.argv[1:]))
--- a/python/mozbuild/mozpack/dmg.py
+++ b/python/mozbuild/mozpack/dmg.py
@@ -4,17 +4,16 @@
 
 import buildconfig
 import errno
 import mozfile
 import os
 import platform
 import shutil
 import subprocess
-import sys
 
 from mozbuild.util import ensureParentDir
 
 is_linux = platform.system() == 'Linux'
 
 
 def mkdir(dir):
     if not os.path.isdir(dir):
--- a/toolkit/mozapps/installer/upload-files.mk
+++ b/toolkit/mozapps/installer/upload-files.mk
@@ -210,18 +210,25 @@ ifeq ($(MOZ_PKG_FORMAT),APK)
 include $(MOZILLA_DIR)/toolkit/mozapps/installer/upload-files-$(MOZ_PKG_FORMAT).mk
 endif
 
 ifeq ($(MOZ_PKG_FORMAT),DMG)
   PKG_SUFFIX	= .dmg
 
   _ABS_MOZSRCDIR = $(shell cd $(MOZILLA_DIR) && pwd)
   PKG_DMG_SOURCE = $(MOZ_PKG_DIR)
-  INNER_MAKE_PACKAGE	= $(call py_action,make_dmg,'$(PKG_DMG_SOURCE)' '$(PACKAGE)')
-  INNER_UNMAKE_PACKAGE	= \
+  INNER_MAKE_PACKAGE = \
+    $(call py_action,make_dmg, \
+        $(if $(MOZ_PKG_MAC_DSSTORE),--dsstore '$(MOZ_PKG_MAC_DSSTORE)') \
+        $(if $(MOZ_PKG_MAC_BACKGROUND),--background '$(MOZ_PKG_MAC_BACKGROUND)') \
+        $(if $(MOZ_PKG_MAC_ICON),--icon '$(MOZ_PKG_MAC_ICON)') \
+        --volume-name '$(MOZ_APP_DISPLAYNAME)' \
+        '$(PKG_DMG_SOURCE)' '$(PACKAGE)' \
+        )
+  INNER_UNMAKE_PACKAGE = \
     $(call py_action,unpack_dmg, \
         $(if $(MOZ_PKG_MAC_DSSTORE),--dsstore '$(MOZ_PKG_MAC_DSSTORE)') \
         $(if $(MOZ_PKG_MAC_BACKGROUND),--background '$(MOZ_PKG_MAC_BACKGROUND)') \
         $(if $(MOZ_PKG_MAC_ICON),--icon '$(MOZ_PKG_MAC_ICON)') \
         $(UNPACKAGE) $(MOZ_PKG_DIR) \
         )
 endif