fix: give the install manifest the arbitrated file

This commit is contained in:
Abdessamad Derraz committed 2026-10-05 21:53:59 +02:00
1 parent 81995a4c18
commit 68bcef544d
4 files changed
+123 -47

No files matched your search

+9 -18
View File
@@ -651,30 +651,15 @@ def generate_pack(
from common import resolve_platform_cores
validation_index = {}
slot_overrides: dict[str, str] = {}
if emu_profiles:
platform_profiles = {
name: emu_profiles[name]
for name in resolve_platform_cores(config, emu_profiles)
}
validation_index = _build_validation_index(platform_profiles)
# Where a source-verified profile contradicts the scraped baseline on
# one destination, the pack answers to the platform it is built for.
# In existence mode the frontend never reads the bytes, so serving the
# emulator's file satisfies both sides and nothing is traded away.
mode = config.get("verification_mode", "existence")
for conflict in slots.find_conflicts(
config,
platform_profiles,
db,
base_dest,
{str(c) for c in config.get("standalone_cores", [])},
zip_contents,
data_registry,
):
decision = slots.arbitrate(conflict, mode)
if decision.serves_both and decision.winner.local_path:
slot_overrides[conflict.destination] = decision.winner.local_path
slot_overrides = slots.pack_overrides(
config, emu_profiles or {}, db, zip_contents, data_registry
)
# Filter systems by target if specified
plat_cores = (
@@ -2967,6 +2952,9 @@ def generate_manifest(
pack_only_sizes: list[int] = []
if data_registry is None:
data_registry = load_data_dir_registry(platforms_dir)
slot_overrides = slots.pack_overrides(
config, emu_profiles, db, zip_contents, data_registry
)
def manifest_destination(full_destination: str) -> str:
if base_dest and full_destination.startswith(f"{base_dest}/"):
@@ -3062,6 +3050,9 @@ def generate_manifest(
data_dir_registry=data_registry,
offline=offline,
)
override = slot_overrides.get(full_dest)
if override:
local_path, status = override, "slot_arbitrated"
if (
status == "hash_mismatch"
and local_path
+40
View File
@@ -264,6 +264,46 @@ class Decision:
return self.reason == SERVES_BOTH
def pack_overrides(
config: dict,
profiles: dict,
db: dict,
zip_contents: dict | None = None,
data_dir_registry: dict | None = None,
) -> dict[str, str]:
"""Full pack destination -> the file a platform pack serves there instead.
Where a source-verified profile contradicts the scraped baseline on one
destination, the pack answers to the platform it is built for; in
existence mode the frontend never reads the bytes, so serving the
emulator's file satisfies both. The ZIP builder, the install manifest and
verify all read this: two of them deciding alone gave the one-line
installer different bytes than the ZIP.
"""
from common import resolve_platform_cores
if not profiles:
return {}
platform_profiles = {
name: profiles[name] for name in resolve_platform_cores(config, profiles)
}
mode = config.get("verification_mode", "existence")
overrides: dict[str, str] = {}
for conflict in find_conflicts(
config,
platform_profiles,
db,
config.get("base_destination", ""),
{str(c) for c in config.get("standalone_cores", [])},
zip_contents,
data_dir_registry,
):
decision = arbitrate(conflict, mode)
if decision.serves_both and decision.winner.local_path:
overrides[conflict.destination] = decision.winner.local_path
return overrides
def arbitrate(conflict: Conflict, mode: str, addressee: str = "platform") -> Decision:
"""Decide a contested destination for the pack being built.
+7 -22
View File
@@ -730,28 +730,13 @@ def verify_platform(
)
zip_contents = build_zip_contents_index(db) if has_zipped else {}
slot_overrides: dict[str, str] = {}
if emu_profiles:
base_dest = config.get("base_destination", "")
arbitrated = {
name: emu_profiles[name]
for name in resolve_platform_cores(config, emu_profiles)
}
for conflict in slots.find_conflicts(
config,
arbitrated,
db,
base_dest,
{str(c) for c in config.get("standalone_cores", [])},
zip_contents,
data_dir_registry,
):
decision = slots.arbitrate(conflict, mode)
if decision.serves_both and decision.winner.local_path:
key = conflict.destination
if base_dest and key.startswith(f"{base_dest}/"):
key = key[len(base_dest) + 1:]
slot_overrides[key] = decision.winner.local_path
base_dest = config.get("base_destination", "")
slot_overrides = {
(key[len(base_dest) + 1:] if base_dest and key.startswith(f"{base_dest}/") else key): path
for key, path in slots.pack_overrides(
config, emu_profiles or {}, db, zip_contents, data_dir_registry
).items()
}
# Build HLE + validation indexes from emulator profiles
profiles = (