refs: rename lookup_ref_store() to lookup_submodule_ref_store()
[git/raj.git] / t / lib-gpg.sh
blobec2aa8f6879d68078caeccaff25d89178b9fb902
1 #!/bin/sh
3 gpg_version=$(gpg --version 2>&1)
4 if test $? != 127
5 then
6 # As said here: http://www.gnupg.org/documentation/faqs.html#q6.19
7 # the gpg version 1.0.6 didn't parse trust packets correctly, so for
8 # that version, creation of signed tags using the generated key fails.
9 case "$gpg_version" in
10 'gpg (GnuPG) 1.0.6'*)
11 say "Your version of gpg (1.0.6) is too buggy for testing"
14 # Available key info:
15 # * Type DSA and Elgamal, size 2048 bits, no expiration date,
16 # name and email: C O Mitter <committer@example.com>
17 # * Type RSA, size 2048 bits, no expiration date,
18 # name and email: Eris Discordia <discord@example.net>
19 # No password given, to enable non-interactive operation.
20 # To generate new key:
21 # gpg --homedir /tmp/gpghome --gen-key
22 # To write armored exported key to keyring:
23 # gpg --homedir /tmp/gpghome --export-secret-keys \
24 # --armor 0xDEADBEEF >> lib-gpg/keyring.gpg
25 # gpg --homedir /tmp/gpghome --export \
26 # --armor 0xDEADBEEF >> lib-gpg/keyring.gpg
27 # To export ownertrust:
28 # gpg --homedir /tmp/gpghome --export-ownertrust \
29 # > lib-gpg/ownertrust
30 mkdir ./gpghome &&
31 chmod 0700 ./gpghome &&
32 GNUPGHOME="$(pwd)/gpghome" &&
33 export GNUPGHOME &&
34 gpg --homedir "${GNUPGHOME}" 2>/dev/null --import \
35 "$TEST_DIRECTORY"/lib-gpg/keyring.gpg &&
36 gpg --homedir "${GNUPGHOME}" 2>/dev/null --import-ownertrust \
37 "$TEST_DIRECTORY"/lib-gpg/ownertrust &&
38 gpg --homedir "${GNUPGHOME}" </dev/null >/dev/null 2>&1 \
39 --sign -u committer@example.com &&
40 test_set_prereq GPG
42 esac
45 if test_have_prereq GPG &&
46 echo | gpg --homedir "${GNUPGHOME}" -b --rfc1991 >/dev/null 2>&1
47 then
48 test_set_prereq RFC1991
51 sanitize_pgp() {
52 perl -ne '
53 /^-----END PGP/ and $in_pgp = 0;
54 print unless $in_pgp;
55 /^-----BEGIN PGP/ and $in_pgp = 1;