clean up smoketester GPG leaks

Follow to #11948
This commit is contained in:
Shunya Ueta 2023-12-07 00:29:00 +09:00 committed by GitHub
parent af2aea5eb2
commit 064c05f785
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 2 deletions

View File

@ -264,13 +264,15 @@ def checkSigs(urlString, version, tmpDir, isSigned, keysFile):
if os.path.exists(gpgHomeDir):
shutil.rmtree(gpgHomeDir)
os.makedirs(gpgHomeDir, 0o700)
run('gpg --homedir %s --import %s' % (gpgHomeDir, keysFile),
'%s/lucene.gpg.import.log' % tmpDir)
gpgLogFile = '%s/lucene.gpg.import.log' % tmpDir
run('gpg --homedir %s --import %s' % (gpgHomeDir, keysFile), gpgLogFile)
if mavenURL is None:
stopGpgAgent(gpgHomeDir, logFile)
raise RuntimeError('lucene is missing maven')
if changesURL is None:
stopGpgAgent(gpgHomeDir, logFile)
raise RuntimeError('lucene is missing changes-%s' % version)
testChanges(version, changesURL)
@ -308,6 +310,11 @@ def checkSigs(urlString, version, tmpDir, isSigned, keysFile):
if line.lower().find('warning') != -1:
print(' GPG: %s' % line.strip())
# Make sure to shutdown the GPG agent at the end
stopGpgAgent(gpgHomeDir, logFile)
def stopGpgAgent(gpgHomeDir, logFile):
run('gpgconf --homedir %s --kill gpg-agent' % (gpgHomeDir), logFile)
def testChanges(version, changesURLString):
print(' check changes HTML...')
@ -857,6 +864,8 @@ def verifyMavenSigs(tmpDir, artifacts, keysFile):
sys.stdout.write('.')
print()
# Make sure to shutdown the GPG agent at the end
stopGpgAgent(gpgHomeDir, logFile)
def print_warnings_in_file(file):
with open(file) as f: