[devtools,v2] arch-nspawn: fix up host_mirrors cachedir handling

Message ID 20200211004137.2677730-1-eschwartz@archlinux.org
State Accepted
Headers show
Series [devtools,v2] arch-nspawn: fix up host_mirrors cachedir handling | expand

Commit Message

Emil Velikov via arch-projects Feb. 11, 2020, 12:41 a.m. UTC
This was incorrectly implemented in commit
00671765296ad598f392df7a542dbfca48a6e7b7, which added the host_mirrors
root directory as a cachedir, when we actually want to use the pool/*
subdirectories (the same ones installed on the build server's
/etc/pacman.conf).

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
---

v2: add paths with trailing "/", for consistency and to make sure we
only try to match directories (though no file should ever be there).

 arch-nspawn.in | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Patch

diff --git a/arch-nspawn.in b/arch-nspawn.in
index 198d227..cde1f60 100644
--- a/arch-nspawn.in
+++ b/arch-nspawn.in
@@ -69,7 +69,9 @@  host_mirrors=($($pacconf_cmd --repo extra Server 2> /dev/null | sed -r 's#(.*/)e
 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")
+		for m in "$host_mirror"/pool/*/; do
+			in_array "$m" "${cache_dirs[@]}" || cache_dirs+=("$m")
+		done
 	fi
 done