예제 #1
0
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))
예제 #2
0
def extract_src_package():
    global QT_SRC_DIR
    global QT_PKG_NAME
    global QT_MODULE_PKG_NAME

    print_wrap('---------------- Extracting source package -------------------------')

    contents_before = os.listdir(QT_SRC_DIR)
    bldinstallercommon.extract_file(QT_SRC_ZIP, QT_SRC_DIR)

    extracted_dir_name = ntpath.basename(QT_SRC_ZIP)
    extracted_dir_name = os.path.splitext(extracted_dir_name)[0]
    QT_SRC_DIR = os.path.join(QT_SRC_DIR, extracted_dir_name)
    QT_PKG_NAME = extracted_dir_name

    print_wrap('------------')
    print_wrap('    Extracting module zip')
    bldinstallercommon.create_dirs(MODULE_DIR)
    before = os.listdir(MODULE_DIR)
    bldinstallercommon.extract_file(QT_MODULE_ZIP, MODULE_DIR)
    after = os.listdir(MODULE_DIR)
    items_b = len(before)
    items_a = len(after)
    if items_b < items_a:
        print_wrap('    Module package extracted.')
        for item in after:
            if os.path.isdir(MODULE_DIR + os.sep + item):
                QT_MODULE_PKG_NAME = item
                print_wrap('    Module pkg name: ' + QT_MODULE_PKG_NAME)
    else:
        print_wrap('*** Unsupported directory structure!!!')
        sys.exit(-1)

    print_wrap('--------------------------------------------------------------------')
예제 #3
0
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]
    start_IFW_build(options, cmd_args, options.installer_framework_build_dir)
    if options.squish_dir:
        print('--------------------------------------------------------------------')
        print('Build Installer Framework with squish support')
        if not os.path.exists(options.installer_framework_build_dir_squish):
            bldinstallercommon.create_dirs(options.installer_framework_build_dir_squish)
        cmd_args = [qmake_bin]
        cmd_args += options.qt_installer_framework_qmake_args
        cmd_args += ['SQUISH_PATH=' + options.squish_dir]
        cmd_args += [options.installer_framework_source_dir]
        start_IFW_build(options, cmd_args, options.installer_framework_build_dir_squish)
예제 #4
0
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), options.qt_source_dir, True, False, get_build_env(options.openssl_dir))
    print('--------------------------------------------------------------------')
    print('Building Qt')
    cmd_args = options.make_cmd
    for module in qt_modules:
        cmd_args += " module-"+module
    bldinstallercommon.do_execute_sub_process(cmd_args.split(' '), options.qt_source_dir, True, False, get_build_env(options.openssl_dir))
    print('--------------------------------------------------------------------')
    print('Installing Qt')
    cmd_args = options.make_install_cmd
    for module in qt_modules:
        moduleDir = os.path.join(options.qt_source_dir, module)
        bldinstallercommon.do_execute_sub_process(cmd_args.split(' '), moduleDir)
예제 #5
0
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)
예제 #6
0
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_with_squish_archive_name):
        os.remove(options.installer_framework_with_squish_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_build_dir_squish):
        bldinstallercommon.remove_tree(options.installer_framework_build_dir_squish)

    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_source_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)
예제 #7
0
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
예제 #8
0
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))
예제 #9
0
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)
예제 #10
0
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)
예제 #11
0
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)
예제 #12
0
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)
예제 #13
0
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)
예제 #14
0
파일: mkqt5bld.py 프로젝트: qtproject/qtsdk
def run_build():
    # init
    init_mkqt5bld()
    # create work dir
    bldinstallercommon.create_dirs(WORK_DIR)
    # fetch src package (or create?)
    fetch_src_package()
    # extract src package
    extract_src_package()
    # configure
    configure_qt()
    # save used install prefix
    save_install_prefix()
    # create submodule list
    create_submodule_list()
    # build
    build_qt()
    # save original qt_prfxpath in qmake executable
    save_original_qt_prfxpath()
    # install
    install_qt()
    # build docs and copy to essentials install dir
    if not ANDROID_BUILD and not QNX_BUILD:
        build_docs()
    #cleanup files that are not needed in binary packages
    clean_up()
    # patch files after build
    patch_build()
    # archive each submodule
    archive_submodules()
예제 #15
0
def get_and_extract_qt_src(url, temp, path):
    bldinstallercommon.create_dirs(temp)
    ext = package_extension(url)
    file_path = os.path.join(temp, 'qtsrc' + ext)
    bldinstallercommon.retrieve_url(url, file_path)
    bldinstallercommon.create_dirs(path)
    bldinstallercommon.extract_file(file_path, path)
    bldinstallercommon.remove_one_tree_level(path)
예제 #16
0
def get_and_extract_qt_src(url, temp, path):
    bldinstallercommon.create_dirs(temp)
    ext = package_extension(url)
    file_path = os.path.join(temp, 'qtsrc' + ext)
    bldinstallercommon.retrieve_url(url, file_path)
    bldinstallercommon.create_dirs(path)
    bldinstallercommon.extract_file(file_path, path)
    bldinstallercommon.remove_one_tree_level(path)
예제 #17
0
def backup_repo(backup_base_dir, directory_to_be_backed_up):
    backup_full_path = os.path.join(backup_base_dir, TIMESTAMP)
    # create dirs
    bldinstallercommon.create_dirs(backup_full_path)
    # backup
    bldinstallercommon.copy_tree(directory_to_be_backed_up, backup_full_path)
    print('Created backup of repository:')
    print('Source:      {0}'.format(directory_to_be_backed_up))
    print('Destination: {0}'.format(backup_full_path))
예제 #18
0
def backup_repo(backup_base_dir, directory_to_be_backed_up):
    backup_full_path = os.path.join(backup_base_dir, TIMESTAMP)
    # create dirs
    bldinstallercommon.create_dirs(backup_full_path)
    # backup
    bldinstallercommon.copy_tree(directory_to_be_backed_up, backup_full_path)
    print('Created backup of repository:')
    print('Source:      {0}'.format(directory_to_be_backed_up))
    print('Destination: {0}'.format(backup_full_path))
