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 <anthraxx@archlinux.org>
This commit is contained in:
Morten Linderud 2021-12-25 15:04:32 +01:00 committed by Levente Polyak
parent ec16d6e4bd
commit 95d06e0f60
No known key found for this signature in database
GPG Key ID: FC1B547C8D8172C8
1 changed files with 15 additions and 13 deletions

View File

@ -147,22 +147,24 @@ for _arch in "${arch[@]}"; do
continue 2
fi
uploads+=("$pkgfile")
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"
fi
uploads+=("$sigfile")
done
done
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
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
if ! in_array "$_arch" "${skip_arches[@]}"; then
commit_arches+=("$_arch")