mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-22 06:15:58 +00:00
ci: cache the pinned Turnip archive and retry its download (#2276)
* ci: cache the pinned Turnip archive and retry its download "Prepare graphics driver variants" fetched the same checksum-pinned Banners-Turnip zip from GitHub on every run with a single 120 s attempt, so a 502 or a read timeout failed whole PR builds three times today. The archive is now cached between runs (it is still checked against its SHA-256 after a restore), and a cold download is retried on timeouts, 429 and 5xx with a growing pause. * ci: keep PowerVR's verified downloads between runs tools/powervr/fetch.py already keeps checksum-verified downloads in ~/.cache/droiddeck-build, but CI never saved that folder, so every run fetched the PowerVR components again and a read timeout failed "Build the add-on packs". The folder joins the existing pack-inputs cache, keyed on release.json too.
This commit is contained in:
1 parent
aa883830ca
commit
c755d05473
3 files changed
+82
-4
No files matched your search
@@ -7,6 +7,9 @@ import sys
|
||||
import tarfile
|
||||
import tempfile
|
||||
import hashlib
|
||||
import http.client
|
||||
import time
|
||||
import urllib.error
|
||||
import urllib.request
|
||||
import zipfile
|
||||
|
||||
@@ -32,11 +35,23 @@ def pack(entries, output):
|
||||
print(output)
|
||||
|
||||
|
||||
def download(url, attempts=4):
|
||||
for attempt in range(1, attempts + 1):
|
||||
try:
|
||||
with urllib.request.urlopen(url, timeout=120) as response:
|
||||
return response.read()
|
||||
except (OSError, http.client.HTTPException) as error:
|
||||
if attempt == attempts or isinstance(error, urllib.error.HTTPError) and error.code < 500 and error.code != 429:
|
||||
raise
|
||||
print(f'Download failed ({error}); retrying in {attempt * 15} s')
|
||||
time.sleep(attempt * 15)
|
||||
|
||||
|
||||
def build_a6xx(ndk, output_dir=OUTPUT.parent, archive_path=None):
|
||||
cached = archive_path or ROOT / 'app/build/quest-inputs' / f'Turnip-{A6XX_TAG}.zip'
|
||||
if not cached.exists():
|
||||
cached.parent.mkdir(parents=True, exist_ok=True)
|
||||
data = urllib.request.urlopen(A6XX_URL, timeout=120).read()
|
||||
data = download(A6XX_URL)
|
||||
if hashlib.sha256(data).hexdigest() != A6XX_SHA256:
|
||||
raise ValueError('A6xx archive checksum mismatch')
|
||||
cached.write_bytes(data)
|
||||
|
||||
Reference in new issue
Block a user