diff options
author | Harmen Stoppels <me@harmenstoppels.nl> | 2023-11-06 23:30:27 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-06 14:30:27 -0800 |
commit | 461eb944bdff103b8e347c272afb2bcbd31f9723 (patch) | |
tree | 8e54a9d7a3601b205e0784eeb44ac56899b02d49 /var | |
parent | 4700108b5b91c3182c96c4b8468ecf3b536dfd0a (diff) | |
download | spack-461eb944bdff103b8e347c272afb2bcbd31f9723.tar.gz spack-461eb944bdff103b8e347c272afb2bcbd31f9723.tar.bz2 spack-461eb944bdff103b8e347c272afb2bcbd31f9723.tar.xz spack-461eb944bdff103b8e347c272afb2bcbd31f9723.zip |
Don't let runtime env variables of compiler like deps leak into the build environment (#40916)
* Test that setup_run_environment changes to CC/CXX/FC/F77 are dropped in build env
* compilers set in run env shouldn't impact build
Adds `drop` to EnvironmentModifications courtesy of @haampie, and uses
it to clear modifications of CC, CXX, F77 and FC made by
`setup_{,dependent_}run_environment` routines when producing an
environment in BUILD context.
* comment / style
* comment
---------
Co-authored-by: Tom Scogland <scogland1@llnl.gov>
Diffstat (limited to 'var')
-rw-r--r-- | var/spack/repos/builtin.mock/packages/build-env-compiler-var-a/package.py | 14 | ||||
-rw-r--r-- | var/spack/repos/builtin.mock/packages/build-env-compiler-var-b/package.py | 20 |
2 files changed, 34 insertions, 0 deletions
diff --git a/var/spack/repos/builtin.mock/packages/build-env-compiler-var-a/package.py b/var/spack/repos/builtin.mock/packages/build-env-compiler-var-a/package.py new file mode 100644 index 0000000000..ea6f0f34e8 --- /dev/null +++ b/var/spack/repos/builtin.mock/packages/build-env-compiler-var-a/package.py @@ -0,0 +1,14 @@ +# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack.package import * + + +class BuildEnvCompilerVarA(Package): + """Package with runtime variable that should be dropped in the parent's build environment.""" + + url = "https://www.example.com" + version("1.0", md5="0123456789abcdef0123456789abcdef") + depends_on("build-env-compiler-var-b", type="build") diff --git a/var/spack/repos/builtin.mock/packages/build-env-compiler-var-b/package.py b/var/spack/repos/builtin.mock/packages/build-env-compiler-var-b/package.py new file mode 100644 index 0000000000..7905869b34 --- /dev/null +++ b/var/spack/repos/builtin.mock/packages/build-env-compiler-var-b/package.py @@ -0,0 +1,20 @@ +# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack.package import * + + +class BuildEnvCompilerVarB(Package): + """Package with runtime variable that should be dropped in the parent's build environment.""" + + url = "https://www.example.com" + version("1.0", md5="0123456789abcdef0123456789abcdef") + + def setup_run_environment(self, env): + env.set("CC", "this-should-be-dropped") + env.set("CXX", "this-should-be-dropped") + env.set("FC", "this-should-be-dropped") + env.set("F77", "this-should-be-dropped") + env.set("ANOTHER_VAR", "this-should-be-present") |