예제 #19
0
def handle_installer_build(optionDict, installer_type, branch, arch):
    conf_file = optionDict['RELEASE_DESCRIPTION_FILE']
    print('Parsing [{0}] installer build jobs from: {0}'.format(conf_file))
    if not os.path.isfile(conf_file):
        raise IOError('*** Fatal error! Given file does not exist: {0}'.format(
            conf_file))
    init_env(optionDict)
    license_type = optionDict['LICENSE']
    platform = optionDict['HOST_PLATFORM']
    packages_base_url = optionDict['PACKAGE_STORAGE_SERVER_PATH_HTTP']
    # 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')
    if not global_version:
        raise RuntimeError(
            '*** Fatal error! Invalid values in {0} -> {1}'.format(
                conf_file, section_name))
    # parse build jobs
    job_list = get_job_list(optionDict, installer_type, branch, arch,
                            global_version, global_version_tag)
    if (len(job_list) == 0):
        raise RuntimeError(
            '*** Fatal error! No [{0}] installer build jobs found from: {1}. Probably an error?'
            .format(installer_type, conf_file))
    installer_output_dir = os.path.join(
        SCRIPT_ROOT_DIR, pkg_constants.INSTALLER_OUTPUT_DIR_NAME)
    rta_descr_output_dir = os.path.join(
        SCRIPT_ROOT_DIR, pkg_constants.RTA_DESCRIPTION_FILE_DIR_NAME)
    bldinstallercommon.create_dirs(rta_descr_output_dir)
    # create rta description file
    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 + '.txt')
    # handle build jobs
    for job in job_list:
        # create installer
        type_arg = '--online' if 'online' in installer_type.lower(
        ) else '--offline'
        creation_ok = create_installer(job, packages_base_url, type_arg)
        # write the rta description file only if installer creation was ok
        if (creation_ok):
            rta_description_file = open(rta_description_file_name, 'a')
            rta_description_file.write(job.installer_name + ' ' +
                                       job.rta_key_list + '\n')
            rta_description_file.close()
    # if "/installer_output" directory is empty -> error
    if not os.listdir(installer_output_dir):
        raise RuntimeError(
            '*** Fatal error! No installers generated into: %s' %
            installer_output_dir)
예제 #20
0
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()
예제 #21
0
def init_build_icu(icu_src,
                   icu_version='',
                   archive_icu=False,
                   environment=dict(os.environ)):
    # clean up first
    cleanup_icu()
    icu_src_dir = os.path.join(SCRIPT_ROOT_DIR, ICU_SRC_DIR_NAME)
    # what to do
    if not icu_src:
        print(
            '*** Error! You asked to build the ICU but did not tell from where to find the sources?'
        )
        sys.exit(-1)
    if icu_src.endswith('git'):
        if not icu_version:
            print(
                '*** Error! You asked to clone ICU sources from git repository but did not tell from which branch/tag/sha?'
            )
            sys.exit(-1)
        bldinstallercommon.clone_repository(icu_src, icu_version, icu_src_dir)
    else:
        if not bldinstallercommon.is_content_url_valid(icu_src):
            print('*** Error! The given URL for ICU sources is not valid: {0}'.
                  format(icu_src))
            sys.exit(-1)
        package_save_as_temp = os.path.join(SCRIPT_ROOT_DIR,
                                            os.path.basename(icu_src))
        bldinstallercommon.create_dirs(icu_src_dir)
        print('Downloading ICU src package: ' + icu_src)
        bldinstallercommon.retrieve_url(icu_src, package_save_as_temp)
        bldinstallercommon.extract_file(package_save_as_temp, icu_src_dir)
    # now build the icu
    icu_configuration = None
    if bldinstallercommon.is_linux_platform():
        icu_configuration = build_icu_linux(
            environment, os.path.join(SCRIPT_ROOT_DIR, icu_src_dir),
            archive_icu)
    elif bldinstallercommon.is_mac_platform():
        print('*** ICU build for macOS not implemented yet!')
    elif bldinstallercommon.is_win_platform():
        icu_configuration = build_icu_win(
            environment, os.path.join(SCRIPT_ROOT_DIR, icu_src_dir),
            archive_icu)
    else:
        print('*** Unsupported platform')
    # set options for Qt5 build
    extra_qt_configure_args = ' -L' + icu_configuration.icu_lib_path
    extra_qt_configure_args += ' -I' + icu_configuration.icu_include_path
    icu_configuration.qt_configure_extra_args = extra_qt_configure_args
    icu_configuration.environment = get_icu_env(
        icu_configuration.icu_lib_path, icu_configuration.icu_include_path)
    return icu_configuration
예제 #22
0
def prepare_installer_framework(options):
    if options.incremental_mode and os.path.exists(options.installer_framework_source_dir):
        return
    print('--------------------------------------------------------------------')
    print('Prepare Installer Framework source')
    #create dirs
    bldinstallercommon.create_dirs(options.installer_framework_build_dir)
    if options.qt_installer_framework_uri.endswith('.git'):
        # clone repos
        bldinstallercommon.clone_repository(options.qt_installer_framework_uri, options.qt_installer_framework_branch, options.installer_framework_source_dir)
    else:
        # fetch src package
        prepare_src_package(options.qt_installer_framework_uri, options.qt_installer_framework_uri_saveas, options.installer_framework_source_dir)
예제 #23
0
def prepare_installer_framework(options):
    if options.incremental_mode and os.path.exists(options.installer_framework_source_dir):
        return
    print('--------------------------------------------------------------------')
    print('Prepare Installer Framework source')
    #create dirs
    bldinstallercommon.create_dirs(options.installer_framework_build_dir)
    if options.qt_installer_framework_uri.endswith('.git'):
        # clone repos
        bldinstallercommon.clone_repository(options.qt_installer_framework_uri, options.qt_installer_framework_branch, options.installer_framework_source_dir)
    else:
        # fetch src package
        prepare_src_package(options.qt_installer_framework_uri, options.qt_installer_framework_uri_saveas, options.installer_framework_source_dir)
