Skip to content

Commit

Permalink
Dump some system info on error (#885)
Browse files Browse the repository at this point in the history
  • Loading branch information
singiamtel authored Nov 19, 2024
1 parent a8a767e commit cfcb0eb
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions alibuild_helpers/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
from alibuild_helpers.analytics import report_event
from alibuild_helpers.log import debug, info, banner, warning
from alibuild_helpers.log import dieOnError
from alibuild_helpers.cmd import execute, DockerRunner, BASH, install_wrapper_script
from alibuild_helpers.utilities import prunePaths, symlink, call_ignoring_oserrors, topological_sort
from alibuild_helpers.cmd import execute, DockerRunner, BASH, install_wrapper_script, getstatusoutput
from alibuild_helpers.utilities import prunePaths, symlink, call_ignoring_oserrors, topological_sort, detectArch
from alibuild_helpers.utilities import resolve_store_path
from alibuild_helpers.utilities import parseDefaults, readDefaults
from alibuild_helpers.utilities import getPackageList, asList
Expand Down Expand Up @@ -1112,6 +1112,29 @@ def doBuild(args, parser):
""")
buildErrMsg += "".join("\n ( cd %s && git pull --rebase )" % dp for dp in updatablePkgs)

# Gather build info for the error message
try:
safe_args = {
"pkgname", "defaults", "architecture", "forceUnknownArch",
"develPrefix", "jobs", "noSystem", "noDevel", "forceTracked", "plugin",
"disable", "annotate", "onlyDeps", "docker"
}
args_str = " ".join(f"--{k}={v}" for k, v in vars(args).items() if v and k in safe_args)
detected_arch = detectArch()
buildErrMsg += dedent(f"""
Build info:
OS: {detected_arch}
Using aliBuild from alibuild@{__version__ or "unknown"} recipes in alidist@{os.environ["ALIBUILD_ALIDIST_HASH"][:10]}
Build arguments: {args_str}
""")

if detected_arch.startswith("osx"):
buildErrMsg += f'XCode version: {getstatusoutput("xcodebuild -version")[1]}'

except Exception as exc:
warning("Failed to gather build info", exc_info=exc)


dieOnError(err, buildErrMsg.strip())

# We need to create 2 sets of links, once with the full requires,
Expand Down

0 comments on commit cfcb0eb

Please sign in to comment.