arrow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From w...@apache.org
Subject arrow git commit: ARROW-1351: Update CHANGELOG.md in 00-prepare.sh when creating release candidate
Date Thu, 31 Aug 2017 00:45:30 GMT
Repository: arrow
Updated Branches:
  refs/heads/master 6b391f0d7 -> 78c952d2e


ARROW-1351: Update CHANGELOG.md in 00-prepare.sh when creating release candidate

This will ensure the updated changelog is part of source releases

Author: Wes McKinney <wes.mckinney@twosigma.com>

Closes #1018 from wesm/ARROW-1351 and squashes the following commits:

9d60e367 [Wes McKinney] Add today's date after version with US / English month names
5b4b0764 [Wes McKinney] Update CHANGELOG.md in 00-prepare.sh when creating release candidate


Project: http://git-wip-us.apache.org/repos/asf/arrow/repo
Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/78c952d2
Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/78c952d2
Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/78c952d2

Branch: refs/heads/master
Commit: 78c952d2ec97862efe28c9666a4ff37a70ab78c0
Parents: 6b391f0
Author: Wes McKinney <wes.mckinney@twosigma.com>
Authored: Wed Aug 30 20:45:25 2017 -0400
Committer: Wes McKinney <wes.mckinney@twosigma.com>
Committed: Wed Aug 30 20:45:25 2017 -0400

----------------------------------------------------------------------
 dev/make_changelog.py           | 117 --------------------------
 dev/release/00-prepare.sh       |   9 +-
 dev/release/changelog.py        | 159 +++++++++++++++++++++++++++++++++++
 dev/release/update-changelog.sh |  31 +++++++
 4 files changed, 196 insertions(+), 120 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/arrow/blob/78c952d2/dev/make_changelog.py
----------------------------------------------------------------------
diff --git a/dev/make_changelog.py b/dev/make_changelog.py
deleted file mode 100644
index b4b0070..0000000
--- a/dev/make_changelog.py
+++ /dev/null
@@ -1,117 +0,0 @@
-#!/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.
-#
-
-# Utility for generating changelogs for fix versions
-# requirements: pip install jira
-# Set $JIRA_USERNAME, $JIRA_PASSWORD environment variables
-
-from collections import defaultdict
-from io import StringIO
-import os
-import sys
-
-import jira.client
-
-# ASF JIRA username
-JIRA_USERNAME = os.environ.get("JIRA_USERNAME")
-# ASF JIRA password
-JIRA_PASSWORD = os.environ.get("JIRA_PASSWORD")
-
-JIRA_API_BASE = "https://issues.apache.org/jira"
-
-asf_jira = jira.client.JIRA({'server': JIRA_API_BASE},
-                            basic_auth=(JIRA_USERNAME, JIRA_PASSWORD))
-
-
-def get_issues_for_version(version):
-    jql = ("project=ARROW "
-           "AND fixVersion='{0}' "
-           "AND status = Resolved "
-           "AND resolution in (Fixed, Done) "
-           "ORDER BY issuetype DESC").format(version)
-
-    return asf_jira.search_issues(jql, maxResults=9999)
-
-
-LINK_TEMPLATE = '[{0}](https://issues.apache.org/jira/browse/{0})'
-
-
-def format_changelog_markdown(issues, out):
-    issues_by_type = defaultdict(list)
-    for issue in issues:
-        issues_by_type[issue.fields.issuetype.name].append(issue)
-
-    for issue_type, issue_group in sorted(issues_by_type.items()):
-        issue_group.sort(key=lambda x: x.key)
-
-        out.write('## {0}\n\n'.format(issue_type))
-        for issue in issue_group:
-            out.write('* {0} - {1}\n'.format(issue.key,
-                                             issue.fields.summary))
-        out.write('\n')
-
-
-def format_changelog_website(issues, out):
-    NEW_FEATURE = 'New Features and Improvements'
-    BUGFIX = 'Bug Fixes'
-
-    CATEGORIES = {
-        'New Feature': NEW_FEATURE,
-        'Improvement': NEW_FEATURE,
-        'Wish': NEW_FEATURE,
-        'Task': NEW_FEATURE,
-        'Test': NEW_FEATURE,
-        'Bug': BUGFIX
-    }
-
-    issues_by_category = defaultdict(list)
-    for issue in issues:
-        issue_type = issue.fields.issuetype.name
-        website_category = CATEGORIES[issue_type]
-        issues_by_category[website_category].append(issue)
-
-    WEBSITE_ORDER = [NEW_FEATURE, BUGFIX]
-
-    for issue_category in WEBSITE_ORDER:
-        issue_group = issues_by_category[issue_category]
-        issue_group.sort(key=lambda x: x.key)
-
-        out.write('## {0}\n\n'.format(issue_category))
-        for issue in issue_group:
-            name = LINK_TEMPLATE.format(issue.key)
-            out.write('* {0} - {1}\n'.format(name, issue.fields.summary))
-        out.write('\n')
-
-
-if __name__ == '__main__':
-    if len(sys.argv) < 2:
-        print('Usage: make_changelog.py $FIX_VERSION [$IS_WEBSITE]')
-
-    buf = StringIO()
-
-    for_website = len(sys.argv) > 2 and sys.argv[2] == '1'
-
-    issues_for_version = get_issues_for_version(sys.argv[1])
-
-    if for_website:
-        format_changelog_website(issues_for_version, buf)
-    else:
-        format_changelog_markdown(issues_for_version, buf)
-
-    print(buf.getvalue())

