1 |
commit: 25accafd2e792b338dd9bc2cbeb5fdd3232062a1 |
2 |
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat May 25 15:51:29 2019 +0000 |
4 |
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat May 25 15:51:29 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=25accafd |
7 |
|
8 |
tests/qmanifest: try and work with old gpg |
9 |
|
10 |
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org> |
11 |
|
12 |
tests/qmanifest/dotest | 28 +++++++++++++++++++++------- |
13 |
1 file changed, 21 insertions(+), 7 deletions(-) |
14 |
|
15 |
diff --git a/tests/qmanifest/dotest b/tests/qmanifest/dotest |
16 |
index 549223b..a6b1431 100755 |
17 |
--- a/tests/qmanifest/dotest |
18 |
+++ b/tests/qmanifest/dotest |
19 |
@@ -50,14 +50,28 @@ mkdir "${HOME}"/.gnupg |
20 |
# silence gpg warnings |
21 |
chmod -R og-rwx "${HOME}"/.gnupg |
22 |
|
23 |
+gpg_import() { |
24 |
+ local key=$1 |
25 |
+ local pass=$2 |
26 |
+ local args=( |
27 |
+ --batch |
28 |
+ --quiet |
29 |
+ --no-tty |
30 |
+ --passphrase-fd 0 |
31 |
+ --import "${key}" |
32 |
+ ) |
33 |
+ local killpinentry="--pinentry-mode loopback" |
34 |
+ |
35 |
+ # see if gpg is new enough for killpinentry |
36 |
+ echo "${pass}" | gpg -n ${killpinentry} "${args[@]}" |
37 |
+ if [[ $? -ne 0 ]] ; then |
38 |
+ echo "${pass}" | gpg "${args[@]}" |
39 |
+ else |
40 |
+ echo "${pass}" | gpg ${killpinentry} "${args[@]}" |
41 |
+ fi |
42 |
+} |
43 |
# import key and sanity check |
44 |
-echo qmanifest | gpg \ |
45 |
- --batch \ |
46 |
- --quiet \ |
47 |
- --no-tty \ |
48 |
- --passphrase-fd 0 \ |
49 |
- --pinentry-mode loopback \ |
50 |
- --import "${as}"/key.gpg |
51 |
+gpg_import "${as}"/key.gpg qmanifest |
52 |
test p6 0 "gpg --list-keys | sed '1,2d'" |
53 |
|
54 |
# make it a fully valid tree |