mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-24 10:37:54 -06:00
fix: site reads core file counts from verify
compute_coverage recounted the gap entries: one per entry, not one per pack path, with held-but-unplaced and bundled files counted missing. RetroArch read 7956 packed and 419 missing where verify says 7977 and 66. packs/shares.py holds the split both now read.
This commit is contained in:
1 parent
d1b0c77039
commit
2f9cfc8e8d
12 files changed
+168
-94
No files matched your search
+9
-66
@@ -5,6 +5,7 @@ from __future__ import annotations
|
||||
from collections import Counter
|
||||
|
||||
from core.text import count_text
|
||||
from packs.shares import core_shares
|
||||
from packs.verdicts import Severity, Status
|
||||
from resolve.categories import BIOS
|
||||
from resolve.nativemode import reads_file_contents
|
||||
@@ -229,53 +230,6 @@ def _print_undeclared_entry(
|
||||
print(f" validates {'+'.join(checks)}")
|
||||
|
||||
|
||||
def split_undeclared(undeclared: list[dict]) -> tuple[list[dict], list[dict], list[dict]]:
|
||||
"""Game data, firmware the pack places, firmware it holds but cannot place.
|
||||
|
||||
Everything that is not game data is firmware the core loads, archives
|
||||
included: a bios_zip sat in neither list, so a required one that was
|
||||
missing was never printed.
|
||||
"""
|
||||
game_data = [u for u in undeclared if u.get("category", "bios") == "game_data"]
|
||||
firmware = [u for u in undeclared if u.get("category", "bios") != "game_data"]
|
||||
unplaced = [u for u in firmware if u["in_repo"] and not u.get("in_pack", True)]
|
||||
placed = [u for u in firmware if u.get("in_pack", True)]
|
||||
return game_data, placed, unplaced
|
||||
|
||||
|
||||
def pack_shares(result: dict) -> tuple[int, int]:
|
||||
"""The core files and the game data a platform's pack carries, by the report.
|
||||
|
||||
The builder's count, one file per pack path, when the platform pass
|
||||
replayed it. Counting entries said 1130 for RetroArch, 48 more than the
|
||||
pack holds: rom.key alone was claimed by three Amiga cores.
|
||||
"""
|
||||
packed = result.get("packed_extras")
|
||||
if packed is not None:
|
||||
return packed["bios"], packed["game_data"]
|
||||
game_data, bios_files, _unplaced = split_undeclared(result.get("undeclared_files", []))
|
||||
return (
|
||||
sum(1 for u in bios_files if u["in_repo"]),
|
||||
sum(1 for u in game_data if u["in_repo"] and u.get("in_pack", True)),
|
||||
)
|
||||
|
||||
|
||||
def core_required_missing(bios_files: list[dict]) -> list[dict]:
|
||||
"""Core files a core cannot run without, absent from the collection.
|
||||
|
||||
A file bundled with the emulator (DaedalusX64's n64.psh, the shader
|
||||
library its renderer installs beside the binary) arrives with it: the
|
||||
collection does not hold it by design, and listing it as missing sent
|
||||
readers after a file every install already has.
|
||||
"""
|
||||
return [
|
||||
u
|
||||
for u in bios_files
|
||||
if u["required"] and not u["in_repo"] and not u.get("hle_fallback")
|
||||
and not u.get("bundled")
|
||||
]
|
||||
|
||||
|
||||
def _repeated_names(entries: list[dict]) -> frozenset[str]:
|
||||
"""Names more than one of ``entries`` carries."""
|
||||
counts = Counter(u["name"] for u in entries)
|
||||
@@ -305,23 +259,12 @@ def _print_undeclared_section(result: dict, verbose: bool) -> None:
|
||||
if not undeclared and not (packed and any(packed.values())):
|
||||
return
|
||||
|
||||
game_data, bios_files, unplaced = split_undeclared(undeclared)
|
||||
|
||||
# A file installed with its emulator is never collected, firmware or
|
||||
# game data, required or not: cross_reference counts it apart. The
|
||||
# firmware already left the pack lists (_mark_unplaced), the game data
|
||||
# did not, and Abuse's three bundled data files read as missing.
|
||||
bundled = [u for u in undeclared if not u["in_repo"] and u.get("bundled")]
|
||||
game_data = [u for u in game_data if u["in_repo"] or not u.get("bundled")]
|
||||
|
||||
req_not_in_repo = core_required_missing(bios_files)
|
||||
req_hle_not_in_repo = [
|
||||
u
|
||||
for u in bios_files
|
||||
if u["required"] and not u["in_repo"] and u.get("hle_fallback")
|
||||
]
|
||||
opt_not_in_repo = [u for u in bios_files if not u["required"] and not u["in_repo"]]
|
||||
core_in_pack, gd_packed = pack_shares(result)
|
||||
shares = core_shares(result)
|
||||
bundled, unplaced, game_data = shares.bundled, shares.unplaced, shares.game_data
|
||||
req_not_in_repo = shares.required_missing
|
||||
req_hle_not_in_repo = shares.hle_missing
|
||||
opt_not_in_repo = shares.optional_missing
|
||||
core_in_pack, gd_packed = shares.in_pack, shares.game_data_packed
|
||||
core_missing_req = len(req_not_in_repo) + len(req_hle_not_in_repo)
|
||||
core_missing_opt = len(opt_not_in_repo)
|
||||
|
||||
@@ -363,8 +306,8 @@ def _print_undeclared_section(result: dict, verbose: bool) -> None:
|
||||
f"({_omission_reasons(unplaced)})")
|
||||
|
||||
if game_data or (packed and packed.get("game_data")):
|
||||
gd_missing = [u for u in game_data if not u["in_repo"]]
|
||||
gd_unplaced = [u for u in game_data if u["in_repo"] and not u.get("in_pack", True)]
|
||||
gd_missing = shares.game_data_missing
|
||||
gd_unplaced = shares.game_data_unplaced
|
||||
if gd_missing or gd_packed or gd_unplaced:
|
||||
listed = "" if verbose or not gd_missing else " (--verbose lists them)"
|
||||
print(f" Game data: {gd_packed} in pack, {len(gd_missing)} missing{listed}")
|
||||
|
||||
@@ -0,0 +1,116 @@
|
||||
"""The files a platform's cores add to its pack, placed, held or missing, as verify counts them."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
|
||||
|
||||
def split_undeclared(undeclared: list[dict]) -> tuple[list[dict], list[dict], list[dict]]:
|
||||
"""Game data, firmware the pack places, firmware it holds but cannot place.
|
||||
|
||||
Everything that is not game data is firmware the core loads, archives
|
||||
included: a bios_zip sat in neither list, so a required one that was
|
||||
missing was never printed.
|
||||
"""
|
||||
game_data = [u for u in undeclared if u.get("category", "bios") == "game_data"]
|
||||
firmware = [u for u in undeclared if u.get("category", "bios") != "game_data"]
|
||||
unplaced = [u for u in firmware if u["in_repo"] and not u.get("in_pack", True)]
|
||||
placed = [u for u in firmware if u.get("in_pack", True)]
|
||||
return game_data, placed, unplaced
|
||||
|
||||
|
||||
def pack_shares(result: dict) -> tuple[int, int]:
|
||||
"""The core files and the game data a platform's pack carries, by the report.
|
||||
|
||||
The builder's count, one file per pack path, when the platform pass
|
||||
replayed it. Counting entries said 1130 for RetroArch, 48 more than the
|
||||
pack holds: rom.key alone was claimed by three Amiga cores.
|
||||
"""
|
||||
packed = result.get("packed_extras")
|
||||
if packed is not None:
|
||||
return packed["bios"], packed["game_data"]
|
||||
game_data, bios_files, _unplaced = split_undeclared(result.get("undeclared_files", []))
|
||||
return (
|
||||
sum(1 for u in bios_files if u["in_repo"]),
|
||||
sum(1 for u in game_data if u["in_repo"] and u.get("in_pack", True)),
|
||||
)
|
||||
|
||||
|
||||
def core_required_missing(bios_files: list[dict]) -> list[dict]:
|
||||
"""Core files a core cannot run without, absent from the collection.
|
||||
|
||||
A file bundled with the emulator (DaedalusX64's n64.psh, the shader
|
||||
library its renderer installs beside the binary) arrives with it: the
|
||||
collection does not hold it by design, and listing it as missing sent
|
||||
readers after a file every install already has.
|
||||
"""
|
||||
return [
|
||||
u
|
||||
for u in bios_files
|
||||
if u["required"] and not u["in_repo"] and not u.get("hle_fallback")
|
||||
and not u.get("bundled")
|
||||
]
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class CoreShares:
|
||||
"""One platform's core files and game data, sorted the way verify reports them."""
|
||||
|
||||
in_pack: int
|
||||
required_missing: list[dict]
|
||||
hle_missing: list[dict]
|
||||
optional_missing: list[dict]
|
||||
bundled: list[dict]
|
||||
unplaced: list[dict]
|
||||
game_data: list[dict]
|
||||
game_data_packed: int
|
||||
|
||||
@property
|
||||
def game_data_missing(self) -> list[dict]:
|
||||
return [u for u in self.game_data if not u["in_repo"]]
|
||||
|
||||
@property
|
||||
def game_data_unplaced(self) -> list[dict]:
|
||||
return [u for u in self.game_data if u["in_repo"] and not u.get("in_pack", True)]
|
||||
|
||||
@property
|
||||
def packed(self) -> int:
|
||||
"""Core files and game data the pack carries."""
|
||||
return self.in_pack + self.game_data_packed
|
||||
|
||||
@property
|
||||
def missing(self) -> int:
|
||||
"""Core files and game data the collection lacks, bundled ones apart."""
|
||||
return (len(self.required_missing) + len(self.hle_missing)
|
||||
+ len(self.optional_missing) + len(self.game_data_missing))
|
||||
|
||||
@property
|
||||
def held_unplaced(self) -> int:
|
||||
"""Core files and game data held but left out of the pack."""
|
||||
return len(self.unplaced) + len(self.game_data_unplaced)
|
||||
|
||||
|
||||
def core_shares(result: dict) -> CoreShares:
|
||||
"""What a verify result says of the files its cores add to the pack."""
|
||||
undeclared = result.get("undeclared_files", [])
|
||||
game_data, bios_files, unplaced = split_undeclared(undeclared)
|
||||
# A file installed with its emulator is never collected, firmware or
|
||||
# game data, required or not: cross_reference counts it apart. The
|
||||
# firmware already left the pack lists (_mark_unplaced), the game data
|
||||
# did not, and Abuse's three bundled data files read as missing.
|
||||
bundled = [u for u in undeclared if not u["in_repo"] and u.get("bundled")]
|
||||
game_data = [u for u in game_data if u["in_repo"] or not u.get("bundled")]
|
||||
in_pack, game_data_packed = pack_shares(result)
|
||||
return CoreShares(
|
||||
in_pack=in_pack,
|
||||
required_missing=core_required_missing(bios_files),
|
||||
hle_missing=[
|
||||
u for u in bios_files
|
||||
if u["required"] and not u["in_repo"] and u.get("hle_fallback")
|
||||
],
|
||||
optional_missing=[u for u in bios_files if not u["required"] and not u["in_repo"]],
|
||||
bundled=bundled,
|
||||
unplaced=unplaced,
|
||||
game_data=game_data,
|
||||
game_data_packed=game_data_packed,
|
||||
)
|
||||
@@ -5,7 +5,7 @@ from __future__ import annotations
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
from packs.report import pack_shares
|
||||
from packs.shares import pack_shares
|
||||
from packs.verdicts import Severity, Status
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from core.text import count_text
|
||||
from packs.report import NOT_FIRMWARE, core_required_missing, discrepancy_keys, split_undeclared
|
||||
from packs.report import NOT_FIRMWARE, discrepancy_keys
|
||||
from packs.shares import core_required_missing, split_undeclared
|
||||
from packs.verdicts import Severity
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user