add logging to help users debug where external file searches are taking a long time (#35900)

This commit is contained in:
Peter Scheibel 2023-03-08 09:46:13 -08:00 committed by GitHub
parent 7d54c24939
commit 1b8561f752
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -485,7 +485,13 @@ def update_compiler_args_for_dep(dep):
query = pkg.spec[dep.name] query = pkg.spec[dep.name]
dep_link_dirs = list() dep_link_dirs = list()
try: try:
# In some circumstances (particularly for externals) finding
# libraries packages can be time consuming, so indicate that
# we are performing this operation (and also report when it
# finishes).
tty.debug("Collecting libraries for {0}".format(dep.name))
dep_link_dirs.extend(query.libs.directories) dep_link_dirs.extend(query.libs.directories)
tty.debug("Libraries for {0} have been collected.".format(dep.name))
except NoLibrariesError: except NoLibrariesError:
tty.debug("No libraries found for {0}".format(dep.name)) tty.debug("No libraries found for {0}".format(dep.name))
@ -772,7 +778,9 @@ def setup_package(pkg, dirty, context="build"):
set_compiler_environment_variables(pkg, env_mods) set_compiler_environment_variables(pkg, env_mods)
set_wrapper_variables(pkg, env_mods) set_wrapper_variables(pkg, env_mods)
tty.debug("setup_package: grabbing modifications from dependencies")
env_mods.extend(modifications_from_dependencies(pkg.spec, context, custom_mods_only=False)) env_mods.extend(modifications_from_dependencies(pkg.spec, context, custom_mods_only=False))
tty.debug("setup_package: collected all modifications from dependencies")
# architecture specific setup # architecture specific setup
platform = spack.platforms.by_name(pkg.spec.architecture.platform) platform = spack.platforms.by_name(pkg.spec.architecture.platform)
@ -780,6 +788,7 @@ def setup_package(pkg, dirty, context="build"):
platform.setup_platform_environment(pkg, env_mods) platform.setup_platform_environment(pkg, env_mods)
if context == "build": if context == "build":
tty.debug("setup_package: setup build environment for root")
builder = spack.builder.create(pkg) builder = spack.builder.create(pkg)
builder.setup_build_environment(env_mods) builder.setup_build_environment(env_mods)
@ -790,6 +799,7 @@ def setup_package(pkg, dirty, context="build"):
" includes and omit it when invoked with '--cflags'." " includes and omit it when invoked with '--cflags'."
) )
elif context == "test": elif context == "test":
tty.debug("setup_package: setup test environment for root")
env_mods.extend( env_mods.extend(
inspect_path( inspect_path(
pkg.spec.prefix, pkg.spec.prefix,
@ -806,6 +816,7 @@ def setup_package(pkg, dirty, context="build"):
# Load modules on an already clean environment, just before applying Spack's # Load modules on an already clean environment, just before applying Spack's
# own environment modifications. This ensures Spack controls CC/CXX/... variables. # own environment modifications. This ensures Spack controls CC/CXX/... variables.
if need_compiler: if need_compiler:
tty.debug("setup_package: loading compiler modules")
for mod in pkg.compiler.modules: for mod in pkg.compiler.modules:
load_module(mod) load_module(mod)
@ -943,6 +954,7 @@ def default_modifications_for_dep(dep):
_make_runnable(dep, env) _make_runnable(dep, env)
def add_modifications_for_dep(dep): def add_modifications_for_dep(dep):
tty.debug("Adding env modifications for {0}".format(dep.name))
# Some callers of this function only want the custom modifications. # Some callers of this function only want the custom modifications.
# For callers that want both custom and default modifications, we want # For callers that want both custom and default modifications, we want
# to perform the default modifications here (this groups custom # to perform the default modifications here (this groups custom
@ -968,6 +980,7 @@ def add_modifications_for_dep(dep):
builder.setup_dependent_build_environment(env, spec) builder.setup_dependent_build_environment(env, spec)
else: else:
dpkg.setup_dependent_run_environment(env, spec) dpkg.setup_dependent_run_environment(env, spec)
tty.debug("Added env modifications for {0}".format(dep.name))
# Note that we want to perform environment modifications in a fixed order. # Note that we want to perform environment modifications in a fixed order.
# The Spec.traverse method provides this: i.e. in addition to # The Spec.traverse method provides this: i.e. in addition to