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