예제 #24
0
def swap_repository(parser_args):
    if not parser_args:
        raise RuntimeError(
            '*** No options available to swap online reposities')

    source_match_list = get_directory_list(parser_args.source,
                                           parser_args.component)
    if not source_match_list:
        raise RuntimeError(
            '*** Nothing to update? Did not find any component named: %s' %
            parser_args.component)
    dest_match_list = get_directory_list(parser_args.destination,
                                         parser_args.component)

    match_list = generate_match_list(source_match_list, dest_match_list,
                                     parser_args.component,
                                     parser_args.destination)
    for swap_option in match_list:
        print()
        print('###################################################')
        print('Replacing: {0}'.format(swap_option.destination_dir))
        print('With:      {0}'.format(swap_option.source_dir))
        print()
        print('y: Yes')
        print('n: No (abort)')
        print()
        keep_asking = True
        while (keep_asking):
            var = raw_input("Proceed? ")
            if var in ['n', 'N']:
                keep_asking = False
                break
            if var in ['y', 'Y']:
                keep_asking = False
                print()
                # if the repo exists, take backup
                if os.path.exists(swap_option.destination_dir):
                    backup_dir = swap_option.destination_dir + '_old_' + generate_random_string(
                    )
                    bldinstallercommon.create_dirs(backup_dir)
                    bldinstallercommon.copy_tree(swap_option.destination_dir,
                                                 backup_dir)
                    print('Backup taken into: {0}'.format(backup_dir))
                    shutil.rmtree(swap_option.destination_dir)
                bldinstallercommon.create_dirs(swap_option.destination_dir)
                bldinstallercommon.copy_tree(swap_option.source_dir,
                                             swap_option.destination_dir)
                print('Repository updated: {0}'.format(
                    swap_option.destination_dir))
예제 #25
0
파일: mkqt5bld.py 프로젝트: qtproject/qtsdk
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('--------------------------------------------------------------------')
예제 #26
0
def handle_installer_build(optionDict, installer_type, branch, arch):
    conf_file = optionDict["RELEASE_DESCRIPTION_FILE"]
    print("Parsing [{0}] installer build jobs from: {0}".format(conf_file))
    if not os.path.isfile(conf_file):
        raise IOError("*** Fatal error! Given file does not exist: {0}".format(conf_file))
    init_env(optionDict)
    license_type = optionDict["LICENSE"]
    platform = optionDict["HOST_PLATFORM"]
    packages_base_url = optionDict["PACKAGE_STORAGE_SERVER_PATH_HTTP"]
    # 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")
    if not global_version:
        raise RuntimeError("*** Fatal error! Invalid values in {0} -> {1}".format(conf_file, section_name))
    # parse build jobs
    job_list = get_job_list(optionDict, installer_type, branch, arch, global_version, global_version_tag)
    if len(job_list) == 0:
        raise RuntimeError(
            "*** Fatal error! No [{0}] installer build jobs found from: {1}. Probably an error?".format(
                installer_type, conf_file
            )
        )
    installer_output_dir = os.path.join(SCRIPT_ROOT_DIR, pkg_constants.INSTALLER_OUTPUT_DIR_NAME)
    rta_descr_output_dir = os.path.join(SCRIPT_ROOT_DIR, pkg_constants.RTA_DESCRIPTION_FILE_DIR_NAME)
    bldinstallercommon.create_dirs(rta_descr_output_dir)
    # create rta description file
    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 + ".txt",
    )
    # handle build jobs
    for job in job_list:
        # create installer
        type_arg = "--online" if "online" in installer_type.lower() else "--offline"
        creation_ok = create_installer(job, packages_base_url, type_arg)
        # write the rta description file only if installer creation was ok
        if creation_ok:
            rta_description_file = open(rta_description_file_name, "a")
            rta_description_file.write(job.installer_name + " " + job.rta_key_list + "\n")
            rta_description_file.close()
    # if "/installer_output" directory is empty -> error
    if not os.listdir(installer_output_dir):
        raise RuntimeError("*** Fatal error! No installers generated into: %s" % installer_output_dir)
예제 #27
0
파일: mkqt5bld.py 프로젝트: qtproject/qtsdk
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('--------------------------------------------------------------------')
예제 #28
0
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
예제 #29
0
파일: mkqt5bld.py 프로젝트: qtproject/qtsdk
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)
예제 #30
0
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))
예제 #31
0
def build_icu_win(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
    cygpath = subprocess.check_output(['cygpath', os.path.join(SCRIPT_ROOT_DIR, ICU_INSTALL_DIR_NAME)])
    cmd_args = ['bash', 'runConfigureICU', 'Cygwin/MSVC', '--prefix=' + cygpath]
    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']
    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)

    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')
    # archive icu build artifacts if requested
    if archive_icu:
        archive_build_artifacts(search_path)
    return icu_configuration
예제 #32
0
def swap_repository(parser_args):
    if not parser_args:
        raise RuntimeError("*** No options available to swap online reposities")

    source_match_list = get_directory_list(parser_args.source, parser_args.component)
    if not source_match_list:
        raise RuntimeError("*** Nothing to update? Did not find any component named: %s" % parser_args.component)
    dest_match_list = get_directory_list(parser_args.destination, parser_args.component)

    match_list = generate_match_list(source_match_list, dest_match_list, parser_args.component, parser_args.destination)
    for swap_option in match_list:
        print()
        print("###################################################")
        print("Replacing: {0}".format(swap_option.destination_dir))
        print("With:      {0}".format(swap_option.source_dir))
        print()
        print("y: Yes")
        print("n: No (abort)")
        print()
        keep_asking = True
        while keep_asking:
            var = raw_input("Proceed? ")
            if var in ["n", "N"]:
                keep_asking = False
                break
            if var in ["y", "Y"]:
                keep_asking = False
                print()
                # if the repo exists, take backup
                if os.path.exists(swap_option.destination_dir):
                    backup_dir = swap_option.destination_dir + "_old_" + generate_random_string()
                    bldinstallercommon.create_dirs(backup_dir)
                    bldinstallercommon.copy_tree(swap_option.destination_dir, backup_dir)
                    print("Backup taken into: {0}".format(backup_dir))
                    shutil.rmtree(swap_option.destination_dir)
                bldinstallercommon.create_dirs(swap_option.destination_dir)
                bldinstallercommon.copy_tree(swap_option.source_dir, swap_option.destination_dir)
                print("Repository updated: {0}".format(swap_option.destination_dir))
