lmod: module files are written in a root folder named by target family (#13121)

fixes #13005

This commit fixes an issue with the name of the root directory for
module file hierarchies. Since #3206 the root folder was named after
the microarchitecture used for the spec, which is too specific and
not backward compatible for lmod hierarchies. Here we compute the
root folder name using the target family instead of the target name
itself and we add target information in the 'whatis' portion of the
module file.
This commit is contained in:
Massimiliano Culpo 2019-10-15 20:20:49 +02:00 committed by Todd Gamblin
parent 41e7e5693e
commit d33b0ffc50
3 changed files with 22 additions and 1 deletions

View File

@ -198,7 +198,11 @@ class LmodFileLayout(BaseFileLayout):
@property
def arch_dirname(self):
"""Returns the root folder for THIS architecture"""
arch_folder = str(self.spec.architecture)
arch_folder = '-'.join([
str(self.spec.platform),
str(self.spec.os),
str(self.spec.target.family)
])
return os.path.join(
self.dirname(), # root for lmod module files
arch_folder, # architecture relative path

View File

@ -262,3 +262,19 @@ def no_op_set(*args, **kwargs):
# Assert we have core compilers now
writer, _ = factory(mpileaks_spec_string)
assert writer.conf.core_compilers
@pytest.mark.parametrize('spec_str', [
'mpileaks target=haswell',
'mpileaks target=core2',
'mpileaks target=x86_64',
])
@pytest.mark.regression('13005')
def test_only_generic_microarchitectures_in_root(
self, spec_str, factory, module_configuration
):
module_configuration('complex_hierarchy')
writer, spec = factory(spec_str)
assert str(spec.target.family) in writer.layout.arch_dirname
if spec.target.family != spec.target:
assert str(spec.target) not in writer.layout.arch_dirname

View File

@ -8,6 +8,7 @@
{% if short_description %}
whatis([[Name : {{ spec.name }}]])
whatis([[Version : {{ spec.version }}]])
whatis([[Target : {{ spec.target }}]])
whatis([[Short description : {{ short_description }}]])
{% endif %}
{% if configure_options %}