mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-16 08:23:28 -05:00
fix: resolve archives with profile hashes
This commit is contained in:
1 parent
78b2075976
commit
76fbade6b8
2 files changed
+27
-6
No files matched your search
+5
-1
@@ -401,7 +401,11 @@ def resolve_local_file(
|
|||||||
exact, zip_exact, hash_mismatch, not_found.
|
exact, zip_exact, hash_mismatch, not_found.
|
||||||
"""
|
"""
|
||||||
sha1 = file_entry.get("sha1")
|
sha1 = file_entry.get("sha1")
|
||||||
md5_raw = str(file_entry.get("md5", "") or "")
|
md5_field = file_entry.get("md5", "") or ""
|
||||||
|
if isinstance(md5_field, list):
|
||||||
|
md5_raw = ",".join(str(m) for m in md5_field)
|
||||||
|
else:
|
||||||
|
md5_raw = str(md5_field)
|
||||||
name = file_entry.get("name", "")
|
name = file_entry.get("name", "")
|
||||||
zipped_file = file_entry.get("zipped_file")
|
zipped_file = file_entry.get("zipped_file")
|
||||||
aliases = file_entry.get("aliases", [])
|
aliases = file_entry.get("aliases", [])
|
||||||
|
|||||||
@@ -287,12 +287,18 @@ def resolve_file(
|
|||||||
# missing OR has a hash mismatch (wrong variant on disk)
|
# missing OR has a hash mismatch (wrong variant on disk)
|
||||||
name = file_entry.get("name", "")
|
name = file_entry.get("name", "")
|
||||||
sha1 = file_entry.get("sha1")
|
sha1 = file_entry.get("sha1")
|
||||||
|
first_sha1 = (sha1[0] if sha1 else "") if isinstance(sha1, list) else (sha1 or "")
|
||||||
md5_raw = file_entry.get("md5", "")
|
md5_raw = file_entry.get("md5", "")
|
||||||
md5_list = (
|
if isinstance(md5_raw, list):
|
||||||
[m.strip().lower() for m in md5_raw.split(",") if m.strip()] if md5_raw else []
|
md5_list = [str(m).strip().lower() for m in md5_raw if str(m).strip()]
|
||||||
)
|
else:
|
||||||
|
md5_list = (
|
||||||
|
[m.strip().lower() for m in md5_raw.split(",") if m.strip()]
|
||||||
|
if md5_raw
|
||||||
|
else []
|
||||||
|
)
|
||||||
first_md5 = md5_list[0] if md5_list else ""
|
first_md5 = md5_list[0] if md5_list else ""
|
||||||
cached = fetch_large_file(name, expected_sha1=sha1 or "", expected_md5=first_md5)
|
cached = fetch_large_file(name, expected_sha1=first_sha1, expected_md5=first_md5)
|
||||||
if cached:
|
if cached:
|
||||||
return cached, "release_asset"
|
return cached, "release_asset"
|
||||||
|
|
||||||
@@ -554,6 +560,8 @@ def _collect_emulator_extras(
|
|||||||
"required": u.get("required", False),
|
"required": u.get("required", False),
|
||||||
"hle_fallback": u.get("hle_fallback", False),
|
"hle_fallback": u.get("hle_fallback", False),
|
||||||
"source_emulator": u.get("emulator", ""),
|
"source_emulator": u.get("emulator", ""),
|
||||||
|
"sha1": u.get("sha1"),
|
||||||
|
"md5": u.get("md5"),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1835,7 +1843,16 @@ def generate_emulator_pack(
|
|||||||
if _has_path_conflict(archive_dest, seen_destinations, seen_parents):
|
if _has_path_conflict(archive_dest, seen_destinations, seen_parents):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
archive_entry = {"name": archive_name}
|
# Prefer the profile's own entry for the archive (carries
|
||||||
|
# hashes for exact resolution when several dumps share a name)
|
||||||
|
archive_entry = next(
|
||||||
|
(
|
||||||
|
f
|
||||||
|
for f in files
|
||||||
|
if f.get("name") == archive_name and not f.get("archive")
|
||||||
|
),
|
||||||
|
{"name": archive_name},
|
||||||
|
)
|
||||||
local_path, status = resolve_file(
|
local_path, status = resolve_file(
|
||||||
archive_entry,
|
archive_entry,
|
||||||
db,
|
db,
|
||||||
|
|||||||
Reference in new issue
Block a user