Bug 1345422 - Do not hardcode the sfx package and installer path. r=mshal

This commit is contained in:
Edmund Wong 2017-03-22 08:52:35 +08:00
Родитель 76372437ce
Коммит f2596e1f77
3 изменённых файлов: 10 добавлений и 7 удалений

Просмотреть файл

@ -44,6 +44,9 @@ MOZ_PKG_MAC_ICON=$(ABS_DIST)/branding/disk.icns
MOZ_PKG_MAC_EXTRA=--symlink '/Applications:/ '
endif
MOZ_SFX_PACKAGE=$(topsrcdir)/other-licenses/7zstub/firefox/7zSD.sfx
MOZ_INSTALLER_PATH=$(topsrcdir)/browser/installer/windows
ifeq (WINNT,$(OS_ARCH))
UNINSTALLER_PACKAGE_HOOK = $(RM) -r $(STAGEDIST)/uninstall; \
$(NSINSTALL) -D $(STAGEDIST)/uninstall; \

Просмотреть файл

@ -11,24 +11,24 @@ import subprocess
import tempfile
import mozpack.path as mozpath
def archive_exe(pkg_dir, tagfile, package):
def archive_exe(pkg_dir, tagfile, sfx_package, package):
tmpdir = tempfile.mkdtemp(prefix='tmp')
subprocess.check_call(['upx', '--best', '-o', mozpath.join(tmpdir, '7zSD.sfx'), '../../../other-licenses/7zstub/firefox/7zSD.sfx'])
subprocess.check_call(['upx', '--best', '-o', mozpath.join(tmpdir, '7zSD.sfx'), sfx_package])
shutil.move(pkg_dir, 'core')
subprocess.check_call(['7z', 'a', '-r', '-t7z', mozpath.join(tmpdir, 'app.7z'), '-mx', '-m0=BCJ2', '-m1=LZMA:d25', '-m2=LZMA:d19', '-m3=LZMA:d19', '-mb0:1', '-mb0s1:2', '-mb0s2:3'])
shutil.move('core', pkg_dir)
with open(package, 'wb') as o:
for i in [mozpath.join(tmpdir, '7zSD.sfx'), mozpath.join('../../../browser/installer/windows', tagfile), mozpath.join(tmpdir, 'app.7z')]:
for i in [mozpath.join(tmpdir, '7zSD.sfx'), tagfile, mozpath.join(tmpdir, 'app.7z')]:
shutil.copyfileobj(open(i, 'rb'), o)
os.chmod(package, 755)
def main(args):
if len(args) != 3:
print('Usage: 7z_exe_archive.py <pkg_dir> <tagfile> <package>',
if len(args) != 4:
print('Usage: 7z_exe_archive.py <pkg_dir> <tagfile> <sfx_package> <package>',
file=sys.stderr)
return 1
else:
archive_exe(args[0], args[1], args[2])
archive_exe(args[0], args[1], args[2], args[3])
return 0
if __name__ == '__main__':

Просмотреть файл

@ -120,7 +120,7 @@ endif
ifeq ($(MOZ_PKG_FORMAT),SFX7Z)
PKG_SUFFIX = .exe
INNER_MAKE_PACKAGE = $(call py_action,7z_exe_archive,'$(MOZ_PKG_DIR)' 'app.tag' '$(PACKAGE)')
INNER_MAKE_PACKAGE = $(call py_action,7z_exe_archive,'$(MOZ_PKG_DIR)' '$(MOZ_INSTALLER_PATH)/app.tag' '$(MOZ_SFX_PACKAGE)' '$(PACKAGE)')
INNER_UNMAKE_PACKAGE = $(call py_action,7z_exe_extract,'$(UNPACKAGE)' '$(MOZ_PKG_DIR)')
endif