refactor: one installed-everywhere rule for needs

This commit is contained in:
Abdessamad Derraz committed 2026-11-24 00:20:03 +01:00
1 parent 4185ad79ca
commit 38f81892ee
3 files changed
+11 -2

No files matched your search

+2 -1
View File
@@ -13,6 +13,7 @@ from core.hashing import parse_hash_list
from core.paths import REPO_ROOT
from core.ziptools import is_archive_path, zip_members
from resolve.content import size_fits
from resolve.validation import installed_everywhere
HASH_FIELDS = ("sha1", "md5", "sha256")
@@ -67,7 +68,7 @@ def profile_needs(profiles: dict, db: dict) -> dict:
continue
# Installed with the emulator, so not an acquisition target,
# unless a platform package leaves it out.
if entry.get("bundled") and not entry.get("not_bundled_on"):
if installed_everywhere(entry):
continue
need = {"emulator": emulator, "name": name,
"required": bool(entry.get("required"))}
+2 -1
View File
@@ -10,6 +10,7 @@ from model.platforms import load_platform_config
from model.registry import list_registered_platforms
from packs.consumers import FileConsumers
from resolve.directories import expand_directory_entries
from resolve.validation import installed_everywhere
def _entries(profile: dict, db: dict) -> list[dict]:
@@ -52,7 +53,7 @@ def bundled_only(db: dict, profiles: dict, platforms_dir: str, install_dir: Path
# A platform whose package leaves the file out (not_bundled_on:
# AmberELEC's amiberry 7.1.1 has no AROS ROMs) brings it from
# the collection.
if entry.get("bundled") and not entry.get("not_bundled_on"):
if installed_everywhere(entry):
bundled.setdefault(sha1, set()).add(emulator)
else:
needed.add(sha1)
+7
View File
@@ -5629,6 +5629,7 @@ class BundledFilesAreNotToSource(unittest.TestCase):
def test_a_view_naming_no_setup_keeps_what_one_package_leaves_out(self):
"""touchHLE panics without its fonts on ROCKNIX: the emulator page,
the global gap report and the wanted list all still ask for them."""
from acquire.provenance import profile_needs
from packs.crossref import cross_reference
from resolve.validation import installed_everywhere
from sitegen.install import comes_with_app
@@ -5642,6 +5643,12 @@ class BundledFilesAreNotToSource(unittest.TestCase):
"systems": ["apple-ios"], "files": [font]}}
report = cross_reference(profiles, {}, {"files": {}, "indexes": {}})
self.assertFalse(report["touchhle"]["gap_details"][0]["bundled"])
sized = {**font, "size": 312132}
needs = profile_needs({"touchhle": {"files": [sized]}}, {"files": {}, "indexes": {}})
self.assertIn("liberationmono-regular.ttf", needs["by_name"])
everywhere = {**sized, "not_bundled_on": []}
needs = profile_needs({"touchhle": {"files": [everywhere]}}, {"files": {}, "indexes": {}})
self.assertEqual(needs["by_name"], {})
def test_every_platform_named_is_registered(self):
from model.registry import list_registered_platforms