fix: resolve profile entries with their owner

This commit is contained in:
Abdessamad Derraz committed 2026-10-10 07:38:33 +02:00
1 parent 8a661932f2
commit af7b3133a4
4 files changed
+80 -5

No files matched your search

+10 -3
View File
@@ -242,10 +242,17 @@ class FileConsumers:
self.platforms: dict[str, set[str]] = {}
self.emulators: dict[str, set[str]] = {}
def sha1_of(self, entry: dict, dest: str = "") -> str | None:
"""The collected file an entry resolves to, or None."""
def sha1_of(self, entry: dict, dest: str = "", owner: str = "") -> str | None:
"""The collected file an entry resolves to, or None.
A profile entry names its owner, as the builder does: without it the
name step chose another tree's copy, and the page credited the file
the pack does not ship.
"""
if not entry.get("name"):
return None
if owner:
entry = {**entry, "source_profile": owner}
path, status = resolve_local_file(
entry, self._db, self._zip_contents, dest_hint=dest
)
@@ -266,7 +273,7 @@ class FileConsumers:
if profile.get("type") == "alias":
continue
for entry in profile.get("files", []):
sha1 = self.sha1_of(entry, entry.get("path") or "")
sha1 = self.sha1_of(entry, entry.get("path") or "", owner=name)
if sha1:
self.emulators.setdefault(sha1, set()).add(name)
+3 -1
View File
@@ -213,7 +213,9 @@ def _agnostic_scan_extras(
if not isinstance(candidate, dict):
continue
local, status = resolve_local_file(
candidate, db, dest_hint=candidate.get("path", "")
{**candidate, "source_profile": emu_name},
db,
dest_hint=candidate.get("path", ""),
)
if not local or "/" not in local:
continue
+2 -1
View File
@@ -175,8 +175,9 @@ def profile_claims(
if not dest:
continue
full = f"{base_dest}/{dest}" if base_dest else dest
# The owner's own copy is the one the builder ships.
local, status = resolve_local_file(
entry,
{**entry, "source_profile": emu_name},
db,
zip_contents,
dest_hint=dest,