refactor: read tree members the build recorded

This commit is contained in:
Abdessamad Derraz committed 2026-11-23 21:02:47 +01:00
1 parent e4845ea446
commit 9491c02887
8 files changed
+42 -79

No files matched your search

+1 -29
View File
@@ -1,38 +1,10 @@
"""What the step 5 comparisons share: the inputs they read, the members set aside, the difference lines."""
"""What the step 5 comparisons share: the inputs they read and the difference lines."""
from __future__ import annotations
import os
from core.paths import EMULATORS_DIR
from model.registry import load_data_dir_registry
def tree_members(
platform: str, platforms_dir: str, emulators_dir: str = EMULATORS_DIR,
) -> dict[str, int]:
"""Archive path -> size of every file the platform's data trees can add."""
from packs import datatrees
from model.profiles import installed_data_refs_in, load_emulator_profiles
from model.platforms import load_platform_config
from packs.archive import Placed
from packs.paths import flat_arcname
config = load_platform_config(platform, platforms_dir)
base_dest = config.get("base_destination", "")
registry = load_data_dir_registry(platforms_dir)
profiles = load_emulator_profiles(emulators_dir)
core_trees = datatrees.core_data_trees(config, profiles, platform, registry)
members: dict[str, int] = {}
for src, full in datatrees.data_directory_members(
config.get("systems", {}), registry,
platform, base_dest, Placed(False),
core_trees=core_trees, installed=installed_data_refs_in(platform, profiles),
):
members[flat_arcname(full, base_dest, True)] = os.path.getsize(src)
return members
def set_difference_lines(label: str, credited: set[str], written: set[str]) -> list[str]:
"""The paths one side has and the other lacks, ten of each at most."""
lines = []