summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/build_systems/oneapi.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/spack/spack/build_systems/oneapi.py b/lib/spack/spack/build_systems/oneapi.py
index dfa1e1da78..0844ff5d82 100644
--- a/lib/spack/spack/build_systems/oneapi.py
+++ b/lib/spack/spack/build_systems/oneapi.py
@@ -7,6 +7,8 @@
"""
+import getpass
+import shutil
from sys import platform
from os.path import basename, dirname, isdir
@@ -47,6 +49,22 @@ class IntelOneApiPackage(Package):
installer_path = basename(self.url_for_version(spec.version))
if platform == 'linux':
+ # Intel installer assumes and enforces that all components
+ # are installed into a single prefix. Spack wants to
+ # install each component in a separate prefix. The
+ # installer mechanism is implemented by saving install
+ # information in a directory called installercache for
+ # future runs. The location of the installercache depends
+ # on the userid. For root it is always in /var/intel. For
+ # non-root it is in $HOME/intel.
+ #
+ # The method for preventing this install from interfering
+ # with other install depends on the userid. For root, we
+ # delete the installercache before and after install. For
+ # non root we redefine the HOME environment variable.
+ if getpass.getuser() == 'root':
+ shutil.rmtree('/var/intel/installercache', ignore_errors=True)
+
bash = Executable('bash')
# Installer writes files in ~/intel set HOME so it goes to prefix
@@ -57,6 +75,9 @@ class IntelOneApiPackage(Package):
'--eula', 'accept',
'--install-dir', prefix)
+ if getpass.getuser() == 'root':
+ shutil.rmtree('/var/intel/installercache', ignore_errors=True)
+
# Some installers have a bug and do not return an error code when failing
if not isdir(join_path(prefix, self.component_dir)):
raise RuntimeError('install failed')