summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAdin Scannell <ascannell@google.com>2020-06-03 11:30:49 -0700
committergVisor bot <gvisor-bot@google.com>2020-06-03 11:32:11 -0700
commitfa9c9055053172ba8653c9543e4195e0207c7543 (patch)
tree074070b5c345b9034880a0d6cc5c598fca9b7665
parentc8e79683891db9e780449112f78ee4004a2de833 (diff)
Fix test release commands to work with older GPG.
The --quick-generate-key command wasn't added until recently. PiperOrigin-RevId: 314570297
-rw-r--r--Makefile14
1 files changed, 11 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index d6cd9ec03..85818ebea 100644
--- a/Makefile
+++ b/Makefile
@@ -171,12 +171,20 @@ RELEASE_COMMIT :=
RELEASE_NAME :=
RELEASE_NOTES :=
+GPG_TEST_OPTIONS := $(shell if gpg --pinentry-mode loopback --version >/dev/null 2>&1; then echo --pinentry-mode loopback; fi)
$(RELEASE_KEY):
@echo "WARNING: Generating a key for testing ($@); don't use this."
T=$$(mktemp /tmp/keyring.XXXXXX); \
- gpg --no-default-keyring --keyring $$T --batch --passphrase "" --quick-generate-key $(shell whoami) && \
- gpg --export-secret-keys --no-default-keyring --keyring $$T > $@; \
- rc=$$?; rm -f $$T; exit $$rc
+ C=$$(mktemp /tmp/config.XXXXXX); \
+ echo Key-Type: DSA >> $$C && \
+ echo Key-Length: 1024 >> $$C && \
+ echo Name-Real: Test >> $$C && \
+ echo Name-Email: test@example.com >> $$C && \
+ echo Expire-Date: 0 >> $$C && \
+ echo %commit >> $$C && \
+ gpg --batch $(GPG_TEST_OPTIONS) --passphrase '' --no-default-keyring --keyring $$T --no-tty --gen-key $$C && \
+ gpg --batch $(GPG_TEST_OPTIONS) --export-secret-keys --no-default-keyring --keyring $$T --secret-keyring $$T > $@; \
+ rc=$$?; rm -f $$T $$C; exit $$rc
release: $(RELEASE_KEY) ## Builds a release.
@mkdir -p $(RELEASE_ROOT)