fix: name why an external download failed

download_external returns an ExternalFetch outcome instead of printing and returning a bare bool, so the pack report names the real cause. lookup_hashes resolves offline and counts a release asset as held without downloading it.
This commit is contained in:
Abdessamad Derraz committed 2026-11-23 21:02:46 +01:00
1 parent 5b3f0c3f4c
commit d6abe6fd95
4 files changed
+111 -40

No files matched your search

+6 -3
View File
@@ -324,9 +324,12 @@ class _EmulatorPackBuild:
try:
# Built in memory, nothing is fetched: verify --emulator
# cannot fetch either and reports the file missing.
if self.record is None and download_external(fe, tmp_path):
self._add(tmp_path, dest, None)
return (alternatives, True, None)
if self.record is None:
fetch = download_external(fe, tmp_path)
if fetch.fetched:
self._add(tmp_path, dest, None)
return (alternatives, True, None)
self.progress(f" WARNING: {fe['name']}: {fetch.reason}")
return (alternatives, False, functools.partial(
self.missing_files.append, fe["name"]
))
+10 -2
View File
@@ -636,7 +636,12 @@ class _PlatformPackBuild:
# filling it on a failed download made the two differ.
self.placed.take(full_dest)
try:
if self.plan.opts.record is None and download_external(file_entry, tmp_path):
# Built in memory, nothing is fetched: verify cannot fetch either.
fetch = (
download_external(file_entry, tmp_path)
if self.plan.opts.record is None else None
)
if fetch is not None and fetch.fetched:
extract = file_entry.get("extract", False)
if extract and tmp_path.endswith(".zip"):
extract_zip_to_archive(tmp_path, self._flat(full_dest), self.zf)
@@ -646,7 +651,10 @@ class _PlatformPackBuild:
self.total_files += 1
else:
self.file_status[full_dest] = "missing"
self.file_reasons[full_dest] = "external download failed"
self.file_reasons[full_dest] = (
fetch.reason if fetch is not None
else "external file not fetched for an in-memory build"
)
finally:
if os.path.exists(tmp_path):
os.unlink(tmp_path)