refactor: read pipeline output with shared walkers

The four generate_pack parsers walk the lines under a full pack's header
through one generator, and the two verify parsers the lines under a
summary through another. The three offline comparisons hold the policy
through resolve.packfiles.offline() and read their inputs from one
setup function; platformpack is imported once.
This commit is contained in:
Abdessamad Derraz committed 2026-11-21 06:04:31 +01:00
1 parent 96539e353c
commit e636614ae3
2 files changed
+105 -123

No files matched your search

+13
View File
@@ -6,11 +6,13 @@ and the offline switch that forbids reaching for the network."""
from __future__ import annotations
import contextlib
import hashlib
import os
import re
import urllib.error
import urllib.request
from collections.abc import Iterator
from pathlib import Path
from model.database import record_at, record_for_hash
@@ -32,6 +34,17 @@ def set_offline(value: bool) -> None:
OFFLINE = value
@contextlib.contextmanager
def offline() -> Iterator[None]:
"""The run offline for the length of a block, the previous policy restored after."""
was_offline = OFFLINE
set_offline(True)
try:
yield
finally:
set_offline(was_offline)
def scratch_dir() -> str:
"""The repository's tmp/, never the system /tmp (a 4 GB tmpfs on WSL)."""
path = REPO_ROOT / "tmp"