mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-11-05 20:13:47 +08:00
6d742eb343
Add control trace and platform qualification tools that exercise explicit safety modes and vehicle coverage. Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> Co-authored-by: Dom <168790843+firestar5683@users.noreply.github.com> Co-authored-by: Kacper Rączy <gfw.kra@gmail.com> Co-authored-by: YassineYousfi <yyousfi1@binghamton.edu> Co-authored-by: firestarsdog <229254897+firestarsdog@users.noreply.github.com> Co-authored-by: dirwin31 <83434411+dirwin31@users.noreply.github.com> Co-authored-by: prabhaavp <prabhaav@msu.edu>
66 lines
2.5 KiB
Python
Executable File
66 lines
2.5 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
import os
|
|
import re
|
|
import subprocess
|
|
import sys
|
|
|
|
HERE = os.path.abspath(os.path.dirname(__file__))
|
|
ROOT = os.path.abspath(os.path.join(HERE, "../.."))
|
|
|
|
blacklist = [
|
|
".git/",
|
|
".venv/",
|
|
r"^\.github/workflows/",
|
|
|
|
"matlab.*.md",
|
|
|
|
# Obsolete checkout metadata is never packaged
|
|
".lfsconfig",
|
|
".git$",
|
|
".gitmodules",
|
|
]
|
|
|
|
# Dependency sources are ordinary tracked files. A gitlink cannot be packaged
|
|
# without a separate checkout, so fail rather than silently omitting its source.
|
|
def release_files(root: str, include_big_model: bool = False, *, require_provider: bool = False) -> list[bytes]:
|
|
entries = subprocess.check_output(["git", "ls-files", "--stage", "-z"], cwd=root).split(b"\0")
|
|
files = []
|
|
modes = {}
|
|
for entry in entries:
|
|
if not entry:
|
|
continue
|
|
|
|
metadata, tracked_file = entry.split(b"\t", 1)
|
|
mode, _, stage = metadata.split()
|
|
rf = os.fsdecode(tracked_file)
|
|
if mode == b"160000":
|
|
raise ValueError(f"Cannot package gitlink: {rf}; dependency sources must be tracked files")
|
|
if stage != b"0":
|
|
raise ValueError(f"Cannot package unresolved merge: {rf}")
|
|
if rf == "openpilot/selfdrive/modeld/models/big_driving_tinygrad.pkl":
|
|
continue
|
|
if not include_big_model and rf.startswith("openpilot/selfdrive/modeld/models/big_"):
|
|
continue
|
|
blacklisted = any(re.search(p, rf) for p in blacklist)
|
|
if blacklisted:
|
|
continue
|
|
|
|
modes[tracked_file] = mode
|
|
files.append(tracked_file)
|
|
if b"prebuilt" in files and b"openpilot/starpilot/replay/owner.py" in files:
|
|
for name, allowed_modes in ((b"openpilot/tools/replay/replay", (b"100755",)),
|
|
(b"openpilot/tools/replay/libmedia_mux.so", (b"100644", b"100755"))):
|
|
if modes.get(name) not in allowed_modes:
|
|
raise ValueError(f"Prebuilt Replay Git package missing or invalid mode: {os.fsdecode(name)}; track both Replay runtime outputs")
|
|
if require_provider or b"openpilot/starpilot/maps/shadow_lifecycle.py" in files:
|
|
for name, mode in ((b"openpilot/starpilot/maps/provider/mapd", b"100755"),
|
|
(b"openpilot/starpilot/maps/provider/manifest.json", b"100644")):
|
|
if modes.get(name) != mode:
|
|
raise ValueError(f"Mapd Git package missing or invalid mode: {os.fsdecode(name)}; track the verified provider package")
|
|
return files
|
|
|
|
|
|
if __name__ == "__main__":
|
|
for tracked_file in release_files(ROOT, bool(os.getenv("INCLUDE_BIG_MODEL"))):
|
|
sys.stdout.buffer.write(tracked_file + b"\0")
|