summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2019-10-02 10:36:53 -0400
committerLevente Polyak <anthraxx@archlinux.org>2019-11-07 21:28:19 +0100
commit00671765296ad598f392df7a542dbfca48a6e7b7 (patch)
tree6948dd989107e66d9f03c13695b52a055a074484
parent75d23eec942e7160108ee194894b6b83ed3045d5 (diff)
downloaddevtools32-00671765296ad598f392df7a542dbfca48a6e7b7.tar.xz
arch-nspawn: restore cachedir handling for host_mirrors
In commit 27ff286ee78eb2faac803e3ef67f3171ddfa0098, we moved from sourcing the primary cachedir via /etc/pacman.conf, to using the pacman.conf in the workdir. One unanticipated side effect of this was breaking the special host mirrors magic we used to turn a host mirror into a cachedir. It was still processed as a server, but we relied on it being in the host's cachedirs in order to be persisted, and this no longer occurred. Solve this by explicitly adding each host mirror root as a cachedir. Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
-rw-r--r--arch-nspawn.in7
1 files changed, 7 insertions, 0 deletions
diff --git a/arch-nspawn.in b/arch-nspawn.in
index 5817143..90fe967 100644
--- a/arch-nspawn.in
+++ b/arch-nspawn.in
@@ -99,7 +99,14 @@ build_mount_args() {
copy_hostconf () {
unshare --fork --pid gpg --homedir "$working_dir"/etc/pacman.d/gnupg/ --no-permission-warning --quiet --batch --import --import-options import-local-sigs "$(pacman-conf GpgDir)"/pubring.gpg >/dev/null 2>&1
pacman-key --gpgdir "$working_dir"/etc/pacman.d/gnupg/ --import-trustdb "$(pacman-conf GpgDir)" >/dev/null 2>&1
+
printf 'Server = %s\n' "${host_mirrors[@]}" >"$working_dir/etc/pacman.d/mirrorlist"
+ for host_mirror in "${host_mirrors[@]}"; do
+ if [[ $host_mirror == *file://* ]]; then
+ host_mirror=$(echo "$host_mirror" | sed -r 's#file://(/.*)/\$repo/os/\$arch#\1#g')
+ in_array "$host_mirror" "${cache_dirs[@]}" || cache_dirs+=("$host_mirror")
+ fi
+ done
[[ -n $pac_conf ]] && cp "$pac_conf" "$working_dir/etc/pacman.conf"
[[ -n $makepkg_conf ]] && cp "$makepkg_conf" "$working_dir/etc/makepkg.conf"