1212OTA_OUTPUT_DIR = OUTPUT_DIR / "ota"
1313
1414SECTOR_SIZE = 4096
15- CHUNK_SIZE = 52_428_800 # 50 MB - must be under raw.githubusercontent.com's 100 MB limit
1615
17- BASE_URL = os .environ .get ("BASE_URL " , "https://raw.githubusercontent. com/commaai/vamOS/release-images " )
16+ RELEASE_URL = os .environ .get ("RELEASE_URL " , "https://github. com/commaai/vamos/releases/download/untagged " )
1817
1918GPT = namedtuple ('GPT' , ['lun' , 'name' , 'path' , 'start_sector' , 'num_sectors' , 'has_ab' , 'full_check' ])
2019GPTS = [
@@ -74,30 +73,14 @@ def process_file(entry):
7473 sha256 .update (b'\x00 ' * ((SECTOR_SIZE - (size % SECTOR_SIZE )) % SECTOR_SIZE ))
7574 ondevice_hash = sha256 .hexdigest ()
7675
77- base_name = f"{ entry .name } -{ hash_raw } .img"
78-
79- # Write file(s) to output directory, splitting into chunks if needed
80- chunks = None
81- if size > CHUNK_SIZE :
82- chunks = []
83- chunk_idx = 0
84- with open (entry .path , 'rb' ) as f :
85- while True :
86- data = f .read (CHUNK_SIZE )
87- if not data :
88- break
89- chunk_name = f"{ base_name } .{ chunk_idx :02d} "
90- (OTA_OUTPUT_DIR / chunk_name ).write_bytes (data )
91- chunks .append ({"url" : f"{ BASE_URL } /{ chunk_name } " , "size" : len (data )})
92- print (f" chunk { chunk_idx } : { chunk_name } ({ len (data )} bytes)" )
93- chunk_idx += 1
94- else :
95- print (f" copying to { base_name } " )
96- shutil .copy (entry .path , OTA_OUTPUT_DIR / base_name )
76+ # Copy to output directory
77+ out_fn = OTA_OUTPUT_DIR / f"{ entry .name } -{ hash_raw } .img"
78+ print (f" copying to { out_fn .name } " )
79+ shutil .copy (entry .path , out_fn )
9780
9881 ret = {
9982 "name" : entry .name ,
100- "url" : f"{ BASE_URL } /{ base_name } " ,
83+ "url" : f"{ RELEASE_URL } /{ out_fn . name } " ,
10184 "hash" : hash ,
10285 "hash_raw" : hash_raw ,
10386 "size" : size ,
@@ -107,10 +90,6 @@ def process_file(entry):
10790 "ondevice_hash" : ondevice_hash ,
10891 }
10992
110- if chunks :
111- ret ["url" ] = ""
112- ret ["chunks" ] = chunks
113-
11493 if isinstance (entry , GPT ):
11594 ret ["gpt" ] = {
11695 "lun" : entry .lun ,
0 commit comments