Add gnupg2-smime and perl JSON BuildRequires for tests

In addition to the gnupg2-smime BR, patch an issue which prevents the
gpgsm tests from running.  Only include gpgsm on Fedora and RHEL > 8.
On RHEL < 8 the gnupg2-smime package is too old to run the tests.
This commit is contained in:
Todd Zullinger 2019-02-02 02:47:15 -05:00
parent a245ca5676
commit a74fadafe7
3 changed files with 90 additions and 0 deletions

View File

@ -0,0 +1,39 @@
From 32ca60bbf5bb3020bbf24036bc61003711ace611 Mon Sep 17 00:00:00 2001
From: Todd Zullinger <tmz@pobox.com>
Date: Fri, 1 Feb 2019 19:36:41 -0500
Subject: [PATCH 1/2] t/lib-gpg: quote path to ${GNUPGHOME}/trustlist.txt
When gpgsm is installed, lib-gpg.sh attempts to update trustlist.txt to
relax the checking of some root certificate requirements. The path to
"${GNUPGHOME}" contains spaces which cause an "ambiguous redirect"
warning when bash is used to run the tests:
$ bash t7030-verify-tag.sh
/git/t/lib-gpg.sh: line 66: ${GNUPGHOME}/trustlist.txt: ambiguous redirect
ok 1 - create signed tags
ok 2 # skip create signed tags x509 (missing GPGSM)
...
No warning is issued when using bash called as /bin/sh, dash, or mksh.
Quote the path to ensure the redirect works as intended and sets the
GPGSM prereq. While we're here, drop the space after ">>".
Signed-off-by: Todd Zullinger <tmz@pobox.com>
---
t/lib-gpg.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/t/lib-gpg.sh b/t/lib-gpg.sh
index f1277bef4f..207009793b 100755
--- a/t/lib-gpg.sh
+++ b/t/lib-gpg.sh
@@ -63,7 +63,7 @@ then
cut -d" " -f4 |
tr -d '\n' >"${GNUPGHOME}/trustlist.txt" &&
- echo " S relax" >> ${GNUPGHOME}/trustlist.txt &&
+ echo " S relax" >>"${GNUPGHOME}/trustlist.txt" &&
(gpgconf --kill gpg-agent >/dev/null 2>&1 || : ) &&
echo hello | gpgsm --homedir "${GNUPGHOME}" >/dev/null \
-u committer@example.com -o /dev/null --sign - 2>&1 &&

View File

@ -0,0 +1,40 @@
From 09436d6a5b6db6ab8e80ab449b3b841883b27d19 Mon Sep 17 00:00:00 2001
From: Todd Zullinger <tmz@pobox.com>
Date: Sat, 2 Feb 2019 02:31:52 -0500
Subject: [PATCH 2/2] t/lib-gpg: drop redundant killing of gpg-agent
In 53fc999306 ("gpg-interface t: extend the existing GPG tests with
GPGSM", 2018-07-20), the gpgconf call which kills gpg-agent was copied
from the existing gpg setup code.
The reason for killing gpg-agent is given in 29ff1f8f74 ("t: lib-gpg:
flush gpg agent on startup", 2017-07-20):
When running gpg-relevant tests, a gpg-daemon is spawned for each
GNUPGHOME used. This daemon may stay running after the test and cache
file descriptors for the trash directories, even after the trash
directory is removed. This leads to ENOENT errors when attempting to
create files if tests are run multiple times.
Add a cleanup script to force flushing the gpg-agent for that GNUPGHOME
(if any) before setting up the GPG relevant-environment.
Killing gpg-agent once per test is sufficient.
Signed-off-by: Todd Zullinger <tmz@pobox.com>
---
t/lib-gpg.sh | 1 -
1 file changed, 1 deletion(-)
diff --git a/t/lib-gpg.sh b/t/lib-gpg.sh
index 207009793b..8d28652b72 100755
--- a/t/lib-gpg.sh
+++ b/t/lib-gpg.sh
@@ -64,7 +64,6 @@ then
tr -d '\n' >"${GNUPGHOME}/trustlist.txt" &&
echo " S relax" >>"${GNUPGHOME}/trustlist.txt" &&
- (gpgconf --kill gpg-agent >/dev/null 2>&1 || : ) &&
echo hello | gpgsm --homedir "${GNUPGHOME}" >/dev/null \
-u committer@example.com -o /dev/null --sign - 2>&1 &&
test_set_prereq GPGSM

View File

@ -119,6 +119,12 @@ Source99: print-failed-test-output
# https://bugzilla.redhat.com/490602
Patch0: git-cvsimport-Ignore-cvsps-2.2b1-Branches-output.patch
# Fix "ambiguous redirect" in t/lib-gpg.sh; it causes gpgsm tests to be skipped
# https://public-inbox.org/git/20190208031746.22683-2-tmz@pobox.com/
Patch2: 0001-t-lib-gpg-quote-path-to-GNUPGHOME-trustlist.txt.patch
# t/lib-gpg: drop redundant killing of gpg-agent
# https://public-inbox.org/git/20190208031746.22683-3-tmz@pobox.com/
Patch3: 0002-t-lib-gpg-drop-redundant-killing-of-gpg-agent.patch
%if %{with docs}
# pod2man is needed to build Git.3pm
@ -186,6 +192,9 @@ BuildRequires: glibc-langpack-en
BuildRequires: glibc-langpack-is
%endif # use_glibc_langpacks
BuildRequires: gnupg
%if 0%{?fedora} || 0%{?rhel} > 8
BuildRequires: gnupg2-smime
%endif # fedora or el > 8
%if 0%{?fedora} || ( 0%{?rhel} && ( 0%{?rhel} == 6 || 0%{?rhel} >= 7 && %{_arch} != ppc64 ))
BuildRequires: highlight
%endif # fedora, el-6, or el7-ppc64
@ -202,6 +211,7 @@ BuildRequires: perl(DBD::SQLite)
BuildRequires: perl(Digest::MD5)
BuildRequires: perl(HTTP::Date)
BuildRequires: perl(IO::Pty)
BuildRequires: perl(JSON)
BuildRequires: perl(Mail::Address)
BuildRequires: perl(Memoize)
BuildRequires: perl(Test::More)
@ -925,6 +935,7 @@ make -C contrib/credential/netrc/ testverbose
- Remove extraneous pcre BuildRequires
- Add additional BuildRequires for i18n locales used in tests
- Replace gitweb home-link with inline sed
- Add gnupg2-smime and perl JSON BuildRequires for tests
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.20.1-1.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild