Skip to content

Commit b79e78c

Browse files
pd0wmspektor56
authored andcommitted
build.py: remove retry logic (commaai#24986)
1 parent 99f3662 commit b79e78c

File tree

1 file changed

+43
-58
lines changed

1 file changed

+43
-58
lines changed

selfdrive/manager/build.py

+43-58
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#!/usr/bin/env python3
22
import os
33
import subprocess
4-
import sys
5-
import time
64
import textwrap
75
from pathlib import Path
86

@@ -28,62 +26,49 @@ def build(spinner: Spinner, dirty: bool = False) -> None:
2826
nproc = os.cpu_count()
2927
j_flag = "" if nproc is None else f"-j{nproc - 1}"
3028

31-
for retry in [True, False]:
32-
scons: subprocess.Popen = subprocess.Popen(["scons", j_flag, "--cache-populate"], cwd=BASEDIR, env=env, stderr=subprocess.PIPE)
33-
assert scons.stderr is not None
34-
35-
compile_output = []
36-
37-
# Read progress from stderr and update spinner
38-
while scons.poll() is None:
39-
try:
40-
line = scons.stderr.readline()
41-
if line is None:
42-
continue
43-
line = line.rstrip()
44-
45-
prefix = b'progress: '
46-
if line.startswith(prefix):
47-
i = int(line[len(prefix):])
48-
spinner.update_progress(MAX_BUILD_PROGRESS * min(1., i / TOTAL_SCONS_NODES), 100.)
49-
elif len(line):
50-
compile_output.append(line)
51-
print(line.decode('utf8', 'replace'))
52-
except Exception:
53-
pass
54-
55-
if scons.returncode != 0:
56-
# Read remaining output
57-
r = scons.stderr.read().split(b'\n')
58-
compile_output += r
59-
60-
if retry and (not dirty):
61-
if not os.getenv("CI"):
62-
print("scons build failed, cleaning in")
63-
for i in range(3, -1, -1):
64-
print("....%d" % i)
65-
time.sleep(1)
66-
subprocess.check_call(["scons", "-c"], cwd=BASEDIR, env=env)
67-
else:
68-
print("scons build failed after retry")
69-
sys.exit(1)
70-
else:
71-
# Build failed log errors
72-
errors = [line.decode('utf8', 'replace') for line in compile_output
73-
if any(err in line for err in [b'error: ', b'not found, needed by target'])]
74-
error_s = "\n".join(errors)
75-
add_file_handler(cloudlog)
76-
cloudlog.error("scons build failed\n" + error_s)
77-
78-
# Show TextWindow
79-
spinner.close()
80-
if not os.getenv("CI"):
81-
error_s = "\n \n".join("\n".join(textwrap.wrap(e, 65)) for e in errors)
82-
with TextWindow("openpilot failed to build\n \n" + error_s) as t:
83-
t.wait_for_exit()
84-
exit(1)
85-
else:
86-
break
29+
scons: subprocess.Popen = subprocess.Popen(["scons", j_flag, "--cache-populate"], cwd=BASEDIR, env=env, stderr=subprocess.PIPE)
30+
assert scons.stderr is not None
31+
32+
compile_output = []
33+
34+
# Read progress from stderr and update spinner
35+
while scons.poll() is None:
36+
try:
37+
line = scons.stderr.readline()
38+
if line is None:
39+
continue
40+
line = line.rstrip()
41+
42+
prefix = b'progress: '
43+
if line.startswith(prefix):
44+
i = int(line[len(prefix):])
45+
spinner.update_progress(MAX_BUILD_PROGRESS * min(1., i / TOTAL_SCONS_NODES), 100.)
46+
elif len(line):
47+
compile_output.append(line)
48+
print(line.decode('utf8', 'replace'))
49+
except Exception:
50+
pass
51+
52+
if scons.returncode != 0:
53+
# Read remaining output
54+
r = scons.stderr.read().split(b'\n')
55+
compile_output += r
56+
57+
# Build failed log errors
58+
errors = [line.decode('utf8', 'replace') for line in compile_output
59+
if any(err in line for err in [b'error: ', b'not found, needed by target'])]
60+
error_s = "\n".join(errors)
61+
add_file_handler(cloudlog)
62+
cloudlog.error("scons build failed\n" + error_s)
63+
64+
# Show TextWindow
65+
spinner.close()
66+
if not os.getenv("CI"):
67+
error_s = "\n \n".join("\n".join(textwrap.wrap(e, 65)) for e in errors)
68+
with TextWindow("openpilot failed to build\n \n" + error_s) as t:
69+
t.wait_for_exit()
70+
exit(1)
71+
8772

8873
# enforce max cache size
8974
cache_files = [f for f in CACHE_DIR.rglob('*') if f.is_file()]

0 commit comments

Comments
 (0)