def init_mkqt5bld(): global CONFIGURE_CMD global CONFIGURE_OPTIONS global MAKE_INSTALL_CMD global QT_BUILD_OPTIONS print_wrap('---------------- Initializing build --------------------------------') #do not edit configure options, if configure options are overridden from commandline options if bldinstallercommon.is_unix_platform(): CONFIGURE_CMD = './' if QT_BUILD_OPTIONS.silent_build and not bldinstallercommon.is_win_platform(): CONFIGURE_OPTIONS += ' -silent' # add required configuration arguments if Android build if ANDROID_BUILD: CONFIGURE_OPTIONS += ' -android-ndk ' + QT_BUILD_OPTIONS.android_ndk_home CONFIGURE_OPTIONS += ' -android-sdk ' + QT_BUILD_OPTIONS.android_sdk_home QT_BUILD_OPTIONS.system_env['ANDROID_NDK_HOST'] = QT_BUILD_OPTIONS.android_ndk_host QT_BUILD_OPTIONS.system_env['ANDROID_API_VERSION'] = QT_BUILD_OPTIONS.android_api_version CONFIGURE_CMD += 'configure' # make cmd if QT_BUILD_OPTIONS.make_cmd == '': #if not given in commandline param, use nmake or make according to the os if bldinstallercommon.is_win_platform(): #win QT_BUILD_OPTIONS.make_cmd = 'nmake' MAKE_INSTALL_CMD = 'nmake' if QT_BUILD_OPTIONS.silent_build: QT_BUILD_OPTIONS.make_cmd += ' /s' MAKE_INSTALL_CMD += ' /s' MAKE_INSTALL_CMD += ' install' elif bldinstallercommon.is_unix_platform(): #linux & mac QT_BUILD_OPTIONS.make_cmd = 'make' MAKE_INSTALL_CMD = 'make' if QT_BUILD_OPTIONS.silent_build: QT_BUILD_OPTIONS.make_cmd += ' -s' MAKE_INSTALL_CMD += ' -s' MAKE_INSTALL_CMD += ' install' else: if QT_BUILD_OPTIONS.make_cmd == 'jom': MAKE_INSTALL_CMD = 'jom -j1 install' if QT_BUILD_OPTIONS.silent_build: QT_BUILD_OPTIONS.make_cmd += ' -s -nologo' MAKE_INSTALL_CMD += ' -s -nologo' ## QTBUG-38555: make install INSTALL_ROOT=\some\path does not work on Windows # always use 'make' for 'make install', 'mingw32-make install' does not work atm elif QT_BUILD_OPTIONS.make_cmd == 'mingw32-make' and bldinstallercommon.is_win_platform() and QNX_BUILD: MAKE_INSTALL_CMD = 'make install' #remove old working dirs if os.path.exists(WORK_DIR): print_wrap(' Removing old work dir ' + WORK_DIR) bldinstallercommon.remove_tree(WORK_DIR) if os.path.exists(MODULE_ARCHIVE_DIR): print_wrap(' Removing old module archive dir ' + MODULE_ARCHIVE_DIR) bldinstallercommon.remove_tree(MODULE_ARCHIVE_DIR) print_wrap(' Build : ' + QT_BUILD_OPTIONS.make_cmd) print_wrap(' Install : ' + MAKE_INSTALL_CMD) print_wrap(' Configure: ' + CONFIGURE_OPTIONS) print_wrap('--------------------------------------------------------------------')
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 clean_icu_lib(lib_path): plat = platform.system().lower() if plat.startswith('linux'): libs_to_save = ['libicudata', 'libicui18n', 'libicuuc'] file_list = os.listdir(lib_path) for item in file_list: item_path = os.path.join(lib_path, item) if os.path.isdir(item_path): bldinstallercommon.remove_tree(item_path) elif (item.count('.') > 1) and any(item[:item.index('.')] in s for s in libs_to_save): continue else: os.remove(item_path) elif plat.startswith('win'): libs_to_save = ['icudt??.dll', 'icuin??.dll', 'icuuc??.dll'] file_list = os.listdir(lib_path) for item in file_list: item_path = os.path.join(lib_path, item) if os.path.isdir(item_path): bldinstallercommon.remove_tree(item_path) elif any(fnmatch.fnmatch(item, p) for p in libs_to_save): continue else: os.remove(item_path) else: print('*** Platform not supported: {0}'.format(plat)) sys.exit(-1)
def build_ifw(options, create_installer=False, build_ifw_examples=False): # verbose options.print_data() #clean environment first clean_build_environment(options) #checkout sources prepare_installer_framework(options) # copy qt sources prepare_qt_sources(options) # build qt build_qt(options, options.qt_build_dir, options.qt_configure_options, options.qt_build_modules) # build installer framework build_installer_framework(options) if build_ifw_examples: build_installer_framework_examples(options) # steps when creating ifw installer if create_installer: configure_options = get_dynamic_qt_configure_options() + '-prefix ' + options.qt_build_dir_dynamic + os.sep + 'qtbase' # Although we have a shadow build qt sources are still taminated. Unpack sources again. if os.path.exists(options.qt_source_dir): bldinstallercommon.remove_tree(options.qt_source_dir) # copy qt sources prepare_qt_sources(options) build_qt(options, options.qt_build_dir_dynamic, configure_options, options.qt_build_modules_docs) build_ifw_docs(options) create_installer_package(options) #archive archive_installerbase(options) archive_installer_framework(options) return os.path.basename(options.installer_framework_build_dir)
def prepare_src_package(src_pkg_uri, src_pkg_saveas, destination_dir): print('Fetching Src package from: {0}'.format(src_pkg_uri)) if not os.path.isfile(src_pkg_saveas): if not bldinstallercommon.is_content_url_valid(src_pkg_uri): print('*** Src package uri is invalid! Abort!') sys.exit(-1) bldinstallercommon.retrieve_url(src_pkg_uri, src_pkg_saveas) else: print( 'Found old local package, using that: {0}'.format(src_pkg_saveas)) print('Done') print( '--------------------------------------------------------------------') bldinstallercommon.create_dirs(destination_dir) bldinstallercommon.extract_file(src_pkg_saveas, destination_dir) l = os.listdir(destination_dir) items = len(l) if items == 1: dir_name = l[0] full_dir_name = destination_dir + os.sep + dir_name bldinstallercommon.move_tree(full_dir_name, destination_dir) bldinstallercommon.remove_tree(full_dir_name) else: print('*** Invalid dir structure encountered?!') sys.exit(-1)
def clean_build_environment(options): if os.path.isfile(options.installer_framework_archive_name): os.remove(options.installer_framework_archive_name) if os.path.isfile(options.installer_framework_payload_arch): os.remove(options.installer_framework_payload_arch) if os.path.exists(options.build_artifacts_dir): bldinstallercommon.remove_tree(options.build_artifacts_dir) bldinstallercommon.create_dirs(options.build_artifacts_dir) if os.path.exists(options.installer_framework_build_dir): bldinstallercommon.remove_tree(options.installer_framework_build_dir) if os.path.exists(options.installer_framework_pkg_dir): shutil.rmtree(options.installer_framework_pkg_dir) if os.path.exists(options.installer_framework_target_dir): shutil.rmtree(options.installer_framework_target_dir) if options.incremental_mode: return if os.path.exists(options.installer_framework_source_dir): bldinstallercommon.remove_tree(options.installer_framework_source_dir) if os.path.exists(options.qt_source_dir): bldinstallercommon.remove_tree(options.qt_source_dir) if os.path.exists(options.qt_build_dir): bldinstallercommon.remove_tree(options.qt_build_dir) if os.path.isfile(options.qt_source_package_uri_saveas): os.remove(options.qt_source_package_uri_saveas) if os.path.isfile(options.qt_installer_framework_uri_saveas): os.remove(options.qt_installer_framework_uri_saveas)
def fetch_repogen_tools(tools_uri): global REPOGEN_TOOL executable_suffix = bldinstallercommon.get_executable_suffix() # first check if we have existing copy of the tool if os.path.exists(REPOGEN_TOOLS_DIR): tool = bldinstallercommon.locate_executable(REPOGEN_TOOLS_DIR, REPOGEN_TOOL + executable_suffix) if os.path.isfile(tool): REPOGEN_TOOL = tool print('Found existing repogen tool: {0}'.format(REPOGEN_TOOL)) return else: # remove the bogus directory bldinstallercommon.remove_tree(REPOGEN_TOOLS_DIR) # create dirs bldinstallercommon.create_dirs(REPOGEN_TOOLS_DIR) # fetch print('Fetch repogen tools') if bldinstallercommon.is_content_url_valid(tools_uri): package_save_as_temp = os.path.normpath(os.path.join(ROOT_DIR, os.path.basename(tools_uri))) bldinstallercommon.retrieve_url(tools_uri, package_save_as_temp) bldinstallercommon.extract_file(package_save_as_temp, REPOGEN_TOOLS_DIR) print('Trying to locate repogen tool: {0}'.format(REPOGEN_TOOL + executable_suffix)) tool = bldinstallercommon.locate_executable(REPOGEN_TOOLS_DIR, REPOGEN_TOOL + executable_suffix) if not os.path.isfile(tool): raise IOError('Unable to locate repogen tool [%s] under directory: %s' % (REPOGEN_TOOL + executable_suffix, REPOGEN_TOOLS_DIR)) else: REPOGEN_TOOL = tool else: raise IOError('Invalid url: %s' % tools_uri) # found the tool print('Using repogen tool: {0}'.format(REPOGEN_TOOL))
def handle_repo_build(optionDict, branch, arch, update_staging_repo, update_production_repo): conf_file = optionDict['RELEASE_DESCRIPTION_FILE'] if not os.path.isfile(conf_file): raise IOError('*** Fatal error! Given file does not exist: %s' % conf_file) init_env(optionDict) packages_base_url = optionDict['PACKAGE_STORAGE_SERVER_PATH_HTTP'] ifw_base_url = optionDict['IFW_TOOLS_BASE_URL'] release_tools_dir = SCRIPT_ROOT_DIR # parse conf file parser = ConfigParser.ConfigParser() parser.readfp(open(conf_file)) section_name = branch + '.' + 'global' global_version = bldinstallercommon.safe_config_key_fetch(parser, section_name, 'version') global_version_tag = bldinstallercommon.safe_config_key_fetch(parser, section_name, 'version_tag') # parse build jobs repo_job_list = get_repo_job_list(optionDict, branch, arch, global_version, global_version_tag) if (len(repo_job_list) == 0): raise RuntimeError('*** Fatal error! No repository build jobs found. Probably an error? %s' % conf_file) # init repo dirs init_repositories(optionDict, repo_job_list) # is this snapshot build? Then enable component version number forced update forced_version_number_bump = False if update_staging_repo and not update_production_repo: forced_version_number_bump = True if optionDict.get('FORCE_VERSION_NUMBER_INCREASE') in ['yes', 'true', '1']: forced_version_number_bump = True # create rta description file rta_descr_output_dir = os.path.join(SCRIPT_ROOT_DIR, pkg_constants.RTA_DESCRIPTION_FILE_DIR_NAME) bldinstallercommon.create_dirs(rta_descr_output_dir) architecture = bldinstallercommon.get_architecture() plat_suffix = bldinstallercommon.get_platform_suffix() rta_description_file_name = os.path.join( rta_descr_output_dir, pkg_constants.RTA_DESCRIPTION_FILE_NAME_BASE + '-' + plat_suffix + '-' + architecture + '-repo.txt') # handle repo build jobs for job in repo_job_list: create_online_repository(job, packages_base_url, forced_version_number_bump) # determine testination path on test server dest_path_repository, dest_path_pkg = generate_repo_dest_path_pending(optionDict, job) # copy repo content to test server source_path_repository = os.path.join(release_tools_dir, 'repository') source_path_pkg = os.path.join(release_tools_dir, 'pkg') push_online_repository(optionDict, optionDict['PKG_STAGING_SERVER'], optionDict['PKG_STAGING_SERVER_UNAME'], source_path_repository, dest_path_repository) push_online_repository(optionDict, optionDict['PKG_STAGING_SERVER'], optionDict['PKG_STAGING_SERVER_UNAME'], source_path_pkg, dest_path_pkg) # remove local repository and pkg directories bldinstallercommon.remove_tree(source_path_repository) bldinstallercommon.remove_tree(source_path_pkg) # update repo in testing area staging_repo_updated, dummy = update_online_repo(optionDict, job, update_staging_repo, update_production_repo) # write the rta description file only if staging repository creation was ok if (staging_repo_updated): rta_description_file = open(rta_description_file_name, 'a') rta_description_file.write(job.repo_url_specifier + ' ' + job.rta_key_list + '\n') rta_description_file.close()
def init(): if bldinstallercommon.is_win_platform() == False: print_wrap(' *** Error: Not a windows platform, can not create configure.exe! Exiting...') sys.exit(-1) print_wrap('Emptying the working directory...') contents = os.listdir(QT_SRC_DIR) if len(contents) > 0: for item in contents: print_wrap(' Deleting ' + item) if os.path.isdir(item): bldinstallercommon.remove_tree(item) else: os.remove(item) else: print_wrap(' Nothing to delete.')
def init(): if bldinstallercommon.is_win_platform() == False: print_wrap( ' *** Error: Not a windows platform, can not create configure.exe! Exiting...' ) sys.exit(-1) print_wrap('Emptying the working directory...') contents = os.listdir(QT_SRC_DIR) if len(contents) > 0: for item in contents: print_wrap(' Deleting ' + item) if os.path.isdir(item): bldinstallercommon.remove_tree(item) else: os.remove(item) else: print_wrap(' Nothing to delete.')
def extract_src_package(): global QT_SOURCE_DIR global QT_BUILD_OPTIONS print_wrap('---------------- Extracting source package -------------------------') if os.path.exists(QT_SOURCE_DIR): print_wrap('Source dir ' + QT_SOURCE_DIR + ' already exists, using that (not re-extracting the archive!)') else: print_wrap('Extracting source package: ' + QT_PACKAGE_SAVE_AS_TEMP) print_wrap('Into: ' + QT_SOURCE_DIR) bldinstallercommon.create_dirs(QT_SOURCE_DIR) bldinstallercommon.extract_file(QT_PACKAGE_SAVE_AS_TEMP, QT_SOURCE_DIR) time.sleep(10) l = os.listdir(QT_SOURCE_DIR) items = len(l) if items == 1: print_wrap(' Replacing qt-everywhere-xxx-src-5.0.0 with shorter path names') shorter_dir_path = QT_SOURCE_DIR + os.sep + QT_PACKAGE_SHORT_NAME time.sleep(10) print_wrap(QT_SOURCE_DIR + os.sep + l[0] + ',' + shorter_dir_path) time.sleep(20) os.rename(QT_SOURCE_DIR + os.sep + l[0], shorter_dir_path) time.sleep(10) print_wrap(' Old source dir: ' + QT_SOURCE_DIR) QT_SOURCE_DIR = shorter_dir_path print_wrap(' New source dir: ' + QT_SOURCE_DIR) #CONFIGURE_CMD = QT_SOURCE_DIR + os.sep + CONFIGURE_CMD #is this needed in shadow build? else: print_wrap('*** Unsupported directory structure!!!') sys.exit(-1) #Remove the modules to be ignored for ignore in QT_BUILD_OPTIONS.module_ignore_list: if os.path.exists(QT_SOURCE_DIR + os.sep + ignore): print_wrap(' Removing ' + ignore) bldinstallercommon.remove_tree(QT_SOURCE_DIR + os.sep + ignore) # Locate gnuwin32 tools if bldinstallercommon.is_win_platform(): gnuwin32_path = bldinstallercommon.locate_directory(QT_SOURCE_DIR, 'gnuwin32') gnuwin32_path = os.path.join(gnuwin32_path, 'bin') QT_BUILD_OPTIONS.system_env['PATH'] = gnuwin32_path + ';' + QT_BUILD_OPTIONS.system_env['PATH'] print_wrap('--------------------------------------------------------------------')
def use_custom_icu(): if os.path.isdir(QT_BUILD_OPTIONS.icu_uri): return QT_BUILD_OPTIONS.icu_uri package_raw_name = os.path.basename(QT_BUILD_OPTIONS.icu_uri) icu_extract_path = os.path.join(SCRIPT_ROOT_DIR, 'icu_saveas') if os.path.isdir(icu_extract_path): bldinstallercommon.remove_tree(icu_extract_path) bldinstallercommon.create_dirs(icu_extract_path) icu_extract_saveas = os.path.join(icu_extract_path, package_raw_name) if os.path.isfile(QT_BUILD_OPTIONS.icu_uri): bldinstallercommon.extract_file(QT_BUILD_OPTIONS.icu_uri, icu_extract_path) if bldinstallercommon.is_content_url_valid(QT_BUILD_OPTIONS.icu_uri): bldinstallercommon.retrieve_url(QT_BUILD_OPTIONS.icu_uri, icu_extract_saveas) bldinstallercommon.extract_file(icu_extract_saveas, icu_extract_path) lib_path = bldinstallercommon.locate_directory(icu_extract_path, 'lib') if not lib_path: return icu_extract_path if (lib_path.endswith('/')): lib_path = lib_path[:len(lib_path) - 1] return os.path.dirname(lib_path)
def build_ifw(options, create_installer=False, build_ifw_examples=False): # verbose options.print_data() #clean environment first clean_build_environment(options) #checkout sources prepare_installer_framework(options) if options.qt_binaries_static: prepare_compressed_package(options.qt_binaries_static, options.qt_binaries_static_saveas, options.qt_build_dir) else: prepare_qt_sources(options) build_qt(options, options.qt_build_dir, options.qt_configure_options, options.qt_build_modules) if(options.squish_src): build_squish(options) # build installer framework build_installer_framework(options) if build_ifw_examples or options.squish_dir: build_installer_framework_examples(options) # steps when creating ifw installer if create_installer: if options.qt_binaries_dynamic: prepare_compressed_package(options.qt_binaries_dynamic, options.qt_binaries_dynamic_saveas, options.qt_build_dir_dynamic) if bldinstallercommon.is_win_platform(): patch_win32_mkspecs(os.path.join(options.qt_build_dir_dynamic, "qtbase", "mkspecs")) else: configure_options = get_dynamic_qt_configure_options() + '-prefix ' + options.qt_build_dir_dynamic + os.sep + 'qtbase' # Although we have a shadow build qt sources are still taminated. Unpack sources again. if os.path.exists(options.qt_source_dir): bldinstallercommon.remove_tree(options.qt_source_dir) prepare_qt_sources(options) build_qt(options, options.qt_build_dir_dynamic, configure_options, options.qt_build_modules_docs) build_ifw_docs(options) create_installer_package(options) #archive archive_installerbase(options) archive_installer_framework(options.installer_framework_build_dir, options.installer_framework_archive_name, options.build_artifacts_dir) if (options.squish_dir): archive_installer_framework(options.installer_framework_build_dir_squish, options.installer_framework_with_squish_archive_name, options.build_artifacts_dir) return os.path.basename(options.installer_framework_build_dir)
def fetch_repogen_tools(tools_uri): global REPOGEN_TOOL executable_suffix = bldinstallercommon.get_executable_suffix() # first check if we have existing copy of the tool if os.path.exists(REPOGEN_TOOLS_DIR): tool = bldinstallercommon.locate_executable( REPOGEN_TOOLS_DIR, REPOGEN_TOOL + executable_suffix) if os.path.isfile(tool): REPOGEN_TOOL = tool print('Found existing repogen tool: {0}'.format(REPOGEN_TOOL)) return else: # remove the bogus directory bldinstallercommon.remove_tree(REPOGEN_TOOLS_DIR) # create dirs bldinstallercommon.create_dirs(REPOGEN_TOOLS_DIR) # fetch print('Fetch repogen tools') if bldinstallercommon.is_content_url_valid(tools_uri): package_save_as_temp = os.path.normpath( os.path.join(ROOT_DIR, os.path.basename(tools_uri))) bldinstallercommon.retrieve_url(tools_uri, package_save_as_temp) bldinstallercommon.extract_file(package_save_as_temp, REPOGEN_TOOLS_DIR) print('Trying to locate repogen tool: {0}'.format(REPOGEN_TOOL + executable_suffix)) tool = bldinstallercommon.locate_executable( REPOGEN_TOOLS_DIR, REPOGEN_TOOL + executable_suffix) if not os.path.isfile(tool): raise IOError( 'Unable to locate repogen tool [%s] under directory: %s' % (REPOGEN_TOOL + executable_suffix, REPOGEN_TOOLS_DIR)) else: REPOGEN_TOOL = tool else: raise IOError('Invalid url: %s' % tools_uri) # found the tool print('Using repogen tool: {0}'.format(REPOGEN_TOOL))
def prepare_compressed_package(src_pkg_uri, src_pkg_saveas, destination_dir): print('Fetching package from: {0}'.format(src_pkg_uri)) if not os.path.isfile(src_pkg_saveas): if not bldinstallercommon.is_content_url_valid(src_pkg_uri): print('*** Src package uri is invalid! Abort!') sys.exit(-1) bldinstallercommon.retrieve_url(src_pkg_uri, src_pkg_saveas) else: print('Found old local package, using that: {0}'.format(src_pkg_saveas)) print('Done') print('--------------------------------------------------------------------') bldinstallercommon.create_dirs(destination_dir) bldinstallercommon.extract_file(src_pkg_saveas, destination_dir) l = os.listdir(destination_dir) items = len(l) if items == 1: dir_name = l[0] full_dir_name = destination_dir + os.sep + dir_name bldinstallercommon.move_tree(full_dir_name, destination_dir) bldinstallercommon.remove_tree(full_dir_name) else: print('*** Invalid dir structure encountered?!') sys.exit(-1)
def build_plugins(caller_arguments): (basename,_) = os.path.splitext(os.path.basename(caller_arguments.target_7zfile)) Paths = collections.namedtuple('Paths', ['qt5', 'temp', 'qtc_dev', 'qtc_build', 'source', 'build', 'target', 'dev_target']) paths = Paths(qt5 = os.path.join(caller_arguments.build_path, basename + '-qt5'), temp = os.path.join(caller_arguments.build_path, basename + '-temp'), qtc_dev = caller_arguments.qtc_dev, qtc_build = caller_arguments.qtc_build, source = caller_arguments.plugin_path, build = os.path.join(caller_arguments.build_path, basename + '-build'), target = os.path.join(caller_arguments.build_path, basename + '-target'), dev_target = os.path.join(caller_arguments.build_path, basename + '-tempdev')) if caller_arguments.clean: bldinstallercommon.remove_tree(paths.qt5) bldinstallercommon.remove_tree(paths.temp) if caller_arguments.qtc_dev_url: bldinstallercommon.remove_tree(paths.qtc_dev) if caller_arguments.qtc_build_url: bldinstallercommon.remove_tree(paths.qtc_build) bldinstallercommon.remove_tree(paths.build) bldinstallercommon.remove_tree(paths.target) bldinstallercommon.remove_tree(paths.dev_target) download_packages_work = ThreadedWork('Get and extract all needed packages') need_to_install_qt = not os.path.exists(paths.qt5) if need_to_install_qt: download_packages_work.addTaskObject(bldinstallercommon.create_qt_download_task( caller_arguments.qt_modules, paths.qt5, paths.temp, caller_arguments)) if caller_arguments.qtc_build_url and not os.path.exists(paths.qtc_build): download_packages_work.addTaskObject(bldinstallercommon.create_download_extract_task(caller_arguments.qtc_build_url, paths.qtc_build, paths.temp, caller_arguments)) if caller_arguments.qtc_dev_url and not os.path.exists(paths.qtc_dev): download_packages_work.addTaskObject(bldinstallercommon.create_download_extract_task(caller_arguments.qtc_dev_url, paths.qtc_dev, paths.temp, caller_arguments)) if download_packages_work.taskNumber != 0: download_packages_work.run() if need_to_install_qt: patch_qt_pri_files(paths.qt5) bldinstallercommon.patch_qt(paths.qt5) # qmake arguments qmake_filepath = qmake_binary(paths.qt5) common_qmake_arguments = get_common_qmake_arguments(paths, caller_arguments) # environment environment = get_common_environment(paths.qt5, caller_arguments) # build plugins print('------------') print('Building plugin "{0}" in "{1}" ...'.format(paths.source, paths.build)) qmake_command = [qmake_filepath] qmake_command.append(paths.source) qmake_command.extend(common_qmake_arguments) runCommand(qmake_command, paths.build, callerArguments = caller_arguments, init_environment = environment) runBuildCommand(currentWorkingDirectory = paths.build, callerArguments = caller_arguments, init_environment = environment) # run custom deploy script if caller_arguments.deploy_command: custom_deploy_command = caller_arguments.deploy_command + [paths.qt5, paths.target] runCommand(custom_deploy_command, currentWorkingDirectory = paths.target) sevenzip_filepath = '7z.exe' if bldinstallercommon.is_win_platform() else '7z' if hasattr(caller_arguments, 'sevenzippath') and caller_arguments.sevenzippath: sevenzip_filepath = os.path.join(caller_arguments.sevenzippath, sevenzip_filepath) # deploy and zip up deploy_command = ['python', '-u', os.path.join(paths.qtc_dev, 'scripts', 'packagePlugins.py'), '--qmake_binary', os.path.join(paths.qt5, 'bin', 'qmake'), '--7z', sevenzip_filepath] deploy_command.extend([paths.target, caller_arguments.target_7zfile]) runCommand(deploy_command, paths.temp, callerArguments = caller_arguments, init_environment = environment) if caller_arguments.target_dev7zfile: dev_command = ['python', '-u', os.path.join(paths.qtc_dev, 'scripts', 'createDevPackage.py'), '--source', paths.source, '--build', paths.build, '--7z', sevenzip_filepath, '--7z_out', caller_arguments.target_dev7zfile, paths.dev_target] runCommand(dev_command, paths.temp, callerArguments = caller_arguments, init_environment = environment)
def handle_repo_build(optionDict, branch, arch, update_staging_repo, update_production_repo): conf_file = optionDict['RELEASE_DESCRIPTION_FILE'] if not os.path.isfile(conf_file): raise IOError('*** Fatal error! Given file does not exist: %s' % conf_file) init_env(optionDict) packages_base_url = optionDict['PACKAGE_STORAGE_SERVER_PATH_HTTP'] ifw_base_url = optionDict['IFW_TOOLS_BASE_URL'] release_tools_dir = SCRIPT_ROOT_DIR # parse conf file parser = ConfigParser.ConfigParser() parser.readfp(open(conf_file)) section_name = branch + '.' + 'global' global_version = bldinstallercommon.safe_config_key_fetch(parser, section_name, 'version') global_version_tag = bldinstallercommon.safe_config_key_fetch(parser, section_name, 'version_tag') # parse build jobs repo_job_list = get_repo_job_list(optionDict, branch, arch, global_version, global_version_tag) if (len(repo_job_list) == 0): raise RuntimeError('*** Fatal error! No repository build jobs found. Probably an error? %s' % conf_file) # init repo dirs init_repositories(optionDict, repo_job_list) # is this snapshot build? Then enable component version number forced update forced_version_number_bump = False if update_staging_repo and not update_production_repo: forced_version_number_bump = True if optionDict.get('FORCE_VERSION_NUMBER_INCREASE') in ['yes', 'true', '1']: forced_version_number_bump = True # create rta description file rta_descr_output_dir = os.path.join(SCRIPT_ROOT_DIR, pkg_constants.RTA_DESCRIPTION_FILE_DIR_NAME) bldinstallercommon.create_dirs(rta_descr_output_dir) architecture = bldinstallercommon.get_architecture() plat_suffix = bldinstallercommon.get_platform_suffix() rta_description_file_name = os.path.join( rta_descr_output_dir, pkg_constants.RTA_DESCRIPTION_FILE_NAME_BASE + '-' + plat_suffix + '-' + architecture + '-repo.txt') # handle repo build jobs for job in repo_job_list: create_online_repository(job, packages_base_url, forced_version_number_bump) # determine testination path on test server dest_path_repository, dest_path_pkg = generate_repo_dest_path_pending(optionDict, job) # copy repo content to test server source_path_repository = os.path.join(release_tools_dir, 'online_repository') source_path_pkg = os.path.join(release_tools_dir, 'pkg') push_online_repository(optionDict, optionDict['PKG_STAGING_SERVER'], optionDict['PKG_STAGING_SERVER_UNAME'], source_path_repository, dest_path_repository) push_online_repository(optionDict, optionDict['PKG_STAGING_SERVER'], optionDict['PKG_STAGING_SERVER_UNAME'], source_path_pkg, dest_path_pkg) # remove local repository and pkg directories bldinstallercommon.remove_tree(source_path_repository) bldinstallercommon.remove_tree(source_path_pkg) # update repo in testing area staging_repo_updated, production_repo_updated = update_online_repo(optionDict, job, update_staging_repo, update_production_repo) # write the rta description file only if staging repository creation was ok # remove also temp staging repositories from 'staging_pending' and 'production_dist_update_work' directories server_addr = optionDict['PKG_STAGING_SERVER_UNAME'] + '@' + optionDict['PKG_STAGING_SERVER'] if (staging_repo_updated): rta_description_file = open(rta_description_file_name, 'a') rta_description_file.write(job.repo_url_specifier + ' ' + job.rta_key_list + '\n') rta_description_file.close() staging_temp_content_to_be_deleted = generate_repo_path_for_pending_area(optionDict, job) delete_online_repo_paths(optionDict, server_addr, staging_temp_content_to_be_deleted) if (production_repo_updated): production_temp_content_to_be_deleted = optionDict['REPO_STAGING_SERVER_TEST_REPO_DIST_WORK'] + '/' + optionDict['ONLINE_REPOSITORY_BASE_NAME'] + '/' + job.repo_url_specifier delete_online_repo_paths(optionDict, server_addr, production_temp_content_to_be_deleted)
'wininterrupt') wininterruptBuildDirectory = os.path.abspath( os.path.join(qtCreatorSourceDirectory, '..', 'wininterrupt_build')) wininterruptInstallDirectory = os.path.abspath( os.path.join(qtCreatorSourceDirectory, '..', 'wininterrupt_install')) tempPath = os.path.abspath( os.path.join(qtCreatorSourceDirectory, '..', 'qt-creator_temp')) check_arguments(callerArguments) # clean step if callerArguments.clean: print("##### {0} #####".format("clean old builds")) bldinstallercommon.remove_tree(callerArguments.qt5path) bldinstallercommon.remove_tree(qtCreatorBuildDirectory) bldinstallercommon.remove_tree(qtCreatorInstallDirectory) if bldinstallercommon.is_win_platform(): bldinstallercommon.remove_tree(cdbextBuildDirectory) bldinstallercommon.remove_tree(cdbextInstallDirectory) bldinstallercommon.remove_tree(wininterruptBuildDirectory) bldinstallercommon.remove_tree(wininterruptInstallDirectory) bldinstallercommon.remove_tree(tempPath) qmakeBinary = qmake_binary(callerArguments.qt5path) download_packages_work = ThreadedWork("get and extract Qt 5 binaries") need_to_install_qt = not os.path.lexists(callerArguments.qt5path) if need_to_install_qt: download_packages_work.addTaskObject(
def cleanup_icu(): bldinstallercommon.remove_tree(os.path.join(SCRIPT_ROOT_DIR, ICU_SRC_DIR_NAME)) bldinstallercommon.remove_tree(os.path.join(SCRIPT_ROOT_DIR, ICU_INSTALL_DIR_NAME))
'..', 'cdbextension_install')) wininterruptSourceDirectory = os.path.join(qtCreatorSourceDirectory, 'src', 'tools', 'wininterrupt') wininterruptBuildDirectory = os.path.abspath(os.path.join(qtCreatorSourceDirectory, '..', 'wininterrupt_build')) wininterruptInstallDirectory = os.path.abspath(os.path.join(qtCreatorSourceDirectory, '..', 'wininterrupt_install')) tempPath = os.path.abspath(os.path.join(qtCreatorSourceDirectory, '..', 'qt-creator_temp')) check_arguments(callerArguments) # clean step if callerArguments.clean: print("##### {0} #####".format("clean old builds")) bldinstallercommon.remove_tree(callerArguments.qt5path) bldinstallercommon.remove_tree(qtCreatorBuildDirectory) bldinstallercommon.remove_tree(qtCreatorInstallDirectory) if bldinstallercommon.is_win_platform(): bldinstallercommon.remove_tree(cdbextBuildDirectory) bldinstallercommon.remove_tree(cdbextInstallDirectory) bldinstallercommon.remove_tree(wininterruptBuildDirectory) bldinstallercommon.remove_tree(wininterruptInstallDirectory) bldinstallercommon.remove_tree(tempPath) qmakeBinary = qmake_binary(callerArguments.qt5path) download_packages_work = ThreadedWork("get and extract Qt 5 binaries") need_to_install_qt = not os.path.lexists(callerArguments.qt5path) if need_to_install_qt:
'..', 'qt-creator_install')) tempPath = os.path.abspath(os.path.join(qtCreatorSourceDirectory, '..', 'qt-creator_temp')) # check mac setup if bldinstallercommon.is_mac_platform(): if callerArguments.keychain_unlock_script: if not os.environ['SIGNING_IDENTITY']: print('error: Environment variable SIGNING_IDENTITY not set') sys.exit(1) # clean step if callerArguments.clean: print("##### {0} #####".format("clean old builds")) bldinstallercommon.remove_tree(callerArguments.qt5path) bldinstallercommon.remove_tree(qtCreatorBuildDirectory) bldinstallercommon.remove_tree(qtCreatorInstallDirectory) bldinstallercommon.remove_tree(tempPath) if not os.path.lexists(callerArguments.qt5path) and not callerArguments.qt_modules: parser.print_help() print(("error: You have to pass the --qt-module argument if the {0} does not exist" + os.linesep + os.linesep).format(callerArguments.qt5path)) sys.exit(1) qmakeBinary = qmake_binary(callerArguments.qt5path) download_packages_work = ThreadedWork("get and extract Qt 5 binaries") need_to_install_qt = not os.path.lexists(callerArguments.qt5path) if need_to_install_qt:
def cleanup_icu(): bldinstallercommon.remove_tree( os.path.join(SCRIPT_ROOT_DIR, ICU_SRC_DIR_NAME)) bldinstallercommon.remove_tree( os.path.join(SCRIPT_ROOT_DIR, ICU_INSTALL_DIR_NAME))
def build_plugins(caller_arguments): (basename, _) = os.path.splitext(os.path.basename(caller_arguments.target_7zfile)) Paths = collections.namedtuple('Paths', [ 'qt5', 'temp', 'qtc_dev', 'qtc_build', 'source', 'build', 'target', 'dev_target' ]) paths = Paths(qt5=os.path.join(caller_arguments.build_path, basename + '-qt5'), temp=os.path.join(caller_arguments.build_path, basename + '-temp'), qtc_dev=caller_arguments.qtc_dev, qtc_build=caller_arguments.qtc_build, source=caller_arguments.plugin_path, build=os.path.join(caller_arguments.build_path, basename + '-build'), target=os.path.join(caller_arguments.build_path, basename + '-target'), dev_target=os.path.join(caller_arguments.build_path, basename + '-tempdev')) if caller_arguments.clean: bldinstallercommon.remove_tree(paths.qt5) bldinstallercommon.remove_tree(paths.temp) if caller_arguments.qtc_dev_url: bldinstallercommon.remove_tree(paths.qtc_dev) if caller_arguments.qtc_build_url: bldinstallercommon.remove_tree(paths.qtc_build) bldinstallercommon.remove_tree(paths.build) bldinstallercommon.remove_tree(paths.target) bldinstallercommon.remove_tree(paths.dev_target) download_packages_work = ThreadedWork( 'Get and extract all needed packages') need_to_install_qt = not os.path.exists(paths.qt5) if need_to_install_qt: download_packages_work.addTaskObject( bldinstallercommon.create_qt_download_task( caller_arguments.qt_modules, paths.qt5, paths.temp, caller_arguments)) if caller_arguments.qtc_build_url and not os.path.exists(paths.qtc_build): download_packages_work.addTaskObject( bldinstallercommon.create_download_extract_task( caller_arguments.qtc_build_url, paths.qtc_build, paths.temp, caller_arguments)) if caller_arguments.qtc_dev_url and not os.path.exists(paths.qtc_dev): download_packages_work.addTaskObject( bldinstallercommon.create_download_extract_task( caller_arguments.qtc_dev_url, paths.qtc_dev, paths.temp, caller_arguments)) if download_packages_work.taskNumber != 0: download_packages_work.run() if need_to_install_qt: patch_qt_pri_files(paths.qt5) bldinstallercommon.patch_qt(paths.qt5) # qmake arguments qmake_filepath = qmake_binary(paths.qt5) common_qmake_arguments = get_common_qmake_arguments( paths, caller_arguments) # environment environment = get_common_environment(paths.qt5, caller_arguments) # build plugins print('------------') print('Building plugin "{0}" in "{1}" ...'.format(paths.source, paths.build)) qmake_command = [qmake_filepath] qmake_command.append(paths.source) qmake_command.extend(common_qmake_arguments) runCommand(qmake_command, paths.build, callerArguments=caller_arguments, init_environment=environment) runBuildCommand(currentWorkingDirectory=paths.build, callerArguments=caller_arguments, init_environment=environment) runBuildCommand("docs", currentWorkingDirectory=paths.build, callerArguments=caller_arguments, init_environment=environment) # run custom deploy script if caller_arguments.deploy_command: custom_deploy_command = caller_arguments.deploy_command + [ paths.qt5, paths.target ] runCommand(custom_deploy_command, currentWorkingDirectory=paths.target) if caller_arguments.deploy: runInstallCommand(["deploy"], currentWorkingDirectory=paths.build, callerArguments=caller_arguments, init_environment=environment) sevenzip_filepath = '7z.exe' if bldinstallercommon.is_win_platform( ) else '7z' if hasattr(caller_arguments, 'sevenzippath') and caller_arguments.sevenzippath: sevenzip_filepath = os.path.join(caller_arguments.sevenzippath, sevenzip_filepath) # deploy and zip up deploy_command = [ 'python', '-u', os.path.join(paths.qtc_dev, 'scripts', 'packagePlugins.py'), '--qmake_binary', os.path.join(paths.qt5, 'bin', 'qmake'), '--7z', sevenzip_filepath ] deploy_command.extend([paths.target, caller_arguments.target_7zfile]) runCommand(deploy_command, paths.temp, callerArguments=caller_arguments, init_environment=environment) if caller_arguments.target_dev7zfile: dev_command = [ 'python', '-u', os.path.join(paths.qtc_dev, 'scripts', 'createDevPackage.py'), '--source', paths.source, '--build', paths.build, '--7z', sevenzip_filepath, '--7z_out', caller_arguments.target_dev7zfile, paths.dev_target ] runCommand(dev_command, paths.temp, callerArguments=caller_arguments, init_environment=environment)
# install directory qtModuleInstallDirectory = qtModuleSourceDirectory + '_install' if bldinstallercommon.is_win_platform(): # rip out drive letter from path on Windows qtModuleInstallDirectory = qtModuleInstallDirectory[2:] # check whether this is a QNX build if any('qnx' in qt5_url.lower() for qt5_url in callerArguments.qt5_module_urls): # apply the workaround from QTBUG-38555 qtModuleInstallDirectory = qtModuleInstallDirectory.replace( '\\', '/').replace('/', '\\', 1) ### clean step if callerArguments.clean: print("##### {0} #####".format("clean old builds")) bldinstallercommon.remove_tree(callerArguments.qt5path) bldinstallercommon.remove_tree(qtModuleInstallDirectory) bldinstallercommon.remove_tree(tempPath) if not os.path.lexists( callerArguments.qt5path) and not callerArguments.qt5_module_urls: parser.print_help() print(( "error: Please add the missing qt5_module_url arguments if the {0} does not exist" + os.linesep + os.linesep).format(callerArguments.qt5path)) raise RuntimeError() qmakeBinary = os.path.abspath( os.path.join(callerArguments.qt5path, 'bin', 'qmake')) if not os.path.lexists(callerArguments.qt5path):
def handle_repo_build(optionDict, branch, arch, update_staging_repo, update_production_repo): conf_file = optionDict["RELEASE_DESCRIPTION_FILE"] if not os.path.isfile(conf_file): raise IOError("*** Fatal error! Given file does not exist: %s" % conf_file) init_env(optionDict) packages_base_url = optionDict["PACKAGE_STORAGE_SERVER_PATH_HTTP"] ifw_base_url = optionDict["IFW_TOOLS_BASE_URL"] release_tools_dir = SCRIPT_ROOT_DIR # parse conf file parser = ConfigParser.ConfigParser() parser.readfp(open(conf_file)) section_name = branch + "." + "global" global_version = bldinstallercommon.safe_config_key_fetch(parser, section_name, "version") global_version_tag = bldinstallercommon.safe_config_key_fetch(parser, section_name, "version_tag") # parse build jobs repo_job_list = get_repo_job_list(optionDict, branch, arch, global_version, global_version_tag) if len(repo_job_list) == 0: raise RuntimeError("*** Fatal error! No repository build jobs found. Probably an error? %s" % conf_file) # init repo dirs init_repositories(optionDict, repo_job_list) # is this snapshot build? Then enable component version number forced update forced_version_number_bump = False if update_staging_repo and not update_production_repo: forced_version_number_bump = True # create rta description file rta_descr_output_dir = os.path.join(SCRIPT_ROOT_DIR, pkg_constants.RTA_DESCRIPTION_FILE_DIR_NAME) bldinstallercommon.create_dirs(rta_descr_output_dir) architecture = bldinstallercommon.get_architecture() plat_suffix = bldinstallercommon.get_platform_suffix() rta_description_file_name = os.path.join( rta_descr_output_dir, pkg_constants.RTA_DESCRIPTION_FILE_NAME_BASE + "-" + plat_suffix + "-" + architecture + "-repo.txt", ) # handle repo build jobs for job in repo_job_list: create_online_repository(job, packages_base_url, forced_version_number_bump) # determine testination path on test server dest_path_repository, dest_path_pkg = generate_repo_dest_path_pending(optionDict, job) # copy repo content to test server source_path_repository = os.path.join(release_tools_dir, "repository") source_path_pkg = os.path.join(release_tools_dir, "pkg") push_online_repository( optionDict, optionDict["PKG_STAGING_SERVER"], optionDict["PKG_STAGING_SERVER_UNAME"], source_path_repository, dest_path_repository, ) push_online_repository( optionDict, optionDict["PKG_STAGING_SERVER"], optionDict["PKG_STAGING_SERVER_UNAME"], source_path_pkg, dest_path_pkg, ) # remove local repository and pkg directories bldinstallercommon.remove_tree(source_path_repository) bldinstallercommon.remove_tree(source_path_pkg) # update repo in testing area staging_repo_updated, dummy = update_online_repo(optionDict, job, update_staging_repo, update_production_repo) # write the rta description file only if staging repository creation was ok if staging_repo_updated: rta_description_file = open(rta_description_file_name, "a") rta_description_file.write(job.repo_url_specifier + " " + job.rta_key_list + "\n") rta_description_file.close()
# install directory qtModuleInstallDirectory = qtModuleSourceDirectory + '_install' if bldinstallercommon.is_win_platform(): # rip out drive letter from path on Windows qtModuleInstallDirectory = qtModuleInstallDirectory[2:] # check whether this is a QNX build if any('qnx' in qt5_url.lower() for qt5_url in callerArguments.qt5_module_urls): # apply the workaround from QTBUG-38555 qtModuleInstallDirectory = qtModuleInstallDirectory.replace('\\','/').replace('/', '\\', 1) ### clean step if callerArguments.clean: print("##### {0} #####".format("clean old builds")) bldinstallercommon.remove_tree(callerArguments.qt5path) bldinstallercommon.remove_tree(qtModuleInstallDirectory) bldinstallercommon.remove_tree(tempPath) if not os.path.lexists(callerArguments.qt5path) and not callerArguments.qt5_module_urls: parser.print_help() print(("error: Please add the missing qt5_module_url arguments if the {0} does not exist" + os.linesep + os.linesep).format(callerArguments.qt5path)) raise RuntimeError() qmakeBinary = os.path.abspath(os.path.join(callerArguments.qt5path, 'bin', 'qmake')) if not os.path.lexists(callerArguments.qt5path): # get Qt myGetQtBinaryWork = ThreadedWork("get and extract Qt 5 binary") myGetQtBinaryWork.addTaskObject(bldinstallercommon.create_qt_download_task(callerArguments.qt5_module_urls,