fix: carry each gap row's category from crossref

This commit is contained in:
Abdessamad Derraz committed 2026-11-24 03:38:59 +01:00
1 parent e21c3478b4
commit 94fbf8d386
5 files changed
+68 -24

No files matched your search

+6 -18
View File
@@ -236,7 +236,6 @@ def _emulator_export_items(profiles: dict) -> list[dict]:
def _gap_export_rows(
coverages: dict, gap_report: dict | None = None, db: dict | None = None,
profiles: dict | None = None,
) -> list[dict]:
"""Every gap the site reports, both layers, in one table.
@@ -272,10 +271,11 @@ def _gap_export_rows(
})
for emu_key, data in sorted((gap_report or {}).items()):
systems = ";".join(str(s) for s in data.get("systems", []) or [])
categories = _profile_categories((profiles or {}).get(emu_key) or {})
# The category travels on the row: its path is the destination the
# running build reads, not the profile's, and a join on it left 940
# rows without one.
rows.extend({
"category": categories.get(
(gap.get("name", ""), gap.get("path") or gap.get("name", "")), ""),
"category": gap.get("category", ""),
"collection_path": "",
"resolved_sha1": "",
"layer": "emulator",
@@ -300,8 +300,7 @@ def _gap_export_rows(
"expected": gap.get("identity", ""),
} for gap in data.get("gap_details", []) or [])
rows.extend({
"category": categories.get(
(entry.get("name", ""), entry.get("path") or entry.get("name", "")), ""),
"category": entry.get("category", ""),
"collection_path": "",
"resolved_sha1": "",
"layer": "emulator",
@@ -326,17 +325,6 @@ def _gap_export_rows(
return list(unique.values())
def _profile_categories(profile: dict) -> dict[tuple[str, str], str]:
"""(name, path) -> the category a profile gives the entry, bios by default."""
found: dict[tuple[str, str], str] = {}
for entry in profile.get("files") or []:
if isinstance(entry, dict) and entry.get("name"):
name = str(entry["name"])
found.setdefault((name, str(entry.get("path") or name)),
str(entry.get("category") or "bios"))
return found
def _cross_reference_export_rows(coverages: dict, profiles: dict) -> list[dict]:
from resolve.cores import resolve_platform_cores
@@ -640,7 +628,7 @@ def generate_data_exports(
stamp = {"commit": commit} if commit else {}
platform_items, platform_files = _platform_export_rows(coverages, db)
emulator_items = _emulator_export_items(profiles)
gap_rows = _gap_export_rows(coverages, gap_report, db, profiles)
gap_rows = _gap_export_rows(coverages, gap_report, db)
cross_rows = _cross_reference_export_rows(coverages, profiles)
members = data_directory_members()
+3 -2
View File
@@ -530,6 +530,7 @@ def _missing_files(emulator_gaps: list[tuple[str, dict]]) -> _MissingFiles:
"name": g["name"],
"path": g.get("path") or g["name"],
"identity": g.get("identity", ""),
"profile_path": g.get("profile_path", ""),
"emulators": [data["emulator"]],
"emu_keys": [emu_name],
"required": g["required"],
@@ -577,7 +578,7 @@ def _source_row(m: dict, profiles: dict, placer: sitewanted.Placer | None) -> st
for display, key in zip(m["emulators"], m["emu_keys"])
)
owner = profiles[m["emu_keys"][0]]
declared = sitewanted.gap_entries(owner, m["name"], m["identity"], False)
declared = sitewanted.gap_entries(owner, m, False)
folder = placer.folder(declared[0]) if placer and declared else ""
upload = sitewanted.upload_href(sitewanted.UPLOAD_ROOT, folder)
return (
@@ -752,7 +753,7 @@ def _not_collected_section(report_all: dict, profiles: dict, catalogued: dict |
"source_ref": u.get("source_ref", ""),
# The wanted page's own rule, on the entries behind the row.
"wanted": any(sendable(entry, str(u["reason"])) for entry in sitewanted.gap_entries(
profiles.get(emu_name) or {}, str(u["name"]), "", True)),
profiles.get(emu_name) or {}, u, True)),
}
for emu_name, data in sorted(report_all.items())
for u in data.get("unsourceable", [])
+12 -4
View File
@@ -119,10 +119,19 @@ class Held:
return False
def gap_entries(profile: dict, name: str, identity: str, unsourceable: bool) -> list[dict]:
"""The profile entries behind one row of the gap report."""
def gap_entries(profile: dict, row: dict, unsourceable: bool) -> list[dict]:
"""The profile entries behind one row of the gap report.
The row names the profile's own path (``profile_path``), which tells
apart entries of one name the code reads in two places.
"""
name = str(row.get("name", ""))
identity = str(row.get("identity") or "")
declared = str(row.get("profile_path") or "")
named = [f for f in profile.get("files") or []
if isinstance(f, dict) and f.get("name") == name]
if declared:
named = [f for f in named if str(f.get("path") or name) == declared] or named
if unsourceable:
return [f for f in named if f.get("unsourceable")] or named
if identity:
@@ -230,8 +239,7 @@ def wanted_declarations(profiles: dict, coverages: dict, gap_report: dict) -> li
rows += [(row, True) for row in data.get("unsourceable") or []]
for row, unsourceable in rows:
reason = str(row.get("reason") or "") if unsourceable else ""
for entry in gap_entries(profile, str(row.get("name", "")),
str(row.get("identity") or ""), unsourceable):
for entry in gap_entries(profile, row, unsourceable):
if not sendable(entry, reason):
continue
system = entry.get("system") or (systems[0] if len(systems) == 1 else "")