From 9f2f25b037bc1c207d1fddfdbca8c0797f8c9037 Mon Sep 17 00:00:00 2001 From: "Rudra B.S." Date: Mon, 20 Nov 2023 13:06:25 +0530 Subject: [PATCH] chore: make akshara retry package downloads 30 times before failing --- akshara | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/akshara b/akshara index 13cc36d..0ab558a 100755 --- a/akshara +++ b/akshara @@ -241,19 +241,25 @@ Server = {package_repo["repo-url"]} exec_chroot('pacman-key', '--init') exec_chroot('pacman-key', '--populate') - if exec_chroot('pacman', '-Syu', '--noconfirm') != 0: - if exec_chroot('pacman', '-Syu', '--noconfirm') != 0: - if exec_chroot('pacman', '-Syu', '--noconfirm') != 0: - if exec_chroot('pacman', '-Syu', '--noconfirm') != 0: - error('update failed due to unsuccessful package downloads') - sys.exit(50) + counter = 0 + while True: + return_val = exec_chroot('pacman', '-Syu', '--noconfirm') + counter += 1 + if counter > 30: + error('failed to download packages') + exit(50) + if return_val == 0: + break - if exec_chroot('pacman', '-S', '--ask=4', *packages) != 0: - if exec_chroot('pacman', '-S', '--ask=4', *packages) != 0: - if exec_chroot('pacman', '-S', '--ask=4', *packages) != 0: - if exec_chroot('pacman', '-S', '--ask=4', *packages) != 0: - error('update failed due to unsuccessful package downloads') - sys.exit(50) + counter = 0 + while True: + return_val = exec_chroot('pacman', '-S', '--ask=4', *packages) + counter += 1 + if counter > 30: + error('failed to download packages') + exit(50) + if return_val == 0: + break if type(blend_release.get('commands')) == list: for command in blend_release.get('commands'):