Skip to content

add support for ModuleLoadEnvironment aliases in modextrapaths easyconfig parameter + deprecate allow_append_abs_path, allow_prepend_abs_path, modextrapaths_append easyconfig parameters#4774

Merged
boegel merged 31 commits into
easybuilders:5.0.xfrom
lexming:modload-modextrapath
Mar 2, 2025
Merged

Conversation

@lexming

@lexming lexming commented Feb 27, 2025

Copy link
Copy Markdown
Contributor

Add support for --module-search-path-headers to modextrapaths

This is the final change to fully fix #3331 . Now that we have --module-search-path-headers we need to allow modextrapaths to follow that setting. This PR achieves that by adding MODULE_LOAD_ENV_HEADERS as a new constant in easyconfigs. Hence, the same MODULE_LOAD_ENV_HEADERS global can be used in EasyBlocks and EasyConfigs.

modextrapaths = {
    MODULE_LOAD_ENV_HEADERS: 'include/extra_dir',
}

Unify interface to add extra paths in easyconfigs

Currently, there are differing methods to handle options for extra paths. For instance:

  • modextrapaths and modextrapaths_append allow to change placement of paths in the module environment
  • the delimiter of those extra paths can be changed through a dictionary item passed to either of those options. e.g. modextrapath = { 'ENV_VAR' : {'paths': "path", 'delimiter': ':'}}
  • allow_append_abs_path and allow_prepend_abs_path enable absolute paths in modextrapaths

This PR standardizes how extra paths can be injected in easyconfigs by making modextrapaths the only usable parameter. All existing options have been added to ModuleEnvironmentVariable (like delimiter and prepend) and all class settings can now be set through a dictionary in modextrapaths. Example:

modextrapaths = {
    'ENV_VAR': {'paths': ['foo', 'baz'], 'delimiter': ';', 'prepend': False},
}

Hence, modextrapaths becomes the interface to ModuleLoadEnvironment at the easyconfig level. modextrapaths_append is deprecated, same result can be achieved with {'prepend': False} in modextrapaths.

Enable absolute paths in module environment

Absolute paths are allowed by default in all path variables of ModuleLoadEnvironment. Deprecating allow_append_abs_path and allow_prepend_abs_path.

Providing a glob pattern that is an absolute path is enough to enable absolute paths expansion and injection in module files.

Method expand_module_search_path is enhanced to handle absolute globs:

  • absolute globs cannot turn into relative paths; and relative globs cannot turn into absolute ones.
  • safety checks have added to avoid relative paths that jump outside of the install directory after expansion. Which is the only possible scenario that is dangerous.
  • symlinks will be followed and resolved, ensuring that expand_module_search_path always returns paths avoiding symlinks. This removes the need to check for the topology of symlinks between lib and lib64 for instance. However, generated modules look different in some cases, with paths to the same folder jumping through different parents (e.g. imkl with libraries in customs dirs and lib and lib64 symlinks).
  • remove LibSymlink class and related methods from framework

Enhance ModuleLoadEnvironment to handle environment variables starting with underscores

ModuleLoadEnvironment enhanced to allow handling environment variables that start with one or more underscores. This is necessary to process easyconfigs like libglvnd-1.7.0-GCCcore-13.3.0.eb.

All public environment variables are now stored inside a custom dict in ModuleLoadEnvironment._env_vars. Getter and setter methods have been modified to be able to discriminate between private attributes of the class and public environment variables.

…paths in make_module_req leveraging ModuleLoadEnvironment
…ents have been aligned with modextrapaths options
…oadEnvironment and expand globs to real paths following symlinks
@lexming lexming added the EasyBuild-5.0 EasyBuild 5.0 label Feb 27, 2025
@lexming lexming added this to the 5.0 milestone Feb 27, 2025
@lexming

lexming commented Feb 27, 2025

Copy link
Copy Markdown
Contributor Author

Test report for underscore variables of libglvnd in easybuilders/easybuild-easyconfigs#22416 (comment)

