Skip to content

Commit

Permalink
Fix test release commands to work with older GPG.
Browse files Browse the repository at this point in the history
The --quick-generate-key command wasn't added until recently.

PiperOrigin-RevId: 314570297
  • Loading branch information
amscanne authored and gvisor-bot committed Jun 3, 2020
1 parent c8e7968 commit fa9c905
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Makefile
Expand Up @@ -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)
Expand Down

0 comments on commit fa9c905

Please sign in to comment.