make baseline build & launch cleanly
- onroad.cc: fix screenDisplayMode reference to nvg->screenDisplayMode (baseline had a stale reference to the variable after it moved into AnnotatedCameraWidget). Restores the original conditional intent. - ui/SConscript + home.cc: drop QtWebEngine include/link entirely (no longer used by any active code). - build.py: BUILD_ONLY env var spawns the failure TextWindow fully detached (own session, /dev/null stdio) so build_only.sh exits and caller can capture stderr; spinner binary update uses temp+os.replace so a running spinner doesn't ETXTBSY the build. - build_only.sh: tee build output to /tmp/build.log and propagate build.py's exit code via PIPESTATUS. Verified: build_only.sh completes cleanly, launch_openpilot.sh boots the manager and spawns the standard process set.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
@@ -54,6 +55,21 @@ def build(spinner: Spinner, dirty: bool = False, minimal: bool = False) -> None:
|
||||
|
||||
if scons.returncode == 0:
|
||||
Path('/data/openpilot/prebuilt').touch()
|
||||
|
||||
# CLEARPILOT: update prebuilt spinner if the new build is newer.
|
||||
# Write to a temp path then os.replace so we can swap a binary that's
|
||||
# currently executing (the in-process spinner holds the old one open).
|
||||
new_spinner = Path(BASEDIR) / "selfdrive/ui/_spinner"
|
||||
old_spinner = Path(BASEDIR) / "selfdrive/ui/qt/spinner"
|
||||
if new_spinner.exists() and (not old_spinner.exists() or new_spinner.stat().st_mtime > old_spinner.stat().st_mtime):
|
||||
import shutil
|
||||
try:
|
||||
tmp_spinner = old_spinner.with_name(old_spinner.name + ".new")
|
||||
shutil.copy2(str(new_spinner), str(tmp_spinner))
|
||||
os.replace(str(tmp_spinner), str(old_spinner))
|
||||
except OSError as e:
|
||||
print(f"CLP failed to update prebuilt spinner: {e}", file=sys.stderr)
|
||||
|
||||
break
|
||||
|
||||
if scons.returncode != 0:
|
||||
@@ -69,8 +85,23 @@ def build(spinner: Spinner, dirty: bool = False, minimal: bool = False) -> None:
|
||||
# Show TextWindow
|
||||
spinner.close()
|
||||
if not os.getenv("CI"):
|
||||
with TextWindow("openpilot failed to build\n \n" + error_s) as t:
|
||||
t.wait_for_exit()
|
||||
msg = "openpilot failed to build\n \n" + error_s
|
||||
if os.getenv("BUILD_ONLY"):
|
||||
# CLEARPILOT: BUILD_ONLY mode — spawn the text window fully detached
|
||||
# (own session, /dev/null stdio) so it stays on screen after this
|
||||
# script exits and doesn't hold our stdout/stderr pipes open.
|
||||
print(error_s, file=sys.stderr)
|
||||
devnull = open(os.devnull, 'r+b')
|
||||
subprocess.Popen(
|
||||
["./text", msg],
|
||||
cwd=os.path.join(BASEDIR, "selfdrive", "ui"),
|
||||
stdin=devnull, stdout=devnull, stderr=devnull,
|
||||
start_new_session=True,
|
||||
close_fds=True,
|
||||
)
|
||||
else:
|
||||
with TextWindow(msg) as t:
|
||||
t.wait_for_exit()
|
||||
exit(1)
|
||||
|
||||
# enforce max cache size
|
||||
|
||||
Reference in New Issue
Block a user