aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2018-01-22 12:53:35 +0100
committerEike Ziller <eike.ziller@qt.io>2018-01-23 12:21:49 +0000
commitb88bfe7db30aa4dd78568e8de2d1167aaee925fd (patch)
tree99d7613ab37c3b81e98c055ed3b7cf7554717c57 /scripts
parentfdb95299c67b195d46cd3b7a37ed5118809e9a57 (diff)
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>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/common.py14
-rwxr-xr-xscripts/createDistPackage.py17
-rwxr-xr-xscripts/makedmg.py60
-rwxr-xr-xscripts/makedmg.sh45
4 files changed, 75 insertions, 61 deletions
diff --git a/scripts/common.py b/scripts/common.py
index 388ce487fd..b8f640377e 100644
--- a/scripts/common.py
+++ b/scripts/common.py
@@ -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))]
diff --git a/scripts/createDistPackage.py b/scripts/createDistPackage.py
index fc6e7b7aaa..2b0c38ea5f 100755
--- a/scripts/createDistPackage.py
+++ b/scripts/createDistPackage.py
@@ -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])
diff --git a/scripts/makedmg.py b/scripts/makedmg.py
new file mode 100755
index 0000000000..33721f90a7
--- /dev/null
+++ b/scripts/makedmg.py
@@ -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()
diff --git a/scripts/makedmg.sh b/scripts/makedmg.sh
deleted file mode 100755
index befdf42e88..0000000000
--- a/scripts/makedmg.sh
+++ /dev/null
@@ -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}"