예제 #33
0
def init_build_icu(icu_src, icu_version = '', archive_icu = False, environment = dict(os.environ)):
    # clean up first
    cleanup_icu()
    icu_src_dir = os.path.join(SCRIPT_ROOT_DIR, ICU_SRC_DIR_NAME)
    # what to do
    if not icu_src:
        print('*** Error! You asked to build the ICU but did not tell from where to find the sources?')
        sys.exit(-1)
    if icu_src.endswith('git'):
        if not icu_version:
            print('*** Error! You asked to clone ICU sources from git repository but did not tell from which branch/tag/sha?')
            sys.exit(-1)
        bldinstallercommon.clone_repository(icu_src, icu_version, icu_src_dir)
    else:
        if not bldinstallercommon.is_content_url_valid(icu_src):
            print('*** Error! The given URL for ICU sources is not valid: {0}'.format(icu_src))
            sys.exit(-1)
        package_save_as_temp = os.path.join(SCRIPT_ROOT_DIR, os.path.basename(icu_src))
        bldinstallercommon.create_dirs(icu_src_dir)
        print('Downloading ICU src package: ' + icu_src)
        bldinstallercommon.retrieve_url(icu_src, package_save_as_temp)
        bldinstallercommon.extract_file(package_save_as_temp, icu_src_dir)
    # now build the icu
    icu_configuration = None
    if bldinstallercommon.is_linux_platform():
        icu_configuration = build_icu_linux(environment, os.path.join(SCRIPT_ROOT_DIR, icu_src_dir), archive_icu)
    elif bldinstallercommon.is_mac_platform():
        print('*** ICU build for macOS not implemented yet!')
    elif bldinstallercommon.is_win_platform():
        icu_configuration = build_icu_win(environment, os.path.join(SCRIPT_ROOT_DIR, icu_src_dir), archive_icu)
    else:
        print('*** Unsupported platform')
    # set options for Qt5 build
    extra_qt_configure_args = ' -L' + icu_configuration.icu_lib_path
    extra_qt_configure_args += ' -I' + icu_configuration.icu_include_path
    icu_configuration.qt_configure_extra_args = extra_qt_configure_args
    icu_configuration.environment = get_icu_env(icu_configuration.icu_lib_path, icu_configuration.icu_include_path)
    return icu_configuration
예제 #34
0
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)
예제 #35
0
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)
예제 #36
0
def build_icu_win(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
    cygpath = subprocess.check_output(
        ['cygpath',
         os.path.join(SCRIPT_ROOT_DIR, ICU_INSTALL_DIR_NAME)])
    cmd_args = [
        'bash', 'runConfigureICU', 'Cygwin/MSVC', '--prefix=' + cygpath
    ]
    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']
    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)

    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')
    # archive icu build artifacts if requested
    if archive_icu:
        archive_build_artifacts(search_path)
    return icu_configuration
예제 #37
0
def extract_src_package():
    global QT_SRC_DIR
    global QT_PKG_NAME
    global QT_MODULE_PKG_NAME

    print_wrap(
        '---------------- Extracting source package -------------------------')

    contents_before = os.listdir(QT_SRC_DIR)
    bldinstallercommon.extract_file(QT_SRC_ZIP, QT_SRC_DIR)

    extracted_dir_name = ntpath.basename(QT_SRC_ZIP)
    extracted_dir_name = os.path.splitext(extracted_dir_name)[0]
    QT_SRC_DIR = os.path.join(QT_SRC_DIR, extracted_dir_name)
    QT_PKG_NAME = extracted_dir_name

    print_wrap('------------')
    print_wrap('    Extracting module zip')
    bldinstallercommon.create_dirs(MODULE_DIR)
    before = os.listdir(MODULE_DIR)
    bldinstallercommon.extract_file(QT_MODULE_ZIP, MODULE_DIR)
    after = os.listdir(MODULE_DIR)
    items_b = len(before)
    items_a = len(after)
    if items_b < items_a:
        print_wrap('    Module package extracted.')
        for item in after:
            if os.path.isdir(MODULE_DIR + os.sep + item):
                QT_MODULE_PKG_NAME = item
                print_wrap('    Module pkg name: ' + QT_MODULE_PKG_NAME)
    else:
        print_wrap('*** Unsupported directory structure!!!')
        sys.exit(-1)

    print_wrap(
        '--------------------------------------------------------------------')
예제 #38
0
파일: mkqt5bld.py 프로젝트: qtproject/qtsdk
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
예제 #39
0
def configure_qt(params, src, build):
    bldinstallercommon.create_dirs(build)
    configure = os.path.join(src, 'configure')
    bldinstallercommon.do_execute_sub_process([configure, '-prefix', build] + qt_static_configure_options(),
                                              build, redirect_output=params.redirect_output)
예제 #40
0
             '*** The given source directory does not seem to be proper repository? Abort!'
         )
         print('Given source repository: {0}'.format(source_repo))
         raise RuntimeError()
     if os.path.isfile(
             os.path.join(CALLER_ARGUMENTS.target_repo, 'Updates.xml')):
         print(
             'The given destination directory already contains a repository.'
         )
         print('We just update the existing repository:')
         print('Given target repository: {0}'.format(
             CALLER_ARGUMENTS.target_repo))
     else:
         print('Initializing the repository for the first time!')
         # create dirs
         bldinstallercommon.create_dirs(CALLER_ARGUMENTS.target_repo)
         # copy repository
         bldinstallercommon.copy_tree(source_repo,
                                      CALLER_ARGUMENTS.target_repo)
         # everything done now!
         print('Repository initialized:')
         print('Source:      {0}'.format(source_repo))
         print('Destination: {0}'.format(CALLER_ARGUMENTS.target_repo))
         sys.exit()
 # fetch tools
 fetch_repogen_tools(CALLER_ARGUMENTS.repogen_tools)
 # components to update
 COMPONENTS_TO_UPDATE = []
 if not CALLER_ARGUMENTS.components_to_update or CALLER_ARGUMENTS.components_to_update == '':
     # ask user which components to update
     COMPONENTS_TO_UPDATE = ask_for_components(CALLER_ARGUMENTS.source_pkg)
