Give cold Flatpak caches a separate bounded fill budget

This commit is contained in:
Pavel Isaev 2026-11-06 22:09:14 +03:00
parent a3db8ed183
commit b95294bfcd
3 changed files with 24 additions and 5 deletions

View file

@ -4,6 +4,16 @@ The driver accepts `variants: ["core", "gnome", "kde"]`; omitting it preserves t
two-variant cycle. Set `kde_flatpak_cache` to `/opt/archipelago/cache/flatpak/kde`.
The persistent GNOME cache remains at its existing path. Each cache refresh uses
its own policy and permits fallback only to a checksum-verified identical policy.
Cold caches have a separate bounded `flatpak_initial_fill_seconds` budget (7200
seconds by default); warm-cache refresh keeps its 1800-second budget. Interrupted
downloads remain in the dedicated installation for the next normal run.
First attempt `20261106T183225Z` compiled the updated Rust CLI and refreshed GNOME,
then exhausted the former shared 1800-second limit during the initial KDE runtime
download (`org.kde.Platform.Locale/6.10`). No KDE image/plugin or publication was
produced. The four completed Freedesktop runtime refs and approximately 1.2 GiB of
installation data were retained. This motivated the separate cold-cache budget;
successful initial fill still needs evidence from the next normal cycle.
The source freeze includes both native software adapters. Discover's adapter is
built in an ephemeral Arch environment from the checksummed 6.8.2 source archive;

View file

@ -8,6 +8,9 @@ packages=$4
refresh_seconds=${5:-1800}
variant=${6:-gnome}
[[ $variant == gnome || $variant == kde ]]
initial_seconds=${7:-7200}
[[ $refresh_seconds =~ ^[0-9]+$ && $initial_seconds =~ ^[0-9]+$ ]]
(( refresh_seconds > 0 && initial_seconds >= refresh_seconds ))
mkdir -p "$cache" "$packages"
exec 9>"$cache/refresh.lock"
flock -n 9
@ -34,7 +37,10 @@ if [[ -f $cache/current/SHA256SUMS ]]; then
cached=(--bind-ro="$cache/current:/cached-seed")
fi
result=0
timeout --signal=TERM --kill-after=60 "$refresh_seconds" \
timeout_seconds=$refresh_seconds
if [[ ! -f $cache/current/SHA256SUMS ]]; then timeout_seconds=$initial_seconds; fi
printf 'Flatpak %s: bounded %ss %s\n' "$variant" "$timeout_seconds" "$(if [[ -f $cache/current/SHA256SUMS ]]; then echo refresh; else echo initial-fill; fi)"
timeout --signal=TERM --kill-after=60 "$timeout_seconds" \
systemd-nspawn --quiet --ephemeral --register=no --settings=no \
--machine="archipelago-flatpak-$stamp" -D "$cache/tools/root.x86_64" \
--bind-ro="$source_root/builder/adapters/prepare-flatpak-seed.sh:/prepare.sh" \

View file

@ -206,10 +206,13 @@ find {remote_root}/probes -type f -name '*.py' -exec sha256sum {{}} + >> {remote
remote(f'test "$(df -PB1 {remote_root} | awk \'NR==2 {{print $4}}\')" -ge {config.get("minimum_build_free_bytes", 45000000000)}')
phase('updating-flatpak-cache')
refresh = int(config.get('flatpak_refresh_seconds', 1800))
initial_fill = int(config.get('flatpak_initial_fill_seconds', 7200))
if refresh <= 0 or initial_fill < refresh:
raise ValueError('Initial Flatpak fill timeout must be at least the positive refresh timeout')
remote(shlex.join(['bash', remote_root + '/source/src/infrastructure/pipeline/flatpak-cache.sh',
remote_root + '/source/src', config['flatpak_cache'], config['bootstrap'],
config['build_environment']['ARCHIPELAGO_PACKAGE_CACHE'], str(refresh)]) +
' > ' + shlex.quote(remote_root + '/flatpak.log') + ' 2>&1', refresh + 600)
config['build_environment']['ARCHIPELAGO_PACKAGE_CACHE'], str(refresh), 'gnome', str(initial_fill)]) +
' > ' + shlex.quote(remote_root + '/flatpak.log') + ' 2>&1', initial_fill + 600)
call(['rsync', '-a', f"{worker}:{config['flatpak_cache']}/status.json", str(run / 'flatpak-status.json')])
state['flatpak'] = json.loads((run / 'flatpak-status.json').read_text())
if 'kde' in desktops:
@ -219,8 +222,8 @@ find {remote_root}/probes -type f -name '*.py' -exec sha256sum {{}} + >> {remote
raise ValueError('KDE must use a separate Flatpak cache')
remote(shlex.join(['bash', remote_root + '/source/src/infrastructure/pipeline/flatpak-cache.sh',
remote_root + '/source/src', kde_cache, config['bootstrap'],
config['build_environment']['ARCHIPELAGO_PACKAGE_CACHE'], str(refresh), 'kde']) +
' > ' + shlex.quote(remote_root + '/flatpak-kde.log') + ' 2>&1', refresh + 600)
config['build_environment']['ARCHIPELAGO_PACKAGE_CACHE'], str(refresh), 'kde', str(initial_fill)]) +
' > ' + shlex.quote(remote_root + '/flatpak-kde.log') + ' 2>&1', initial_fill + 600)
call(['rsync', '-a', f'{worker}:{kde_cache}/status.json', str(run / 'flatpak-kde-status.json')])
state['flatpak_kde'] = json.loads((run / 'flatpak-kde-status.json').read_text())
if args.existing: