fix: hold the repository for source-paths.json

This commit is contained in:
Abdessamad Derraz committed 2026-11-21 06:02:11 +01:00
1 parent bdfdb608e0
commit 30113783c9
4 files changed
+52 -21

No files matched your search

+11 -11
View File
@@ -647,23 +647,23 @@ def _refresh_source_paths(args: argparse.Namespace) -> None:
return
from model.profiles import emulator_profiles_cache
from sitegen import sources
from core.artifacts import write_if_changed
from core.artifacts import ArtifactLockBusy
# The run loaded the profiles before writing them, and the loader caches
# by directory: read again, the record described the pins just replaced
# (linapple, then ten profiles in one advance).
emulator_profiles_cache.clear()
profiles = load_emulator_profiles(args.emulators_dir, skip_aliases=False)
held, unread = sources.build_source_paths(
profiles, [sources.TREE_CACHE], fetch=True
)
held = sources.keep_unread(
held, unread, sources.read_record(sources.SOURCE_PATHS)
)
sources.SOURCE_PATHS.parent.mkdir(parents=True, exist_ok=True)
write_if_changed(
str(sources.SOURCE_PATHS), json.dumps(held, indent=1, sort_keys=True) + "\n"
)
try:
held, unread = sources.refresh_record(profiles, [sources.TREE_CACHE], fetch=True)
except ArtifactLockBusy as exc:
# The profiles are written: only the record waits for the other run.
print(
f"source paths not refreshed ({exc}): run python scripts/sitesources.py "
"--fetch once it finishes",
file=sys.stderr,
)
return
print(
f"source paths: {sum(map(len, held.values()))} in {len(held)} trees, "
f"{len(unread)} trees not cached: {sources.SOURCE_PATHS}",