aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFabian Groffen <grobian@gentoo.org>2019-05-25 17:51:29 +0200
committerFabian Groffen <grobian@gentoo.org>2019-05-25 17:51:29 +0200
commit25accafd2e792b338dd9bc2cbeb5fdd3232062a1 (patch)
tree8f6e90d77849e5558a62bdd9c6adce27bf0f806a /tests
parenttests/qmanifest: switch to reconstructing gpg keyring (diff)
downloadportage-utils-25accafd2e792b338dd9bc2cbeb5fdd3232062a1.tar.gz
portage-utils-25accafd2e792b338dd9bc2cbeb5fdd3232062a1.tar.bz2
portage-utils-25accafd2e792b338dd9bc2cbeb5fdd3232062a1.zip
tests/qmanifest: try and work with old gpg
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/qmanifest/dotest28
1 files changed, 21 insertions, 7 deletions
diff --git a/tests/qmanifest/dotest b/tests/qmanifest/dotest
index 549223ba..a6b1431b 100755
--- a/tests/qmanifest/dotest
+++ b/tests/qmanifest/dotest
@@ -50,14 +50,28 @@ mkdir "${HOME}"/.gnupg
# silence gpg warnings
chmod -R og-rwx "${HOME}"/.gnupg
+gpg_import() {
+ local key=$1
+ local pass=$2
+ local args=(
+ --batch
+ --quiet
+ --no-tty
+ --passphrase-fd 0
+ --import "${key}"
+ )
+ local killpinentry="--pinentry-mode loopback"
+
+ # see if gpg is new enough for killpinentry
+ echo "${pass}" | gpg -n ${killpinentry} "${args[@]}"
+ if [[ $? -ne 0 ]] ; then
+ echo "${pass}" | gpg "${args[@]}"
+ else
+ echo "${pass}" | gpg ${killpinentry} "${args[@]}"
+ fi
+}
# import key and sanity check
-echo qmanifest | gpg \
- --batch \
- --quiet \
- --no-tty \
- --passphrase-fd 0 \
- --pinentry-mode loopback \
- --import "${as}"/key.gpg
+gpg_import "${as}"/key.gpg qmanifest
test p6 0 "gpg --list-keys | sed '1,2d'"
# make it a fully valid tree