From 01d24327d95d1df5e1c18c2dda6234e45194a639 Mon Sep 17 00:00:00 2001 From: David Young Date: Thu, 26 Nov 2026 05:51:07 -0700 Subject: [PATCH] AUR update: name the packages that failed at the end yay installs the other AUR updates after one fails, and its error ends up thousands of lines above the end of the log (reports CD-EJEKVU and CD-278CL3: flrig 2.0.12-1 has an extra checksum in its PKGBUILD). Now 20-aur.sh lists what's still out of date and says the next update tries again. The hook still fails, so these still get reported. Co-Authored-By: Claude Opus 5.5 --- tests/aur.bats | 26 ++++++++++++++++++++++++++ updates.d/20-aur.sh | 20 ++++++++++++++++++-- 2 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 tests/aur.bats diff --git a/tests/aur.bats b/tests/aur.bats new file mode 100644 index 0000000..8675f8a --- /dev/null +++ b/tests/aur.bats @@ -0,0 +1,26 @@ +#!/usr/bin/env bats + +load test_helper + +@test "20-aur names the AUR packages a failed update left behind" { + # yay -Sua fails on flrig (a broken PKGBUILD) after installing the rest + stub yay ' +case "$1" in + --version) echo "yay v12" ;; + -Sua) exit 1 ;; + -Qua) echo "flrig 2.0.10-1 -> 2.0.12-1" ;; +esac' + + run bash "$REPO/updates.d/20-aur.sh" + [ "$status" -eq 1 ] + [[ "$output" == *"These AUR packages could not be updated: flrig"* ]] + called yay -Sua --noconfirm --answerdiff=None --answeredit=None --answerclean=None +} + +@test "20-aur succeeds quietly when yay does" { + stub yay '[ "$1" = --version ] && echo "yay v12"; exit 0' + + run bash "$REPO/updates.d/20-aur.sh" + [ "$status" -eq 0 ] + [[ "$output" != *"could not be updated"* ]] +} diff --git a/updates.d/20-aur.sh b/updates.d/20-aur.sh index e0a31be..dc982fe 100644 --- a/updates.d/20-aur.sh +++ b/updates.d/20-aur.sh @@ -2,7 +2,7 @@ echo "Updating AUR..." -YAY_FLAGS="--noconfirm --answerdiff=None --answeredit=None --answerclean=None" +YAY_FLAGS=(--noconfirm --answerdiff=None --answeredit=None --answerclean=None) # Only rebuild yay when yay itself is broken (e.g. a pacman upgrade bumped # libalpm). A failing AUR package is not fixed by a rebuild, so let that error @@ -20,4 +20,20 @@ if ! yay --version &>/dev/null; then cd || exit 1 fi -yay -Sua $YAY_FLAGS +if ! yay -Sua "${YAY_FLAGS[@]}"; then + # yay goes on to build and install the other packages after one fails, so + # whatever is still out of date is what failed. Name it at the end, where + # it's easy to find; yay's own error is far up in the build output. + mapfile -t STUCK < <(yay -Qua 2> /dev/null | awk '{print $1}') + echo + if (( ${#STUCK[@]} > 0 )); then + echo "These AUR packages could not be updated: ${STUCK[*]}" + echo "The other AUR updates are installed. AUR packages are maintained by" + echo "volunteers, and a broken update is usually fixed on the AUR within a few" + echo "days; the next update will try again. The error is above, just before" + echo "\"error making\" or \"error downloading sources\"." + else + echo "yay reported an error, though no AUR updates are left to install." + fi + exit 1 +fi