Beispiel #1
0
 def check_archive_data(self):
     if self.archive_uri.startswith('http'):
         res = bldinstallercommon.is_content_url_valid(self.archive_uri)
         if not res:
             return '*** Archive check fail! ***\n*** Unable to locate archive: ' + self.archive_uri
     elif not os.path.isfile(self.archive_uri):
         return '*** Archive check fail! ***\n*** Unable to locate archive: ' + self.archive_uri
Beispiel #2
0
 def check_archive_data(self):
     if self.archive_uri.startswith('http'):
         res = bldinstallercommon.is_content_url_valid(self.archive_uri)
         if not res:
             return '*** Archive check fail! ***\n*** Unable to locate archive: ' + self.archive_uri
     elif not os.path.isfile(self.archive_uri):
         return '*** Archive check fail! ***\n*** Unable to locate archive: ' + self.archive_uri
Beispiel #3
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)
Beispiel #4
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))
Beispiel #5
0
 def sanity_check(self):
     # check qt src package url
     res = bldinstallercommon.is_content_url_valid(self.qt_source_package_uri)
     if not(res):
         print('*** Qt src package uri is invalid: {0}'.format(self.qt_source_package_uri))
         sys.exit(-1)
     if self.product_key_checker_pri:
         if os.path.isfile(self.product_key_checker_pri):
             print('Using product key checker: {0}'.format(self.product_key_checker_pri))
         else:
             print('*** Error! Given product key checker is not a valid file: {0}'.format(self.product_key_checker_pri))
             sys.exit(-1)
Beispiel #6
0
 def sanity_check(self):
     # check qt src package url
     res = bldinstallercommon.is_content_url_valid(self.qt_source_package_uri)
     if not(res):
         print('*** Qt src package uri is invalid: {0}'.format(self.qt_source_package_uri))
         sys.exit(-1)
     if self.product_key_checker_pri:
         if os.path.isfile(self.product_key_checker_pri):
             print('Using product key checker: '.format(self.product_key_checker_pri))
         else:
             print('*** Error! Given product key checker is not a valid file: '.format(self.product_key_checker_pri))
             sys.exit(-1)
Beispiel #7
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
Beispiel #8
0
def fetch_src_package():
    global QT_PACKAGE_SAVE_AS_TEMP
    QT_PACKAGE_SAVE_AS_TEMP = os.path.normpath(WORK_DIR + os.sep + os.path.basename(QT_BUILD_OPTIONS.src_url))
    print_wrap('---------------- Fetching Qt src package ---------------------------')
    # check first if package on local file system
    if not os.path.isfile(QT_PACKAGE_SAVE_AS_TEMP):
        if not bldinstallercommon.is_content_url_valid(QT_BUILD_OPTIONS.src_url):
            print_wrap('*** Qt src package url: [' + QT_BUILD_OPTIONS.src_url + '] is invalid! Abort!')
            sys.exit(-1)
        print_wrap('     Downloading:        ' + QT_BUILD_OPTIONS.src_url)
        print_wrap('            into:        ' + QT_PACKAGE_SAVE_AS_TEMP)
        # start download
        urllib.urlretrieve(QT_BUILD_OPTIONS.src_url, QT_PACKAGE_SAVE_AS_TEMP, reporthook=bldinstallercommon.dlProgress)
    else:
        print_wrap('Found local package, using that: ' + QT_PACKAGE_SAVE_AS_TEMP)
    print_wrap('--------------------------------------------------------------------')
Beispiel #9
0
 def resolve_full_uri(self, package_name, server_name, archive_uri):
     """Resolve the full URI in the following order
          1. is archive_uri a valid URI as such
          2. check if given archive_uri denotes a package under package templates directory
          3. check if given URI is valid full URL
          4. try to compose full URL
         return the resolved URI
     """
     # substitute key value pairs if any
     for item in self.key_substitution_list:
         temp = archive_uri.replace(item[0], item[1])
         if temp != archive_uri:
             archive_uri = temp
     # 1. check if given archive_uri denotes a package under package templates directory
     base_path = os.path.join(self.configurations_root_dir,
                              pkg_constants.PKG_TEMPLATE_BASE_DIR_NAME)
     package_path = package_name + os.sep + 'data' + os.sep + archive_uri
     # find the correct template subdirectory
     for subdir in self.pkg_templates_dir_list:
         path_temp = os.path.join(base_path, subdir)
         if not os.path.isdir(path_temp):
             path_temp = path_temp.replace(
                 os.sep + pkg_constants.PKG_TEMPLATE_BASE_DIR_NAME, '')
         if os.path.isdir(path_temp):
             temp = os.path.join(path_temp, package_path)
             if os.path.isfile(temp):
                 return temp
     # 2. check if given URI is valid full URL
     res = bldinstallercommon.is_content_url_valid(archive_uri)
     if res:
         return archive_uri
     else:
         parts = urlparse(archive_uri)
         if parts.scheme and parts.netloc:
             raise RuntimeError(
                 "Url: [%s] points to valid location but it is inaccessible."
                 % (archive_uri))
     # 3. try to compose full URL
     temp = self.server_url_by_name(server_name)
     if not temp.endswith('/') and not archive_uri.startswith('/'):
         temp = temp + '/'
     temp = temp + archive_uri
     return temp
