From 0409300e9f4475cb18353d16a418ee372035e351 Mon Sep 17 00:00:00 2001 From: Maxime Boissonneault Date: Tue, 5 May 2020 18:39:37 +0000 Subject: [PATCH 1/4] if versionsuffix is explicitly set to None, it crashes below --- easybuild/framework/easyconfig/tweak.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/easybuild/framework/easyconfig/tweak.py b/easybuild/framework/easyconfig/tweak.py index e39dfae559..e8263d82bf 100644 --- a/easybuild/framework/easyconfig/tweak.py +++ b/easybuild/framework/easyconfig/tweak.py @@ -1089,6 +1089,9 @@ def find_potential_version_mappings(dep, toolchain_mapping, versionsuffix_mappin # Figure out the main versionsuffix (altered depending on toolchain in the loop below) versionsuffix = dep.get('versionsuffix', '') + # If versionsuffix is equal to None, it should be put to empty string + if not versionsuffix: + versionsuffix = '' # If versionsuffix is in our mapping then we expect it to be updated if versionsuffix in versionsuffix_mapping: versionsuffix = versionsuffix_mapping[versionsuffix] From 85303a3c600f69c2eaedaf846d4a3f078fb5ab51 Mon Sep 17 00:00:00 2001 From: Maxime Boissonneault Date: Tue, 5 May 2020 20:25:22 +0000 Subject: [PATCH 2/4] filtering out bad matches due to the absence of a label for system toolchains --- easybuild/framework/easyconfig/tweak.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/easybuild/framework/easyconfig/tweak.py b/easybuild/framework/easyconfig/tweak.py index e8263d82bf..cac3ee0310 100644 --- a/easybuild/framework/easyconfig/tweak.py +++ b/easybuild/framework/easyconfig/tweak.py @@ -57,6 +57,7 @@ from easybuild.tools.config import build_option from easybuild.tools.filetools import read_file, write_file from easybuild.tools.module_naming_scheme.utilities import det_full_ec_version +from easybuild.tools.py2vs3 import string_type from easybuild.tools.robot import resolve_dependencies, robot_find_easyconfig, search_easyconfigs from easybuild.tools.toolchain.toolchain import SYSTEM_TOOLCHAIN_NAME from easybuild.tools.toolchain.toolchain import TOOLCHAIN_CAPABILITIES @@ -1108,14 +1109,12 @@ def find_potential_version_mappings(dep, toolchain_mapping, versionsuffix_mappin if len(version_components) > 1: # Have at least major.minor candidate_ver_list.append(r'%s\..*' % major_version) candidate_ver_list.append(r'.*') # Include a major version search - potential_version_mappings, highest_version = [], None for candidate_ver in candidate_ver_list: # if any potential version mappings were found already at this point, we don't add more if not potential_version_mappings: - for toolchain in toolchain_hierarchy: # determine search pattern based on toolchain, version prefix/suffix & version regex @@ -1132,6 +1131,21 @@ def find_potential_version_mappings(dep, toolchain_mapping, versionsuffix_mappin tweaked_ecs_paths, _ = alt_easyconfig_paths(tempfile.gettempdir(), tweaked_ecs=True) cand_paths = [path for path in cand_paths if not path.startswith(tweaked_ecs_paths)] + # if SYSTEM_TOOLCHAIN_NAME is used, it produces regex of the form + # -.eb, which can map to incompatible toolchains. + # For example Boost-1.68\..*.eb would match Boost-1.68.0-intel-2019a.eb + # This filters out such matches unless the toolchain in the easyconfig matches a system toolchain + if toolchain['name'] == SYSTEM_TOOLCHAIN_NAME: + cand_paths_filtered = [] + for path in cand_paths: + tc_candidate = fetch_parameters_from_easyconfig(read_file(path), ['toolchain'])[0] + if isinstance(tc_candidate, dict) and toolchain_candidate['name'] == SYSTEM_TOOLCHAIN_NAME: + cand_paths_filtered += [path] + if isinstance(tc_candidate, string_type) and toolchain_candidate == "SYSTEM": + cand_paths_filtered += [path] + + cand_paths = cand_paths_filtered + # add what is left to the possibilities for path in cand_paths: version = fetch_parameters_from_easyconfig(read_file(path), ['version'])[0] From e7bdbe024d19eb76aab9cda327beb9717bb2f69c Mon Sep 17 00:00:00 2001 From: Maxime Boissonneault Date: Tue, 5 May 2020 20:26:49 +0000 Subject: [PATCH 3/4] fixed incorrect renaming of variable toolchain_candidate --- easybuild/framework/easyconfig/tweak.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/easybuild/framework/easyconfig/tweak.py b/easybuild/framework/easyconfig/tweak.py index cac3ee0310..8931e9fdd4 100644 --- a/easybuild/framework/easyconfig/tweak.py +++ b/easybuild/framework/easyconfig/tweak.py @@ -1139,9 +1139,9 @@ def find_potential_version_mappings(dep, toolchain_mapping, versionsuffix_mappin cand_paths_filtered = [] for path in cand_paths: tc_candidate = fetch_parameters_from_easyconfig(read_file(path), ['toolchain'])[0] - if isinstance(tc_candidate, dict) and toolchain_candidate['name'] == SYSTEM_TOOLCHAIN_NAME: + if isinstance(tc_candidate, dict) and tc_candidate['name'] == SYSTEM_TOOLCHAIN_NAME: cand_paths_filtered += [path] - if isinstance(tc_candidate, string_type) and toolchain_candidate == "SYSTEM": + if isinstance(tc_candidate, string_type) and tc_candidate == "SYSTEM": cand_paths_filtered += [path] cand_paths = cand_paths_filtered From f1494b0ef3e3f10a2e49ab872e810d52e4a9e6a7 Mon Sep 17 00:00:00 2001 From: Maxime Boissonneault Date: Wed, 6 May 2020 16:18:22 +0000 Subject: [PATCH 4/4] using TC_CONSTANT_SYSTEM instead of "SYSTEM", and comparing versionsuffix to None explicitly --- easybuild/framework/easyconfig/tweak.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/easybuild/framework/easyconfig/tweak.py b/easybuild/framework/easyconfig/tweak.py index 8931e9fdd4..df3d39f343 100644 --- a/easybuild/framework/easyconfig/tweak.py +++ b/easybuild/framework/easyconfig/tweak.py @@ -52,6 +52,7 @@ from easybuild.framework.easyconfig.format.format import DEPENDENCY_PARAMETERS from easybuild.framework.easyconfig.parser import fetch_parameters_from_easyconfig from easybuild.framework.easyconfig.tools import alt_easyconfig_paths +from easybuild.toolchains.compiler.systemcompiler import TC_CONSTANT_SYSTEM from easybuild.toolchains.gcccore import GCCcore from easybuild.tools.build_log import EasyBuildError, print_warning from easybuild.tools.config import build_option @@ -1091,7 +1092,7 @@ def find_potential_version_mappings(dep, toolchain_mapping, versionsuffix_mappin # Figure out the main versionsuffix (altered depending on toolchain in the loop below) versionsuffix = dep.get('versionsuffix', '') # If versionsuffix is equal to None, it should be put to empty string - if not versionsuffix: + if versionsuffix is None: versionsuffix = '' # If versionsuffix is in our mapping then we expect it to be updated if versionsuffix in versionsuffix_mapping: @@ -1141,7 +1142,7 @@ def find_potential_version_mappings(dep, toolchain_mapping, versionsuffix_mappin tc_candidate = fetch_parameters_from_easyconfig(read_file(path), ['toolchain'])[0] if isinstance(tc_candidate, dict) and tc_candidate['name'] == SYSTEM_TOOLCHAIN_NAME: cand_paths_filtered += [path] - if isinstance(tc_candidate, string_type) and tc_candidate == "SYSTEM": + if isinstance(tc_candidate, string_type) and tc_candidate == TC_CONSTANT_SYSTEM: cand_paths_filtered += [path] cand_paths = cand_paths_filtered