incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [10/10] git commit: [#6422] Update CHANGES in release script
Date Wed, 09 Oct 2013 15:24:57 GMT
[#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/99ae2e0e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/99ae2e0e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/99ae2e0e

Branch: refs/heads/master
Commit: 99ae2e0e0ee71f2b74d1aaa18ac6dd5e728d84f4
Parents: 50edc75
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 15:24:26 2013 +0000

----------------------------------------------------------------------
 scripts/asf-release.sh | 32 +++++++++++++++++---
 scripts/changelog.py   | 71 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 99 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/99ae2e0e/scripts/asf-release.sh
----------------------------------------------------------------------
diff --git a/scripts/asf-release.sh b/scripts/asf-release.sh
index 616cd87..d26e6f4 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,10 +74,10 @@ 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
-
 echo "Release is ready at: $RELEASE_DIR"
-echo "Once confirmed, push release tag with: git push origin asf_release_$VERSION"
+echo "Once confirmed, push the CHANGES commit and release tag with:"
+echo "    git push"
+echo "    git push --tags"
 echo "Then upload the files and signatures, and post the following:"
 echo "-------------------------------------------------------------"
 echo "Subject: [VOTE] Release of Apache Allura $VERSION (incubating)"

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/99ae2e0e/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()


Mime
View raw message