git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/3] create gpg homedir on the fly

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 12, 2014, 20:33 UTC
Message-ID
<xmqqk31wbobc.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1418374214-8241-1-git-send-email-mail@eworm.de>

After queuing these three, I _think_ it is better to have something like this patch on top, as it is distracting to let the GPG message while setting up the test gpghome leak into the test output, especially without running these tests with "-v" option.

The splitting of RFC1991 prerequiste part is about future-proofing. When we want to define other kinds of specific prerequisites in the future, I'd prefer to see it done separately from the basic set-up code.

 t/lib-gpg.sh | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/t/lib-gpg.sh b/t/lib-gpg.sh
index b611b78..33de402 100755
--- a/t/lib-gpg.sh
+++ b/t/lib-gpg.sh
@@ -16,23 +16,25 @@ else
 		# Type DSA and Elgamal, size 2048 bits, no expiration date.
 		# Name and email: C O Mitter <committer@example.com>
 		# No password given, to enable non-interactive operation.
-		mkdir ./gpghome
-		chmod 0700 ./gpghome
-		GNUPGHOME="$(pwd)/gpghome"
-		export GNUPGHOME
-		gpg --homedir "${GNUPGHOME}" --import \
-			"$TEST_DIRECTORY"/lib-gpg/keyring.gpg
-		gpg --homedir "${GNUPGHOME}" --import-ownertrust \
-			"$TEST_DIRECTORY"/lib-gpg/ownertrust
+		mkdir ./gpghome &&
+		chmod 0700 ./gpghome &&
+		GNUPGHOME="$(pwd)/gpghome" &&
+		export GNUPGHOME &&
+		gpg --homedir "${GNUPGHOME}" 2>/dev/null --import \
+			"$TEST_DIRECTORY"/lib-gpg/keyring.gpg &&
+		gpg --homedir "${GNUPGHOME}" 2>/dev/null --import-ownertrust \
+			"$TEST_DIRECTORY"/lib-gpg/ownertrust &&
 		test_set_prereq GPG
-		if echo | gpg --homedir "${GNUPGHOME}" -b --rfc1991 >/dev/null 2>&1
-		then
-			test_set_prereq RFC1991
-		fi
 		;;
 	esac
 fi
 
+if test_have_prereq GPG &&
+    echo | gpg --homedir "${GNUPGHOME}" -b --rfc1991 >/dev/null 2>&1
+then
+	test_set_prereq RFC1991
+fi
+
 sanitize_pgp() {
 	perl -ne '
 		/^-----END PGP/ and $in_pgp = 0;
Previous: Junio C HamanoNext: Christian Hesse
Message 14 of 16 in “create gpg homedir on the fly and skip RFC1991 tests for gnupg 2.1”
  1. 1/1 create gpg homedir on the fly and skip RFC1991 tests for gnupg 2.1Christian Hesse, Dec 11, 2014
  2. Junio C HamanoDec 11, 2014
  3. Christian HesseDec 12, 2014
  4. 1/3 create gpg homedir on the flyChristian Hesse, Dec 12, 2014
  5. 2/3 skip RFC1991 tests for gnupg 2.1Christian Hesse, Dec 12, 2014
  6. 3/3 replace binary keyrings with armored keysChristian Hesse, Dec 12, 2014
  7. Junio C HamanoDec 12, 2014
  8. 3/3 replace binary keyrings with armored keysChristian Hesse, Dec 12, 2014
  9. Junio C HamanoDec 12, 2014
  10. Christian HesseDec 13, 2014
  11. Eric SunshineDec 12, 2014
  12. 1/3 create gpg homedir on the flyChristian Hesse, Dec 12, 2014
  13. Junio C HamanoDec 12, 2014
  14. Junio C HamanoDec 12, 2014
  15. Christian HesseDec 12, 2014
  16. Junio C HamanoDec 12, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.