"""Download approved release objects using curl, verify SHA-256, join split archives.""" import pathlib,subprocess,json,hashlib BASE='https://artifacts.littleply.com/' root=pathlib.Path('littleply-2026-10-28');root.mkdir(exist_ok=True) subprocess.run(['curl','--fail','--location','--proto','=https','--proto-redir','=https','--output',str(root/'release.json'),BASE+'v1/2026-10-28/release.json'],check=True) release=json.loads((root/'release.json').read_text()) def digest(p): h=hashlib.sha256() with p.open('rb') as f: for b in iter(lambda:f.read(8*1024*1024),b''):h.update(b) return h.hexdigest() for package in release['packages']: name=pathlib.PurePosixPath(package['name']);assert not name.is_absolute() and '..' not in name.parts dest=root/name;dest.parent.mkdir(parents=True,exist_ok=True);paths=[] for part in package['parts']: key=part['key'];assert key.startswith('v1/2026-10-28/') and '..' not in pathlib.PurePosixPath(key).parts p=root/pathlib.PurePosixPath(key).relative_to('v1/2026-10-28');p.parent.mkdir(parents=True,exist_ok=True) subprocess.run(['curl','--fail','--location','--proto','=https','--proto-redir','=https','--output',str(p),BASE+key],check=True) assert p.stat().st_size==part['bytes'] and digest(p)==part['sha256'],'Part checksum mismatch' paths.append(p) if len(paths)>1: with dest.open('wb') as out: for p in paths: with p.open('rb') as f: for b in iter(lambda:f.read(8*1024*1024),b''):out.write(b) assert dest.stat().st_size==package['bytes'] and digest(dest)==package['sha256'],'Archive checksum mismatch' print('Verified',name)