refactor: read the large-file cache from one place

This commit is contained in:
Abdessamad Derraz committed 2026-11-24 02:19:04 +01:00
1 parent afa1e88457
commit b350c21329
3 files changed
+6 -4

No files matched your search

+2 -1
View File
@@ -16,6 +16,7 @@ from core.sizes import size_text
from model.composition import composition_tier
from model.registry import data_dir_registry_at
from model.largefiles import (
LARGE_FILES_CACHE,
LARGE_FILES_RELEASE,
LARGE_FILES_REPO,
RELEASE_DOWNLOAD,
@@ -248,7 +249,7 @@ def registry_bundles(registry_path: str = DATA_DIRS_FILE) -> dict[str, str]:
return bundles
def cache_hashes(names: set[str], cache_dir: str = ".cache/large") -> dict[str, str]:
def cache_hashes(names: set[str], cache_dir: str = LARGE_FILES_CACHE) -> dict[str, str]:
"""SHA1 of the cached copy of each named asset that the cache holds."""
hashes: dict[str, str] = {}
for name in names:
+2 -1
View File
@@ -22,13 +22,14 @@ import sys
from pathlib import Path
from core.cli import add_repo_inputs
from model.largefiles import LARGE_FILES_CACHE
from release.restore import restore
def main() -> None:
parser = argparse.ArgumentParser(allow_abbrev=False, description=__doc__)
parser.add_argument(
"--cache", default=".cache/large",
"--cache", default=LARGE_FILES_CACHE,
help="where release assets are cached (default: %(default)s)",
)
add_repo_inputs(parser, "db")
+2 -2
View File
@@ -78,10 +78,10 @@ def _hardlink_tree(src: Path, dst: Path) -> None:
def seed_worktree(repo: Path, worktree: Path) -> list[str]:
"""Hard-link what git does not carry: a tool deleting a file drops a link."""
from model.largefiles import load_registered_paths
from model.largefiles import LARGE_FILES_CACHE, load_registered_paths
seeded = []
for rel in [".cache/large", "data", *load_registered_paths(repo / ".gitignore")]:
for rel in [LARGE_FILES_CACHE, "data", *load_registered_paths(repo / ".gitignore")]:
src, dst = repo / rel, worktree / rel
if src.exists() and not dst.exists():
_hardlink_tree(src, dst)