couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject git commit: Replace discuss_release.sh with discuss_release.py, works with changelog.rst.
Date Wed, 31 Jul 2013 15:25:38 GMT
Updated Branches:
  refs/heads/master 72852311c -> 8b986880e


Replace discuss_release.sh with discuss_release.py, works with changelog.rst.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-admin/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-admin/commit/8b986880
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-admin/tree/8b986880
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-admin/diff/8b986880

Branch: refs/heads/master
Commit: 8b986880ef7813ea67a93abe02d73b5d86289265
Parents: 7285231
Author: Dirkjan Ochtman <dirkjan@ochtman.nl>
Authored: Wed Jul 31 17:25:15 2013 +0200
Committer: Dirkjan Ochtman <dirkjan@ochtman.nl>
Committed: Wed Jul 31 17:25:15 2013 +0200

----------------------------------------------------------------------
 email/discuss_release.py  |  94 ++++++++++++++++++++++++++++++++++++
 email/discuss_release.sh  | 107 -----------------------------------------
 email/discuss_release.txt |  10 ++--
 3 files changed, 97 insertions(+), 114 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-admin/blob/8b986880/email/discuss_release.py
----------------------------------------------------------------------
diff --git a/email/discuss_release.py b/email/discuss_release.py
new file mode 100755
index 0000000..875ba36
--- /dev/null
+++ b/email/discuss_release.py
@@ -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)

http://git-wip-us.apache.org/repos/asf/couchdb-admin/blob/8b986880/email/discuss_release.sh
----------------------------------------------------------------------
diff --git a/email/discuss_release.sh b/email/discuss_release.sh
deleted file mode 100755
index 2db7d71..0000000
--- a/email/discuss_release.sh
+++ /dev/null
@@ -1,107 +0,0 @@
-#!/bin/sh -e
-
-# 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
-
-GIT_URL="https://git-wip-us.apache.org/repos/asf?p=couchdb.git;a=blob_plain;"
-
-EMAIL_TPL=discuss_release.txt
-
-if test -n "$1"; then
-    cache_dir=$1
-else
-	echo "error: no cache directory"
-    exit 1
-fi
-
-if test -n "$2"; then
-    branch=$2
-else
-	echo "error: no branch"
-    exit 1
-fi
-
-if test -n "$3"; then
-    version=$3
-else
-	echo "error: no version"
-    exit 1
-fi
-
-log () {
-    printf "\033[1;31m$1\033[0m\n"
-}
-
-cd `dirname $0`
-
-basename=`basename $0`
-
-tmp_dir=`mktemp -d /tmp/$basename.XXXXXX` || exit 1
-
-log "Parsing documentation..."
-
-email_in_file=$tmp_dir/email.txt.in
-
-cat $EMAIL_TPL > $email_in_file
-
-python <<EOF
-def get_section(doc_path, version):
-    doc_file = open(doc_path)
-    copy = False
-    section = ""
-    for line in doc_file.readlines():
-        if line.startswith("Version"):
-            if line == "Version $version\n":
-                copy = True
-                continue
-            else:
-                if copy:
-                    break
-        if line.startswith("-"):
-            continue
-        if copy:
-            if line.strip():
-                section += line
-    return section.rstrip()
-
-news = get_section("$cache_dir/branch/$branch/NEWS", "$version")
-
-email_in_file = open("$email_in_file")
-
-email_in_file_content = email_in_file.read()
-
-email_in_file_content = email_in_file_content.replace("%NEWS%", news)
-
-email_in_file = open("$email_in_file", "w")
-
-email_in_file.write(email_in_file_content)
-EOF
-
-email_file=$tmp_dir/email.txt
-
-changes=$GIT_URL"\&f=CHANGES;hb=$branch"
-
-sed -e "s|%VERSION%|$version|g" \
-    -e "s|%CHANGES%|$changes|g" \
-    < $email_in_file > $email_file
-
-echo "Email text written to:" $email_file
-
-echo "Send the email to: dev@couchdb.apache.org"
-
-echo "Files in: $tmp_dir"

http://git-wip-us.apache.org/repos/asf/couchdb-admin/blob/8b986880/email/discuss_release.txt
----------------------------------------------------------------------
diff --git a/email/discuss_release.txt b/email/discuss_release.txt
index a44204a..ef7c979 100644
--- a/email/discuss_release.txt
+++ b/email/discuss_release.txt
@@ -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,


Mime
View raw message