Beispiel #10
0
 def resolve_full_uri(self, package_name, server_name, archive_uri):
     """Resolve the full URI in the following order
          1. is archive_uri a valid URI as such
          2. check if given archive_uri denotes a package under package templates directory
          3. check if given URI is valid full URL
          4. try to compose full URL
         return the resolved URI
     """
     # substitute key value pairs if any
     for item in self.key_substitution_list:
         temp = archive_uri.replace(item[0], item[1])
         if temp != archive_uri:
             archive_uri = temp
     # 1. the file exists, uri points to valid path on file system (or network share)
     if os.path.isfile(archive_uri):
         return archive_uri
     # 2. check if given archive_uri denotes a package under package templates directory
     base_path = os.path.join(self.configurations_root_dir, pkg_constants.PKG_TEMPLATE_BASE_DIR_NAME)
     package_path = package_name + os.sep + 'data' + os.sep + archive_uri
     # find the correct template subdirectory
     for subdir in self.pkg_templates_dir_list:
         path_temp = os.path.join(base_path, subdir)
         if not os.path.isdir(path_temp):
             path_temp = path_temp.replace(os.sep + pkg_constants.PKG_TEMPLATE_BASE_DIR_NAME, '')
         if os.path.isdir(path_temp):
             temp = os.path.join(path_temp, package_path)
             if os.path.isfile(temp):
                 return temp
     # 3. check if given URI is valid full URL
     res = bldinstallercommon.is_content_url_valid(archive_uri)
     if res:
         return archive_uri
     else:
         parts = urlparse(archive_uri)
         if parts.scheme and parts.netloc:
             raise RuntimeError("Url: [%s] points to valid location but it is inaccessible." % (archive_uri))
     # 4. try to compose full URL
     temp = self.server_url_by_name(server_name)
     if not temp.endswith('/') and not archive_uri.startswith('/'):
         temp = temp + '/'
     temp = temp + archive_uri
     return temp