예제 #41
0
def handle_module_doc_build(optionDict):
    if not bldinstallercommon.is_linux_platform():
        raise RuntimeError('*** Only Linux platform supported currently to perform doc builds. Aborting')
    if not 'MODULE_NAME' in optionDict:
        print('*** MODULE_NAME environment variable not defined. Unable to generate doc for this package.')
        return
    if not 'MODULE_SRC_PACKAGE_URI' in optionDict:
        print('*** MODULE_SRC_PACKAGE_URI environment variable not defined. Unable to generate doc for this package.')
        return
    if not 'MODULE_DOC_BUILD_QT_PACKAGE_URI' in optionDict:
        print('*** MODULE_DOC_BUILD_QT_PACKAGE_URI environment variable not defined. Unable to generate doc for this package.')
        return
    module_src_package_uri = optionDict['MODULE_SRC_PACKAGE_URI']
    module_doc_build_qt_package_uri = optionDict['MODULE_DOC_BUILD_QT_PACKAGE_URI']
    module_doc_build_qt_dependency_package_uri = optionDict.get('MODULE_DOC_BUILD_QT_DEPENDENCY_PACKAGE_URI', '')
    module_doc_build_qt_icu_package_uri = optionDict.get('MODULE_DOC_BUILD_QT_ICU_PACKAGE_URI', '')
    # define some paths
    current_path = os.path.dirname(os.path.realpath(__file__))
    qt_package_path = os.path.join(current_path, 'doc_build_qt_package')
    qt_icu_path = os.path.join(current_path, 'doc_build_qt_icu_package')
    module_src_path = os.path.join(current_path, 'module_src_package')

    shutil.rmtree(qt_package_path, ignore_errors=True)
    shutil.rmtree(qt_icu_path, ignore_errors=True)
    shutil.rmtree(module_src_path, ignore_errors=True)

    bldinstallercommon.create_dirs(qt_package_path)
    bldinstallercommon.create_dirs(module_src_path)
    bldinstallercommon.create_dirs(qt_icu_path)

    # fetch module src package
    raw_name_module_src_package = module_src_package_uri.rsplit('/', 1)[-1] # get last item from array
    downloaded_module_archive = os.path.join(current_path, raw_name_module_src_package)
    os.remove(downloaded_module_archive) if os.path.isfile(downloaded_module_archive) else None
    print('Starting to download: {0}'.format(module_src_package_uri))
    bldinstallercommon.retrieve_url(module_src_package_uri, downloaded_module_archive)
    bldinstallercommon.extract_file(downloaded_module_archive, module_src_path)

    # fetch qt binary package
    raw_name_qt_bin_package = module_doc_build_qt_package_uri.rsplit('/', 1)[-1] # get last item from array
    downloaded_qt_bin_archive = os.path.join(current_path, raw_name_qt_bin_package)
    os.remove(downloaded_qt_bin_archive) if os.path.isfile(downloaded_qt_bin_archive) else None
    print('Starting to download: {0}'.format(module_doc_build_qt_package_uri))
    bldinstallercommon.retrieve_url(module_doc_build_qt_package_uri, downloaded_qt_bin_archive)
    bldinstallercommon.extract_file(downloaded_qt_bin_archive, qt_package_path)

    # fetch qt dependency package (optional)
    if bldinstallercommon.is_content_url_valid(module_doc_build_qt_dependency_package_uri):
        raw_name_qt_bin_dependency_package = module_doc_build_qt_dependency_package_uri.rsplit('/', 1)[-1] # get last item from array
        downloaded_qt_dependency_bin_archive = os.path.join(current_path, raw_name_qt_bin_dependency_package)
        if os.path.lexists(downloaded_qt_dependency_bin_archive):
            print('*** Deleted existing qt binary dependency package: [{0}] before fetching the new one.'.format(downloaded_qt_dependency_bin_archive))
            os.remove(downloaded_qt_dependency_bin_archive)
        print('Starting to download: {0}'.format(module_doc_build_qt_dependency_package_uri))
        bldinstallercommon.retrieve_url(module_doc_build_qt_dependency_package_uri, downloaded_qt_dependency_bin_archive)
        bldinstallercommon.extract_file(downloaded_qt_dependency_bin_archive, qt_package_path)
    # fetch qt icu binary package if given
    if module_doc_build_qt_icu_package_uri:
        raw_name_qt_icu_package = module_doc_build_qt_icu_package_uri.rsplit('/', 1)[-1] # get last item from array
        downloaded_qt_icu_archive = os.path.join(current_path, raw_name_qt_icu_package)
        if os.path.lexists(downloaded_qt_icu_archive):
            print('*** Deleted existing qt icu package: [{0}] before fetching the new one.'.format(downloaded_qt_icu_archive))
            os.remove(downloaded_qt_icu_archive)
        print('Starting to download: {0} -> into {1}'.format(module_doc_build_qt_icu_package_uri, downloaded_qt_icu_archive))
        bldinstallercommon.retrieve_url(module_doc_build_qt_icu_package_uri, downloaded_qt_icu_archive)
        qt_lib_directory = bldinstallercommon.locate_directory(qt_package_path, 'lib')
        print('Extracting icu libs into: {0}'.format(qt_lib_directory))
        bldinstallercommon.extract_file(downloaded_qt_icu_archive, qt_lib_directory)
    # patch Qt package
    qt_bin_directory = bldinstallercommon.locate_directory(qt_package_path, 'bin')
    if not os.path.exists(qt_bin_directory):
        raise IOError('*** Unable to locate bin directory from: %s' % qt_bin_directory)
    qtConfFile = open(os.path.join(qt_bin_directory, 'qt.conf'), "w")
    qtConfFile.write("[Paths]" + os.linesep)
    qtConfFile.write("Prefix=.." + os.linesep)
    qtConfFile.close()
    qt_directory = os.path.dirname(qt_bin_directory)
    #bldinstallercommon.handle_component_rpath(qt_directory, 'lib')
    # locate tools
    qmake_binary = bldinstallercommon.locate_executable(qt_directory, 'qmake')
    print('Using qmake from: {0}'.format(qmake_binary))
    # locate module .pro file
    module_pro_file = bldinstallercommon.locate_file(module_src_path, '*.pro')
    # build module
    module_build_environment = dict(os.environ)
    module_build_environment["LD_LIBRARY_PATH"] = os.pathsep.join([os.path.join(qt_package_path, 'lib')] +
                                                        optionDict.get("LD_LIBRARY_PATH", "").split(os.pathsep))
    module_build_environment["QMAKESPEC"] = "linux-g++"
    cpu_count = ["-j" + str(multiprocessing.cpu_count() + 1)]
    print('Using .pro file from: {0}'.format(module_pro_file))
    bld_args = [qmake_binary, module_pro_file]
    bldinstallercommon.do_execute_sub_process(args=bld_args, execution_path=os.path.dirname(module_pro_file),
                                              abort_on_fail=False, extra_env=module_build_environment)
    bld_args = ['make'] + cpu_count
    bldinstallercommon.do_execute_sub_process(args=bld_args, execution_path=os.path.dirname(module_pro_file),
                                              abort_on_fail=False, extra_env=module_build_environment)
    # make docs
    bld_args = ['make', '-j1', 'docs']
    bldinstallercommon.do_execute_sub_process(args=bld_args, execution_path=os.path.dirname(module_pro_file),
                                              abort_on_fail=False, extra_env=module_build_environment)
    # make install docs
    module_doc_install_dir = module_src_path = os.path.join(current_path, 'module_doc_install_dir')
    bld_args = ['make', '-j1', 'install_docs', 'INSTALL_ROOT=' + module_doc_install_dir]
    bldinstallercommon.do_execute_sub_process(args=bld_args, execution_path=os.path.dirname(module_pro_file),
                                              abort_on_fail=False, extra_env=module_build_environment)
    # create archive
    doc_dir = bldinstallercommon.locate_directory(module_doc_install_dir, 'doc')
    if not os.path.exists(doc_dir):
        print('Warning! Doc archive not generated!')
        return
    archive_name = optionDict['MODULE_NAME'] + '-' + optionDict['LICENSE'] + '-doc-' + optionDict['MODULE_VERSION'] + '.7z'
    archive_path = os.path.join(current_path, 'doc_archives', archive_name)
    bld_args = ['7z', 'a', archive_path, 'doc']
    bldinstallercommon.do_execute_sub_process(args=bld_args, execution_path=os.path.dirname(doc_dir), abort_on_fail=False)
    if os.path.exists(archive_path):
        print('Doc archive generated successfully: {0}'.format(archive_path))
