installer: show tracebacks from builds to debug failed installs
`installer.py` currently swallows the traceback and preserves only the error messaege if a build process fails. - [x] preserve exceptions from failed build processes - [x] print a full traceback for each one when running with `spack -d` Signed-off-by: Todd Gamblin <tgamblin@llnl.gov>
This commit is contained in:
parent
b7ebcc4a7b
commit
b8ecccbde9
@ -36,6 +36,7 @@
|
|||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
import traceback
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from gzip import GzipFile
|
from gzip import GzipFile
|
||||||
from typing import Dict, Iterator, List, Optional, Set, Tuple, Union
|
from typing import Dict, Iterator, List, Optional, Set, Tuple, Union
|
||||||
@ -2214,7 +2215,7 @@ def install(self) -> None:
|
|||||||
if task.is_build_request:
|
if task.is_build_request:
|
||||||
if single_requested_spec:
|
if single_requested_spec:
|
||||||
raise
|
raise
|
||||||
failed_build_requests.append((pkg, pkg_id, str(exc)))
|
failed_build_requests.append((pkg, pkg_id, exc))
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
# Remove the install prefix if anything went wrong during
|
# Remove the install prefix if anything went wrong during
|
||||||
@ -2241,6 +2242,9 @@ def install(self) -> None:
|
|||||||
if failed_build_requests or missing:
|
if failed_build_requests or missing:
|
||||||
for _, pkg_id, err in failed_build_requests:
|
for _, pkg_id, err in failed_build_requests:
|
||||||
tty.error(f"{pkg_id}: {err}")
|
tty.error(f"{pkg_id}: {err}")
|
||||||
|
if spack.error.debug:
|
||||||
|
# note: in python 3.10+ this can just be print_exception(err)
|
||||||
|
traceback.print_exception(type(err), err, err.__traceback__)
|
||||||
|
|
||||||
for _, pkg_id in missing:
|
for _, pkg_id in missing:
|
||||||
tty.error(f"{pkg_id}: Package was not installed")
|
tty.error(f"{pkg_id}: Package was not installed")
|
||||||
|
Loading…
Reference in New Issue
Block a user