def archive_build_artifacts(base_path): # archive naming archive_name_base = 'icu' if os.environ.get('cfg'): archive_name_base += '-' + os.environ.get('cfg') elif os.environ.get('TARGET_ENV'): archive_name_base += '-' + os.environ.get('TARGET_ENV') # build artifacts output dir output_dir = os.path.join(SCRIPT_ROOT_DIR, ICU_BUILD_OUTPUT_DIR) if os.path.exists(output_dir): bldinstallercommon.remove_tree(output_dir) bldinstallercommon.create_dirs(output_dir) # devel package archive_name = archive_name_base + '-devel.7z' if os.path.isfile(archive_name): os.remove(archive_name) cmd_args = ['7z', 'a', archive_name, '*'] bldinstallercommon.do_execute_sub_process(cmd_args, base_path) shutil.move(os.path.join(base_path, archive_name), output_dir) # lib package archive_name = archive_name_base + '.7z' if os.path.isfile(archive_name): os.remove(archive_name) lib_path = bldinstallercommon.locate_directory(base_path, 'lib') clean_icu_lib(lib_path) cmd_args = ['7z', 'a', archive_name, '*'] bldinstallercommon.do_execute_sub_process(cmd_args, lib_path) shutil.move(os.path.join(lib_path, archive_name), output_dir)
def create_online_repository(build_job, packages_base_url, forced_version_number_bump): # ensure the string ends with '/' if not packages_base_url.endswith("/"): packages_base_url += "/" build_job.print_data() cmd_args = [ "python", "-u", "create_installer.py", "-c", build_job.configurations_dir, "-f", build_job.configurations_file, "--create-repo", "-l", build_job.license, "--version-number=" + build_job.version_number, "-u", packages_base_url, "--ifw-tools=" + build_job.ifw_tools, ] if forced_version_number_bump: cmd_args += ["--force-version-number-increase"] if len(build_job.substitution_arg_list) > 0: for item in build_job.substitution_arg_list: cmd_args = cmd_args + [item] bldinstallercommon.do_execute_sub_process(cmd_args, SCRIPT_ROOT_DIR)
def build_installer_framework_examples(options): print('--------------------------------------------------------------------') print('Building Installer Framework Examples') file_binarycreator = os.path.join(options.installer_framework_build_dir, 'bin', 'binarycreator') if bldinstallercommon.is_win_platform(): file_binarycreator += '.exe' if not os.path.exists(file_binarycreator): print('*** Unable to find binarycreator: {0}, aborting!'.format(file_binarycreator)) sys.exit(-1) ifw_examples = os.path.join(options.installer_framework_source_dir, 'examples') for root, dirs, files in os.walk(ifw_examples): if 'doc' in dirs: dirs.remove('doc') # don't visit doc dir if 'translations' in dirs: dirs.remove('translations') # for now don't visit translation example as qm files needs to be generated first for directory in dirs: print("********** building example " + directory) config_file = os.path.join(root, directory, 'config', 'config.xml') package_dir = os.path.join(root, directory, 'packages') target_dir = os.path.join(root, directory, 'installer') bldinstallercommon.do_execute_sub_process(args=(file_binarycreator, '--offline-only', '-c', config_file, '-p', package_dir, target_dir), execution_path=package_dir) #Breaking here as we don't want to go through sub directories break;
def install_docs(options, qt_build_dir): print('--------------------------------------------------------------------') print('Installing Qt documentation') cmd_args = options.make_install_cmd cmd_args += " docs" qt_build_dir += os.sep + 'qtbase' bldinstallercommon.do_execute_sub_process(cmd_args.split(' '), qt_build_dir)
def create_installer(job, packages_base_url, installer_type): # ensure the string ends with '/' if not packages_base_url.endswith("/"): packages_base_url += "/" job.print_data() cmd_args = ["python", "-u", "create_installer.py"] cmd_args = cmd_args + ["-c", job.configurations_dir] cmd_args = cmd_args + ["-f", job.configurations_file] cmd_args = cmd_args + [installer_type] cmd_args = cmd_args + ["-l", job.license] arch_naming = job.architecture package_type = job.get_package_type() if package_type: arch_naming = arch_naming + "-" + package_type cmd_args = cmd_args + ["-a", arch_naming] cmd_args = cmd_args + ["--version-number=" + job.version_number] cmd_args = cmd_args + ["--version-tag=" + job.version_number_tag] cmd_args = cmd_args + ["-u", packages_base_url] cmd_args = cmd_args + ["--ifw-tools=" + job.ifw_tools] cmd_args = cmd_args + ["--preferred-installer-name=" + job.installer_name] if len(job.substitution_arg_list) > 0: for item in job.substitution_arg_list: cmd_args = cmd_args + [item] # execute, do not bail out if installer job fails subprocess_exec_stataus = False try: bldinstallercommon.do_execute_sub_process(cmd_args, SCRIPT_ROOT_DIR) subprocess_exec_stataus = True except: # catch any interrupt into installer creation, we assume the operation failed subprocess_exec_stataus = False return subprocess_exec_stataus
def archive_installerbase(options): print('--------------------------------------------------------------------') print('Archive Installerbase') cmd_args_archive = [] cmd_args_clean = [] bin_temp = '' if bldinstallercommon.is_linux_platform() or bldinstallercommon.is_mac_platform(): bin_path = bldinstallercommon.locate_executable(options.installer_framework_build_dir, 'installerbase') bin_temp = ROOT_DIR + os.sep + '.tempSDKMaintenanceTool' shutil.copy(bin_path, bin_temp) cmd_args_archive = ['7z', 'a', options.installer_base_archive_name, bin_temp] cmd_args_clean = ['rm', bin_temp] if bldinstallercommon.is_win_platform(): bin_path = bldinstallercommon.locate_executable(options.installer_framework_build_dir, 'installerbase.exe') bin_temp = ROOT_DIR + os.sep + 'tempSDKMaintenanceToolBase.exe' shutil.copy(bin_path, bin_temp) if options.signserver and options.signpwd: sign_windows_installerbase('tempSDKMaintenanceToolBase.exe', ROOT_DIR + os.sep, True, options) cmd_args_archive = ['7z', 'a', options.installer_base_archive_name, bin_temp] cmd_args_clean = ['del', bin_temp] bldinstallercommon.do_execute_sub_process(cmd_args_archive, ROOT_DIR) bldinstallercommon.do_execute_sub_process(cmd_args_clean, ROOT_DIR) if not os.path.isfile(options.installer_base_archive_name): print('*** Failed to generate archive: {0}'.format(options.installer_base_archive_name)) sys.exit(-1) shutil.move(options.installer_base_archive_name, options.build_artifacts_dir)
def create_installer(job, packages_base_url, installer_type): # ensure the string ends with '/' if not packages_base_url.endswith('/'): packages_base_url += '/' job.print_data() cmd_args = ['python', '-u','create_installer.py'] cmd_args = cmd_args + ['-c', job.configurations_dir] cmd_args = cmd_args + ['-f', job.configurations_file] cmd_args = cmd_args + [installer_type] cmd_args = cmd_args + ['-l', job.license] arch_naming = job.architecture package_type = job.get_package_type() if package_type: arch_naming = arch_naming + '-' + package_type cmd_args = cmd_args + ['-a', arch_naming] cmd_args = cmd_args + ['--version-number=' + job.version_number] cmd_args = cmd_args + ['--version-tag=' + job.version_number_tag] cmd_args = cmd_args + ['-u', packages_base_url] cmd_args = cmd_args + ['--ifw-tools=' + job.ifw_tools] cmd_args = cmd_args + ['--preferred-installer-name=' + job.installer_name] if (len(job.substitution_arg_list) > 0): for item in job.substitution_arg_list: cmd_args = cmd_args + [item] # execute, do not bail out if installer job fails subprocess_exec_stataus = False try: bldinstallercommon.do_execute_sub_process(cmd_args, SCRIPT_ROOT_DIR) subprocess_exec_stataus = True except: # catch any interrupt into installer creation, we assume the operation failed subprocess_exec_stataus = False return subprocess_exec_stataus
def build_static_libclang_msvc(toolchain, src_path, build_path, install_path, profile_data_path, bitness=64, environment=None, build_type='Release'): build_path_static = os.path.join(build_path, 'static_build') if build_path_static and not os.path.lexists(build_path_static): os.makedirs(build_path_static) cmake_cmd = cmake_static_libclang(toolchain, src_path, install_path, profile_data_path, bitness, build_type) bldinstallercommon.do_execute_sub_process(cmake_cmd, build_path_static, extra_env=environment) build_and_install(toolchain, build_path_static, environment, ['libclang_static', 'libclang'], []) pack_command = [ 'lib.exe', '/OUT:' + os.path.join(install_path, 'lib', 'libclang_static.lib') ] for file in os.listdir(os.path.join(build_path_static, 'lib')): if file.endswith('.lib') and file != 'libclang.lib': pack_command.append(file) bld_utils.runCommand(pack_command, os.path.join(build_path_static, 'lib'), None, environment)
def build_installer_framework(options): if options.incremental_mode: file_to_check = os.path.join(options.installer_framework_build_dir, 'bin', 'installerbase') if bldinstallercommon.is_win_platform(): file_to_check += '.exe' if os.path.exists(file_to_check): return print( '--------------------------------------------------------------------') print('Building Installer Framework') qmake_bin = os.path.join(options.qt_build_dir, 'qtbase', 'bin', options.qt_qmake_bin) if not os.path.isfile(qmake_bin): print('*** Unable to find qmake, aborting!') print('qmake: {0}'.format(qmake_bin)) sys.exit(-1) if not os.path.exists(options.installer_framework_build_dir): bldinstallercommon.create_dirs(options.installer_framework_build_dir) cmd_args = [qmake_bin] cmd_args += options.qt_installer_framework_qmake_args cmd_args += [options.installer_framework_source_dir] bldinstallercommon.do_execute_sub_process( cmd_args, options.installer_framework_build_dir) cmd_args = options.make_cmd bldinstallercommon.do_execute_sub_process( cmd_args.split(' '), options.installer_framework_build_dir)
def create_installer(job, packages_base_url, installer_type): # ensure the string ends with '/' if not packages_base_url.endswith('/'): packages_base_url += '/' job.print_data() cmd_args = ['python', '-u','create_installer.py'] cmd_args = cmd_args + ['-c', job.configurations_dir] cmd_args = cmd_args + ['-f', job.configurations_file] cmd_args = cmd_args + [installer_type] cmd_args = cmd_args + ['-l', job.license] cmd_args = cmd_args + ['-u', packages_base_url] cmd_args = cmd_args + ['--ifw-tools=' + job.ifw_tools] cmd_args = cmd_args + ['--preferred-installer-name=' + job.installer_name] if (len(job.substitution_arg_list) > 0): for item in job.substitution_arg_list: cmd_args = cmd_args + [item] # execute, do not bail out if installer job fails subprocess_exec_stataus = False try: bldinstallercommon.do_execute_sub_process(cmd_args, SCRIPT_ROOT_DIR) subprocess_exec_stataus = True except: # catch any interrupt into installer creation, we assume the operation failed subprocess_exec_stataus = False return subprocess_exec_stataus
def build_qt(options, qt_build_dir, qt_configure_options, qt_modules): if options.incremental_mode: qmake_bin = os.path.join(options.qt_build_dir, 'qtbase', 'bin', options.qt_qmake_bin) qt_lib_dir = bldinstallercommon.locate_directory(qt_build_dir, 'lib') if os.path.isfile(qmake_bin) and os.path.isdir(qt_lib_dir): return bldinstallercommon.create_dirs(qt_build_dir) # configure first print( '--------------------------------------------------------------------') print('Configuring Qt') configure_options = re.sub(' +', ' ', qt_configure_options) cmd_args = options.qt_configure_bin + ' ' + configure_options # shlex does not like backslashes cmd_args = cmd_args.replace('\\', '/') bldinstallercommon.do_execute_sub_process( shlex.split(cmd_args), qt_build_dir, True, False, get_build_env(options.openssl_dir)) print( '--------------------------------------------------------------------') print('Building Qt') cmd_args = options.make_cmd cmd_args += qt_modules bldinstallercommon.do_execute_sub_process( cmd_args.split(' '), qt_build_dir, True, False, get_build_env(options.openssl_dir))
def build_docs(): print_wrap('------------------------- Building documentation -------------------') print_wrap(' Running \'make qmake_all\' ...') cmd_args = QT_BUILD_OPTIONS.make_cmd + ' qmake_all' bldinstallercommon.do_execute_sub_process(cmd_args.split(' '), QT_SOURCE_DIR, abort_on_fail=False, extra_env=QT_BUILD_OPTIONS.system_env) #first we need to do make install for the sources print_wrap(' Running make install...') install_args = MAKE_INSTALL_CMD bldinstallercommon.do_execute_sub_process(install_args.split(' '), QT_SOURCE_DIR, abort_on_fail=False, extra_env=QT_BUILD_OPTIONS.system_env) cmd_args = QT_BUILD_OPTIONS.make_cmd + ' docs' print_wrap(' Running make docs in ' + QT_SOURCE_DIR) #do not abort on fail, if the doc build fails, we still want to get the binary package bldinstallercommon.do_execute_sub_process(cmd_args.split(' '), QT_SOURCE_DIR, abort_on_fail=False, extra_env=QT_BUILD_OPTIONS.system_env) print_wrap(' Running make install_docs in ' + QT_SOURCE_DIR) make_cmd = QT_BUILD_OPTIONS.make_cmd install_root_path = MAKE_INSTALL_ROOT_DIR + os.sep + ESSENTIALS_INSTALL_DIR_NAME if bldinstallercommon.is_win_platform(): install_root_path = install_root_path[2:] doc_install_args = make_cmd + ' -j1 install_docs INSTALL_ROOT=' + install_root_path #do not abort on fail, if the doc build fails, we still want to get the binary package bldinstallercommon.do_execute_sub_process(doc_install_args.split(' '), QT_SOURCE_DIR, abort_on_fail=False, extra_env=QT_BUILD_OPTIONS.system_env) # Also archive docs in a separate qt5_docs.7z file print_wrap(' Archiving qt5_docs.7z') cmd_args = '7z a ' + MODULE_ARCHIVE_DIR + os.sep + 'qt5_docs' + '.7z *' run_in = os.path.normpath(MAKE_INSTALL_ROOT_DIR + os.sep + ESSENTIALS_INSTALL_DIR_NAME + os.sep + INSTALL_PREFIX + os.sep + 'doc') bldinstallercommon.do_execute_sub_process(cmd_args.split(' '), run_in, get_output=True) print_wrap('--------------------------------------------------------------------')
def build_sdktool_impl(params, qt_build_path): bldinstallercommon.create_dirs(params.build_path) if not params.use_cmake: qmake_command = os.path.join(qt_build_path, 'bin', 'qmake') bldinstallercommon.do_execute_sub_process([qmake_command, '-after', 'DESTDIR=' + params.target_path, params.src_path], params.build_path, redirect_output=params.redirect_output) bldinstallercommon.do_execute_sub_process([params.make_command], params.build_path, redirect_output=params.redirect_output) else: cmake_args = ['cmake', '-DCMAKE_PREFIX_PATH=' + qt_build_path, '-DCMAKE_BUILD_TYPE=Release'] # force MSVC on Windows, because it looks for GCC in the PATH first, # even if MSVC is first mentioned in the PATH... # TODO would be nicer if we only did this if cl.exe is indeed first in the PATH if bldinstallercommon.is_win_platform(): cmake_args += ['-DCMAKE_C_COMPILER=cl', '-DCMAKE_CXX_COMPILER=cl'] bldinstallercommon.do_execute_sub_process(cmake_args + ['-G', 'Ninja', params.src_path], params.build_path, redirect_output=params.redirect_output) bldinstallercommon.do_execute_sub_process(['cmake', '--build', '.'], params.build_path, redirect_output=params.redirect_output) bldinstallercommon.do_execute_sub_process(['cmake', '--install', '.', '--prefix', params.target_path], params.build_path, redirect_output=params.redirect_output)
def push_online_repository(optionDict, server_addr, username, directory_to_copy, where_to_copy): print('Preparing to copy: {0}'.format(directory_to_copy)) where_to_copy = ensure_unix_paths(where_to_copy) destination = username + '@' + server_addr + ':' + where_to_copy + '/' cmd_args = [optionDict['SCP_COMMAND'], '-r', '.', destination] bldinstallercommon.do_execute_sub_process(cmd_args, directory_to_copy)
def archive_installerbase(options): print( '--------------------------------------------------------------------') print('Archive Installerbase') cmd_args_archive = [] cmd_args_clean = [] bin_temp = '' if bldinstallercommon.is_linux_platform( ) or bldinstallercommon.is_mac_platform(): bin_path = bldinstallercommon.locate_executable( options.installer_framework_build_dir, 'installerbase') bin_temp = ROOT_DIR + os.sep + '.tempSDKMaintenanceTool' shutil.copy(bin_path, bin_temp) cmd_args_archive = [ '7z', 'a', options.installer_base_archive_name, bin_temp ] cmd_args_clean = ['rm', bin_temp] if bldinstallercommon.is_win_platform(): bin_path = bldinstallercommon.locate_executable( options.installer_framework_build_dir, 'installerbase.exe') bin_temp = ROOT_DIR + os.sep + 'tempSDKMaintenanceToolBase.exe' shutil.copy(bin_path, bin_temp) cmd_args_archive = [ '7z', 'a', options.installer_base_archive_name, bin_temp ] cmd_args_clean = ['del', bin_temp] bldinstallercommon.do_execute_sub_process(cmd_args_archive, ROOT_DIR) bldinstallercommon.do_execute_sub_process(cmd_args_clean, ROOT_DIR) if not os.path.isfile(options.installer_base_archive_name): print('*** Failed to generate archive: {0}'.format( options.installer_base_archive_name)) sys.exit(-1) shutil.move(options.installer_base_archive_name, options.build_artifacts_dir)
def build_static_libclang(toolchain, src_path, build_path, install_path, profile_data_path, bitness=64, environment=None, build_type='Release'): if build_path and not os.path.lexists(build_path): os.makedirs(build_path) cmake_cmd = cmake_static_libclang(toolchain, src_path, install_path, profile_data_path, bitness, build_type) bldinstallercommon.do_execute_sub_process(cmake_cmd, build_path, extra_env=environment) build_and_install(toolchain, build_path, environment, ['libclang_static'], []) if is_mingw_toolchain(toolchain): shutil.copy2(os.path.join(build_path, 'lib', 'liblibclang_static.a'), os.path.join(install_path, 'lib', 'libclang_static.a')) else: shutil.copy2(os.path.join(build_path, 'lib', 'libclang_static.a'), os.path.join(install_path, 'lib'))
def build_clazy(toolchain, src_path, build_path, install_path, bitness=64, environment=None): if build_path and not os.path.lexists(build_path): os.makedirs(build_path) cmake_cmd = [ 'cmake', '-G', cmake_generator(toolchain), '-DCMAKE_INSTALL_PREFIX=' + install_path, '-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_PREFIX_PATH=' + install_path ] if is_msvc_toolchain(toolchain): cmake_cmd.append('-DCLANG_LIBRARY_IMPORT=' + build_path + '/../build/lib/clang.lib') if bldinstallercommon.is_mac_platform(): cmake_cmd.append('-DREADLINK_CMD=greadlink') cmake_cmd.extend(bitness_flags(bitness)) cmake_cmd.append(src_path) bldinstallercommon.do_execute_sub_process(cmake_cmd, build_path, extra_env=environment) install_targets = ['install/strip'] if is_msvc_toolchain(toolchain): install_targets = ['install'] # There is no 'install/strip' for nmake. build_and_install(toolchain, build_path, environment, [], install_targets)
def archive(install_dir, archive_prefix): (dir, name) = os.path.split(install_dir) bldinstallercommon.do_execute_sub_process( ['7z', 'a', archive_prefix + '.7z', name], dir, True) bldinstallercommon.do_execute_sub_process( ['7z', 'a', archive_prefix + '-runtime.7z', '*.dll'], os.path.join(install_dir, 'bin'), True)
def create_installer(job, packages_base_url, installer_type): # ensure the string ends with '/' if not packages_base_url.endswith('/'): packages_base_url += '/' job.print_data() cmd_args = ['python', '-u', 'create_installer.py'] cmd_args = cmd_args + ['-c', job.configurations_dir] cmd_args = cmd_args + ['-f', job.configurations_file] cmd_args = cmd_args + [installer_type] cmd_args = cmd_args + ['-l', job.license] cmd_args = cmd_args + ['-u', packages_base_url] cmd_args = cmd_args + ['--ifw-tools=' + job.ifw_tools] cmd_args = cmd_args + ['--preferred-installer-name=' + job.installer_name] cmd_args = cmd_args + [ '--max-cpu-count=' + str(6 if bldinstallercommon.is_win_platform() else 8) ] if (len(job.substitution_arg_list) > 0): for item in job.substitution_arg_list: cmd_args = cmd_args + [item] # execute, do not bail out if installer job fails subprocess_exec_stataus = False try: bldinstallercommon.do_execute_sub_process(cmd_args, SCRIPT_ROOT_DIR) subprocess_exec_stataus = True except: # catch any interrupt into installer creation, we assume the operation failed subprocess_exec_stataus = False return subprocess_exec_stataus
def build(src_dir, install_dir, toolset): bldinstallercommon.do_execute_sub_process(['perl', 'Configure', toolset, '--openssldir=' + install_dir], src_dir, True) if toolset == 'VC-WIN32': bldinstallercommon.do_execute_sub_process(['ms\do_nasm.bat'], src_dir, True) else: bldinstallercommon.do_execute_sub_process(['ms\do_win64a'], src_dir, True) bldinstallercommon.do_execute_sub_process(['nmake', '-f', 'ms\\ntdll.mak'], src_dir, True) bldinstallercommon.do_execute_sub_process(['nmake', '-f', 'ms\\ntdll.mak', 'install'], src_dir, True)
def build_clang(toolchain, src_path, build_path, install_path, profile_data_path, first_run, bitness=64, environment=None, build_type='Release'): if build_path and not os.path.lexists(build_path): os.makedirs(build_path) cmake_cmd = cmake_command(toolchain, src_path, install_path, profile_data_path, first_run, bitness, build_type) bldinstallercommon.do_execute_sub_process(cmake_cmd, build_path, extra_env=environment) build_and_install(toolchain, build_path, environment, ['libclang', 'clang', 'llvm-config'], ['install'])
def build_clang(toolchain, src_path, build_path, install_path, profile_data_path, first_run, bitness=64, environment=None, build_type='Release'): if build_path and not os.path.lexists(build_path): os.makedirs(build_path) cmake_cmd = cmake_command(toolchain, src_path, build_path, install_path, profile_data_path, first_run, bitness, build_type) bldinstallercommon.do_execute_sub_process(cmake_cmd, build_path, extra_env=environment) build_and_install(toolchain, build_path, environment, ['libclang', 'clang', 'llvm-config'], ['install'])
def check_clang(toolchain, build_path, environment): if is_msvc_toolchain(toolchain) or is_mingw_toolchain(toolchain): tools_path = os.environ.get('WINDOWS_UNIX_TOOLS_PATH') if tools_path: path_key = 'Path' if 'Path' in environment else 'PATH' environment[path_key] += ';' + tools_path build_cmd = build_command(toolchain) bldinstallercommon.do_execute_sub_process(build_cmd + ['check-clang'], build_path, extra_env=environment)
def archive_macdeployqt(options): print('--------------------------------------------------------------------') print('Archive macdeployqt') content_path = options.qt_build_dir + os.sep + 'tools/macdeployqt/macchangeqt/macchangeqt' cmd_args_archive = ['7z', 'a', options.mac_deploy_qt_archive_name, content_path] bldinstallercommon.do_execute_sub_process(cmd_args_archive, ROOT_DIR) if not os.path.isfile(options.mac_deploy_qt_archive_name): print('*** Failed to generate archive: {0}'.format( options.mac_deploy_qt_archive_name)) sys.exit(-1) shutil.move(options.mac_deploy_qt_archive_name, options.build_artifacts_dir)
def build_and_install(toolchain, build_path, environment, build_targets, install_targets): build_cmd = build_command(toolchain) bldinstallercommon.do_execute_sub_process(build_cmd + build_targets, build_path, extra_env=environment) install_cmd = install_command(toolchain) bldinstallercommon.do_execute_sub_process(install_cmd + install_targets, build_path, extra_env=environment)
def archive_installer_framework(options): print('--------------------------------------------------------------------') print('Archive Installer Framework') # first strip out all unnecessary files for root, dummy, files in os.walk(options.installer_framework_build_dir): for filename in files: if filename.endswith(('.moc', 'Makefile', '.cpp', '.h', '.o')) or filename == 'Makefile': os.remove(os.path.join(root, filename)) cmd_args = ['7z', 'a', options.installer_framework_archive_name, os.path.basename(options.installer_framework_build_dir)] bldinstallercommon.do_execute_sub_process(cmd_args, ROOT_DIR) shutil.move(options.installer_framework_archive_name, options.build_artifacts_dir)
def build_clang(toolchain, src_path, build_path, install_path, bitness=64, environment=None, build_type='Release'): if build_path and not os.path.lexists(build_path): os.makedirs(build_path) cmake_cmd = cmake_command(toolchain, src_path, build_path, install_path, bitness, build_type) bldinstallercommon.do_execute_sub_process(cmake_cmd, build_path, extra_env=environment) build_targets = ['install/strip'] if is_msvc_toolchain(toolchain): build_targets = ['install'] # There is no 'install/strip' for nmake. build_and_install(toolchain, build_path, environment, ['libclang', 'clang', 'llvm-config'], build_targets)
def archive_installer_framework(installer_framework_build_dir, installer_framework_archive_name, build_artifacts_dir): print('--------------------------------------------------------------------') print('Archive Installer Framework') # first strip out all unnecessary files for root, dummy, files in os.walk(installer_framework_build_dir): for filename in files: if filename.endswith(('.moc', 'Makefile', '.cpp', '.h', '.o')) or filename == 'Makefile': os.remove(os.path.join(root, filename)) cmd_args = ['7z', 'a', installer_framework_archive_name, os.path.basename(installer_framework_build_dir)] bldinstallercommon.do_execute_sub_process(cmd_args, ROOT_DIR) shutil.move(installer_framework_archive_name, build_artifacts_dir)
def push_online_repository(optionDict, server_addr, username, directory_to_copy, where_to_copy): print('Preparing to copy: {0}'.format(directory_to_copy)) where_to_copy = ensure_unix_paths(where_to_copy) destination = username + '@' + server_addr + ':' + where_to_copy + '/' parts = directory_to_copy.strip(os.path.sep).split(os.path.sep) parentDir = os.path.sep + os.path.sep.join(parts[:-1]) dirToCopy = parts[-1] if bldinstallercommon.is_win_platform(): parentDir = os.path.sep.join(parts[:-1]) cmd_args = [optionDict['SCP_COMMAND'], '-r', dirToCopy, destination] bldinstallercommon.do_execute_sub_process(cmd_args, parentDir)
def configure_qt(): print_wrap('---------------- Configuring Qt ------------------------------------') cmd_args = CONFIGURE_CMD + ' ' + CONFIGURE_OPTIONS # shlex does not like backslashes cmd_args = cmd_args.replace('\\', '/') print_wrap(' Configure line: ' + cmd_args) if os.path.exists(QT_SOURCE_DIR + os.sep + CONFIGURE_CMD): print_wrap(' configure found from ' + QT_SOURCE_DIR) bldinstallercommon.do_execute_sub_process(shlex.split(cmd_args), QT_SOURCE_DIR, extra_env=QT_BUILD_OPTIONS.system_env) else: print_wrap(' configure found from ' + QT_SOURCE_DIR + os.sep + 'qtbase') bldinstallercommon.do_execute_sub_process(shlex.split(cmd_args), QT_SOURCE_DIR + os.sep + 'qtbase', extra_env=QT_BUILD_OPTIONS.system_env) print_wrap('--------------------------------------------------------------------')
def archive_nib(options): print('--------------------------------------------------------------------') print('Archive qt_menu.nib') content_parent_path = options.qt_source_dir + os.sep + 'src/gui/mac' content_root_path = content_parent_path + os.sep + 'qt_menu.nib' content_parent_path = os.path.normpath(content_parent_path) content_root_path = os.path.normpath(content_root_path) cmd_args = ['7z', 'a', options.mac_qt_menu_nib_archive_name, content_root_path] bldinstallercommon.do_execute_sub_process(cmd_args, ROOT_DIR) if not os.path.isfile(options.mac_qt_menu_nib_archive_name): print('*** Failed to generate archive: {0}'.format(options.mac_qt_menu_nib_archive_name)) sys.exit(-1) shutil.move(options.mac_qt_menu_nib_archive_name, options.build_artifacts_dir)
def build_ifw_docs(options): print('--------------------------------------------------------------------') print('Building Qt Installer Framework Documentation') qmake_bin = bldinstallercommon.locate_file(options.qt_build_dir_dynamic, options.qt_qmake_bin) if not os.path.isfile(qmake_bin): print('*** Aborting doc build, unable to find qmake from: {0}'.format(options.qt_build_dir_dynamic)) sys.exit(-1) cmd_args = qmake_bin + ' ' + options.installer_framework_source_dir bldinstallercommon.do_execute_sub_process(cmd_args.split(' '), options.installer_framework_build_dir) cmd_args = options.make_doc_cmd + ' docs' env = dict(os.environ) env['LD_LIBRARY_PATH'] = os.path.normpath(os.path.join(os.path.dirname(qmake_bin), '..', 'lib')) bldinstallercommon.do_execute_sub_process(args=cmd_args.split(' '), execution_path=options.installer_framework_build_dir, abort_on_fail=True, get_output=False, extra_env=env)
def build_static_libclang_msvc(toolchain, src_path, build_path, install_path, profile_data_path, bitness=64, environment=None, build_type='Release'): build_path_static = os.path.join(build_path, 'static_build') if build_path_static and not os.path.lexists(build_path_static): os.makedirs(build_path_static) cmake_cmd = cmake_static_libclang(toolchain, src_path, install_path, profile_data_path, bitness, build_type) bldinstallercommon.do_execute_sub_process(cmake_cmd, build_path_static, extra_env=environment) build_and_install(toolchain, build_path_static, environment, ['libclang_static', 'libclang'], []) pack_command = ['lib.exe', '/OUT:' + os.path.join(install_path, 'lib', 'libclang_static.lib')] for file in os.listdir(os.path.join(build_path_static, 'lib')): if file.endswith('.lib') and file != 'libclang.lib': pack_command.append(file) bld_utils.runCommand(pack_command, os.path.join(build_path_static, 'lib'), None, environment)
def build_ifw_docs(options): print('--------------------------------------------------------------------') print('Building Qt Installer Framework Documentation') qmake_bin = os.path.join(options.qt_build_dir_dynamic, 'qtbase', 'bin', options.qt_qmake_bin) if not os.path.isfile(qmake_bin): print('*** Aborting doc build, unable to find qmake from: {0}'.format(options.qt_build_dir_dynamic)) sys.exit(-1) cmd_args = qmake_bin + ' ' + options.installer_framework_source_dir bldinstallercommon.do_execute_sub_process(cmd_args.split(' '), options.installer_framework_build_dir) cmd_args = options.make_doc_cmd + ' docs' env = dict(os.environ) env['LD_LIBRARY_PATH'] = os.path.normpath(os.path.join(os.path.dirname(qmake_bin), '..', 'lib')) bldinstallercommon.do_execute_sub_process(args=cmd_args.split(' '), execution_path=options.installer_framework_build_dir, abort_on_fail=True, get_output=False, extra_env=env)
def build_icu_linux(environment, icu_src_base_dir, archive_icu): bldinstallercommon.create_dirs(os.path.join(SCRIPT_ROOT_DIR, ICU_INSTALL_DIR_NAME)) exec_path = icu_src_base_dir # configure environment['LFLAGS'] = '-Wl,-rpath,\$ORIGIN' cmd_args = ['./runConfigureICU', 'Linux', '--enable-rpath', '--prefix=' + os.path.join(SCRIPT_ROOT_DIR, ICU_INSTALL_DIR_NAME)] exec_path = os.path.dirname(bldinstallercommon.locate_file(os.path.join(SCRIPT_ROOT_DIR, ICU_SRC_DIR_NAME), 'configure')) bldinstallercommon.do_execute_sub_process(cmd_args, exec_path, extra_env=environment) # build cmd_args = ['make', '-j' + str(multiprocessing.cpu_count() + 1)] bldinstallercommon.do_execute_sub_process(cmd_args, exec_path, extra_env=environment) cmd_args = ['make', 'install'] bldinstallercommon.do_execute_sub_process(cmd_args, exec_path, extra_env=environment) # patch RPath exec_path = os.path.join(SCRIPT_ROOT_DIR, ICU_INSTALL_DIR_NAME, 'lib') files = bldinstallercommon.make_files_list(exec_path, '.so$') for item in files: cmd_args = 'chrpath -r $ORIGIN ' + item bldinstallercommon.do_execute_sub_process(cmd_args.split(' '), exec_path, extra_env=environment) icu_configuration = ICUConfiguration search_path = os.path.join(SCRIPT_ROOT_DIR, ICU_INSTALL_DIR_NAME) icu_configuration.icu_include_path = bldinstallercommon.locate_directory(search_path, 'include') icu_configuration.icu_lib_path = bldinstallercommon.locate_directory(search_path, 'lib') # archvive icu build artifacts if requested if archive_icu: archive_build_artifacts(search_path) return icu_configuration
def build(src_dir, install_dir, toolset): bldinstallercommon.do_execute_sub_process( ['perl', 'Configure', toolset, '--openssldir=' + install_dir], src_dir, True) if toolset == 'VC-WIN32': bldinstallercommon.do_execute_sub_process(['ms\do_nasm.bat'], src_dir, True) else: bldinstallercommon.do_execute_sub_process(['ms\do_win64a'], src_dir, True) bldinstallercommon.do_execute_sub_process(['nmake', '-f', 'ms\\ntdll.mak'], src_dir, True) bldinstallercommon.do_execute_sub_process( ['nmake', '-f', 'ms\\ntdll.mak', 'install'], src_dir, True)
def build_qt(): print_wrap('---------------- Building Qt ---------------------------------------') #remove if old dir exists if os.path.exists(MAKE_INSTALL_ROOT_DIR): shutil.rmtree(MAKE_INSTALL_ROOT_DIR) #create install dirs bldinstallercommon.create_dirs(MAKE_INSTALL_ROOT_DIR) cmd_args = QT_BUILD_OPTIONS.make_cmd if bldinstallercommon.is_unix_platform(): cmd_args += ' -j' + str(QT_BUILD_OPTIONS.make_thread_count) elif bldinstallercommon.is_win_platform() and 'mingw32-make' in QT_BUILD_OPTIONS.make_cmd: cmd_args += ' -j' + str(QT_BUILD_OPTIONS.make_thread_count) bldinstallercommon.do_execute_sub_process(cmd_args.split(' '), QT_SOURCE_DIR, abort_on_fail=QT_BUILD_OPTIONS.strict_mode, extra_env=QT_BUILD_OPTIONS.system_env) print_wrap('--------------------------------------------------------------------')
def get_qt_install_prefix(qt_path): cmd_args = [ os.path.join(qt_path, 'bin', 'qmake'), '-query', 'QT_INSTALL_PREFIX' ] ret, qt_install_prefix = bldinstallercommon.do_execute_sub_process( cmd_args, qt_path, get_output=True) return qt_install_prefix.strip()
def archive_configure_exe(): print_wrap( '------------- Adding configure.exe to the archive(s) -------------------' ) print_wrap(' Adding to ' + QT_SRC_ZIP) archive = os.path.basename(QT_SRC_ZIP) zip_archive_file = zipfile.ZipFile(archive, "a") exe_location = QT_SRC_DIR + os.sep + 'qtbase' + os.sep + 'configure.exe' exe_in_zip = QT_PKG_NAME + '\\qtbase\\configure.exe' try: zip_archive_file.write(exe_location, exe_in_zip, zipfile.ZIP_DEFLATED) except WindowsError: print_wrap('*** Error, failed to add configure.exe to ' + QT_SRC_ZIP) print_wrap('*** Exiting..') sys.exit(-1) zip_archive_file.close() print_wrap(' Adding to ' + QT_MODULE_ZIP) archive2 = os.path.basename(QT_MODULE_ZIP) zip_archive_file2 = zipfile.ZipFile(archive2, "a") exe_in_zip2 = QT_MODULE_PKG_NAME + '\\configure.exe' try: zip_archive_file2.write(exe_location, exe_in_zip2, zipfile.ZIP_DEFLATED) except WindowsError: print_wrap('*** Error, failed to add configure.exe to ' + QT_MODULE_ZIP) print_wrap('*** Exiting..') sys.exit(-1) zip_archive_file2.close() if DO_7Z: print_wrap(' Adding to ' + QT_SRC_7Z) cmd_args = ['7z', 'u', QT_SRC_7Z, exe_in_zip] bldinstallercommon.do_execute_sub_process(cmd_args, SCRIPT_ROOT_DIR, True, False) print_wrap(' Adding to ' + QT_MODULE_7Z) cmd_args = [ '7z', 'u', QT_MODULE_7Z, QT_MODULE_PKG_NAME + os.sep + 'configure.exe' ] bldinstallercommon.do_execute_sub_process(cmd_args, MODULE_DIR, True, False) print_wrap( '--------------------------------------------------------------------')
def create_online_repository(build_job, packages_base_url, forced_version_number_bump): # ensure the string ends with '/' if not packages_base_url.endswith('/'): packages_base_url += '/' build_job.print_data() cmd_args = ['python', '-u', 'create_installer.py', \ '-c', build_job.configurations_dir, \ '-f', build_job.configurations_file, \ '--create-repo', \ '-l', build_job.license, \ '-u', packages_base_url, \ '--ifw-tools='+ build_job.ifw_tools] if forced_version_number_bump: cmd_args += ['--force-version-number-increase'] if (len(build_job.substitution_arg_list) > 0): for item in build_job.substitution_arg_list: cmd_args = cmd_args + [item] bldinstallercommon.do_execute_sub_process(cmd_args, SCRIPT_ROOT_DIR)
def install_qt(): print_wrap('---------------- Installing Qt -------------------------------------') if QNX_BUILD: install_root_path = MAKE_INSTALL_ROOT_DIR + os.sep + SINGLE_INSTALL_DIR_NAME if bldinstallercommon.is_win_platform(): # do not use drive letter when running make install [because of c:$(INSTALL_ROOT)/$(PREFIX)] install_root_path = install_root_path[2:] # apply the workaround from QTBUG-38555 install_root_path = install_root_path.replace('\\','/').replace('/', '\\', 1) cmd_args = MAKE_INSTALL_CMD + ' ' + 'INSTALL_ROOT=' + install_root_path print_wrap('Installing module: Qt top level') return_code, output = bldinstallercommon.do_execute_sub_process(cmd_args.split(' '), QT_SOURCE_DIR, abort_on_fail=QT_BUILD_OPTIONS.strict_mode, extra_env=QT_BUILD_OPTIONS.system_env) return #make install for each module with INSTALL_ROOT print_wrap('Install modules to separate INSTALL_ROOT') for module_name in QT5_MODULES_LIST: # we do not provide pre-built examples if module_name in QT5_MODULE_INSTALL_EXCLUDE_LIST: print_wrap('Qt5 module excluded from make install: ' + module_name) continue # determine into which final archive this module belongs into install_dir = '' if module_name in QT_BUILD_OPTIONS.module_separate_install_list: install_dir = module_name elif module_name in QT5_ESSENTIALS: install_dir = ESSENTIALS_INSTALL_DIR_NAME else: install_dir = ADDONS_INSTALL_DIR_NAME install_root_path = MAKE_INSTALL_ROOT_DIR + os.path.sep + install_dir if bldinstallercommon.is_win_platform(): install_root_path = install_root_path[2:] print_wrap('Using install root path: ' + install_root_path) submodule_dir_name = QT_SOURCE_DIR + os.sep + module_name cmd_args = MAKE_INSTALL_CMD + ' ' + 'INSTALL_ROOT=' + install_root_path print_wrap('Installing module: ' + module_name) return_code, output = bldinstallercommon.do_execute_sub_process(cmd_args.split(' '), submodule_dir_name, abort_on_fail=QT_BUILD_OPTIONS.strict_mode, extra_env=QT_BUILD_OPTIONS.system_env) if return_code >= 0: file_handle = open(MISSING_MODULES_FILE, 'a') file_handle.write('\nFailed to install ' + module_name) file_handle.close() print_wrap('--------------------------------------------------------------------')
def do_split(location_archive, archives_dir, tmp_archive_dir): archivePath = location_archive tmpDir = tmp_archive_dir # create temp directories for location & positioning if not os.path.exists(os.path.join(tmpDir, locationDir)): os.makedirs(os.path.join(tmpDir, locationDir)) if not os.path.exists(os.path.join(tmpDir, positioningDir)): os.makedirs(os.path.join(tmpDir, positioningDir)) locationDest = os.path.join(tmpDir, locationDir) positioningDest = os.path.join(tmpDir, positioningDir) bldinstallercommon.extract_file(archivePath, locationDest) bldinstallercommon.extract_file(archivePath, positioningDest) # check for new files in the qtlocation archive do_content_comparison(locationDest, getFileCount(archivePath)) # remove *qtpositioning* from qt5_qtlocation.7z locRegex = re.compile('\.*osition\.*') do_cleanup(locRegex, locationDest) # remove *qtlocation* from qt5_qtpositionign.7z posRegex = re.compile('\.*ocation\.*') do_cleanup(posRegex, positioningDest) # remove original qtlocation os.remove(archivePath) # archive qt5_qtlocation.7z os.chdir(locationDest) cmd_args_archive = ['7z', 'a', locationDir, '*'] bldinstallercommon.do_execute_sub_process(cmd_args_archive, locationDest) shutil.copy2(os.path.join(locationDest, locationDir) + '.7z', archives_dir) # archive qt5_qtpositioning.7z os.chdir(positioningDest) cmd_args_archive = ['7z', 'a', positioningDir, '*'] bldinstallercommon.do_execute_sub_process(cmd_args_archive, positioningDest) shutil.copy2( os.path.join(positioningDest, positioningDir) + '.7z', archives_dir)
def build_qt(options, qt_build_dir, qt_configure_options, qt_modules): if options.incremental_mode: qmake_bin = bldinstallercommon.locate_file(qt_build_dir, options.qt_qmake_bin) qt_lib_dir = bldinstallercommon.locate_directory(qt_build_dir, 'lib') if os.path.isfile(qmake_bin) and os.path.isdir(qt_lib_dir): return bldinstallercommon.create_dirs(qt_build_dir) # configure first print('--------------------------------------------------------------------') print('Configuring Qt') configure_options = re.sub(' +', ' ', qt_configure_options) cmd_args = options.qt_configure_bin + ' ' + configure_options # shlex does not like backslashes cmd_args = cmd_args.replace('\\', '/') bldinstallercommon.do_execute_sub_process(shlex.split(cmd_args), qt_build_dir, True, False, get_build_env(options.openssl_dir)) print('--------------------------------------------------------------------') print('Building Qt') cmd_args = options.make_cmd cmd_args += qt_modules bldinstallercommon.do_execute_sub_process(cmd_args.split(' '), qt_build_dir, True, False, get_build_env(options.openssl_dir))
def build_clang(toolchain, src_path, build_path, install_path, profile_data_path, generate_instrumented, bitness=64, environment=None, build_type='Release'): if build_path and not os.path.lexists(build_path): os.makedirs(build_path) cmake_cmd = cmake_command(toolchain, src_path, build_path, install_path, profile_data_path, generate_instrumented, bitness, build_type) bldinstallercommon.do_execute_sub_process(cmake_cmd, build_path, extra_env=environment) bldinstallercommon.do_execute_sub_process(make_command(toolchain), build_path, extra_env=environment) bldinstallercommon.do_execute_sub_process(install_command(toolchain), build_path, extra_env=environment)
def configure_qt(): print_wrap( '----------------------- Configuring qt -----------------------------') cmd_args = CONFIGURE_CMD + ' ' + CONFIGURE_OPTIONS gitignore = QT_SRC_DIR + os.sep + 'qtbase' + os.sep + '.gitignore' open(gitignore, 'w').close() if os.path.exists(QT_SRC_DIR + os.sep + CONFIGURE_CMD): print_wrap(' configure found from ' + QT_SRC_DIR) bldinstallercommon.do_execute_sub_process(cmd_args.split(' '), QT_SRC_DIR, False) else: print_wrap(' configure found from ' + QT_SRC_DIR + os.sep + 'qtbase') bldinstallercommon.do_execute_sub_process( cmd_args.split(' '), QT_SRC_DIR + os.sep + 'qtbase', False) if QT_MODULE_ZIP_URL: cmd_args = "copy " + QT_SRC_DIR + os.sep + 'qtbase' + os.sep + 'configure.exe ' + MODULE_DIR + os.sep + QT_MODULE_PKG_NAME bldinstallercommon.do_execute_sub_process(cmd_args.split(' '), '.', True) print_wrap(' copied configure.exe') else: print_wrap(' module url empty') sys.exit(-1) print_wrap( '--------------------------------------------------------------------')
def do_split(location_archive, archives_dir, tmp_archive_dir): archivePath = location_archive tmpDir = tmp_archive_dir # create temp directories for location & positioning if not os.path.exists(os.path.join(tmpDir, locationDir)): os.makedirs(os.path.join(tmpDir, locationDir)) if not os.path.exists(os.path.join(tmpDir, positioningDir)): os.makedirs(os.path.join(tmpDir, positioningDir)) locationDest = os.path.join(tmpDir, locationDir) positioningDest = os.path.join(tmpDir, positioningDir) bldinstallercommon.extract_file(archivePath, locationDest) bldinstallercommon.extract_file(archivePath, positioningDest) # check for new files in the qtlocation archive do_content_comparison(locationDest, getFileCount(archivePath)) # remove *qtpositioning* from qt5_qtlocation.7z locRegex = re.compile('\.*osition\.*') do_cleanup(locRegex, locationDest) # remove *qtlocation* from qt5_qtpositionign.7z posRegex = re.compile('\.*ocation\.*') do_cleanup(posRegex, positioningDest) # remove original qtlocation os.remove(archivePath) # archive qt5_qtlocation.7z os.chdir(locationDest) cmd_args_archive = ['7z', 'a', locationDir, '*'] bldinstallercommon.do_execute_sub_process(cmd_args_archive, locationDest) shutil.copy2(os.path.join(locationDest, locationDir) + '.7z', archives_dir) # archive qt5_qtpositioning.7z os.chdir(positioningDest) cmd_args_archive = ['7z', 'a', positioningDir, '*'] bldinstallercommon.do_execute_sub_process(cmd_args_archive, positioningDest) shutil.copy2(os.path.join(positioningDest, positioningDir) + '.7z', archives_dir)
def build_installer_framework(options): if options.incremental_mode: file_to_check = os.path.join(options.installer_framework_build_dir, 'bin', 'installerbase') if bldinstallercommon.is_win_platform(): file_to_check += '.exe' if os.path.exists(file_to_check): return print('--------------------------------------------------------------------') print('Building Installer Framework') qmake_bin = bldinstallercommon.locate_file(options.qt_build_dir, options.qt_qmake_bin) if not os.path.isfile(qmake_bin): print('*** Unable to find qmake, aborting!') print('qmake: {0}'.format(qmake_bin)) sys.exit(-1) if not os.path.exists(options.installer_framework_build_dir): bldinstallercommon.create_dirs(options.installer_framework_build_dir) cmd_args = [qmake_bin] cmd_args += options.qt_installer_framework_qmake_args cmd_args += [options.installer_framework_source_dir] bldinstallercommon.do_execute_sub_process(cmd_args, options.installer_framework_build_dir) cmd_args = options.make_cmd bldinstallercommon.do_execute_sub_process(cmd_args.split(' '), options.installer_framework_build_dir)
def update_repository(source_pkg, target_repo, components_to_update): print('Updating repository') print(' Target repository: {0}'.format(target_repo)) print(' Source pkg: {0}'.format(source_pkg)) print(' Components: {0}'.format(components_to_update)) print() if not len(components_to_update): raise RuntimeError('*** You asked me to update nothing?') if not os.path.exists(source_pkg): raise IOError('*** Source pkg does not exist: %s' % source_pkg) if not os.path.exists(target_repo): raise IOError('*** Target repository does not exist: %s' % target_repo) # do we update new components only or all given components no matter # what the version numbers are repogen_update_cmd = '--update' if UPDATE_NEW_COMPONENTS_ONLY: repogen_update_cmd = '--update-new-components' cmd_args = [REPOGEN_TOOL, repogen_update_cmd, '-p', source_pkg] if components_to_update[0] and components_to_update[0] == '*': cmd_args += [target_repo] else: cmd_args += ['--include', ','.join(components_to_update), target_repo] bldinstallercommon.do_execute_sub_process(cmd_args, source_pkg, True)
def archive_configure_exe(): print_wrap('------------- Adding configure.exe to the archive(s) -------------------') print_wrap(' Adding to ' + QT_SRC_ZIP) archive = os.path.basename(QT_SRC_ZIP) zip_archive_file = zipfile.ZipFile(archive, "a" ) exe_location = QT_SRC_DIR + os.sep + 'qtbase' + os.sep + 'configure.exe' exe_in_zip = QT_PKG_NAME + '\\qtbase\\configure.exe' try: zip_archive_file.write(exe_location, exe_in_zip, zipfile.ZIP_DEFLATED ) except WindowsError: print_wrap('*** Error, failed to add configure.exe to ' + QT_SRC_ZIP) print_wrap('*** Exiting..') sys.exit(-1) zip_archive_file.close() print_wrap(' Adding to ' + QT_MODULE_ZIP) archive2 = os.path.basename(QT_MODULE_ZIP) zip_archive_file2 = zipfile.ZipFile(archive2, "a" ) exe_in_zip2 = QT_MODULE_PKG_NAME + '\\configure.exe' try: zip_archive_file2.write(exe_location, exe_in_zip2, zipfile.ZIP_DEFLATED ) except WindowsError: print_wrap('*** Error, failed to add configure.exe to ' + QT_MODULE_ZIP) print_wrap('*** Exiting..') sys.exit(-1) zip_archive_file2.close() if DO_7Z: print_wrap(' Adding to ' + QT_SRC_7Z) cmd_args = ['7z', 'u', QT_SRC_7Z, exe_in_zip] bldinstallercommon.do_execute_sub_process(cmd_args, SCRIPT_ROOT_DIR, True, False) print_wrap(' Adding to ' + QT_MODULE_7Z) cmd_args = ['7z', 'u', QT_MODULE_7Z, QT_MODULE_PKG_NAME + os.sep + 'configure.exe'] bldinstallercommon.do_execute_sub_process(cmd_args, MODULE_DIR, True, False) print_wrap('--------------------------------------------------------------------')
def archive_submodules(): print_wrap('---------------- Archiving submodules ------------------------------') bldinstallercommon.create_dirs(MODULE_ARCHIVE_DIR) if QNX_BUILD: print_wrap('---------- Archiving Qt modules') install_path = MAKE_INSTALL_ROOT_DIR + os.sep + SINGLE_INSTALL_DIR_NAME if bldinstallercommon.is_win_platform(): install_path = 'C' + install_path[1:] if os.path.exists(install_path): cmd_args = '7z a ' + MODULE_ARCHIVE_DIR + os.sep + 'qt5_essentials' + '.7z *' run_in = os.path.normpath(install_path + os.sep + INSTALL_PREFIX) bldinstallercommon.do_execute_sub_process(cmd_args.split(' '), run_in, get_output=True) else: print_wrap(install_path + os.sep + SINGLE_INSTALL_DIR_NAME + ' DIRECTORY NOT FOUND\n -> Qt not archived!') return file_list = os.listdir(MAKE_INSTALL_ROOT_DIR) for item in file_list: print_wrap('---------- Archiving: ' + item) cmd_args = ['7z', 'a', MODULE_ARCHIVE_DIR + os.sep + 'qt5_' + item, '.7z' , '*'] run_in = os.path.normpath(MAKE_INSTALL_ROOT_DIR + os.sep + item + os.sep + INSTALL_PREFIX) bldinstallercommon.do_execute_sub_process(cmd_args, run_in, get_output=True) return
def build_installer_framework_examples(options): print('--------------------------------------------------------------------') print('Building Installer Framework Examples') if options.squish_dir: file_binarycreator = os.path.join(options.installer_framework_build_dir_squish, 'bin', 'binarycreator') else: file_binarycreator = os.path.join(options.installer_framework_build_dir, 'bin', 'binarycreator') if bldinstallercommon.is_win_platform(): file_binarycreator += '.exe' if not os.path.exists(file_binarycreator): print('*** Unable to find binarycreator: {0}, aborting!'.format(file_binarycreator)) sys.exit(-1) ifw_examples = os.path.join(options.installer_framework_source_dir, 'examples') ifw_example_binaries = [] for root, dirs, files in os.walk(ifw_examples): if 'doc' in dirs: dirs.remove('doc') # don't visit doc dir if 'translations' in dirs: dirs.remove('translations') # for now don't visit translation example as qm files needs to be generated first for directory in dirs: print("********** building example " + directory) config_file = os.path.join(root, directory, 'config', 'config.xml') package_dir = os.path.join(root, directory, 'packages') target_filename = os.path.join(root, directory, 'installer') bldinstallercommon.do_execute_sub_process(args=(file_binarycreator, '--offline-only', '-c', config_file, '-p', package_dir, target_filename), execution_path=package_dir) if bldinstallercommon.is_win_platform: target_filename += '.exe' ifw_example_binaries.append(target_filename) #Breaking here as we don't want to go through sub directories break file_squishDir = options.squish_dir if os.path.exists(file_squishDir): print('--------------------------------------------------------------------') print('Running squish tests') # Windows if sys.platform.startswith('win'): squishserver_handle = subprocess.Popen(os.path.join(file_squishDir, 'bin', 'squishserver.exe')) bldinstallercommon.do_execute_sub_process(args=('squishrunner.exe --testsuite ' + os.path.join(os.getcwd(), 'squish_suites', 'suite_IFW_examples')), execution_path=os.path.join(file_squishDir, 'bin')) squishserver_handle.kill() # this will not kill squishserver most likely subprocess.Popen("TASKKILL /IM _squishserver.exe /F") #this should kill squish server # Unix else: squishserver_handle = subprocess.Popen(shlex.split(os.path.join(file_squishDir, "bin", "squishserver")), shell=False) bldinstallercommon.do_execute_sub_process(args=shlex.split(os.path.join(file_squishDir, "bin", "squishrunner") + ' --testsuite ' +os.path.join(os.getcwd(), "squish_suites", "suite_IFW_examples")), execution_path=os.path.join(file_squishDir, "bin")) squishserver_handle.kill() #kills squish server # Delete the example executables we have created for Squish for example in ifw_example_binaries: print("Removing " + example) os.remove(example)