[#6422] Update CHANGES in release script
Signed-off-by: Cory Johns <cjohns@slashdotmedia.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/f4a63acb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/f4a63acb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/f4a63acb
Branch: refs/heads/cj/6422
Commit: f4a63acbd8c1e9697f0313f58087230d9879ee80
Parents: f4c60af
Author: Cory Johns <cjohns@slashdotmedia.com>
Authored: Wed Oct 9 12:46:19 2013 +0000
Committer: Cory Johns <cjohns@slashdotmedia.com>
Committed: Wed Oct 9 12:47:32 2013 +0000
----------------------------------------------------------------------
scripts/asf-release.sh | 29 ++++++++++++++++--
scripts/changelog.py | 71 +++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 98 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f4a63acb/scripts/asf-release.sh
----------------------------------------------------------------------
diff --git a/scripts/asf-release.sh b/scripts/asf-release.sh
index 616cd87..f31a57d 100755
--- a/scripts/asf-release.sh
+++ b/scripts/asf-release.sh
@@ -1,5 +1,22 @@
#!/bin/bash
+# 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
+#
+# 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.
+
function prompt() {
ivar="$1"
prompt_str="$2: "
@@ -24,6 +41,14 @@ RELEASE_FILE=$RELEASE_DIR/$RELEASE_BASE.tar.gz
RELEASE_TAG=asf_release_$VERSION
CLOSE_DATE=`date -d '+72 hours' +%F`
+scripts/changelog.py asf_release_$PREV_VERSION HEAD $VERSION > .changelog.tmp
+echo >> .changelog.tmp
+cat CHANGES >> .changelog.tmp
+mv -f .changelog.tmp CHANGES
+prompt DUMMY "Changelog updated; press enter when ready to commit" "enter"
+git add CHANGES
+git commit -m "CHANGES updated for ASF release $VERSION"
+
DEFAULT_KEY=`grep default-key ~/.gnupg/gpg.conf | sed -e 's/default-key //'`
if [[ -z "$DEFAULT_KEY" ]]; then
DEFAULT_KEY=`gpg --list-secret-keys | head -3 | tail -1 | sed -e 's/^.*\///' | sed -e
's/ .*//'`
@@ -38,7 +63,6 @@ prompt VOTE_THREAD_URL "URL for allura-dev VOTE thread"
prompt DISCUSS_THREAD_URL "URL for allura-dev DISCUSS thread"
prompt RAT_LOG_PASTEBIN_URL "URL for RAT log pastebin"
-
git tag $RELEASE_TAG
COMMIT_SHA=`git rev-parse $RELEASE_TAG`
@@ -50,7 +74,8 @@ MD5_CHECKSUM=`md5sum $RELEASE_FILE` ; echo $MD5_CHECKSUM > $RELEASE_FILE.md5
SHA1_CHECKSUM=`shasum -a1 $RELEASE_FILE` ; echo $SHA1_CHECKSUM > $RELEASE_FILE.sha1
SHA512_CHECKSUM=`shasum -a512 $RELEASE_FILE` ; echo $SHA512_CHECKSUM > $RELEASE_FILE.sha512
-#git push origin asf_release_$VERSION
+#git push
+#git push --tags
echo "Release is ready at: $RELEASE_DIR"
echo "Once confirmed, push release tag with: git push origin asf_release_$VERSION"
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/f4a63acb/scripts/changelog.py
----------------------------------------------------------------------
diff --git a/scripts/changelog.py b/scripts/changelog.py
new file mode 100755
index 0000000..02eabd0
--- /dev/null
+++ b/scripts/changelog.py
@@ -0,0 +1,71 @@
+#!/usr/bin/env python
+
+# 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
+#
+# 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.
+
+import sys
+import re
+import git
+import requests
+from datetime import datetime
+
+
+CHANGELOG = 'CHANGES'
+API_URL = 'http://sourceforge.net/rest/p/allura/tickets/{0}'
+
+
+def main():
+ from_ref, to_ref, version = get_versions()
+ tickets = get_tickets(from_ref, to_ref)
+ summaries = get_ticket_summaries(tickets)
+ print_changelog(version, summaries)
+
+
+def get_versions():
+ return sys.argv[1], sys.argv[2], sys.argv[3]
+
+def get_tickets(from_ref, to_ref):
+ repo = git.Repo('.')
+ ticket_nums = set()
+ ref_spec = '..'.join([from_ref, to_ref])
+ for commit in repo.iter_commits(ref_spec):
+ match = re.match(r'\s*\[#([^]]*)\]', commit.summary)
+ if match:
+ ticket_nums.add(match.group(1))
+ return list(ticket_nums)
+
+def get_ticket_summaries(tickets):
+ summaries = {}
+ for ticket in tickets:
+ r = requests.get(API_URL.format(ticket))
+ if r.status_code == 401:
+ continue # skip private tickets
+ if r.status_code != 200:
+ raise ValueError('Unexpected response code: {}'.format(r.status_code))
+ summaries[ticket] = r.json()['ticket']['summary']
+ return summaries
+
+def print_changelog(version, summaries):
+ print 'Version {version} ({date})\n'.format(**{
+ 'version': version,
+ 'date': datetime.utcnow().strftime('%B %Y'),
+ })
+ for ticket in sorted(summaries.keys()):
+ print " * [#{0}] {1}".format(ticket, summaries[ticket])
+
+if __name__ == '__main__':
+ main()
|