mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-12-03 23:08:55 -06:00
fix: gap report names the platforms a file needs
The gaps page decided again which platforms a missing file affects, without installed_on and not_bundled_on. whole_tree_gaps now records them on each missing row with the per-platform rules (build layout, mode, unread_on, installed_with_emulator), and the page renders them.
This commit is contained in:
1 parent
374891b83e
commit
7000335825
4 files changed
+106
-67
No files matched your search
@@ -106,10 +106,52 @@ def whole_tree_gaps(
|
||||
standalone layout is proven against them.
|
||||
"""
|
||||
declared, scope = global_report_scope(configs, db, profiles)
|
||||
return cross_reference(
|
||||
report = cross_reference(
|
||||
emulator_profiles(profiles if compared is None else compared),
|
||||
declared, db, data_names, **scope,
|
||||
)
|
||||
_record_needing_platforms(report, configs, profiles)
|
||||
return report
|
||||
|
||||
|
||||
def _record_needing_platforms(
|
||||
report: dict, configs: list[dict], profiles: dict[str, dict],
|
||||
) -> None:
|
||||
"""Give each missing row the platforms whose build of its emulator needs it.
|
||||
|
||||
A platform needs the entry when the build it runs reads it (BlastEm's
|
||||
cdbios.bin is read by the standalone build only), its launcher does not
|
||||
point the emulator elsewhere (`unread_on`) and its package of the
|
||||
emulator does not install it (`installed_on`, `not_bundled_on`).
|
||||
"""
|
||||
from resolve.cores import resolve_platform_cores
|
||||
from resolve.standalone import standalone_set
|
||||
from resolve.validation import filter_files_by_mode
|
||||
|
||||
missing = [
|
||||
(emu_name, gap) for emu_name, data in report.items()
|
||||
for gap in data["gap_details"] if gap["source"] == "missing"
|
||||
]
|
||||
if not missing:
|
||||
return
|
||||
runners: dict[str, list[tuple[str, set[str]]]] = {}
|
||||
runnable = emulator_profiles(profiles)
|
||||
for config in configs:
|
||||
platform = str(config.get("_key") or "")
|
||||
standalone = standalone_set(config, profiles)
|
||||
for emu_name in resolve_platform_cores(config, runnable):
|
||||
runners.setdefault(emu_name, []).append((platform, standalone))
|
||||
for emu_name, gap in missing:
|
||||
profile = profiles[emu_name]
|
||||
gap["platforms"] = sorted(
|
||||
platform for platform, standalone in runners.get(emu_name, [])
|
||||
if any(
|
||||
f.get("name") == gap["name"] and not unread_on(f, platform)
|
||||
and not installed_with_emulator(f, platform)
|
||||
for view, is_standalone in platform_layouts(emu_name, profile, standalone)
|
||||
for f in filter_files_by_mode(view.get("files") or [], is_standalone)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
+7
-47
@@ -11,9 +11,7 @@ from core.hashing import declared_hash_lists
|
||||
from core.text import series
|
||||
from model.database import sha1_at
|
||||
from model.platforms import native_layer
|
||||
from model.profiles import is_emulator
|
||||
from packs.crossref import gap_source_counts, whole_tree_gaps
|
||||
from resolve.cores import resolve_platform_cores
|
||||
from resolve.nativemode import check_label
|
||||
from resolve.sendable import sendable
|
||||
from sitegen import markup, wanted as sitewanted
|
||||
@@ -369,25 +367,6 @@ PER_EMULATOR_STEM = "gaps-per-emulator"
|
||||
NOT_COLLECTED_STEM = "gaps-not-collected"
|
||||
|
||||
|
||||
def reading_platforms(emu_name: str, profiles: dict[str, dict], name: str,
|
||||
configs: dict[str, dict]) -> set[str]:
|
||||
"""Of the platforms running an emulator (name -> config), those whose
|
||||
build of it reads the entry: BlastEm's cdbios.bin is read by the
|
||||
standalone build only, and RetroBat hands that build other names.
|
||||
*profiles* is every profile of the run, the emulator's among them."""
|
||||
from resolve.standalone import platform_layouts, standalone_set
|
||||
from resolve.validation import filter_files_by_mode, unread_on
|
||||
|
||||
profile = profiles[emu_name]
|
||||
return {
|
||||
platform for platform, config in configs.items()
|
||||
if any(f.get("name") == name and not unread_on(f, platform)
|
||||
for view, standalone in platform_layouts(
|
||||
emu_name, profile, standalone_set(config, profiles))
|
||||
for f in filter_files_by_mode(view.get("files") or [], standalone))
|
||||
}
|
||||
|
||||
|
||||
@dataclass
|
||||
class _VerifyTally:
|
||||
"""Verify results aggregated across all platforms."""
|
||||
@@ -526,22 +505,6 @@ def _divergence_rows(
|
||||
return div_rows
|
||||
|
||||
|
||||
def _emulator_platforms(profiles: dict, coverages: dict) -> dict[str, set[str]]:
|
||||
"""Each emulator with the platforms that run it."""
|
||||
emu_to_platforms: dict[str, set[str]] = {}
|
||||
unique_profiles = {
|
||||
k: v
|
||||
for k, v in profiles.items()
|
||||
if is_emulator(v)
|
||||
}
|
||||
for pname in coverages:
|
||||
config = coverages[pname]["config"]
|
||||
matched = resolve_platform_cores(config, unique_profiles)
|
||||
for emu_name in matched:
|
||||
emu_to_platforms.setdefault(emu_name, set()).add(pname)
|
||||
return emu_to_platforms
|
||||
|
||||
|
||||
@dataclass
|
||||
class _MissingFiles:
|
||||
"""The files to find, one row each, and the entries they come from."""
|
||||
@@ -581,12 +544,14 @@ def _missing_files(emulator_gaps: list[tuple[str, dict]]) -> _MissingFiles:
|
||||
"emu_keys": [emu_name],
|
||||
"required": g["required"],
|
||||
"source_ref": g["source_ref"],
|
||||
"platforms": set(g.get("platforms") or ()),
|
||||
}
|
||||
found.rows.append(row)
|
||||
elif emu_name not in row["emu_keys"]:
|
||||
row["emulators"].append(data["emulator"])
|
||||
row["emu_keys"].append(emu_name)
|
||||
row["required"] = row["required"] or g["required"]
|
||||
row["platforms"].update(g.get("platforms") or ())
|
||||
return found
|
||||
|
||||
|
||||
@@ -601,14 +566,10 @@ class SourceListing:
|
||||
placer: sitewanted.Placer | None = None
|
||||
|
||||
|
||||
def _source_row(m: dict, profiles: dict, coverages: dict,
|
||||
emu_to_platforms: dict[str, set[str]], placer: sitewanted.Placer | None) -> str:
|
||||
"""The row of one file to source."""
|
||||
plats = sorted(set().union(
|
||||
*(reading_platforms(key, profiles, m["name"], {
|
||||
p: coverages[p]["config"] for p in emu_to_platforms.get(key, set())
|
||||
}) for key in m["emu_keys"])
|
||||
))
|
||||
def _source_row(m: dict, profiles: dict, placer: sitewanted.Placer | None) -> str:
|
||||
"""The row of one file to source, with the platforms the gap report
|
||||
found needing it."""
|
||||
plats = sorted(m["platforms"])
|
||||
plat_badges = (
|
||||
" ".join(
|
||||
f'<span class="rb-badge rb-badge-info">{p}</span>'
|
||||
@@ -1004,12 +965,11 @@ def generate_gap_analysis(
|
||||
lines.extend(_complement_intro(src_totals, total_undeclared, emulator_gaps,
|
||||
listing.moved))
|
||||
# List truly missing files with platform impact
|
||||
emu_to_platforms = _emulator_platforms(profiles, coverages)
|
||||
missing = _missing_files(emulator_gaps)
|
||||
if missing.rows:
|
||||
counted = _source_counted(missing)
|
||||
rows = [
|
||||
_source_row(m, profiles, coverages, emu_to_platforms, listing.placer)
|
||||
_source_row(m, profiles, listing.placer)
|
||||
for m in sorted(missing.rows, key=lambda x: (not x["required"], x["name"]))
|
||||
]
|
||||
lines.extend(["### Files to source", "", counted,
|
||||
|
||||
Reference in new issue
Block a user