예제 #42
0
def configure_qt(src, build):
    bldinstallercommon.create_dirs(build)
    configure = os.path.join(src, 'configure')
    bld_utils.runCommand([configure, '-prefix', build] +
                         qt_static_configure_options(), build)
예제 #43
0
def build_sdktool_impl(src, build, target, qmake_command, make_command):
    bldinstallercommon.create_dirs(build)
    bld_utils.runCommand([qmake_command, '-after', 'DESTDIR=' + target, src],
                         build)
    bld_utils.runCommand(make_command, build)
예제 #44
0
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)
예제 #45
0
def handle_module_doc_build(optionDict):
    if not bldinstallercommon.is_linux_platform():
        raise RuntimeError(
            '*** Only Linux platform supported currently to perform doc builds. Aborting'
        )
    if not 'MODULE_NAME' in optionDict:
        print(
            '*** MODULE_NAME environment variable not defined. Unable to generate doc for this package.'
        )
        return
    if not 'MODULE_SRC_PACKAGE_URI' in optionDict:
        print(
            '*** MODULE_SRC_PACKAGE_URI environment variable not defined. Unable to generate doc for this package.'
        )
        return
    if not 'MODULE_DOC_BUILD_QT_PACKAGE_URI' in optionDict:
        print(
            '*** MODULE_DOC_BUILD_QT_PACKAGE_URI environment variable not defined. Unable to generate doc for this package.'
        )
        return
    module_src_package_uri = optionDict['MODULE_SRC_PACKAGE_URI']
    module_doc_build_qt_package_uri = optionDict[
        'MODULE_DOC_BUILD_QT_PACKAGE_URI']
    module_doc_build_qt_dependency_package_uri = optionDict.get(
        'MODULE_DOC_BUILD_QT_DEPENDENCY_PACKAGE_URI', '')
    module_doc_build_qt_icu_package_uri = optionDict.get(
        'MODULE_DOC_BUILD_QT_ICU_PACKAGE_URI', '')
    # define some paths
    current_path = os.path.dirname(os.path.realpath(__file__))
    qt_package_path = os.path.join(current_path, 'doc_build_qt_package')
    qt_icu_path = os.path.join(current_path, 'doc_build_qt_icu_package')
    module_src_path = os.path.join(current_path, 'module_src_package')

    shutil.rmtree(qt_package_path, ignore_errors=True)
    shutil.rmtree(qt_icu_path, ignore_errors=True)
    shutil.rmtree(module_src_path, ignore_errors=True)

    bldinstallercommon.create_dirs(qt_package_path)
    bldinstallercommon.create_dirs(module_src_path)
    bldinstallercommon.create_dirs(qt_icu_path)

    # fetch module src package
    raw_name_module_src_package = module_src_package_uri.rsplit(
        '/', 1)[-1]  # get last item from array
    downloaded_module_archive = os.path.join(current_path,
                                             raw_name_module_src_package)
    os.remove(downloaded_module_archive) if os.path.isfile(
        downloaded_module_archive) else None
    print('Starting to download: {0}'.format(module_src_package_uri))
    bldinstallercommon.retrieve_url(module_src_package_uri,
                                    downloaded_module_archive)
    bldinstallercommon.extract_file(downloaded_module_archive, module_src_path)

    # fetch qt binary package
    raw_name_qt_bin_package = module_doc_build_qt_package_uri.rsplit(
        '/', 1)[-1]  # get last item from array
    downloaded_qt_bin_archive = os.path.join(current_path,
                                             raw_name_qt_bin_package)
    os.remove(downloaded_qt_bin_archive) if os.path.isfile(
        downloaded_qt_bin_archive) else None
    print('Starting to download: {0}'.format(module_doc_build_qt_package_uri))
    bldinstallercommon.retrieve_url(module_doc_build_qt_package_uri,
                                    downloaded_qt_bin_archive)
    bldinstallercommon.extract_file(downloaded_qt_bin_archive, qt_package_path)

    # fetch qt dependency package (optional)
    if bldinstallercommon.is_content_url_valid(
            module_doc_build_qt_dependency_package_uri):
        raw_name_qt_bin_dependency_package = module_doc_build_qt_dependency_package_uri.rsplit(
            '/', 1)[-1]  # get last item from array
        downloaded_qt_dependency_bin_archive = os.path.join(
            current_path, raw_name_qt_bin_dependency_package)
        if os.path.lexists(downloaded_qt_dependency_bin_archive):
            print(
                '*** Deleted existing qt binary dependency package: [{0}] before fetching the new one.'
                .format(downloaded_qt_dependency_bin_archive))
            os.remove(downloaded_qt_dependency_bin_archive)
        print('Starting to download: {0}'.format(
            module_doc_build_qt_dependency_package_uri))
        bldinstallercommon.retrieve_url(
            module_doc_build_qt_dependency_package_uri,
            downloaded_qt_dependency_bin_archive)
        bldinstallercommon.extract_file(downloaded_qt_dependency_bin_archive,
                                        qt_package_path)
    # fetch qt icu binary package if given
    if module_doc_build_qt_icu_package_uri:
        raw_name_qt_icu_package = module_doc_build_qt_icu_package_uri.rsplit(
            '/', 1)[-1]  # get last item from array
        downloaded_qt_icu_archive = os.path.join(current_path,
                                                 raw_name_qt_icu_package)
        if os.path.lexists(downloaded_qt_icu_archive):
            print(
                '*** Deleted existing qt icu package: [{0}] before fetching the new one.'
                .format(downloaded_qt_icu_archive))
            os.remove(downloaded_qt_icu_archive)
        print('Starting to download: {0} -> into {1}'.format(
            module_doc_build_qt_icu_package_uri, downloaded_qt_icu_archive))
        bldinstallercommon.retrieve_url(module_doc_build_qt_icu_package_uri,
                                        downloaded_qt_icu_archive)
        qt_lib_directory = bldinstallercommon.locate_directory(
            qt_package_path, 'lib')
        print('Extracting icu libs into: {0}'.format(qt_lib_directory))
        bldinstallercommon.extract_file(downloaded_qt_icu_archive,
                                        qt_lib_directory)
    # patch Qt package
    qt_bin_directory = bldinstallercommon.locate_directory(
        qt_package_path, 'bin')
    if not os.path.exists(qt_bin_directory):
        raise IOError('*** Unable to locate bin directory from: %s' %
                      qt_bin_directory)
    qtConfFile = open(os.path.join(qt_bin_directory, 'qt.conf'), "w")
    qtConfFile.write("[Paths]" + os.linesep)
    qtConfFile.write("Prefix=.." + os.linesep)
    qtConfFile.close()
    qt_directory = os.path.dirname(qt_bin_directory)
    #bldinstallercommon.handle_component_rpath(qt_directory, 'lib')
    # locate tools
    qmake_binary = bldinstallercommon.locate_executable(qt_directory, 'qmake')
    print('Using qmake from: {0}'.format(qmake_binary))
    # locate module .pro file
    module_pro_file = bldinstallercommon.locate_file(module_src_path, '*.pro')
    # build module
    module_build_environment = dict(os.environ)
    module_build_environment["LD_LIBRARY_PATH"] = os.pathsep.join(
        [os.path.join(qt_package_path, 'lib')] +
        optionDict.get("LD_LIBRARY_PATH", "").split(os.pathsep))
    module_build_environment["QMAKESPEC"] = "linux-g++"
    cpu_count = ["-j" + str(multiprocessing.cpu_count() + 1)]
    print('Using .pro file from: {0}'.format(module_pro_file))
    bld_args = [qmake_binary, module_pro_file]
    bldinstallercommon.do_execute_sub_process(
        args=bld_args,
        execution_path=os.path.dirname(module_pro_file),
        abort_on_fail=False,
        extra_env=module_build_environment)
    bld_args = ['make'] + cpu_count
    bldinstallercommon.do_execute_sub_process(
        args=bld_args,
        execution_path=os.path.dirname(module_pro_file),
        abort_on_fail=False,
        extra_env=module_build_environment)
    # make docs
    bld_args = ['make', '-j1', 'docs']
    bldinstallercommon.do_execute_sub_process(
        args=bld_args,
        execution_path=os.path.dirname(module_pro_file),
        abort_on_fail=False,
        extra_env=module_build_environment)
    # make install docs
    module_doc_install_dir = module_src_path = os.path.join(
        current_path, 'module_doc_install_dir')
    bld_args = [
        'make', '-j1', 'install_docs', 'INSTALL_ROOT=' + module_doc_install_dir
    ]
    bldinstallercommon.do_execute_sub_process(
        args=bld_args,
        execution_path=os.path.dirname(module_pro_file),
        abort_on_fail=False,
        extra_env=module_build_environment)
    # create archive
    doc_dir = bldinstallercommon.locate_directory(module_doc_install_dir,
                                                  'doc')
    if not os.path.exists(doc_dir):
        print('Warning! Doc archive not generated!')
        return
    archive_name = optionDict['MODULE_NAME'] + '-' + optionDict[
        'LICENSE'] + '-doc-' + optionDict['MODULE_VERSION'] + '.7z'
    archive_path = os.path.join(current_path, 'doc_archives', archive_name)
    bld_args = ['7z', 'a', archive_path, 'doc']
    bldinstallercommon.do_execute_sub_process(
        args=bld_args,
        execution_path=os.path.dirname(doc_dir),
        abort_on_fail=False)
    if os.path.exists(archive_path):
        print('Doc archive generated successfully: {0}'.format(archive_path))
