From 064c05f785bec3408d211446e4b934999c55696f Mon Sep 17 00:00:00 2001 From: Shunya Ueta Date: Thu, 7 Dec 2023 00:29:00 +0900 Subject: [PATCH] clean up smoketester GPG leaks Follow to #11948 --- dev-tools/scripts/smokeTestRelease.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/dev-tools/scripts/smokeTestRelease.py b/dev-tools/scripts/smokeTestRelease.py index 5b6ae716876..f3b13640363 100755 --- a/dev-tools/scripts/smokeTestRelease.py +++ b/dev-tools/scripts/smokeTestRelease.py @@ -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: