Bind the locale cache into the build container

The cache path was computed from a host-only variable inside the nspawn,
where it is unset (set -u aborted the Core build). Define it in the outer
script and expose it as /archipelago-locale-cache.
This commit is contained in:
Archipelago 2026-11-13 16:12:49 +03:00
parent ff2366952c
commit 6eaab1f163

View file

@ -31,6 +31,10 @@ if [[ $(stat -f -c %T "$work") == zfs ]]; then
work="$outer/workspace"
fi
cache=$(realpath -m "${ARCHIPELAGO_PACKAGE_CACHE:-$outer/package-cache}")
# Generated locale archive is a pure function of glibc + locale.gen; keep it
# next to the package cache and bind it into the build container.
locale_cache=${ARCHIPELAGO_LOCALE_CACHE:-$(dirname "$cache")/locale-archive}
mkdir -p "$locale_cache"
[[ $cache != *:* && $cache != *','* ]]
mkdir -p "$cache"
printf '%s %s\n' 655bc99849b80859173fa39338a6c910185e952173f6a1a61526cfa34ab8339c "$archive" | sha256sum -c -
@ -206,14 +210,12 @@ sed -i -E 's/^#[[:space:]]*([a-z][a-z][a-z]?_[A-Z][A-Z][^[:space:]]*[[:space:]]+
# cache it across builds; any change to either invalidates the key.
locale_key=$( { arch-chroot /job/core pacman -Q glibc; sha256sum /job/core/etc/locale.gen; } |
sha256sum | cut -d' ' -f1 )
locale_cache=${ARCHIPELAGO_LOCALE_CACHE:-$(dirname "$cache")/locale-archive}
mkdir -p "$locale_cache"
if [[ -f $locale_cache/$locale_key ]]; then
install -Dm0644 "$locale_cache/$locale_key" /job/core/usr/lib/locale/locale-archive
if [[ -f /archipelago-locale-cache/$locale_key ]]; then
install -Dm0644 "/archipelago-locale-cache/$locale_key" /job/core/usr/lib/locale/locale-archive
printf 'reused cached locale archive %s\n' "$locale_key" > /job/evidence/locales.log
else
arch-chroot /job/core locale-gen > /job/evidence/locales.log 2>&1
install -Dm0644 /job/core/usr/lib/locale/locale-archive "$locale_cache/$locale_key"
install -Dm0644 /job/core/usr/lib/locale/locale-archive "/archipelago-locale-cache/$locale_key"
fi
arch-chroot /job/core locale -a > /job/evidence/locales.txt
if [[ $ARCHIPELAGO_BUILD_PROFILE == gnome-probe ]]; then
@ -387,7 +389,8 @@ cd /job/output
sha256sum "$output_name" > SHA256SUMS
BUILD
systemd-nspawn --machine="archipelago-build-$$" --settings=no --register=no --resolv-conf=replace-host --capability=CAP_SYS_ADMIN,CAP_MKNOD \
-D "$toolroot" --bind="$work:/job" --bind="$cache:/var/cache/pacman/pkg" "${core_bind[@]}" /usr/bin/bash /job/build-in-container.sh 2>&1 | tee "$outer/build.log"
-D "$toolroot" --bind="$work:/job" --bind="$cache:/var/cache/pacman/pkg" \
--bind="$locale_cache:/archipelago-locale-cache" "${core_bind[@]}" /usr/bin/bash /job/build-in-container.sh 2>&1 | tee "$outer/build.log"
if [[ $outer != "$work" ]]; then
cp -a "$work/output" "$outer/output"
cp -a "$work/evidence" "$outer/evidence"