http://git-wip-us.apache.org/repos/asf/arrow/blob/78c952d2/dev/release/00-prepare.sh
----------------------------------------------------------------------
diff --git a/dev/release/00-prepare.sh b/dev/release/00-prepare.sh
index c8d7909..6dc3be1 100644
--- a/dev/release/00-prepare.sh
+++ b/dev/release/00-prepare.sh
@@ -27,7 +27,11 @@ if [ "$#" -eq 2 ]; then
   nextVersionSNAPSHOT=${nextVersion}-SNAPSHOT
   tag=apache-arrow-${version}
 
-  echo "prepare release ${version} rc ${rcnum} on tag ${tag} then reset to version ${nextVersionSNAPSHOT}"

+  echo "Updating changelog for $version"
+  # Update changelog
+  $SOURCE_DIR/update-changelog.sh $version
+
+  echo "prepare release ${version} rc ${rcnum} on tag ${tag} then reset to version ${nextVersionSNAPSHOT}"
 
   cd "${SOURCE_DIR}/../../java"
 
@@ -38,8 +42,7 @@ if [ "$#" -eq 2 ]; then
 
   echo "Finish staging binary artifacts by running: sh dev/release/01-perform.sh"
 
-else  
+else
   echo "Usage: $0 <version> <nextVersion>"
   exit
 fi
-

