bootstrap: fix bootstrapping GnuPG from different macOS versions (#28350)

This commit is contained in:
Massimiliano Culpo 2022-01-12 17:18:16 +01:00 committed by GitHub
parent 38fee7e0da
commit 91fc4cf28f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 8 deletions

View File

@ -575,7 +575,9 @@ def ensure_executables_in_path_or_raise(executables, abstract_spec):
root=True, order='post', deptype=('link', 'run')
):
env_mods.extend(
spack.user_environment.environment_modifications_for_spec(dep)
spack.user_environment.environment_modifications_for_spec(
dep, set_package_py_globals=False
)
)
cmd.add_default_envmod(env_mods)
return cmd

View File

@ -856,7 +856,9 @@ def _make_runnable(pkg, env):
env.prepend_path('PATH', bin_dir)
def modifications_from_dependencies(spec, context, custom_mods_only=True):
def modifications_from_dependencies(
spec, context, custom_mods_only=True, set_package_py_globals=True
):
"""Returns the environment modifications that are required by
the dependencies of a spec and also applies modifications
to this spec's package at module scope, if need be.
@ -889,6 +891,11 @@ def modifications_from_dependencies(spec, context, custom_mods_only=True):
spec (spack.spec.Spec): spec for which we want the modifications
context (str): either 'build' for build-time modifications or 'run'
for run-time modifications
custom_mods_only (bool): if True returns only custom modifications, if False
returns custom and default modifications
set_package_py_globals (bool): whether or not to set the global variables in the
package.py files (this may be problematic when using buildcaches that have
been built on a different but compatible OS)
"""
if context not in ['build', 'run', 'test']:
raise ValueError(
@ -962,7 +969,8 @@ def add_modifications_for_dep(dep):
# PKG_CONFIG_PATH)
if dep in custom_mod_deps:
dpkg = dep.package
set_module_variables_for_package(dpkg)
if set_package_py_globals:
set_module_variables_for_package(dpkg)
# Allow dependencies to modify the module
dpkg.setup_dependent_package(spec.package.module, spec)
if context == 'build':

View File

@ -65,11 +65,19 @@ def unconditional_environment_modifications(view):
return env
def environment_modifications_for_spec(spec, view=None):
def environment_modifications_for_spec(spec, view=None, set_package_py_globals=True):
"""List of environment (shell) modifications to be processed for spec.
This list is specific to the location of the spec or its projection in
the view."""
the view.
Args:
spec (spack.spec.Spec): spec for which to list the environment modifications
view: view associated with the spec passed as first argument
set_package_py_globals (bool): whether or not to set the global variables in the
package.py files (this may be problematic when using buildcaches that have
been built on a different but compatible OS)
"""
spec = spec.copy()
if view and not spec.external:
spec.prefix = prefix.Prefix(view.get_projection_for_spec(spec))
@ -86,12 +94,13 @@ def environment_modifications_for_spec(spec, view=None):
# before asking for package-specific modifications
env.extend(
spack.build_environment.modifications_from_dependencies(
spec, context='run'
spec, context='run', set_package_py_globals=set_package_py_globals
)
)
# Package specific modifications
spack.build_environment.set_module_variables_for_package(spec.package)
if set_package_py_globals:
spack.build_environment.set_module_variables_for_package(spec.package)
spec.package.setup_run_environment(env)
return env