[arch-projects] [devtools] [PATCH] arch-nspawn: rely on deduplication to avoid making multiple host_mirror mounts
Instead of comparing exact mirror urls to see if they are in host_mirrors in order to "skip" the official mirrors, simply trim the expected .../os/... pattern match. We already filter duplicate cachedirs. Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> --- I wasn't sure of the precise utility of this, but in addition to being a bit simpler, it seems to work around the case of https://github.com/archlinux/devtools/issues/14 (Even though I don't really understand why anyone is using '$repo/os/$arch' for their own Server urls.) arch-nspawn.in | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/arch-nspawn.in b/arch-nspawn.in index 7aa6fd6..198d227 100644 --- a/arch-nspawn.in +++ b/arch-nspawn.in @@ -75,15 +75,13 @@ done while read -r line; do mapfile -t lines < <($pacconf_cmd --config "${pac_conf:-$working_dir/etc/pacman.conf}" \ - --repo $line Server | sed -r 's#(.*/)[^/]+/os/.+#\1$repo/os/$arch#') - if [[ ${lines[0]} != ${host_mirrors[0]} ]]; then - for line in "${lines[@]}"; do - if [[ $line = file://* ]]; then - line=${line#file://} - in_array "$line" "${cache_dirs[@]}" || cache_dirs+=("$line") - fi - done - fi + --repo $line Server | sed -r 's#(.*/)[^/]+/os/.+#\1#') + for line in "${lines[@]}"; do + if [[ $line = file://* ]]; then + line=${line#file://} + in_array "$line" "${cache_dirs[@]}" || cache_dirs+=("$line") + fi + done done < <($pacconf_cmd --config "${pac_conf:-$working_dir/etc/pacman.conf}" --repo-list) mount_args+=("--bind=${cache_dirs[0]//:/\\:}") -- 2.24.0
participants (1)
-
Eli Schwartz