From 95d06e0f6056c3fcff87e048468318389786f0b8 Mon Sep 17 00:00:00 2001 From: Morten Linderud Date: Sat, 25 Dec 2021 15:04:32 +0100 Subject: commitpkg: Split signature check into own loop This allows us to extend the uploads array without having to duplicate the current signing logic. This doesn't change anything as we still exit on any failed packages. Signed-off-by: Levente Polyak --- commitpkg.in | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/commitpkg.in b/commitpkg.in index 465ef6b..53b7e9f 100644 --- a/commitpkg.in +++ b/commitpkg.in @@ -147,20 +147,22 @@ for _arch in "${arch[@]}"; do continue 2 fi uploads+=("$pkgfile") + done +done - sigfile="${pkgfile}.sig" - if [[ ! -f $sigfile ]]; then - msg "Signing package %s..." "${pkgfile}" - if [[ -n $GPGKEY ]]; then - SIGNWITHKEY=(-u "${GPGKEY}") - fi - gpg --detach-sign --use-agent --no-armor "${SIGNWITHKEY[@]}" "${pkgfile}" || die - fi - if ! gpg --verify "$sigfile" "$pkgfile" >/dev/null 2>&1; then - die "Signature %s is incorrect!" "$sigfile" +for pkgfile in "${uploads[@]}"; do + sigfile="${pkgfile}.sig" + if [[ ! -f $sigfile ]]; then + msg "Signing package %s..." "${pkgfile}" + if [[ -n $GPGKEY ]]; then + SIGNWITHKEY=(-u "${GPGKEY}") fi - uploads+=("$sigfile") - done + gpg --detach-sign --use-agent --no-armor "${SIGNWITHKEY[@]}" "${pkgfile}" || die + fi + if ! gpg --verify "$sigfile" "$pkgfile" >/dev/null 2>&1; then + die "Signature %s is incorrect!" "$sigfile" + fi + uploads+=("$sigfile") done for _arch in "${arch[@]}"; do -- cgit v1.2.3-54-g00ecf