summaryrefslogtreecommitdiff
path: root/bin/build-packages
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-10-21 13:56:29 +0200
committerErich Eckner <git@eckner.net>2017-10-21 13:56:29 +0200
commitb3c8621bdadd03d74af2abcc73e297d0fe26075e (patch)
tree1f37f5f943271956083a70be38a35b5dfcbc6430 /bin/build-packages
parent2ae50268142fefdcfc11051e270c65ba34908f8e (diff)
downloadbuilder-b3c8621bdadd03d74af2abcc73e297d0fe26075e.tar.xz
bin/build-packages: try other mirrors if download of x86_64 package fails
Diffstat (limited to 'bin/build-packages')
-rwxr-xr-xbin/build-packages24
1 files changed, 20 insertions, 4 deletions
diff --git a/bin/build-packages b/bin/build-packages
index 4f2ed68..61b32a2 100755
--- a/bin/build-packages
+++ b/bin/build-packages
@@ -306,11 +306,27 @@ while [ "${count}" -ne 0 ]; do
-printf '%f\n' | \
sponge | \
while read -r pkg_file; do
- url=$(
+ {
pacman -Spdd --print-format '%l' --noconfirm "${pkg_file%-*-*-*}"
- )
- wget -q -nd "${url}" || \
- true
+ # shellcheck disable=SC2016
+ curl -Ss 'https://www.archlinux.org/mirrorlist/?country=all&protocol=https&tier=1&use_mirror_status=on' | \
+ sed -n '
+ s/^#Server = //
+ T
+ s/\$repo/'"${repository}"'/g
+ s/\$arch/x86_64/g
+ s|/$||
+ s|$|/'"${pkg_file}"'|
+ s/-i686\(\.pkg\.tar\.xz\)$/-x86_64\1/
+ p
+ ' | \
+ shuf
+ } | \
+ while read -r url; do
+ if wget -q -nd "${url}"; then
+ break;
+ fi
+ done
done
if [ "${repository}" = 'multilib' ]; then
x86_64_build_command='multilib-build'