prepend_path("CMAKE_LIBRARY_PATH", pathJoin(root, "lib"))
prepend_path("CMAKE_PREFIX_PATH", root)
prepend_path("CPATH", pathJoin(root, "include"))
prepend_path("LD_LIBRARY_PATH", pathJoin(root, "lib"))
prepend_path("LIBRARY_PATH", pathJoin(root, "lib"))
prepend_path("PKG_CONFIG_PATH", pathJoin(root, "lib/pkgconfig"))
prepend_path("__EGL_VENDOR_LIBRARY_DIRS", "/usr/share/glvnd/egl_vendor.d")
setenv("EBROOTLIBGLVND", root)
setenv("EBVERSIONLIBGLVND", "1.7.0")
setenv("EBDEVELLIBGLVND", pathJoin(root, "easybuild/libglvnd-1.7.0-GCCcore-13.3.0-easybuild-devel"))

@lexming

lexming commented Feb 27, 2025

Copy link
Copy Markdown
Contributor Author

Test report for MODULE_LOAD_ENV_HEADERS in modextrapaths for libtirc:

  • CPATH: replace hardcoded 'CPATH' in modextravars with MODULE_LOAD_ENV_HEADERS constant easybuild-easyconfigs#22417 (comment)
    prepend_path("CMAKE_LIBRARY_PATH", pathJoin(root, "lib"))
    prepend_path("CMAKE_PREFIX_PATH", root)
    prepend_path("CPATH", pathJoin(root, "include"))
    prepend_path("CPATH", pathJoin(root, "include/tirpc"))
    prepend_path("LD_LIBRARY_PATH", pathJoin(root, "lib"))
    prepend_path("LIBRARY_PATH", pathJoin(root, "lib"))
    prepend_path("MANPATH", pathJoin(root, "share/man"))
    prepend_path("PKG_CONFIG_PATH", pathJoin(root, "lib/pkgconfig"))
    prepend_path("XDG_DATA_DIRS", pathJoin(root, "share"))
    setenv("EBROOTLIBTIRPC", root)
    setenv("EBVERSIONLIBTIRPC", "1.3.5")
    setenv("EBDEVELLIBTIRPC", pathJoin(root, "easybuild/libtirpc-1.3.5-GCCcore-13.3.0-easybuild-devel"))
    
  • INCLUDE_PATHS: replace hardcoded 'CPATH' in modextravars with MODULE_LOAD_ENV_HEADERS constant easybuild-easyconfigs#22417 (comment)
    prepend_path("CMAKE_LIBRARY_PATH", pathJoin(root, "lib"))
    prepend_path("CMAKE_PREFIX_PATH", root)
    prepend_path("CPLUS_INCLUDE_PATH", pathJoin(root, "include"))
    prepend_path("CPLUS_INCLUDE_PATH", pathJoin(root, "include/tirpc"))
    prepend_path("C_INCLUDE_PATH", pathJoin(root, "include"))
    prepend_path("C_INCLUDE_PATH", pathJoin(root, "include/tirpc"))
    prepend_path("LD_LIBRARY_PATH", pathJoin(root, "lib"))
    prepend_path("LIBRARY_PATH", pathJoin(root, "lib"))
    prepend_path("MANPATH", pathJoin(root, "share/man"))
    prepend_path("OBJC_INCLUDE_PATH", pathJoin(root, "include"))
    prepend_path("OBJC_INCLUDE_PATH", pathJoin(root, "include/tirpc"))
    prepend_path("PKG_CONFIG_PATH", pathJoin(root, "lib/pkgconfig"))
    prepend_path("XDG_DATA_DIRS", pathJoin(root, "share"))
    setenv("EBROOTLIBTIRPC", root)
    setenv("EBVERSIONLIBTIRPC", "1.3.5")
    setenv("EBDEVELLIBTIRPC", pathJoin(root, "easybuild/libtirpc-1.3.5-GCCcore-13.3.0-easybuild-devel"))
    

@boegel boegel changed the title add support for ModuleLoadEnvironment aliases in easyconfig parameter modextrapaths add support for ModuleLoadEnvironment aliases in easyconfig parameter modextrapaths Mar 2, 2025
@boegel boegel moved this to Breaking changes in EasyBuild v5.0 Mar 2, 2025

@boegel boegel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@boegel boegel changed the title add support for ModuleLoadEnvironment aliases in easyconfig parameter modextrapaths add support for ModuleLoadEnvironment aliases in modextrapaths easyconfig parameter + deprecate allow_append_abs_path, allow_prepend_abs_path, modextrapaths_append easyconfig parameters Mar 2, 2025
@boegel boegel merged commit 0813e82 into easybuilders:5.0.x Mar 2, 2025
@lexming lexming deleted the modload-modextrapath branch March 2, 2025 23:05
@boegel boegel removed this from EasyBuild v5.0 Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants