|
|
@ -3,7 +3,7 @@ import json |
|
|
|
import pathlib |
|
|
|
import pathlib |
|
|
|
import tempfile |
|
|
|
import tempfile |
|
|
|
from openpilot.common.basedir import BASEDIR |
|
|
|
from openpilot.common.basedir import BASEDIR |
|
|
|
from openpilot.system.hardware.tici.agnos import StreamingDecompressor |
|
|
|
from openpilot.system.hardware.tici.agnos import StreamingDecompressor, unsparsify, noop |
|
|
|
from openpilot.system.updated.casync.common import create_casync_from_file |
|
|
|
from openpilot.system.updated.casync.common import create_casync_from_file |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -31,22 +31,15 @@ if __name__ == "__main__": |
|
|
|
print(f"creating casync agnos build from {entry}") |
|
|
|
print(f"creating casync agnos build from {entry}") |
|
|
|
downloader = StreamingDecompressor(entry['url']) |
|
|
|
downloader = StreamingDecompressor(entry['url']) |
|
|
|
|
|
|
|
|
|
|
|
CHUNK_SIZE=16*1024*1024 # 16mb |
|
|
|
parse_func = unsparsify if entry['sparse'] else noop |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
parsed_chunks = parse_func(downloader) |
|
|
|
|
|
|
|
|
|
|
|
size = entry["size"] |
|
|
|
size = entry["size"] |
|
|
|
|
|
|
|
|
|
|
|
cur = 0 |
|
|
|
cur = 0 |
|
|
|
with open(entry_path, "wb") as f: |
|
|
|
with open(entry_path, "wb") as f: |
|
|
|
while True: |
|
|
|
for chunk in parsed_chunks: |
|
|
|
to_read = min((size - cur), CHUNK_SIZE) |
|
|
|
f.write(chunk) |
|
|
|
|
|
|
|
|
|
|
|
print(f"{cur/size*100:06.2f}% {to_read}") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not to_read: |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
f.write(downloader.read(to_read)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cur += to_read |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
create_casync_from_file(entry_path, output_dir, f"agnos-{args.version}-{entry['name']}") |
|
|
|
create_casync_from_file(entry_path, output_dir, f"agnos-{args.version}-{entry['name']}") |
|
|
|