http://git-wip-us.apache.org/repos/asf/arrow/blob/78c952d2/dev/release/changelog.py
----------------------------------------------------------------------
diff --git a/dev/release/changelog.py b/dev/release/changelog.py
new file mode 100644
index 0000000..6588150
--- /dev/null
+++ b/dev/release/changelog.py
@@ -0,0 +1,159 @@
+#!/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.
+#
+
+# Utility for generating changelogs for fix versions
+# requirements: pip install jira
+# Set $JIRA_USERNAME, $JIRA_PASSWORD environment variables
+
+from __future__ import print_function
+
+from collections import defaultdict
+from datetime import datetime
+from io import StringIO
+import locale
+import os
+import sys
+
+import jira.client
+
+# ASF JIRA username
+JIRA_USERNAME = os.environ.get("JIRA_USERNAME")
+# ASF JIRA password
+JIRA_PASSWORD = os.environ.get("JIRA_PASSWORD")
+
+JIRA_API_BASE = "https://issues.apache.org/jira"
+
+asf_jira = jira.client.JIRA({'server': JIRA_API_BASE},
+                            basic_auth=(JIRA_USERNAME, JIRA_PASSWORD))
+
+
+locale.setlocale(locale.LC_ALL, 'en_US.utf8')
+
+
+def get_issues_for_version(version):
+    jql = ("project=ARROW "
+           "AND fixVersion='{0}' "
+           "AND status = Resolved "
+           "AND resolution in (Fixed, Done) "
+           "ORDER BY issuetype DESC").format(version)
+
+    return asf_jira.search_issues(jql, maxResults=9999)
+
+
+LINK_TEMPLATE = '[{0}](https://issues.apache.org/jira/browse/{0})'
+
+
+def format_changelog_markdown(issues, out):
+    issues_by_type = defaultdict(list)
+    for issue in issues:
+        issues_by_type[issue.fields.issuetype.name].append(issue)
+
+    for issue_type, issue_group in sorted(issues_by_type.items()):
+        issue_group.sort(key=lambda x: x.key)
+
+        out.write('## {0}\n\n'.format(issue_type))
+        for issue in issue_group:
+            out.write('* {0} - {1}\n'.format(issue.key,
+                                             issue.fields.summary))
+        out.write('\n')
+
+
+def format_changelog_website(issues, out):
+    NEW_FEATURE = 'New Features and Improvements'
+    BUGFIX = 'Bug Fixes'
+
+    CATEGORIES = {
+        'New Feature': NEW_FEATURE,
+        'Improvement': NEW_FEATURE,
+        'Wish': NEW_FEATURE,
+        'Task': NEW_FEATURE,
+        'Test': NEW_FEATURE,
+        'Bug': BUGFIX
+    }
+
+    issues_by_category = defaultdict(list)
+    for issue in issues:
+        issue_type = issue.fields.issuetype.name
+        website_category = CATEGORIES[issue_type]
+        issues_by_category[website_category].append(issue)
+
+    WEBSITE_ORDER = [NEW_FEATURE, BUGFIX]
+
+    for issue_category in WEBSITE_ORDER:
+        issue_group = issues_by_category[issue_category]
+        issue_group.sort(key=lambda x: x.key)
+
+        out.write('## {0}\n\n'.format(issue_category))
+        for issue in issue_group:
+            name = LINK_TEMPLATE.format(issue.key)
+            out.write('* {0} - {1}\n'.format(name, issue.fields.summary))
+        out.write('\n')
+
+
+def get_changelog(version, for_website=False):
+    issues_for_version = get_issues_for_version(version)
+
+    buf = StringIO()
+
+    if for_website:
+        format_changelog_website(issues_for_version, buf)
+    else:
+        format_changelog_markdown(issues_for_version, buf)
+
+    return buf.getvalue()
+
+
+def append_changelog(version, changelog_path):
+    new_changelog = get_changelog(version)
+
+    with open(changelog_path, 'r') as f:
+        old_changelog = f.readlines()
+
+    result = StringIO()
+    # Header
+    print(''.join(old_changelog[:18]), file=result)
+
+    # New version
+    today = datetime.today().strftime('%d %B %Y')
+    print('# Apache Arrow {0} ({1})'.format(version, today),
+          end='', file=result)
+    print('\n', file=result)
+    print(new_changelog.replace('_', '\_'),
+          end='', file=result)
+
+    # Prior versions
+    print(''.join(old_changelog[19:]), file=result)
+
+    with open(changelog_path, 'w') as f:
+        f.write(result.getvalue())
+
+
+if __name__ == '__main__':
+    if len(sys.argv) < 2:
+        print('Usage: changelog.py $FIX_VERSION [$IS_WEBSITE] '
+              '[$CHANGELOG_TO_UPDATE]')
+
+    for_website = len(sys.argv) > 2 and sys.argv[2] == '1'
+
+    version = sys.argv[1]
+    if len(sys.argv) > 3:
+        changelog_path = sys.argv[3]
+        append_changelog(version, changelog_path)
+    else:
+        print(get_changelog(version, for_website=for_website))

http://git-wip-us.apache.org/repos/asf/arrow/blob/78c952d2/dev/release/update-changelog.sh
----------------------------------------------------------------------
diff --git a/dev/release/update-changelog.sh b/dev/release/update-changelog.sh
new file mode 100755
index 0000000..d47c906
--- /dev/null
+++ b/dev/release/update-changelog.sh
@@ -0,0 +1,31 @@
+#!/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.
+#
+set -e
+
+SOURCE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
+version=$1
+
+CHANGELOG=$SOURCE_DIR/../../CHANGELOG.md
+
+python $SOURCE_DIR/changelog.py $version 0 $CHANGELOG
+
+git add $CHANGELOG
+git commit -m "[Release] Update CHANGELOG.md for $version"


Mime
View raw message