From e4ac1b651764d39b58b732174e2f654224a509a2 Mon Sep 17 00:00:00 2001 From: DarkFeather Date: Thu, 7 Dec 2023 13:24:21 -0600 Subject: [PATCH] Better exit code & diffing for PKGBUILD terms --- Hooks/scripts.d/check-AniNIX-PKGBUILD | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Hooks/scripts.d/check-AniNIX-PKGBUILD b/Hooks/scripts.d/check-AniNIX-PKGBUILD index 47aa80c..e160e0b 100755 --- a/Hooks/scripts.d/check-AniNIX-PKGBUILD +++ b/Hooks/scripts.d/check-AniNIX-PKGBUILD @@ -3,10 +3,10 @@ # Ensure that the following lines match the base PKGBUILD export retcode=0 -for term in pkgname replaces pkgver epoch pkgdesc url license ../LICENSE; do - current="$(grep -E "^${term}=" ./PKGBUILD)" - reference="$(grep -E "^${term}=" /opt/aninix/Uniglot/pacman/PKGBUILD)" - diff -w --color=always <(printf "${reference}") <(echo "${current}") +for term in ^pkgname\= ^replaces\= ^pkgver\= ^epoch\= ^pkgdesc\= ^url\= ^license\= ../LICENSE; do + current="$(grep -E "${term}" ./PKGBUILD)" + reference="$(grep -E "${term}" /opt/aninix/Uniglot/pacman/PKGBUILD)" + diff -w --color=always <(printf "${reference}") <(printf "${current}") export retcode="$(( $retcode || $? ))"; if [ "$retcode" != 0 ]; then echo "$term has delta." @@ -24,4 +24,5 @@ if [ "$(basename "$PWD")" == 'Uniglot' ] && [ "$retcode" != 0 ]; then fi elif [ "$retcode" != 0 ]; then echo ERROR: PKGBUILD is out of sync with AniNIX/Uniglot. + exit 1 fi