forked from qt-creator/qt-creator
Filter debug info out when creating macOS disk image
Move the script to Python for that, for code sharing Change-Id: I1a0b1ed7fe3ed4413045d478c82621d75800520e Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
This commit is contained in:
@@ -112,7 +112,7 @@ macx {
|
||||
BINDIST_SOURCE = "$$OUT_PWD/bin/Qt Creator.app"
|
||||
deployqt.commands = $$PWD/scripts/deployqtHelper_mac.sh \"$${APPBUNDLE}\" \"$$[QT_INSTALL_BINS]\" \"$$[QT_INSTALL_TRANSLATIONS]\" \"$$[QT_INSTALL_PLUGINS]\" \"$$[QT_INSTALL_IMPORTS]\" \"$$[QT_INSTALL_QML]\"
|
||||
codesign.commands = codesign --deep -s \"$(SIGNING_IDENTITY)\" $(SIGNING_FLAGS) \"$${APPBUNDLE}\"
|
||||
dmg.commands = $$PWD/scripts/makedmg.sh $$OUT_PWD/bin $${BASENAME}.dmg
|
||||
dmg.commands = python -u \"$$PWD/scripts/makedmg.py\" \"$${BASENAME}.dmg\" \"Qt Creator\" \"$$IDE_SOURCE_TREE\" \"$$OUT_PWD/bin\"
|
||||
#dmg.depends = deployqt
|
||||
QMAKE_EXTRA_TARGETS += codesign dmg
|
||||
} else {
|
||||
|
@@ -163,3 +163,17 @@ def fix_rpaths(path, qt_deploy_path, qt_install_info, chrpath=None):
|
||||
if is_unix_executable(filepath) or is_unix_library(filepath):
|
||||
fix_rpaths_helper(filepath)
|
||||
|
||||
def is_debug_file(filepath):
|
||||
if is_mac_platform():
|
||||
return filepath.endswith('.dSYM') or '.dSYM/' in filepath
|
||||
elif is_linux_platform():
|
||||
return filepath.endswith('.debug')
|
||||
else:
|
||||
return filepath.endswith('.pdb')
|
||||
|
||||
def is_debug(path, filenames):
|
||||
return [fn for fn in filenames if is_debug_file(os.path.join(path, fn))]
|
||||
|
||||
def is_not_debug(path, filenames):
|
||||
files = [fn for fn in filenames if os.path.isfile(os.path.join(path, fn))]
|
||||
return [fn for fn in files if not is_debug_file(os.path.join(path, fn))]
|
||||
|
@@ -45,28 +45,13 @@ def parse_arguments():
|
||||
parser.add_argument('source_directory', help='source directory with the Qt Creator installation')
|
||||
return parser.parse_args()
|
||||
|
||||
def is_debug_file(filepath):
|
||||
if common.is_mac_platform():
|
||||
return filepath.endswith('.dSYM') or '.dSYM/' in filepath
|
||||
elif common.is_linux_platform():
|
||||
return filepath.endswith('.debug')
|
||||
else:
|
||||
return filepath.endswith('.pdb')
|
||||
|
||||
def is_debug(path, filenames):
|
||||
return [fn for fn in filenames if is_debug_file(os.path.join(path, fn))]
|
||||
|
||||
def is_not_debug(path, filenames):
|
||||
files = [fn for fn in filenames if os.path.isfile(os.path.join(path, fn))]
|
||||
return [fn for fn in files if not is_debug_file(os.path.join(path, fn))]
|
||||
|
||||
def main():
|
||||
arguments = parse_arguments()
|
||||
tempdir_base = tempfile.mkdtemp()
|
||||
tempdir = os.path.join(tempdir_base, os.path.basename(arguments.source_directory))
|
||||
try:
|
||||
common.copytree(arguments.source_directory, tempdir, symlinks=True,
|
||||
ignore=(is_not_debug if arguments.debug else is_debug))
|
||||
ignore=(common.is_not_debug if arguments.debug else common.is_debug))
|
||||
zip_source = os.path.join(tempdir, '*') if arguments.exclude_toplevel else tempdir
|
||||
subprocess.check_call([arguments.sevenzip, 'a', '-mx9',
|
||||
arguments.target_archive, zip_source])
|
||||
|
60
scripts/makedmg.py
Executable file
60
scripts/makedmg.py
Executable file
@@ -0,0 +1,60 @@
|
||||
#!/usr/bin/env python
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (C) 2018 The Qt Company Ltd.
|
||||
# Contact: https://www.qt.io/licensing/
|
||||
#
|
||||
# This file is part of Qt Creator.
|
||||
#
|
||||
# Commercial License Usage
|
||||
# Licensees holding valid commercial Qt licenses may use this file in
|
||||
# accordance with the commercial license agreement provided with the
|
||||
# Software or, alternatively, in accordance with the terms contained in
|
||||
# a written agreement between you and The Qt Company. For licensing terms
|
||||
# and conditions see https://www.qt.io/terms-conditions. For further
|
||||
# information use the contact form at https://www.qt.io/contact-us.
|
||||
#
|
||||
# GNU General Public License Usage
|
||||
# Alternatively, this file may be used under the terms of the GNU
|
||||
# General Public License version 3 as published by the Free Software
|
||||
# Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
# included in the packaging of this file. Please review the following
|
||||
# information to ensure the GNU General Public License requirements will
|
||||
# be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import tempfile
|
||||
import time
|
||||
|
||||
import common
|
||||
|
||||
def parse_arguments():
|
||||
parser = argparse.ArgumentParser(description='Create Qt Creator disk image, filtering out debug information files.')
|
||||
parser.add_argument('target_diskimage', help='output .dmg file to create')
|
||||
parser.add_argument('dmg_volumename', help='volume name to use for the disk image')
|
||||
parser.add_argument('source_directory', help='directory with the Qt Creator sources')
|
||||
parser.add_argument('binary_directory', help='directory that contains the Qt Creator.app')
|
||||
return parser.parse_args()
|
||||
|
||||
def main():
|
||||
arguments = parse_arguments()
|
||||
tempdir_base = tempfile.mkdtemp()
|
||||
tempdir = os.path.join(tempdir_base, os.path.basename(arguments.binary_directory))
|
||||
try:
|
||||
common.copytree(arguments.binary_directory, tempdir, symlinks=True, ignore=common.is_debug)
|
||||
os.symlink('/Applications', os.path.join(tempdir, 'Applications'))
|
||||
shutil.copy(os.path.join(arguments.source_directory, 'LICENSE.GPL3-EXCEPT'), tempdir)
|
||||
dmg_cmd = ['hdiutil', 'create', '-srcfolder', tempdir, '-volname', arguments.dmg_volumename,
|
||||
'-format', 'UDBZ', arguments.target_diskimage, '-ov', '-scrub', '-size', '1g', '-verbose']
|
||||
subprocess.check_call(dmg_cmd)
|
||||
# sleep a few seconds to make sure disk image is fully unmounted etc
|
||||
time.sleep(5)
|
||||
finally:
|
||||
shutil.rmtree(tempdir_base)
|
||||
if __name__ == "__main__":
|
||||
main()
|
@@ -1,45 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (C) 2016 The Qt Company Ltd.
|
||||
# Contact: https://www.qt.io/licensing/
|
||||
#
|
||||
# This file is part of Qt Creator.
|
||||
#
|
||||
# Commercial License Usage
|
||||
# Licensees holding valid commercial Qt licenses may use this file in
|
||||
# accordance with the commercial license agreement provided with the
|
||||
# Software or, alternatively, in accordance with the terms contained in
|
||||
# a written agreement between you and The Qt Company. For licensing terms
|
||||
# and conditions see https://www.qt.io/terms-conditions. For further
|
||||
# information use the contact form at https://www.qt.io/contact-us.
|
||||
#
|
||||
# GNU General Public License Usage
|
||||
# Alternatively, this file may be used under the terms of the GNU
|
||||
# General Public License version 3 as published by the Free Software
|
||||
# Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
||||
# included in the packaging of this file. Please review the following
|
||||
# information to ensure the GNU General Public License requirements will
|
||||
# be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
[ $# -lt 2 ] && echo "Usage: $(basename $0) <folder> <name.dmg>" && exit 2
|
||||
[ $(uname -s) != "Darwin" ] && echo "Run this script on Mac OS X" && exit 2;
|
||||
sourceFolder="$1"
|
||||
intermediateFolder=$(mktemp -d "/tmp/packagedir.XXXXX")
|
||||
finalDMGName="$2"
|
||||
title="Qt Creator"
|
||||
|
||||
echo Preparing image artifacts...
|
||||
cp -a "${sourceFolder}/" "${intermediateFolder}"
|
||||
ln -s /Applications "${intermediateFolder}"
|
||||
cp "$(dirname "${BASH_SOURCE[0]}")/../LICENSE.GPL3-EXCEPT" "${intermediateFolder}/LICENSE.GPL3-EXCEPT.txt"
|
||||
echo Creating image...
|
||||
hdiutil create -srcfolder "${intermediateFolder}" -volname "${title}" -format UDBZ "${finalDMGName}" -ov -scrub -size 1g -verbose
|
||||
# make sure that the image is umounted etc
|
||||
sleep 4
|
||||
|
||||
# clean up
|
||||
rm -rf "${intermediateFolder}"
|
Reference in New Issue
Block a user