def __init__(self, target_config, server_base_url_override, configurations_root_dir, key_substitution_list): """Init data based on the target configuration""" self.server_list = [] self.pkg_templates_dir_list = [] self.default_server = None self.configurations_root_dir = configurations_root_dir self.key_substitution_list = key_substitution_list # get packages tempalates src dir first pkg_templates_dir = os.path.normpath(bldinstallercommon.config_section_map(target_config,'PackageTemplates')['template_dirs']) self.pkg_templates_dir_list = pkg_templates_dir.replace(' ', '').rstrip(',\n').split(',') # next read server list if server_base_url_override: server_obj = ArchiveLocationResolver.ArchiveRemoteLocation('default_server_name', server_base_url_override, '') self.server_list.append(server_obj) else: for section in target_config.sections(): if section.startswith(SERVER_NAMESPACE): server_name = section.split('.')[-1] base_url = bldinstallercommon.safe_config_key_fetch(target_config, section, 'base_url') base_path = bldinstallercommon.safe_config_key_fetch(target_config, section, 'base_path') base_path.replace(' ', '') # if base path is defined, then the following logic applies: # if script is used in testclient mode fetch the packages from "RnD" location # otherwise fetch packages from "release" location. # If the base_path is not defined, use the address as-is if base_path: base_path = base_path + PACKAGE_REMOTE_LOCATION_RELEASE server_obj = ArchiveLocationResolver.ArchiveRemoteLocation(server_name, base_url, base_path) self.server_list.append(server_obj) if len(self.server_list) == 1: self.default_server = self.server_list[0]
def __init__(self, archive, package_name, parent_target_install_base, archive_server_name, target_config, archive_location_resolver, key_value_substitution_list): self.archive_uri = bldinstallercommon.config_section_map( target_config, archive)['archive_uri'] self.archive_action = bldinstallercommon.safe_config_key_fetch( target_config, archive, 'archive_action') self.extract_archive = bldinstallercommon.safe_config_key_fetch( target_config, archive, 'extract_archive') self.package_strip_dirs = bldinstallercommon.safe_config_key_fetch( target_config, archive, 'package_strip_dirs') self.package_finalize_items = bldinstallercommon.safe_config_key_fetch( target_config, archive, 'package_finalize_items') # parent's 'target_install_base' self.parent_target_install_base = parent_target_install_base # in case the individual archive needs to be installed outside the root dir specified by the parent component self.target_install_base = bldinstallercommon.safe_config_key_fetch( target_config, archive, 'target_install_base') # this is relative to 1) current archive's 'target_install_base' 2) parent components 'target_install_base'. (1) takes priority self.target_install_dir = bldinstallercommon.safe_config_key_fetch( target_config, archive, 'target_install_dir').lstrip(os.path.sep) self.rpath_target = bldinstallercommon.safe_config_key_fetch( target_config, archive, 'rpath_target') self.component_sha1_file = bldinstallercommon.safe_config_key_fetch( target_config, archive, 'component_sha1_file') self.nomalize_archive_uri(package_name, archive_server_name, archive_location_resolver) self.archive_name = bldinstallercommon.safe_config_key_fetch( target_config, archive, 'archive_name') if not self.archive_name: self.archive_name = self.path_leaf(self.archive_uri) # Parse unnecessary extensions away from filename (QTBUG-39219) known_archive_types = [ '.tar.gz', '.tar', '.zip', '.tar.xz', '.tar.bz2' ] for item in known_archive_types: if self.archive_name.endswith(item): self.archive_name = self.archive_name.replace(item, '') if not self.archive_name.endswith('.7z'): self.archive_name += '.7z' # substitute key-value pairs if any for item in key_value_substitution_list: self.target_install_base = self.target_install_base.replace( item[0], item[1]) self.target_install_dir = self.target_install_dir.replace( item[0], item[1]) self.archive_name = self.archive_name.replace(item[0], item[1])
def __init__(self, target_config, server_base_url_override, configurations_root_dir, key_substitution_list): """Init data based on the target configuration""" self.server_list = [] self.pkg_templates_dir_list = [] self.default_server = None self.configurations_root_dir = configurations_root_dir self.key_substitution_list = key_substitution_list # get packages tempalates src dir first pkg_templates_dir = os.path.normpath( bldinstallercommon.config_section_map( target_config, 'PackageTemplates')['template_dirs']) self.pkg_templates_dir_list = pkg_templates_dir.replace( ' ', '').rstrip(',\n').split(',') # next read server list if server_base_url_override: server_obj = ArchiveLocationResolver.ArchiveRemoteLocation( 'default_server_name', server_base_url_override, '') self.server_list.append(server_obj) else: for section in target_config.sections(): if section.startswith(SERVER_NAMESPACE): server_name = section.split('.')[-1] base_url = bldinstallercommon.safe_config_key_fetch( target_config, section, 'base_url') base_path = bldinstallercommon.safe_config_key_fetch( target_config, section, 'base_path') base_path.replace(' ', '') # if base path is defined, then the following logic applies: # if script is used in testclient mode fetch the packages from "RnD" location # otherwise fetch packages from "release" location. # If the base_path is not defined, use the address as-is if base_path: base_path = base_path + PACKAGE_REMOTE_LOCATION_RELEASE server_obj = ArchiveLocationResolver.ArchiveRemoteLocation( server_name, base_url, base_path) self.server_list.append(server_obj) if len(self.server_list) == 1: self.default_server = self.server_list[0]
def __init__(self, archive, package_name, archive_server_name, target_config, archive_location_resolver, key_value_substitution_list): self.archive_uri = bldinstallercommon.config_section_map(target_config, archive)['archive_uri'] self.extract_archive = bldinstallercommon.safe_config_key_fetch(target_config, archive, 'extract_archive') self.package_strip_dirs = bldinstallercommon.safe_config_key_fetch(target_config, archive, 'package_strip_dirs') self.package_finalize_items = bldinstallercommon.safe_config_key_fetch(target_config, archive, 'package_finalize_items') self.target_install_dir = bldinstallercommon.safe_config_key_fetch(target_config, archive, 'target_install_dir') # todo, is needed? self.rpath_target = bldinstallercommon.safe_config_key_fetch(target_config, archive, 'rpath_target') self.nomalize_archive_uri(package_name, archive_server_name, archive_location_resolver) self.archive_name = bldinstallercommon.safe_config_key_fetch(target_config, archive, 'archive_name') if not self.archive_name: self.archive_name = self.path_leaf(self.archive_uri) # Parse unnecessary extensions away from filename (QTBUG-39219) known_archive_types = ['.tar.gz', '.tar', '.zip', '.tar.xz', '.tar.bz2'] for item in known_archive_types: if self.archive_name.endswith(item): self.archive_name = self.archive_name.replace(item, '') if not self.archive_name.endswith('.7z'): self.archive_name += '.7z' # substitute key-value pairs if any for item in key_value_substitution_list: self.target_install_dir = self.target_install_dir.replace(item[0], item[1]) self.archive_name = self.archive_name.replace(item[0], item[1])
def __init__(self, archive, package_name, archive_server_name, target_config, archive_location_resolver, key_value_substitution_list): self.archive_uri = bldinstallercommon.config_section_map( target_config, archive)['archive_uri'] self.extract_archive = bldinstallercommon.safe_config_key_fetch( target_config, archive, 'extract_archive') self.package_strip_dirs = bldinstallercommon.safe_config_key_fetch( target_config, archive, 'package_strip_dirs') self.package_finalize_items = bldinstallercommon.safe_config_key_fetch( target_config, archive, 'package_finalize_items') self.target_install_dir = bldinstallercommon.safe_config_key_fetch( target_config, archive, 'target_install_dir') # todo, is needed? self.rpath_target = bldinstallercommon.safe_config_key_fetch( target_config, archive, 'rpath_target') self.nomalize_archive_uri(package_name, archive_server_name, archive_location_resolver) self.archive_name = bldinstallercommon.safe_config_key_fetch( target_config, archive, 'archive_name') if not self.archive_name: self.archive_name = self.path_leaf(self.archive_uri) # Parse unnecessary extensions away from filename (QTBUG-39219) known_archive_types = [ '.tar.gz', '.tar', '.zip', '.tar.xz', '.tar.bz2' ] for item in known_archive_types: if self.archive_name.endswith(item): self.archive_name = self.archive_name.replace(item, '') if not self.archive_name.endswith('.7z'): self.archive_name += '.7z' # substitute key-value pairs if any for item in key_value_substitution_list: self.target_install_dir = self.target_install_dir.replace( item[0], item[1]) self.archive_name = self.archive_name.replace(item[0], item[1])
# common key/value substitution list commonSubstitutionList = {} commonSubstitutionList["%QT_VERSION%"] = qtVersion commonSubstitutionList["%QT_VERSION_TAG%"] = qtVersionTag commonSubstitutionList["%BASE_DEPENDENCY_PKG_NAME%"] = qtPkgName commonSubstitutionList[ "%QT_VERSION_PKG_SORTING_PRIO%"] = qtVersion.replace(".", "") # split binary components splitBinaryComponents = readValueAsList(configParser, 'split_binary_components', 'list') # toolchains toolchains = readValueAsList(configParser, 'toolchains', 'list') # split excludes by toolchain splitBinaryComponentsExcludeByTcKeys = bldinstallercommon.config_section_map( configParser, 'split_binary_component_excludes') splitExcludeDict = {} for key, value in splitBinaryComponentsExcludeByTcKeys.iteritems(): splitExcludeDict[key] = trimAndSplit(value) # generate qt root component finalPkgTemlateName = "qt" qtRootPkgTemplate = os.path.join(currentDir, baseDir, "templates", "qt") destinationDir = os.path.join(pkgOutputBaseDirName, finalPkgTemlateName) shutil.copytree(qtRootPkgTemplate, destinationDir) print(finalPkgTemlateName) # generate qt.qt_version component finalPkgTemlateName = "qt" + "." + qtPkgName qtRootPkgTemplate = os.path.join(currentDir, baseDir, "templates", "qt.qt_version")
modules = parseGitModules(qt5Branch, qt5CheckoutDir) # common key/value substitution list commonSubstitutionList = {} commonSubstitutionList["%QT_VERSION%"] = qtVersion commonSubstitutionList["%QT_VERSION_TAG%"] = qtVersionTag commonSubstitutionList["%BASE_DEPENDENCY_PKG_NAME%"] = qtPkgName commonSubstitutionList["%QT_VERSION_PKG_SORTING_PRIO%"] = qtVersion.replace(".", "") # split binary components splitBinaryComponents = readValueAsList(configParser, 'split_binary_components', 'list') # toolchains toolchains = readValueAsList(configParser, 'toolchains', 'list') # split excludes by toolchain splitBinaryComponentsExcludeByTcKeys = bldinstallercommon.config_section_map(configParser, 'split_binary_component_excludes') splitExcludeDict = {} for key, value in splitBinaryComponentsExcludeByTcKeys.iteritems(): splitExcludeDict[key] = trimAndSplit(value) # generate qt root component finalPkgTemlateName = "qt" qtRootPkgTemplate = os.path.join(currentDir, baseDir, "templates", "qt") destinationDir = os.path.join(pkgOutputBaseDirName, finalPkgTemlateName) shutil.copytree(qtRootPkgTemplate, destinationDir) print(finalPkgTemlateName) # generate qt.qt_version component finalPkgTemlateName = "qt" + "." + qtPkgName qtRootPkgTemplate = os.path.join(currentDir, baseDir, "templates", "qt.qt_version") destinationDir = os.path.join(pkgOutputBaseDirName, finalPkgTemlateName)