diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/installer.py | 6 | ||||
-rw-r--r-- | lib/spack/spack/util/executable.py | 27 |
2 files changed, 31 insertions, 2 deletions
diff --git a/lib/spack/spack/installer.py b/lib/spack/spack/installer.py index 68782a84bc..5ba5b3a70d 100644 --- a/lib/spack/spack/installer.py +++ b/lib/spack/spack/installer.py @@ -54,6 +54,7 @@ import spack.package import spack.package_prefs as prefs import spack.repo import spack.store +import spack.util.executable from spack.util.environment import dump_environment from spack.util.executable import which from spack.util.timer import Timer @@ -1883,7 +1884,10 @@ def build_process(pkg, install_args): """ installer = BuildProcessInstaller(pkg, install_args) - return installer.run() + + # don't print long padded paths in executable debug output. + with spack.util.executable.filter_padding(): + return installer.run() class BuildTask(object): diff --git a/lib/spack/spack/util/executable.py b/lib/spack/spack/util/executable.py index 1074a96cf7..94fc7f16a7 100644 --- a/lib/spack/spack/util/executable.py +++ b/lib/spack/spack/util/executable.py @@ -2,6 +2,7 @@ # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) +import contextlib import os import re import shlex @@ -16,6 +17,27 @@ import spack.error __all__ = ['Executable', 'which', 'ProcessError'] +#: optionally filter padding on debug output in spack.util.executable +_filter_padding = False + + +@contextlib.contextmanager +def filter_padding(): + """Context manager to safely disable path padding in debug output. + + This is needed because Spack's debug output gets extremely long when we use a + long padded installation path. + """ + global _filter_padding + try: + # don't bother filtering if padding isn't actually enabled + padding = spack.config.get("config:install_tree:padded_length", None) + if padding: + _filter_padding = True + yield + finally: + _filter_padding = False + class Executable(object): """Class representing a program that can be run on the command line.""" @@ -187,7 +209,10 @@ class Executable(object): cmd_line = "'%s'" % "' '".join( map(lambda arg: arg.replace("'", "'\"'\"'"), cmd)) - tty.debug(cmd_line) + debug_cmd_line = cmd_line + if _filter_padding: + debug_cmd_line = [spack.util.path.padding_filter(elt) for elt in cmd_line] + tty.debug(debug_cmd_line) try: proc = subprocess.Popen( |