You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Simon Willnauer <si...@gmail.com> on 2013/04/17 21:58:52 UTC
Re: svn commit: r1469040 - /lucene/dev/branches/branch_4x/dev-tools/scripts/buildAndPushRelease.py
WOOT
On Wed, Apr 17, 2013 at 9:33 PM, <mi...@apache.org> wrote:
> Author: mikemccand
> Date: Wed Apr 17 19:33:48 2013
> New Revision: 1469040
>
> URL: http://svn.apache.org/r1469040
> Log:
> prompt for GPG password up front
>
> Modified:
> lucene/dev/branches/branch_4x/dev-tools/scripts/buildAndPushRelease.py
>
> Modified:
> lucene/dev/branches/branch_4x/dev-tools/scripts/buildAndPushRelease.py
> URL:
> http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/dev-tools/scripts/buildAndPushRelease.py?rev=1469040&r1=1469039&r2=1469040&view=diff
>
> ==============================================================================
> --- lucene/dev/branches/branch_4x/dev-tools/scripts/buildAndPushRelease.py
> (original)
> +++ lucene/dev/branches/branch_4x/dev-tools/scripts/buildAndPushRelease.py
> Wed Apr 17 19:33:48 2013
> @@ -15,9 +15,11 @@
>
> import datetime
> import re
> +import time
> import shutil
> import os
> import sys
> +import subprocess
>
> # Usage: python3.2 -u buildAndPushRelease.py [-sign gpgKey(eg: 6E68DA61)]
> [-prepare] [-push userName] [-pushLocal dirName] [-smoke tmpDir]
> /path/to/checkout version(eg: 3.4.0) rcNum(eg: 0)
> #
> @@ -43,6 +45,25 @@ def run(command):
> print(msg)
> raise RuntimeError(msg)
>
> +def runAndSendGPGPassword(command, password):
> + p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE,
> stderr=subprocess.STDOUT, stdin=subprocess.PIPE)
> + f = open(LOG, 'ab')
> + while True:
> + line = p.stdout.readline()
> + if len(line) == 0:
> + break
> + f.write(line)
> + if line.find(b'Enter GPG keystore password:') != -1:
> + time.sleep(1.0)
> + p.stdin.write((password + '\n').encode('UTF-8'))
> + p.stdin.write('\n'.encode('UTF-8'))
> +
> + result = p.poll()
> + if result != 0:
> + msg = ' FAILED: %s [see log %s]' % (command, LOG)
> + print(msg)
> + raise RuntimeError(msg)
> +
> def scrubCheckout():
> # removes any files not checked into svn
>
> @@ -68,7 +89,7 @@ def getSVNRev():
> return rev
>
>
> -def prepare(root, version, gpgKeyID, doTest):
> +def prepare(root, version, gpgKeyID, gpgPassword, doTest):
> print()
> print('Prepare release...')
> if os.path.exists(LOG):
> @@ -98,7 +119,11 @@ def prepare(root, version, gpgKeyID, doT
> cmd += ' -Dgpg.key=%s prepare-release' % gpgKeyID
> else:
> cmd += ' prepare-release-no-sign'
> - run(cmd)
> +
> + if gpgPassword is not None:
> + runAndSendGPGPassword(cmd, gpgPassword)
> + else:
> + run(cmd)
>
> print(' solr prepare-release')
> os.chdir('../solr')
> @@ -107,7 +132,12 @@ def prepare(root, version, gpgKeyID, doT
> cmd += ' -Dgpg.key=%s prepare-release' % gpgKeyID
> else:
> cmd += ' prepare-release-no-sign'
> - run(cmd)
> +
> + if gpgPassword is not None:
> + runAndSendGPGPassword(cmd, gpgPassword)
> + else:
> + run(cmd)
> +
> print(' done!')
> print()
> return rev
> @@ -253,12 +283,16 @@ def main():
> gpgKeyID = sys.argv[idx+1]
> del sys.argv[idx:idx+2]
>
> + sys.stdout.flush()
> + import getpass
> + gpgPassword = getpass.getpass('Enter GPG keystore password: ')
> +
> root = os.path.abspath(sys.argv[1])
> version = sys.argv[2]
> rcNum = int(sys.argv[3])
>
> if doPrepare:
> - rev = prepare(root, version, gpgKeyID, smokeTmpDir is None)
> + rev = prepare(root, version, gpgKeyID, gpgPassword, smokeTmpDir is
> None)
> else:
> os.chdir(root)
> rev = open('rev.txt', encoding='UTF-8').read()
>
>
>