diff options
author | Akseli Salovaara <akseli.salovaara@qt.io> | 2017-05-12 09:16:59 +0300 |
---|---|---|
committer | Akseli Salovaara <akseli.salovaara@qt.io> | 2017-05-15 09:35:02 +0000 |
commit | 6650428afc48e00c48364172a5ff57792daff5e3 (patch) | |
tree | 9c7f6ac58c576ace7b7948da81ee612dfdf7a4fc /packaging-tools/create_installer.py | |
parent | 294ab72d8a76dd12236fcf47ae27c82b6b21e16e (diff) |
Add option to remove pdb files from offline installer
In order to provide single offline installer for Windows
pdb files has to be removed from installer and packaged
separately. Otherwise installer size is more than 4GB
and becomes invalid win32 application.
This patch introduces --remove-pdb-files command line
option for excluding pdb files from offline installer
during installer build. By default --remove-pdb-files
option is false.
Implementation is limited to Windows and offline installer only.
Using option on other platforms or with online installer build
doesn't stop build but prints out only informative message
about option usage limitations.
Change-Id: I222ba55089791dab0d8bb3f2b635a50c001aabec
Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
Diffstat (limited to 'packaging-tools/create_installer.py')
-rw-r--r-- | packaging-tools/create_installer.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/packaging-tools/create_installer.py b/packaging-tools/create_installer.py index e05c04428..f407efd2f 100644 --- a/packaging-tools/create_installer.py +++ b/packaging-tools/create_installer.py @@ -289,6 +289,10 @@ def setup_option_parser(): OPTION_PARSER.add_option("--force-version-number-increase", action="store_true", dest="force_version_number_increase", default=False, help="If you wish to enable forced version number bump for components that have %VERSION_NUMBER_AUTO_INCREASE% tag in package.xml file(s)") + # enable pdb files removal + OPTION_PARSER.add_option("--remove-pdb-files", + action="store_true", dest="remove_pdb_files", default=False, + help="Windows only: Removes Windows pdb files from offline installer") ############################################################## @@ -315,6 +319,7 @@ def print_options(): print "Archive skip: %r" % (ARCHIVE_DOWNLOAD_SKIP) print "Legacy IFW: %r" % (USE_LEGACY_IFW) print "Strict mode: %r" % (STRICT_MODE) + print "Remove pdb files: %r" % (REMOVE_PDB_FILES) print print "Installer naming scheme options:\n" print "License type: " + LICENSE_TYPE @@ -368,6 +373,7 @@ def parse_cmd_line(): global KEY_SUBSTITUTION_LIST global PREFERRED_INSTALLER_NAME global VERSION_NUMBER_AUTO_INCREASE_VALUE + global REMOVE_PDB_FILES CONFIGURATIONS_DIR = options.configurations_dir MAIN_CONFIG_NAME = options.configuration_file @@ -386,6 +392,7 @@ def parse_cmd_line(): INSTALLER_NAMING_SCHEME_VERSION_TAG = options.installer_version_tag ARCHIVE_SERVER_BASE_URL = options.archive_base_url INSTALLER_FRAMEWORK_TOOLS = options.ifw_tools_uri + REMOVE_PDB_FILES = options.remove_pdb_files if os.environ.get('CREATE_MAINTENANCE_TOOL_RESOURCE_FILE') in ['yes', 'true', '1']: CREATE_MAINTENANCE_TOOL_RESOURCE_FILE = True @@ -410,6 +417,8 @@ def parse_cmd_line(): for item in options.global_key_value_substitution_list: if delimeter in item: key, value = item.split(delimeter) + if key == 'REMOVE_PDB_FILES': + REMOVE_PDB_FILES = True KEY_SUBSTITUTION_LIST.append([key, value]) KEY_SUBSTITUTION_LIST.append(['%LICENSE%', LICENSE_TYPE]) @@ -850,6 +859,32 @@ def get_component_data(sdk_component, archive, install_dir, data_dir_dest, compr examples_dir = bldinstallercommon.locate_directory(install_dir, 'examples') qml_examples_only(examples_dir) + # remove Windows pdb files from offline installer + if bldinstallercommon.is_win_platform(): + if CREATE_OFFLINE_INSTALLER and REMOVE_PDB_FILES: + pdb_bin_dir = bldinstallercommon.locate_directory(install_dir, 'bin') + if os.path.exists(pdb_bin_dir): + print 'Erasing pdb files from: ' + pdb_bin_dir + # This will only take the text connected to the .pdb by grabbing all non-space characters (\S). + bldinstallercommon.delete_files_by_type_recursive(pdb_bin_dir, '\S*\.pdb') + + pdb_lib_dir = bldinstallercommon.locate_directory(install_dir, 'lib') + if os.path.exists(pdb_lib_dir): + print 'Erasing pdb files from: ' + pdb_lib_dir + bldinstallercommon.delete_files_by_type_recursive(pdb_lib_dir, '\S*\.pdb') + + pdb_qml_dir = bldinstallercommon.locate_directory(install_dir, 'qml') + if os.path.exists(pdb_qml_dir): + print 'Erasing pdb files from: ' + pdb_qml_dir + bldinstallercommon.delete_files_by_type_recursive(pdb_qml_dir, '\S*\.pdb') + + pdb_plugins_dir = bldinstallercommon.locate_directory(install_dir, 'plugins') + if os.path.exists(pdb_plugins_dir): + print 'Erasing pdb files from: ' + pdb_plugins_dir + bldinstallercommon.delete_files_by_type_recursive(pdb_plugins_dir, '\S*\.pdb') + else: + print 'Removal of pdb files is allowed only when creating offline installer!' + if archive.rpath_target: if not archive.rpath_target.startswith(os.sep): archive.rpath_target = os.sep + archive.rpath_target |