tests: skip RFC1991 tests for gnupg 2.1
[git.git] / t / lib-gpg.sh
blob7e077b01c118e8bad9c41348b122a0dbd0f55ed6
1 #!/bin/sh
3 gpg_version=$(gpg --version 2>&1)
4 if test $? = 127; then
5 say "You do not seem to have gpg installed"
6 else
7 # As said here: http://www.gnupg.org/documentation/faqs.html#q6.19
8 # the gpg version 1.0.6 didn't parse trust packets correctly, so for
9 # that version, creation of signed tags using the generated key fails.
10 case "$gpg_version" in
11 'gpg (GnuPG) 1.0.6'*)
12 say "Your version of gpg (1.0.6) is too buggy for testing"
15 # key generation info: gpg --homedir t/lib-gpg --gen-key
16 # Type DSA and Elgamal, size 2048 bits, no expiration date.
17 # Name and email: C O Mitter <committer@example.com>
18 # No password given, to enable non-interactive operation.
19 mkdir ./gpghome
20 chmod 0700 ./gpghome
21 GNUPGHOME="$(pwd)/gpghome"
22 export GNUPGHOME
23 gpg --homedir "${GNUPGHOME}" --import \
24 "$TEST_DIRECTORY"/lib-gpg/pubring.gpg \
25 "$TEST_DIRECTORY"/lib-gpg/secring.gpg
26 gpg --homedir "${GNUPGHOME}" --import-ownertrust \
27 "$TEST_DIRECTORY"/lib-gpg/ownertrust
28 test_set_prereq GPG
29 if echo | gpg --homedir "${GNUPGHOME}" -b --rfc1991 >/dev/null 2>&1
30 then
31 test_set_prereq RFC1991
34 esac
37 sanitize_pgp() {
38 perl -ne '
39 /^-----END PGP/ and $in_pgp = 0;
40 print unless $in_pgp;
41 /^-----BEGIN PGP/ and $in_pgp = 1;