tests: only generate key when not available yet

Installing a build key requires root permissions, something that is not
possible in all cases, most notably on the builders.

Instead of generating a key each time, which results in many keys being
generated each test suite run, check whether a key is already present by
using `abuild-sign --installed`, and only generate a key when that
returns false.
This commit is contained in:
Kevin Daudt 2021-10-11 22:47:50 +02:00
parent a0d6085e9b
commit 2a95c3d50c
2 changed files with 6 additions and 2 deletions

View File

@ -12,7 +12,9 @@ setup() {
export PATH="$PWD/../:$PATH"
export ARCH=$(apk --print-arch)
abuild-keygen -ain >/dev/null 2>&1
if ! abuild-sign --installed 2>/dev/null; then
abuild-keygen -ain >/dev/null 2>&1
fi
mkdir -p "$tmpdir" "$WORKDIR"
}

View File

@ -12,7 +12,9 @@ setup() {
export APORTSDIR="$PWD"/testrepo
export PATH="$PWD/../:$PATH"
abuild-keygen -ain >/dev/null 2>&1
if ! abuild-sign --installed 2>/dev/null; then
abuild-keygen -ain >/dev/null 2>&1
fi
mkdir -p "$tmpdir" "$WORKDIR"
printf "[color]\n\tui = always\n" > "$GIT_CONFIG_GLOBAL"