|
|
|
@ -1,8 +1,6 @@ |
|
|
|
|
#!/usr/bin/env python3 |
|
|
|
|
import os |
|
|
|
|
import subprocess |
|
|
|
|
import sys |
|
|
|
|
import time |
|
|
|
|
import textwrap |
|
|
|
|
from pathlib import Path |
|
|
|
|
|
|
|
|
@ -28,7 +26,6 @@ def build(spinner: Spinner, dirty: bool = False) -> None: |
|
|
|
|
nproc = os.cpu_count() |
|
|
|
|
j_flag = "" if nproc is None else f"-j{nproc - 1}" |
|
|
|
|
|
|
|
|
|
for retry in [True, False]: |
|
|
|
|
scons: subprocess.Popen = subprocess.Popen(["scons", j_flag, "--cache-populate"], cwd=BASEDIR, env=env, stderr=subprocess.PIPE) |
|
|
|
|
assert scons.stderr is not None |
|
|
|
|
|
|
|
|
@ -57,17 +54,6 @@ def build(spinner: Spinner, dirty: bool = False) -> None: |
|
|
|
|
r = scons.stderr.read().split(b'\n') |
|
|
|
|
compile_output += r |
|
|
|
|
|
|
|
|
|
if retry and (not dirty): |
|
|
|
|
if not os.getenv("CI"): |
|
|
|
|
print("scons build failed, cleaning in") |
|
|
|
|
for i in range(3, -1, -1): |
|
|
|
|
print("....%d" % i) |
|
|
|
|
time.sleep(1) |
|
|
|
|
subprocess.check_call(["scons", "-c"], cwd=BASEDIR, env=env) |
|
|
|
|
else: |
|
|
|
|
print("scons build failed after retry") |
|
|
|
|
sys.exit(1) |
|
|
|
|
else: |
|
|
|
|
# Build failed log errors |
|
|
|
|
errors = [line.decode('utf8', 'replace') for line in compile_output |
|
|
|
|
if any(err in line for err in [b'error: ', b'not found, needed by target'])] |
|
|
|
@ -82,8 +68,7 @@ def build(spinner: Spinner, dirty: bool = False) -> None: |
|
|
|
|
with TextWindow("openpilot failed to build\n \n" + error_s) as t: |
|
|
|
|
t.wait_for_exit() |
|
|
|
|
exit(1) |
|
|
|
|
else: |
|
|
|
|
break |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# enforce max cache size |
|
|
|
|
cache_files = [f for f in CACHE_DIR.rglob('*') if f.is_file()] |
|
|
|
|