Skip to content
Permalink
Browse files
Replace discuss_release.sh with discuss_release.py, works with change…
…log.rst.
  • Loading branch information
djc committed Jul 31, 2013
1 parent 7285231 commit 8b986880ef7813ea67a93abe02d73b5d86289265
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 114 deletions.
@@ -0,0 +1,94 @@
#!/usr/bin/env python

# Licensed 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# 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.

# This script is for use by committers.
#
# It should be used in accordance with the project release procedure.
#
# cf. http://wiki.apache.org/couchdb/Release_Procedure

from docutils import core
import sys, os, tempfile

EMAIL_TPL = 'discuss_release.txt'

def red(s):
return '\033[1;31m%s\033[0m' % s

def get_section(doc_path, version):

version_info = version.split('.')
if version_info[2] == '0':
branch = '.'.join(version_info[:2]) + '.x Branch'
start = lambda x: x.startswith(branch)
end = lambda x: x.rstrip().endswith('.x Branch')
else:
start = lambda x: x.startswith('Version ' + version)
end = lambda x: x.startswith('Version ')

state, lines = 0, []
with open(doc_path) as f:
for ln in f:
#print state, ln, start(ln), end(ln)
#raw_input('')
if state == 0 and start(ln):
state = 1
elif state == 1 and end(ln):
break
if state:
lines.append(ln)

if version_info[2] == '0':
return ''.join(lines[7:]).rstrip()
else:
return ''.join(lines[3:]).rstrip()

def main(cache, branch, version):

dir = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(dir, EMAIL_TPL)) as f:
tpl = f.read()

print red('Parsing documentation')
changelog_fn = os.path.join(cache, 'branch', branch, 'changelog.rst')
changelog = get_section(changelog_fn, version)

tpl = tpl.replace('%VERSION%', version)
tpl = tpl.replace('%CHANGELOG%', changelog)
print 'Email text:'
print tpl
print 'Send the email to: dev@couchdb.apache.org'

if __name__ == '__main__':

if len(sys.argv) < 2:
print 'Usage: discuss_release.py <cache-dir> <branch> <version>'
sys.exit(0)

if not os.path.isdir(sys.argv[1]):
print 'error: no cache directory'
sys.exit(1)

cache = sys.argv[1]
if len(sys.argv) < 3:
print 'error: no branch'
sys.exit(1)

branch = sys.argv[2]
if len(sys.argv) < 4:
print 'error: no version'
sys.exit(1)

version = sys.argv[3]
main(cache, branch, version)

This file was deleted.

@@ -9,14 +9,10 @@ I would like to propose that we release Apache CouchDB %VERSION%.

The project aims to produce time-based releases. If your favourite feature is not ready for this version, it can be included in the next version. However, if you know of anything that should block the release, please speak up now.

The %VERSION% NEWS entry as it stands:
The %VERSION% changelog as it stands:

%NEWS%
%CHANGELOG%

The %VERSION% CHANGES entry as it stands:

%CHANGES%

Are these accurate? Please double check any work you may have done and make sure that the corresponding NEWS and CHANGES entries are up-to-date.
Are these accurate? Please double check any work you may have done and make sure that the corresponding changelog entries are up-to-date.

Thanks,

0 comments on commit 8b98688

Please sign in to comment.