cmake: Do not use gpg if user has no keys.

When UPSTREAM_RELEASE is set, only use gpg to make detached signatures
if the output of gpg -k is not blank. If it is not, the user has likely
installed a private key to sign with.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2020-03-14 13:28:36 +00:00
parent 7b04c4ceec
commit 571025da66
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
1 changed files with 13 additions and 6 deletions

View File

@ -1006,6 +1006,17 @@ endif()
option(UPSTREAM_RELEASE "do some release automation tasks" OFF)
find_program(GPG_PROGRAM gpg)
if(GPG_PROGRAM)
execute_process(
COMMAND ${GPG_PROGRAM} -k
OUTPUT_VARIABLE GPG_KEYS
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
endif()
if(UPSTREAM_RELEASE AND WIN32)
set(home "$ENV{HOME}")
@ -1056,9 +1067,7 @@ if(UPSTREAM_RELEASE AND WIN32)
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
find_program(GPG_PROGRAM gpg)
if(GPG_PROGRAM)
if(GPG_KEYS)
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/translations.zip.asc
COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_BINARY_DIR}/translations.zip.asc
@ -1160,9 +1169,7 @@ if(UPSTREAM_RELEASE AND APPLE)
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
find_program(GPG_PROGRAM gpg)
if(GPG_PROGRAM)
if(GPG_KEYS)
add_custom_command(
TARGET visualboyadvance-m
POST_BUILD