Beispiel #11
0
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)
Beispiel #12
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))
Beispiel #13
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
Beispiel #14
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)
Beispiel #15
0
def fetch_src_package():
    global QT_SRC_ZIP
    global QT_MODULE_ZIP
    global QT_SRC_7Z
    global QT_MODULE_7Z
    global QT_SRC_7Z_URL
    global QT_MODULE_7Z_URL

    #strip base name for the archive to be downloaded (qt-opensource-xxxx)
    src_pack_basename = os.path.splitext(os.path.basename(QT_SRC_ZIP_URL))[0]
    mdl_pack_basename = os.path.splitext(os.path.basename(QT_MODULE_ZIP_URL))[0]
    #strip base path for the archive to be downloaded (\path\to\the\archive\qt-opensource-xxxx)
    src_pack_basepath = os.path.splitext(QT_SRC_ZIP_URL)[0]
    mdl_pack_basepath = os.path.splitext(QT_MODULE_ZIP_URL)[0]

    print_wrap('------------------- Fetching packages ------------------------------')
    QT_SRC_ZIP = os.path.normpath(SCRIPT_ROOT_DIR + os.sep + os.path.basename(QT_SRC_ZIP_URL))
    print_wrap('    Fetching ' + QT_SRC_ZIP)
    # check first if package on local file system
    if not os.path.isfile(QT_SRC_ZIP):
        if not bldinstallercommon.is_content_url_valid(QT_SRC_ZIP_URL):
            print_wrap('*** Qt src package url: [' + QT_SRC_ZIP_URL + '] is invalid! Abort!')
            sys.exit(-1)
        print_wrap('     Downloading:        ' + QT_SRC_ZIP_URL)
        print_wrap('            into:        ' + QT_SRC_ZIP)
        # start download
        urllib.urlretrieve(QT_SRC_ZIP_URL, QT_SRC_ZIP, reporthook=bldinstallercommon.dlProgress)
    else:
        print_wrap('Found local package, using that: ' + QT_SRC_ZIP)

    print_wrap('    Fetching module ' + QT_MODULE_ZIP)
    QT_MODULE_ZIP = os.path.normpath(SCRIPT_ROOT_DIR + os.sep + os.path.basename(QT_MODULE_ZIP_URL))
    # check first if package on local file system
    if not os.path.isfile(QT_MODULE_ZIP):
        if not bldinstallercommon.is_content_url_valid(QT_MODULE_ZIP_URL):
            print_wrap('*** Module src package url: [' + QT_MODULE_ZIP_URL + '] is invalid! Abort!')
            sys.exit(-1)
        print_wrap('     Downloading:        ' + QT_MODULE_ZIP_URL)
        print_wrap('            into:        ' + QT_MODULE_ZIP)
        # start download
        urllib.urlretrieve(QT_MODULE_ZIP_URL, QT_MODULE_ZIP, reporthook=bldinstallercommon.dlProgress)
    else:
        print_wrap('Found local module package, using that: ' + QT_MODULE_ZIP)

    if DO_7Z:
        QT_SRC_7Z = os.path.normpath(SCRIPT_ROOT_DIR + os.sep + src_pack_basename + '.7z')
        QT_SRC_7Z_URL = src_pack_basepath + '.7z'
        print_wrap('    Fetching ' + QT_SRC_7Z)
        # check first if package on local file system
        if not os.path.isfile(QT_SRC_7Z):
            if not bldinstallercommon.is_content_url_valid(QT_SRC_7Z_URL):
                print_wrap('*** Qt src package url: [' + QT_SRC_7Z_URL + '] is invalid! Abort!')
                sys.exit(-1)
            print_wrap('     Downloading:        ' + QT_SRC_7Z_URL)
            print_wrap('            into:        ' + QT_SRC_7Z)
            # start download
            urllib.urlretrieve(QT_SRC_7Z_URL, QT_SRC_7Z, reporthook=bldinstallercommon.dlProgress)
        else:
            print_wrap('Found local package, using that: ' + QT_SRC_7Z)

        QT_MODULE_7Z = os.path.normpath(SCRIPT_ROOT_DIR + os.sep + mdl_pack_basename + '.7z')
        QT_MODULE_7Z_URL = mdl_pack_basepath + '.7z'
        print_wrap('    Fetching module ' + QT_MODULE_7Z)
        # check first if package on local file system
        if not os.path.isfile(QT_MODULE_7Z):
            if not bldinstallercommon.is_content_url_valid(QT_MODULE_7Z_URL):
                print_wrap('*** Module src package url: [' + QT_MODULE_7Z_URL + '] is invalid! Abort!')
                sys.exit(-1)
            print_wrap('     Downloading:        ' + QT_MODULE_7Z_URL)
            print_wrap('            into:        ' + QT_MODULE_7Z)
            # start download
            urllib.urlretrieve(QT_MODULE_7Z_URL, QT_MODULE_7Z, reporthook=bldinstallercommon.dlProgress)
        else:
            print_wrap('Found local module package, using that: ' + QT_MODULE_7Z)

    print_wrap('--------------------------------------------------------------------')
