Skip to content

Commit

Permalink
spack_install: if the first line contains 'Error: ' clean the misc cache
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardkaindl committed Oct 17, 2024
1 parent 83a1345 commit 05c2ebf
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions build_pr_changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,17 @@ def spack_install(specs, args) -> Tuple[List[str], List[Tuple[str, str]]]:

with LogFile(install_log_filename) as install_log:
ret = spawn("bin/spack", cmd, logfile=install_log)
# Check if the installation failed, and if so, print the log file:
# TODO: Add support for retrying the installation if it fails.
# If the first line of the log contains "Error: ", clean the misc cache and retry.
if ret:
with open(install_log_filename, encoding="utf-8", errors="ignore") as log_file:
if "Error: " in log_file.readline():
print("Error in the log file, cleaning the misc cache and retrying.")
spawn("bin/spack", ["clean", "--misc"])
print("Retrying with misc cache cleaned:")
ret = spawn("bin/spack", cmd, logfile=install_log)

if ret == 0:
print(f"\n------------------------- Passed {spec} -------------------------")
passed.append(spec)
Expand Down

0 comments on commit 05c2ebf

Please sign in to comment.