|
|
|
@ -7,7 +7,6 @@ from functools import lru_cache |
|
|
|
|
from common.basedir import BASEDIR |
|
|
|
|
from selfdrive.swaglog import cloudlog |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TESTED_BRANCHES = ['devel', 'release2-staging', 'release3-staging', 'dashcam-staging', 'release2', 'release3', 'dashcam'] |
|
|
|
|
|
|
|
|
|
training_version: bytes = b"0.2.0" |
|
|
|
@ -62,12 +61,12 @@ def get_version() -> str: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@cache |
|
|
|
|
def get_prebuilt() -> bool: |
|
|
|
|
def is_prebuilt() -> bool: |
|
|
|
|
return os.path.exists(os.path.join(BASEDIR, 'prebuilt')) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@cache |
|
|
|
|
def get_comma_remote() -> bool: |
|
|
|
|
def is_comma_remote() -> bool: |
|
|
|
|
origin = get_origin() |
|
|
|
|
if origin is None: |
|
|
|
|
return False |
|
|
|
@ -76,12 +75,12 @@ def get_comma_remote() -> bool: |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@cache |
|
|
|
|
def get_tested_branch() -> bool: |
|
|
|
|
def is_tested_branch() -> bool: |
|
|
|
|
return get_short_branch() in TESTED_BRANCHES |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@cache |
|
|
|
|
def get_dirty() -> bool: |
|
|
|
|
def is_dirty() -> bool: |
|
|
|
|
origin = get_origin() |
|
|
|
|
branch = get_branch() |
|
|
|
|
if (origin is None) or (branch is None): |
|
|
|
@ -90,7 +89,7 @@ def get_dirty() -> bool: |
|
|
|
|
dirty = False |
|
|
|
|
try: |
|
|
|
|
# Actually check dirty files |
|
|
|
|
if not get_prebuilt(): |
|
|
|
|
if not is_prebuilt(): |
|
|
|
|
# This is needed otherwise touched files might show up as modified |
|
|
|
|
try: |
|
|
|
|
subprocess.check_call(["git", "update-index", "--refresh"]) |
|
|
|
@ -100,15 +99,15 @@ def get_dirty() -> bool: |
|
|
|
|
dirty = (subprocess.call(["git", "diff-index", "--quiet", branch, "--"]) != 0) |
|
|
|
|
|
|
|
|
|
# Log dirty files |
|
|
|
|
if dirty and get_comma_remote(): |
|
|
|
|
if dirty and is_comma_remote(): |
|
|
|
|
try: |
|
|
|
|
dirty_files = run_cmd(["git", "diff-index", branch, "--"]) |
|
|
|
|
cloudlog.event("dirty comma branch", version=get_version(), dirty=dirty, origin=origin, branch=branch, |
|
|
|
|
dirty_files=dirty_files, commit=get_commit(), origin_commit=get_commit(branch)) |
|
|
|
|
dirty_files=dirty_files, commit=get_commit(), origin_commit=get_commit(branch)) |
|
|
|
|
except subprocess.CalledProcessError: |
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
dirty = dirty or (not get_comma_remote()) |
|
|
|
|
dirty = dirty or (not is_comma_remote()) |
|
|
|
|
dirty = dirty or ('master' in branch) |
|
|
|
|
|
|
|
|
|
except subprocess.CalledProcessError: |
|
|
|
@ -125,9 +124,9 @@ if __name__ == "__main__": |
|
|
|
|
params.put("TermsVersion", terms_version) |
|
|
|
|
params.put("TrainingVersion", training_version) |
|
|
|
|
|
|
|
|
|
print("Dirty: %s" % get_dirty()) |
|
|
|
|
print("Dirty: %s" % is_dirty()) |
|
|
|
|
print("Version: %s" % get_version()) |
|
|
|
|
print("Origin: %s" % get_origin()) |
|
|
|
|
print("Branch: %s" % get_branch()) |
|
|
|
|
print("Short branch: %s" % get_short_branch()) |
|
|
|
|
print("Prebuilt: %s" % get_prebuilt()) |
|
|
|
|
print("Prebuilt: %s" % is_prebuilt()) |
|
|
|
|