Beispiel #16
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))
Beispiel #17
0
def fetch_src_package():
    global QT_SRC_ZIP
    global QT_MODULE_ZIP
    global QT_SRC_7Z
    global QT_MODULE_7Z
    global QT_SRC_7Z_URL
    global QT_MODULE_7Z_URL

    #strip base name for the archive to be downloaded (qt-opensource-xxxx)
    src_pack_basename = os.path.splitext(os.path.basename(QT_SRC_ZIP_URL))[0]
    mdl_pack_basename = os.path.splitext(
        os.path.basename(QT_MODULE_ZIP_URL))[0]
    #strip base path for the archive to be downloaded (\path\to\the\archive\qt-opensource-xxxx)
    src_pack_basepath = os.path.splitext(QT_SRC_ZIP_URL)[0]
    mdl_pack_basepath = os.path.splitext(QT_MODULE_ZIP_URL)[0]

    print_wrap(
        '------------------- Fetching packages ------------------------------')
    QT_SRC_ZIP = os.path.normpath(SCRIPT_ROOT_DIR + os.sep +
                                  os.path.basename(QT_SRC_ZIP_URL))
    print_wrap('    Fetching ' + QT_SRC_ZIP)
    # check first if package on local file system
    if not os.path.isfile(QT_SRC_ZIP):
        if not bldinstallercommon.is_content_url_valid(QT_SRC_ZIP_URL):
            print_wrap('*** Qt src package url: [' + QT_SRC_ZIP_URL +
                       '] is invalid! Abort!')
            sys.exit(-1)
        print_wrap('     Downloading:        ' + QT_SRC_ZIP_URL)
        print_wrap('            into:        ' + QT_SRC_ZIP)
        # start download
        urllib.urlretrieve(QT_SRC_ZIP_URL,
                           QT_SRC_ZIP,
                           reporthook=bldinstallercommon.dlProgress)
    else:
        print_wrap('Found local package, using that: ' + QT_SRC_ZIP)

    print_wrap('    Fetching module ' + QT_MODULE_ZIP)
    QT_MODULE_ZIP = os.path.normpath(SCRIPT_ROOT_DIR + os.sep +
                                     os.path.basename(QT_MODULE_ZIP_URL))
    # check first if package on local file system
    if not os.path.isfile(QT_MODULE_ZIP):
        if not bldinstallercommon.is_content_url_valid(QT_MODULE_ZIP_URL):
            print_wrap('*** Module src package url: [' + QT_MODULE_ZIP_URL +
                       '] is invalid! Abort!')
            sys.exit(-1)
        print_wrap('     Downloading:        ' + QT_MODULE_ZIP_URL)
        print_wrap('            into:        ' + QT_MODULE_ZIP)
        # start download
        urllib.urlretrieve(QT_MODULE_ZIP_URL,
                           QT_MODULE_ZIP,
                           reporthook=bldinstallercommon.dlProgress)
    else:
        print_wrap('Found local module package, using that: ' + QT_MODULE_ZIP)

    if DO_7Z:
        QT_SRC_7Z = os.path.normpath(SCRIPT_ROOT_DIR + os.sep +
                                     src_pack_basename + '.7z')
        QT_SRC_7Z_URL = src_pack_basepath + '.7z'
        print_wrap('    Fetching ' + QT_SRC_7Z)
        # check first if package on local file system
        if not os.path.isfile(QT_SRC_7Z):
            if not bldinstallercommon.is_content_url_valid(QT_SRC_7Z_URL):
                print_wrap('*** Qt src package url: [' + QT_SRC_7Z_URL +
                           '] is invalid! Abort!')
                sys.exit(-1)
            print_wrap('     Downloading:        ' + QT_SRC_7Z_URL)
            print_wrap('            into:        ' + QT_SRC_7Z)
            # start download
            urllib.urlretrieve(QT_SRC_7Z_URL,
                               QT_SRC_7Z,
                               reporthook=bldinstallercommon.dlProgress)
        else:
            print_wrap('Found local package, using that: ' + QT_SRC_7Z)

        QT_MODULE_7Z = os.path.normpath(SCRIPT_ROOT_DIR + os.sep +
                                        mdl_pack_basename + '.7z')
        QT_MODULE_7Z_URL = mdl_pack_basepath + '.7z'
        print_wrap('    Fetching module ' + QT_MODULE_7Z)
        # check first if package on local file system
        if not os.path.isfile(QT_MODULE_7Z):
            if not bldinstallercommon.is_content_url_valid(QT_MODULE_7Z_URL):
                print_wrap('*** Module src package url: [' + QT_MODULE_7Z_URL +
                           '] is invalid! Abort!')
                sys.exit(-1)
            print_wrap('     Downloading:        ' + QT_MODULE_7Z_URL)
            print_wrap('            into:        ' + QT_MODULE_7Z)
            # start download
            urllib.urlretrieve(QT_MODULE_7Z_URL,
                               QT_MODULE_7Z,
                               reporthook=bldinstallercommon.dlProgress)
        else:
            print_wrap('Found local module package, using that: ' +
                       QT_MODULE_7Z)

    print_wrap(
        '--------------------------------------------------------------------')
Beispiel #18
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))