feat: packs leave out what the emulator installs

A file or tree installed with the emulator is already on the user's machine, so packs, install manifests and verify's pack count leave it out. bundled is scoped by mode like any entry: Dolphin's Sys and PPSSPP's assets ship with the standalone releases, not with the libretro cores, so they now follow the libretro build only and still reach RetroArch packs. PrimeHack, standalone only, ships its own Sys.
This commit is contained in:
Abdessamad Derraz committed 2026-10-20 06:04:10 +02:00
1 parent c589ed49b8
commit ddc7432825
10 files changed
+69 -6

No files matched your search

+1
View File
@@ -27,6 +27,7 @@ pack_structure:
data_directories:
- ref: dolphin-sys
mode: libretro
destination: "Sys"
source_ref: "Source/Core/Common/CommonPaths.h:128-141"
+1
View File
@@ -25,6 +25,7 @@ pack_structure:
data_directories:
- ref: dolphin-sys
mode: libretro
destination: "Sys"
source_ref: "Source/Core/Common/CommonPaths.h:130-131"
+1
View File
@@ -16,6 +16,7 @@ pack_structure:
data_directories:
- ref: ppsspp-assets
mode: libretro
destination: ""
source_ref: "libretro/libretro.cpp:537,549"
+1
View File
@@ -25,6 +25,7 @@ pack_structure:
data_directories:
- ref: dolphin-sys
bundled: true
destination: "Sys"
source_ref: "Source/Core/Common/CommonPaths.h:128-141"
+6 -1
View File
@@ -272,6 +272,10 @@
"both"
]
},
"bundled": {
"type": "boolean",
"description": "Installed with the emulator for the build mode names, so packs leave the tree out."
},
"source_ref": {
"type": "string"
}
@@ -443,7 +447,8 @@
"type": "boolean"
},
"bundled": {
"type": "boolean"
"type": "boolean",
"description": "Installed with the emulator for the build mode names (all builds when mode is absent): already on the user's machine, so packs and install manifests leave it out."
},
"config_key": {
"type": "string"
+3 -2
View File
@@ -91,6 +91,7 @@ from validation import (
validated_choice,
agnostic_substitute,
_build_validation_index,
deliverable,
filter_files_by_mode,
)
@@ -1449,7 +1450,7 @@ def generate_emulator_pack(
pack_structure = profile.get("pack_structure")
files = expand_agnostic_entries(
expand_directory_entries(
filter_files_by_mode(profile.get("files", []), standalone),
deliverable(profile.get("files", []), standalone),
db,
standalone,
),
@@ -1675,7 +1676,7 @@ def generate_emulator_pack(
# profile declares wins over the copy a tree bundles at the same
# path (Dolphin's real dsp_rom.bin over Sys/GC's free one).
# A tree only one build reads follows that build, like a file.
for dd in filter_files_by_mode(
for dd in deliverable(
profile.get("data_directories", []), standalone
):
ref_key = dd.get("ref", "")
+5
View File
@@ -875,6 +875,11 @@ def _collect_emulator_extras(
for destination in seen:
taken[destination] = baseline_claims.setdefault(destination, {})
for u in undeclared:
if u.get("bundled"):
# Installed with the emulator for this build: already on the
# user's machine. The mode a file is bundled for was settled
# upstream, an entry scoped to another build never gets here.
continue
if not u["in_repo"] and absent is None:
continue
# For archive entries, use the archive name for resolution
+11
View File
@@ -525,6 +525,17 @@ def filter_files_by_mode(files: list[dict], standalone: bool) -> list[dict]:
return result
def deliverable(entries: list[dict], standalone: bool) -> list[dict]:
"""The entries of one build a pack has to bring.
A file or tree installed with the emulator is already on the user's
machine: shipping it again only weighs the pack. `bundled` is scoped by
`mode` like any entry, so PPSSPP's assets, shipped by the standalone
release and not by the libretro core, still reach a RetroArch pack.
"""
return [e for e in filter_files_by_mode(entries, standalone) if not e.get("bundled")]
def find_validated_variant(
file_entry: dict,
db: dict,
+10 -3
View File
@@ -94,6 +94,7 @@ from validation import (
_parse_validation,
build_ground_truth,
check_file_validation,
deliverable,
filter_files_by_mode,
outside_gap_scope,
)
@@ -774,6 +775,12 @@ def _mark_unplaced(config: dict, undeclared: list[dict], profiles: dict) -> None
unplaced = unplaceable_extras(config, undeclared, profiles)
for u in undeclared:
if u.get("bundled"):
# Installed with the emulator, so already on the user's machine:
# the pack leaves it out, held or not.
u["in_pack"] = False
u["omitted"] = "installed with its emulator"
continue
reason = unplaced.get(
(u.get("emulator", ""), u.get("name", ""), u.get("path") or "")
)
@@ -1713,7 +1720,7 @@ def verify_emulator(
for emu_name, profile in sorted(selected):
files = expand_agnostic_entries(
expand_directory_entries(
filter_files_by_mode(profile.get("files", []), standalone),
deliverable(profile.get("files", []), standalone),
db,
standalone,
),
@@ -1733,7 +1740,7 @@ def verify_emulator(
]
# Check data directories (only notice if not cached)
for dd in filter_files_by_mode(
for dd in deliverable(
profile.get("data_directories", []), standalone
):
ref = dd.get("ref", "")
@@ -2010,7 +2017,7 @@ def verify_emulator(
file_severity[dest] = sev
# The profile's data trees follow its files in the pack.
for dd in filter_files_by_mode(profile.get("data_directories", []), standalone):
for dd in deliverable(profile.get("data_directories", []), standalone):
cache = (data_registry or {}).get(dd.get("ref", ""), {}).get("local_cache", "")
if not cache or not os.path.isdir(cache):
continue
+30
View File
@@ -4553,6 +4553,36 @@ class BundledFilesAreNotToSource(unittest.TestCase):
}})
self.assertEqual([row["status"] for row in rows], ["bundled"])
def test_a_held_bundled_file_is_not_packed(self):
"""A file installed with the emulator is already on the user's
machine, so the pack leaves it out even when the collection holds it."""
sys.path.insert(0, str(ROOT / "scripts"))
import verify
entry = {"name": "n64.psh", "required": True, "in_repo": True,
"emulator": "daedalusx64", "category": "bios", "bundled": True}
with mock.patch("packextras.unplaceable_extras", return_value={}):
verify._mark_unplaced({}, [entry], {})
self.assertFalse(entry["in_pack"])
self.assertIn("installed with its emulator", entry["omitted"])
def test_a_build_scope_keeps_it_for_the_other_build(self):
"""PPSSPP's standalone release ships assets/, its libretro core does
not: bundled for one build, the entry still reaches a core's pack."""
sys.path.insert(0, str(ROOT / "scripts"))
from validation import deliverable
entries = [{"ref": "ppsspp-assets", "mode": "libretro"},
{"name": "a.bin", "bundled": True, "mode": "standalone"},
{"name": "b.bin", "bundled": True}]
self.assertEqual([e.get("ref") or e["name"] for e in deliverable(entries, False)],
["ppsspp-assets"])
self.assertEqual(deliverable(entries, True), [])
def test_the_pack_builder_skips_it(self):
source = (ROOT / "scripts" / "packextras.py").read_text(encoding="utf-8")
self.assertIn('if u.get("bundled"):', source)
class AdlerValuesReadLikeTheDownloads(unittest.TestCase):