Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for ModuleLoadEnvironment aliases in easyconfig parameter modextrapaths #4774

Open
wants to merge 27 commits into
base: 5.0.x
Choose a base branch
from

Conversation

lexming
Copy link
Contributor

@lexming lexming commented Feb 27, 2025

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

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 handing environment variables that start with a 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
Copy link
Contributor Author

lexming commented Feb 27, 2025

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
Copy link
Contributor Author

lexming commented Feb 27, 2025

Test report for MODULE_LOAD_ENV_HEADERS in modextrapaths for libtirc:

  • CPATH: replace hardcoded CPATH in modextravars with global MODULE_LOAD_ENV_HEADERS 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"))
    
  • C_INCLUDE_PATHS: replace hardcoded CPATH in modextravars with global MODULE_LOAD_ENV_HEADERS 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"))
    

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
EasyBuild-5.0 EasyBuild 5.0
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

1 participant