예제 #46
0
 # 1) target repository directory must be empty i.e. we initialize things for the first time
 # 2) copy the source repository as target repository 1:1 and nothing else
 if CALLER_ARGUMENTS.source_repo:
     source_repo = os.path.join(CALLER_ARGUMENTS.source_repo, 'online_repository')
     if not os.path.isdir(source_repo) or not os.path.isfile(os.path.join(source_repo, 'Updates.xml')):
         print('*** The given source directory does not seem to be proper repository? Abort!')
         print('Given source repository: {0}'.format(source_repo))
         raise RuntimeError()
     if os.path.isfile(os.path.join(CALLER_ARGUMENTS.target_repo, 'Updates.xml')):
         print('The given destination directory already contains a repository.')
         print('We just update the existing repository:')
         print('Given target repository: {0}'.format(CALLER_ARGUMENTS.target_repo))
     else:
         print('Initializing the repository for the first time!')
         # create dirs
         bldinstallercommon.create_dirs(CALLER_ARGUMENTS.target_repo)
         # copy repository
         bldinstallercommon.copy_tree(source_repo, CALLER_ARGUMENTS.target_repo)
         # everything done now!
         print('Repository initialized:')
         print('Source:      {0}'.format(source_repo))
         print('Destination: {0}'.format(CALLER_ARGUMENTS.target_repo))
         sys.exit()
 # fetch tools
 fetch_repogen_tools(CALLER_ARGUMENTS.repogen_tools)
 # components to update
 COMPONENTS_TO_UPDATE = []
 if not CALLER_ARGUMENTS.components_to_update or CALLER_ARGUMENTS.components_to_update == '':
     # ask user which components to update
     COMPONENTS_TO_UPDATE = ask_for_components(CALLER_ARGUMENTS.source_pkg)
 else:
