From f95d544fdb9052f55ac7d8009b3130c9eec3e48c Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Fri, 31 Jul 2026 22:04:01 -0500 Subject: [PATCH] Retry AUR clones and report the real error on failure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A transient network failure cloning retroarch-joypad-autoconfig-git took the whole sync workflow red. Clones now retry up to 3 times, and the failure message includes git's actual error instead of guessing "may not exist in AUR" — which was never the cause anyway: AUR serves an empty repo for unknown package names, so that case is now detected explicitly by the missing PKGBUILD. Co-Authored-By: Claude Fable 5 --- bin/sync-aur | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/bin/sync-aur b/bin/sync-aur index 1d177ad..fb493a8 100755 --- a/bin/sync-aur +++ b/bin/sync-aur @@ -272,6 +272,27 @@ apply_pkgrel_override() { return 0 } +clone_aur_package() { + local aur_package="$1" + local dest="$2" + local clone_log="$TEMP_DIR/clone.log" + local attempt + + for attempt in 1 2 3; do + rm -rf "$dest" + if git clone "https://aur.archlinux.org/${aur_package}.git" "$dest" >"$clone_log" 2>&1; then + return 0 + fi + if [[ $attempt -lt 3 ]]; then + print_warning "Clone of $aur_package failed (attempt $attempt/3), retrying in 10s..." + sleep 10 + fi + done + + print_warning "Failed to clone $aur_package after 3 attempts: $(tail -n 1 "$clone_log")" + return 1 +} + sync_package() { local package="$1" local package_dir="$PKGBUILDS_DIR/$package" @@ -310,10 +331,14 @@ sync_package() { fi cd "$TEMP_DIR" - rm -rf "$aur_package" - if ! git clone "https://aur.archlinux.org/${aur_package}.git" "$aur_package" >/dev/null 2>&1; then - print_warning "Failed to clone $aur_package (may not exist in AUR)" + if ! clone_aur_package "$aur_package" "$TEMP_DIR/$aur_package"; then + ((++FAILED)) + return 0 + fi + + if [[ ! -f "$TEMP_DIR/$aur_package/PKGBUILD" ]]; then + print_warning "AUR repository for $aur_package is empty (package does not exist in AUR)" ((++FAILED)) return 0 fi