# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import datetime
import re
import shutil
import os
import sys
# Usage: python -u buildRelease.py /path/to/checkout version(eg: 3.4.0) gpgKey(eg: 6E68DA61) rcNum user [-prepare] [-push]
#
# EG: python -u buildRelease.py -prepare -push /lucene/34x 3.4.0 6E68DA61 1 mikemccand
#
# TODO: also run smokeTestRelease.py?
# NOTE: you have to type in your gpg password at some point while this
# runs; it's VERY confusing because the output is directed to
# /tmp/release.log, so, you have to tail that and when GPG wants your
# password, type it!
f.close()
print msg
raise RuntimeError(msg)
def scrubCheckout():
# removes any files not checked into svn
if match:
print ' delete %s' % s
else:
def getSVNRev():
try:
except (TypeError, ValueError):
return rev
print
print 'Prepare release...'
print ' svn up...'
run('svn up')
print ' svn rev: %s' % rev
print ' ant clean test'
run('ant clean test')
print ' clean checkout'
print ' lucene prepare-release'
run('ant -Dversion=%s -Dspecversion=%s -Dgpg.key=%s prepare-release' % (version, version, gpgKeyID))
print ' solr prepare-release'
run('ant -Dversion=%s -Dspecversion=%s -Dgpg.key=%s prepare-release' % (version, version, gpgKeyID))
print ' done!'
print
return rev
print 'Push...'
s = os.popen('ssh %s@people.apache.org "ls -ld public_html/staging_area/%s" 2>&1' % (username, dir)).read()
print ' Remove old dir...'
run('ssh %s@people.apache.org "chmod -R u+rwX public_html/staging_area/%s; rm -rf public_html/staging_area/%s"' %
run('ssh %s@people.apache.org "mkdir -p public_html/staging_area/%s/lucene public_html/staging_area/%s/solr"' % \
print ' Lucene'
print ' zip...'
run('tar cjf lucene.tar.bz2 *')
print ' copy...'
print ' unzip...'
run('ssh %s@people.apache.org "cd public_html/staging_area/%s/lucene; tar xjf lucene.tar.bz2; rm -f lucene.tar.bz2"' % (username, dir))
print ' copy changes...'
run('scp -r build/docs/changes %s@people.apache.org:public_html/staging_area/%s/lucene/changes-%s' % (username, dir, version))
print ' Solr'
print ' zip...'
run('tar cjf solr.tar.bz2 *')
print ' copy...'
print ' unzip...'
run('ssh %s@people.apache.org "cd public_html/staging_area/%s/solr; tar xjf solr.tar.bz2; rm -f solr.tar.bz2"' % (username, dir))
print ' KEYS'
run('chmod a+r-w KEYS')
print ' chmod...'
def main():
if doPrepare:
if doPush:
if doPrepare:
else:
if doPush:
if __name__ == '__main__':
main()