예제 #47
0
def build_sdktool_impl(src, build, target, qmake_command, make_command):
    bldinstallercommon.create_dirs(build)
    bld_utils.runCommand([qmake_command, '-after', 'DESTDIR=' + target, src], build)
    bld_utils.runCommand(make_command, build)
예제 #48
0
파일: bld_module.py 프로젝트: zrzhd/qtsdk
# cleanup some values inside the callerArguments object
stripVars(callerArguments, "\"")
if callerArguments.qt5path != os.path.abspath(callerArguments.qt5path):
    print("changing the value of --qt5path from {0} to {1}".format(
        callerArguments.qt5path, os.path.abspath(callerArguments.qt5path)))
    callerArguments.qt5path = os.path.abspath(callerArguments.qt5path)

if not callerArguments.module_name:
    callerArguments.module_name = os.environ['MODULE_NAME']

tempPath = os.path.abspath(os.path.join(os.path.dirname(__file__), 'temp'))

# clone module repo
if callerArguments.module_url != '':
    bldinstallercommon.init_common_module(os.getcwd())
    bldinstallercommon.create_dirs(MODULE_SRC_DIR)
    bldinstallercommon.clone_repository(
        callerArguments.module_url, callerArguments.module_branch,
        os.path.join(os.path.dirname(__file__), MODULE_SRC_DIR_NAME))
    qtModuleSourceDirectory = MODULE_SRC_DIR
elif callerArguments.module7z != '':
    bldinstallercommon.create_dirs(MODULE_SRC_DIR)
    myGetQtModule = ThreadedWork("get and extract module src")
    myGetQtModule.addTaskObject(
        bldinstallercommon.create_download_extract_task(
            callerArguments.module7z, MODULE_SRC_DIR, tempPath,
            callerArguments))
    myGetQtModule.run()
    qtModuleSourceDirectory = MODULE_SRC_DIR
else:
    print(("Using local copy of {0}").format(callerArguments.module_name))
예제 #49
0
def configure_qt(src, build):
    bldinstallercommon.create_dirs(build)
    configure = os.path.join(src, 'configure')
    bld_utils.runCommand([configure, '-prefix', build] + qt_static_configure_options(), build)
예제 #50
0
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()
예제 #51
0
# cleanup some values inside the callerArguments object
stripVars(callerArguments, "\"")
if callerArguments.qt5path != os.path.abspath(callerArguments.qt5path):
    print("changing the value of --qt5path from {0} to {1}".format(callerArguments.qt5path,
        os.path.abspath(callerArguments.qt5path)))
    callerArguments.qt5path = os.path.abspath(callerArguments.qt5path)

if not callerArguments.module_name:
    callerArguments.module_name = os.environ['MODULE_NAME']

tempPath = os.path.abspath(os.path.join(os.path.dirname(__file__), 'temp'))

# clone module repo
if callerArguments.module_url != '':
    bldinstallercommon.init_common_module(os.getcwd())
    bldinstallercommon.create_dirs(MODULE_SRC_DIR)
    bldinstallercommon.clone_repository(callerArguments.module_url, callerArguments.module_branch, os.path.join(os.path.dirname(__file__), MODULE_SRC_DIR_NAME))
    qtModuleSourceDirectory = MODULE_SRC_DIR
elif callerArguments.module7z != '':
    bldinstallercommon.create_dirs(MODULE_SRC_DIR)
    myGetQtModule = ThreadedWork("get and extract module src")
    myGetQtModule.addTaskObject(bldinstallercommon.create_download_extract_task(callerArguments.module7z, MODULE_SRC_DIR, tempPath, callerArguments))
    myGetQtModule.run()
    qtModuleSourceDirectory = MODULE_SRC_DIR
else:
    print(("Using local copy of {0}").format(callerArguments.module_name))
    qtModuleSourceDirectory = callerArguments.module_dir

# install directory
qtModuleInstallDirectory = qtModuleSourceDirectory + '_install'
if bldinstallercommon.is_win_platform():