You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sa...@apache.org on 2016/06/27 20:12:09 UTC
[1/6] lucene-solr:master: Renamed manageRelease.py to
releasedJirasRegex.py, cleaned it up a bit,
fixed a bug (matching JIRAs not at the beginning of bullets),
and added the ability to match older releases' numbered bullets.
Repository: lucene-solr
Updated Branches:
refs/heads/branch_5_5 4ead2c2bd -> 74f9bc9f7
refs/heads/branch_5x 67b31c82a -> 4fd61c62c
refs/heads/branch_6_0 78189c226 -> f814b0a21
refs/heads/branch_6_1 f6b0e1968 -> bc52d4ad7
refs/heads/branch_6x ea344f9c8 -> 240dd35f2
refs/heads/master 1e182d81d -> ac473a9fa
Renamed manageRelease.py to releasedJirasRegex.py, cleaned it up a bit, fixed a bug (matching JIRAs not at the beginning of bullets), and added the ability to match older releases' numbered bullets.
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/ac473a9f
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/ac473a9f
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/ac473a9f
Branch: refs/heads/master
Commit: ac473a9faca6c3356d99816f555c76ee9b60983b
Parents: 1e182d8
Author: Steve Rowe <sa...@apache.org>
Authored: Mon Jun 27 16:10:44 2016 -0400
Committer: Steve Rowe <sa...@apache.org>
Committed: Mon Jun 27 16:10:44 2016 -0400
----------------------------------------------------------------------
dev-tools/scripts/manageRelease.py | 90 ---------------------------
dev-tools/scripts/releasedJirasRegex.py | 92 ++++++++++++++++++++++++++++
2 files changed, 92 insertions(+), 90 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ac473a9f/dev-tools/scripts/manageRelease.py
----------------------------------------------------------------------
diff --git a/dev-tools/scripts/manageRelease.py b/dev-tools/scripts/manageRelease.py
deleted file mode 100644
index 212edd0..0000000
--- a/dev-tools/scripts/manageRelease.py
+++ /dev/null
@@ -1,90 +0,0 @@
-# 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 os
-sys.path.append(os.path.dirname(__file__))
-from scriptutil import *
-import argparse
-import re
-
-# Pulls out all JIRAs mentioned in the given CHANGES.txt filename under the given version
-# and outputs a regular expression that will match all of them
-def print_changes_jira_regex(filename, version):
- release_section_re = re.compile(r'\s*====*\s+(.*)\s+===')
- version_re = re.compile(r'%s(?:$|[^-])' % version)
- bullet_re = re.compile(r'\s*[-*]\s*(.*)')
- issue_list_re = re.compile(r'[:,/()\s]*((?:LUCENE|SOLR)-\d+)')
- more_issues_on_next_line_re = re.compile(r'(?:[:,/()\s]*(?:LUCENE|SOLR)-\d+)+\s*,\s*$') # JIRA list with trailing comma
- under_requested_version = False
- requested_version_found = False
- more_issues_on_next_line = False
- lucene_issues = []
- solr_issues = []
- with open(filename, 'r') as changes:
- for line in changes:
- version_boundary = release_section_re.match(line)
- if version_boundary is not None:
- if under_requested_version:
- break # No longer under the requested version - stop looking for JIRAs
- else:
- if version_re.search(version_boundary.group(1)):
- under_requested_version = True # Start looking for JIRAs
- requested_version_found = True
- else:
- if under_requested_version:
- bullet_match = bullet_re.match(line)
- if more_issues_on_next_line or bullet_match is not None:
- content = bullet_match.group(1) if bullet_match is not None else line
- for issue in issue_list_re.findall(content):
- (lucene_issues if issue.startswith('LUCENE-') else solr_issues).append(issue.rsplit('-', 1)[-1])
- more_issues_on_next_line = more_issues_on_next_line_re.match(content)
- if not requested_version_found:
- raise Exception('Could not find %s in %s' % (version, filename))
- print('\nRegex to match JIRAs in the %s release section in %s:' % (version, filename))
- if len(lucene_issues) > 0:
- print(r'LUCENE-(?:%s)\b' % '|'.join(lucene_issues), end='')
- if len(solr_issues) > 0:
- print('|', end='')
- if len(solr_issues) > 0:
- print(r'SOLR-(?:%s)\b' % '|'.join(solr_issues), end='')
- print()
-
-def read_config():
- parser = argparse.ArgumentParser(description='Tools to help manage a Lucene/Solr release')
- parser.add_argument('version', type=Version.parse, help='Version of the form X.Y.Z')
- c = parser.parse_args()
-
- c.branch_type = find_branch_type()
- c.matching_branch = c.version.is_bugfix_release() and c.branch_type == BranchType.release or \
- c.version.is_minor_release() and c.branch_type == BranchType.stable or \
- c.version.is_major_release() and c.branch_type == BranchType.unstable
-
- print ("branch_type is %s " % c.branch_type)
-
- return c
-
-def main():
- c = read_config()
- # TODO: add other commands to perform, specifiable via cmdline param
- # Right now, only one operation is performed: generate regex matching JIRAs for the given version from CHANGES.txt
- print_changes_jira_regex('lucene/CHANGES.txt', c.version)
- print_changes_jira_regex('solr/CHANGES.txt', c.version)
-
-if __name__ == '__main__':
- try:
- main()
- except KeyboardInterrupt:
- print('\nReceived Ctrl-C, exiting early')
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ac473a9f/dev-tools/scripts/releasedJirasRegex.py
----------------------------------------------------------------------
diff --git a/dev-tools/scripts/releasedJirasRegex.py b/dev-tools/scripts/releasedJirasRegex.py
new file mode 100644
index 0000000..3ed57a5
--- /dev/null
+++ b/dev-tools/scripts/releasedJirasRegex.py
@@ -0,0 +1,92 @@
+# 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 os
+sys.path.append(os.path.dirname(__file__))
+from scriptutil import *
+import argparse
+import re
+
+# Pulls out all JIRAs mentioned at the beginning of bullet items
+# under the given version in the given CHANGES.txt file
+# and prints a regular expression that will match all of them
+#
+# Caveat: only works with modern CHANGES releases that use bullets
+# ('*' or '-') - other list item mechanisms (numbers or letters)
+# are not handled properly.
+def print_released_jiras_regex(version, filename):
+ release_boundary_re = re.compile(r'\s*====*\s+(.*)\s+===')
+ version_re = re.compile(r'%s(?:$|[^-])' % version)
+ bullet_re = re.compile(r'\s*(?:[-*]|\d+\.(?=(?:\s|(?:LUCENE|SOLR)-)))(.*)')
+ jira_ptn = r'(?:LUCENE|SOLR)-\d+'
+ jira_re = re.compile(jira_ptn)
+ jira_list_ptn = r'(?:[:,/()\s]*(?:%s))+' % jira_ptn
+ jira_list_re = re.compile(jira_list_ptn)
+ more_jiras_on_next_line_re = re.compile(r'%s\s*,\s*$' % jira_list_ptn) # JIRA list with trailing comma
+ under_requested_version = False
+ requested_version_found = False
+ more_jiras_on_next_line = False
+ lucene_jiras = []
+ solr_jiras = []
+ with open(filename, 'r') as changes:
+ for line in changes:
+ version_boundary = release_boundary_re.match(line)
+ if version_boundary is not None:
+ if under_requested_version:
+ break # No longer under the requested version - stop looking for JIRAs
+ else:
+ if version_re.search(version_boundary.group(1)):
+ under_requested_version = True # Start looking for JIRAs
+ requested_version_found = True
+ else:
+ if under_requested_version:
+ bullet_match = bullet_re.match(line)
+ if more_jiras_on_next_line or bullet_match is not None:
+ content = line if bullet_match is None else bullet_match.group(1)
+ jira_list_match = jira_list_re.match(content)
+ if jira_list_match is not None:
+ jira_match = jira_re.findall(jira_list_match.group(0))
+ for jira in jira_match:
+ (lucene_jiras if jira.startswith('LUCENE-') else solr_jiras).append(jira.rsplit('-', 1)[-1])
+ more_jiras_on_next_line = more_jiras_on_next_line_re.match(content)
+ if not requested_version_found:
+ raise Exception('Could not find %s in %s' % (version, filename))
+ print()
+ if (len(lucene_jiras) == 0 and len(solr_jiras) == 0):
+ print('(No JIRAs => no regex)', end='')
+ else:
+ if len(lucene_jiras) > 0:
+ print(r'LUCENE-(?:%s)\b%s' % ('|'.join(lucene_jiras), '|' if len(solr_jiras) > 0 else ''), end='')
+ if len(solr_jiras) > 0:
+ print(r'SOLR-(?:%s)\b' % '|'.join(solr_jiras), end='')
+ print()
+
+def read_config():
+ parser = argparse.ArgumentParser(
+ description='Prints a regex matching JIRAs fixed in the given version by parsing the given CHANGES.txt file')
+ parser.add_argument('version', type=Version.parse, help='Version of the form X.Y.Z')
+ parser.add_argument('changes', help='CHANGES.txt file to parse')
+ return parser.parse_args()
+
+def main():
+ config = read_config()
+ print_released_jiras_regex(config.version, config.changes)
+
+if __name__ == '__main__':
+ try:
+ main()
+ except KeyboardInterrupt:
+ print('\nReceived Ctrl-C, exiting early')
[2/6] lucene-solr:branch_6x: Renamed manageRelease.py to
releasedJirasRegex.py, cleaned it up a bit,
fixed a bug (matching JIRAs not at the beginning of bullets),
and added the ability to match older releases' numbered bullets.
Posted by sa...@apache.org.
Renamed manageRelease.py to releasedJirasRegex.py, cleaned it up a bit, fixed a bug (matching JIRAs not at the beginning of bullets), and added the ability to match older releases' numbered bullets.
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/240dd35f
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/240dd35f
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/240dd35f
Branch: refs/heads/branch_6x
Commit: 240dd35f211c01b301f5920db2e55cad4f54379a
Parents: ea344f9
Author: Steve Rowe <sa...@apache.org>
Authored: Mon Jun 27 16:10:44 2016 -0400
Committer: Steve Rowe <sa...@apache.org>
Committed: Mon Jun 27 16:11:20 2016 -0400
----------------------------------------------------------------------
dev-tools/scripts/manageRelease.py | 90 ---------------------------
dev-tools/scripts/releasedJirasRegex.py | 92 ++++++++++++++++++++++++++++
2 files changed, 92 insertions(+), 90 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/240dd35f/dev-tools/scripts/manageRelease.py
----------------------------------------------------------------------
diff --git a/dev-tools/scripts/manageRelease.py b/dev-tools/scripts/manageRelease.py
deleted file mode 100644
index 212edd0..0000000
--- a/dev-tools/scripts/manageRelease.py
+++ /dev/null
@@ -1,90 +0,0 @@
-# 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 os
-sys.path.append(os.path.dirname(__file__))
-from scriptutil import *
-import argparse
-import re
-
-# Pulls out all JIRAs mentioned in the given CHANGES.txt filename under the given version
-# and outputs a regular expression that will match all of them
-def print_changes_jira_regex(filename, version):
- release_section_re = re.compile(r'\s*====*\s+(.*)\s+===')
- version_re = re.compile(r'%s(?:$|[^-])' % version)
- bullet_re = re.compile(r'\s*[-*]\s*(.*)')
- issue_list_re = re.compile(r'[:,/()\s]*((?:LUCENE|SOLR)-\d+)')
- more_issues_on_next_line_re = re.compile(r'(?:[:,/()\s]*(?:LUCENE|SOLR)-\d+)+\s*,\s*$') # JIRA list with trailing comma
- under_requested_version = False
- requested_version_found = False
- more_issues_on_next_line = False
- lucene_issues = []
- solr_issues = []
- with open(filename, 'r') as changes:
- for line in changes:
- version_boundary = release_section_re.match(line)
- if version_boundary is not None:
- if under_requested_version:
- break # No longer under the requested version - stop looking for JIRAs
- else:
- if version_re.search(version_boundary.group(1)):
- under_requested_version = True # Start looking for JIRAs
- requested_version_found = True
- else:
- if under_requested_version:
- bullet_match = bullet_re.match(line)
- if more_issues_on_next_line or bullet_match is not None:
- content = bullet_match.group(1) if bullet_match is not None else line
- for issue in issue_list_re.findall(content):
- (lucene_issues if issue.startswith('LUCENE-') else solr_issues).append(issue.rsplit('-', 1)[-1])
- more_issues_on_next_line = more_issues_on_next_line_re.match(content)
- if not requested_version_found:
- raise Exception('Could not find %s in %s' % (version, filename))
- print('\nRegex to match JIRAs in the %s release section in %s:' % (version, filename))
- if len(lucene_issues) > 0:
- print(r'LUCENE-(?:%s)\b' % '|'.join(lucene_issues), end='')
- if len(solr_issues) > 0:
- print('|', end='')
- if len(solr_issues) > 0:
- print(r'SOLR-(?:%s)\b' % '|'.join(solr_issues), end='')
- print()
-
-def read_config():
- parser = argparse.ArgumentParser(description='Tools to help manage a Lucene/Solr release')
- parser.add_argument('version', type=Version.parse, help='Version of the form X.Y.Z')
- c = parser.parse_args()
-
- c.branch_type = find_branch_type()
- c.matching_branch = c.version.is_bugfix_release() and c.branch_type == BranchType.release or \
- c.version.is_minor_release() and c.branch_type == BranchType.stable or \
- c.version.is_major_release() and c.branch_type == BranchType.unstable
-
- print ("branch_type is %s " % c.branch_type)
-
- return c
-
-def main():
- c = read_config()
- # TODO: add other commands to perform, specifiable via cmdline param
- # Right now, only one operation is performed: generate regex matching JIRAs for the given version from CHANGES.txt
- print_changes_jira_regex('lucene/CHANGES.txt', c.version)
- print_changes_jira_regex('solr/CHANGES.txt', c.version)
-
-if __name__ == '__main__':
- try:
- main()
- except KeyboardInterrupt:
- print('\nReceived Ctrl-C, exiting early')
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/240dd35f/dev-tools/scripts/releasedJirasRegex.py
----------------------------------------------------------------------
diff --git a/dev-tools/scripts/releasedJirasRegex.py b/dev-tools/scripts/releasedJirasRegex.py
new file mode 100644
index 0000000..3ed57a5
--- /dev/null
+++ b/dev-tools/scripts/releasedJirasRegex.py
@@ -0,0 +1,92 @@
+# 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 os
+sys.path.append(os.path.dirname(__file__))
+from scriptutil import *
+import argparse
+import re
+
+# Pulls out all JIRAs mentioned at the beginning of bullet items
+# under the given version in the given CHANGES.txt file
+# and prints a regular expression that will match all of them
+#
+# Caveat: only works with modern CHANGES releases that use bullets
+# ('*' or '-') - other list item mechanisms (numbers or letters)
+# are not handled properly.
+def print_released_jiras_regex(version, filename):
+ release_boundary_re = re.compile(r'\s*====*\s+(.*)\s+===')
+ version_re = re.compile(r'%s(?:$|[^-])' % version)
+ bullet_re = re.compile(r'\s*(?:[-*]|\d+\.(?=(?:\s|(?:LUCENE|SOLR)-)))(.*)')
+ jira_ptn = r'(?:LUCENE|SOLR)-\d+'
+ jira_re = re.compile(jira_ptn)
+ jira_list_ptn = r'(?:[:,/()\s]*(?:%s))+' % jira_ptn
+ jira_list_re = re.compile(jira_list_ptn)
+ more_jiras_on_next_line_re = re.compile(r'%s\s*,\s*$' % jira_list_ptn) # JIRA list with trailing comma
+ under_requested_version = False
+ requested_version_found = False
+ more_jiras_on_next_line = False
+ lucene_jiras = []
+ solr_jiras = []
+ with open(filename, 'r') as changes:
+ for line in changes:
+ version_boundary = release_boundary_re.match(line)
+ if version_boundary is not None:
+ if under_requested_version:
+ break # No longer under the requested version - stop looking for JIRAs
+ else:
+ if version_re.search(version_boundary.group(1)):
+ under_requested_version = True # Start looking for JIRAs
+ requested_version_found = True
+ else:
+ if under_requested_version:
+ bullet_match = bullet_re.match(line)
+ if more_jiras_on_next_line or bullet_match is not None:
+ content = line if bullet_match is None else bullet_match.group(1)
+ jira_list_match = jira_list_re.match(content)
+ if jira_list_match is not None:
+ jira_match = jira_re.findall(jira_list_match.group(0))
+ for jira in jira_match:
+ (lucene_jiras if jira.startswith('LUCENE-') else solr_jiras).append(jira.rsplit('-', 1)[-1])
+ more_jiras_on_next_line = more_jiras_on_next_line_re.match(content)
+ if not requested_version_found:
+ raise Exception('Could not find %s in %s' % (version, filename))
+ print()
+ if (len(lucene_jiras) == 0 and len(solr_jiras) == 0):
+ print('(No JIRAs => no regex)', end='')
+ else:
+ if len(lucene_jiras) > 0:
+ print(r'LUCENE-(?:%s)\b%s' % ('|'.join(lucene_jiras), '|' if len(solr_jiras) > 0 else ''), end='')
+ if len(solr_jiras) > 0:
+ print(r'SOLR-(?:%s)\b' % '|'.join(solr_jiras), end='')
+ print()
+
+def read_config():
+ parser = argparse.ArgumentParser(
+ description='Prints a regex matching JIRAs fixed in the given version by parsing the given CHANGES.txt file')
+ parser.add_argument('version', type=Version.parse, help='Version of the form X.Y.Z')
+ parser.add_argument('changes', help='CHANGES.txt file to parse')
+ return parser.parse_args()
+
+def main():
+ config = read_config()
+ print_released_jiras_regex(config.version, config.changes)
+
+if __name__ == '__main__':
+ try:
+ main()
+ except KeyboardInterrupt:
+ print('\nReceived Ctrl-C, exiting early')
[4/6] lucene-solr:branch_6_0: Renamed manageRelease.py to
releasedJirasRegex.py, cleaned it up a bit,
fixed a bug (matching JIRAs not at the beginning of bullets),
and added the ability to match older releases' numbered bullets.
Posted by sa...@apache.org.
Renamed manageRelease.py to releasedJirasRegex.py, cleaned it up a bit, fixed a bug (matching JIRAs not at the beginning of bullets), and added the ability to match older releases' numbered bullets.
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/f814b0a2
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/f814b0a2
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/f814b0a2
Branch: refs/heads/branch_6_0
Commit: f814b0a21615254f5794977c80bbe7735b1ae54b
Parents: 78189c2
Author: Steve Rowe <sa...@apache.org>
Authored: Mon Jun 27 16:10:44 2016 -0400
Committer: Steve Rowe <sa...@apache.org>
Committed: Mon Jun 27 16:11:39 2016 -0400
----------------------------------------------------------------------
dev-tools/scripts/manageRelease.py | 90 ---------------------------
dev-tools/scripts/releasedJirasRegex.py | 92 ++++++++++++++++++++++++++++
2 files changed, 92 insertions(+), 90 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f814b0a2/dev-tools/scripts/manageRelease.py
----------------------------------------------------------------------
diff --git a/dev-tools/scripts/manageRelease.py b/dev-tools/scripts/manageRelease.py
deleted file mode 100644
index 212edd0..0000000
--- a/dev-tools/scripts/manageRelease.py
+++ /dev/null
@@ -1,90 +0,0 @@
-# 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 os
-sys.path.append(os.path.dirname(__file__))
-from scriptutil import *
-import argparse
-import re
-
-# Pulls out all JIRAs mentioned in the given CHANGES.txt filename under the given version
-# and outputs a regular expression that will match all of them
-def print_changes_jira_regex(filename, version):
- release_section_re = re.compile(r'\s*====*\s+(.*)\s+===')
- version_re = re.compile(r'%s(?:$|[^-])' % version)
- bullet_re = re.compile(r'\s*[-*]\s*(.*)')
- issue_list_re = re.compile(r'[:,/()\s]*((?:LUCENE|SOLR)-\d+)')
- more_issues_on_next_line_re = re.compile(r'(?:[:,/()\s]*(?:LUCENE|SOLR)-\d+)+\s*,\s*$') # JIRA list with trailing comma
- under_requested_version = False
- requested_version_found = False
- more_issues_on_next_line = False
- lucene_issues = []
- solr_issues = []
- with open(filename, 'r') as changes:
- for line in changes:
- version_boundary = release_section_re.match(line)
- if version_boundary is not None:
- if under_requested_version:
- break # No longer under the requested version - stop looking for JIRAs
- else:
- if version_re.search(version_boundary.group(1)):
- under_requested_version = True # Start looking for JIRAs
- requested_version_found = True
- else:
- if under_requested_version:
- bullet_match = bullet_re.match(line)
- if more_issues_on_next_line or bullet_match is not None:
- content = bullet_match.group(1) if bullet_match is not None else line
- for issue in issue_list_re.findall(content):
- (lucene_issues if issue.startswith('LUCENE-') else solr_issues).append(issue.rsplit('-', 1)[-1])
- more_issues_on_next_line = more_issues_on_next_line_re.match(content)
- if not requested_version_found:
- raise Exception('Could not find %s in %s' % (version, filename))
- print('\nRegex to match JIRAs in the %s release section in %s:' % (version, filename))
- if len(lucene_issues) > 0:
- print(r'LUCENE-(?:%s)\b' % '|'.join(lucene_issues), end='')
- if len(solr_issues) > 0:
- print('|', end='')
- if len(solr_issues) > 0:
- print(r'SOLR-(?:%s)\b' % '|'.join(solr_issues), end='')
- print()
-
-def read_config():
- parser = argparse.ArgumentParser(description='Tools to help manage a Lucene/Solr release')
- parser.add_argument('version', type=Version.parse, help='Version of the form X.Y.Z')
- c = parser.parse_args()
-
- c.branch_type = find_branch_type()
- c.matching_branch = c.version.is_bugfix_release() and c.branch_type == BranchType.release or \
- c.version.is_minor_release() and c.branch_type == BranchType.stable or \
- c.version.is_major_release() and c.branch_type == BranchType.unstable
-
- print ("branch_type is %s " % c.branch_type)
-
- return c
-
-def main():
- c = read_config()
- # TODO: add other commands to perform, specifiable via cmdline param
- # Right now, only one operation is performed: generate regex matching JIRAs for the given version from CHANGES.txt
- print_changes_jira_regex('lucene/CHANGES.txt', c.version)
- print_changes_jira_regex('solr/CHANGES.txt', c.version)
-
-if __name__ == '__main__':
- try:
- main()
- except KeyboardInterrupt:
- print('\nReceived Ctrl-C, exiting early')
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f814b0a2/dev-tools/scripts/releasedJirasRegex.py
----------------------------------------------------------------------
diff --git a/dev-tools/scripts/releasedJirasRegex.py b/dev-tools/scripts/releasedJirasRegex.py
new file mode 100644
index 0000000..3ed57a5
--- /dev/null
+++ b/dev-tools/scripts/releasedJirasRegex.py
@@ -0,0 +1,92 @@
+# 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 os
+sys.path.append(os.path.dirname(__file__))
+from scriptutil import *
+import argparse
+import re
+
+# Pulls out all JIRAs mentioned at the beginning of bullet items
+# under the given version in the given CHANGES.txt file
+# and prints a regular expression that will match all of them
+#
+# Caveat: only works with modern CHANGES releases that use bullets
+# ('*' or '-') - other list item mechanisms (numbers or letters)
+# are not handled properly.
+def print_released_jiras_regex(version, filename):
+ release_boundary_re = re.compile(r'\s*====*\s+(.*)\s+===')
+ version_re = re.compile(r'%s(?:$|[^-])' % version)
+ bullet_re = re.compile(r'\s*(?:[-*]|\d+\.(?=(?:\s|(?:LUCENE|SOLR)-)))(.*)')
+ jira_ptn = r'(?:LUCENE|SOLR)-\d+'
+ jira_re = re.compile(jira_ptn)
+ jira_list_ptn = r'(?:[:,/()\s]*(?:%s))+' % jira_ptn
+ jira_list_re = re.compile(jira_list_ptn)
+ more_jiras_on_next_line_re = re.compile(r'%s\s*,\s*$' % jira_list_ptn) # JIRA list with trailing comma
+ under_requested_version = False
+ requested_version_found = False
+ more_jiras_on_next_line = False
+ lucene_jiras = []
+ solr_jiras = []
+ with open(filename, 'r') as changes:
+ for line in changes:
+ version_boundary = release_boundary_re.match(line)
+ if version_boundary is not None:
+ if under_requested_version:
+ break # No longer under the requested version - stop looking for JIRAs
+ else:
+ if version_re.search(version_boundary.group(1)):
+ under_requested_version = True # Start looking for JIRAs
+ requested_version_found = True
+ else:
+ if under_requested_version:
+ bullet_match = bullet_re.match(line)
+ if more_jiras_on_next_line or bullet_match is not None:
+ content = line if bullet_match is None else bullet_match.group(1)
+ jira_list_match = jira_list_re.match(content)
+ if jira_list_match is not None:
+ jira_match = jira_re.findall(jira_list_match.group(0))
+ for jira in jira_match:
+ (lucene_jiras if jira.startswith('LUCENE-') else solr_jiras).append(jira.rsplit('-', 1)[-1])
+ more_jiras_on_next_line = more_jiras_on_next_line_re.match(content)
+ if not requested_version_found:
+ raise Exception('Could not find %s in %s' % (version, filename))
+ print()
+ if (len(lucene_jiras) == 0 and len(solr_jiras) == 0):
+ print('(No JIRAs => no regex)', end='')
+ else:
+ if len(lucene_jiras) > 0:
+ print(r'LUCENE-(?:%s)\b%s' % ('|'.join(lucene_jiras), '|' if len(solr_jiras) > 0 else ''), end='')
+ if len(solr_jiras) > 0:
+ print(r'SOLR-(?:%s)\b' % '|'.join(solr_jiras), end='')
+ print()
+
+def read_config():
+ parser = argparse.ArgumentParser(
+ description='Prints a regex matching JIRAs fixed in the given version by parsing the given CHANGES.txt file')
+ parser.add_argument('version', type=Version.parse, help='Version of the form X.Y.Z')
+ parser.add_argument('changes', help='CHANGES.txt file to parse')
+ return parser.parse_args()
+
+def main():
+ config = read_config()
+ print_released_jiras_regex(config.version, config.changes)
+
+if __name__ == '__main__':
+ try:
+ main()
+ except KeyboardInterrupt:
+ print('\nReceived Ctrl-C, exiting early')
[5/6] lucene-solr:branch_5x: Renamed manageRelease.py to
releasedJirasRegex.py, cleaned it up a bit,
fixed a bug (matching JIRAs not at the beginning of bullets),
and added the ability to match older releases' numbered bullets.
Posted by sa...@apache.org.
Renamed manageRelease.py to releasedJirasRegex.py, cleaned it up a bit, fixed a bug (matching JIRAs not at the beginning of bullets), and added the ability to match older releases' numbered bullets.
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/4fd61c62
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/4fd61c62
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/4fd61c62
Branch: refs/heads/branch_5x
Commit: 4fd61c62c5cf4161220f2684d095a1659a42bce7
Parents: 67b31c8
Author: Steve Rowe <sa...@apache.org>
Authored: Mon Jun 27 16:10:44 2016 -0400
Committer: Steve Rowe <sa...@apache.org>
Committed: Mon Jun 27 16:11:50 2016 -0400
----------------------------------------------------------------------
dev-tools/scripts/manageRelease.py | 90 ---------------------------
dev-tools/scripts/releasedJirasRegex.py | 92 ++++++++++++++++++++++++++++
2 files changed, 92 insertions(+), 90 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4fd61c62/dev-tools/scripts/manageRelease.py
----------------------------------------------------------------------
diff --git a/dev-tools/scripts/manageRelease.py b/dev-tools/scripts/manageRelease.py
deleted file mode 100644
index 212edd0..0000000
--- a/dev-tools/scripts/manageRelease.py
+++ /dev/null
@@ -1,90 +0,0 @@
-# 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 os
-sys.path.append(os.path.dirname(__file__))
-from scriptutil import *
-import argparse
-import re
-
-# Pulls out all JIRAs mentioned in the given CHANGES.txt filename under the given version
-# and outputs a regular expression that will match all of them
-def print_changes_jira_regex(filename, version):
- release_section_re = re.compile(r'\s*====*\s+(.*)\s+===')
- version_re = re.compile(r'%s(?:$|[^-])' % version)
- bullet_re = re.compile(r'\s*[-*]\s*(.*)')
- issue_list_re = re.compile(r'[:,/()\s]*((?:LUCENE|SOLR)-\d+)')
- more_issues_on_next_line_re = re.compile(r'(?:[:,/()\s]*(?:LUCENE|SOLR)-\d+)+\s*,\s*$') # JIRA list with trailing comma
- under_requested_version = False
- requested_version_found = False
- more_issues_on_next_line = False
- lucene_issues = []
- solr_issues = []
- with open(filename, 'r') as changes:
- for line in changes:
- version_boundary = release_section_re.match(line)
- if version_boundary is not None:
- if under_requested_version:
- break # No longer under the requested version - stop looking for JIRAs
- else:
- if version_re.search(version_boundary.group(1)):
- under_requested_version = True # Start looking for JIRAs
- requested_version_found = True
- else:
- if under_requested_version:
- bullet_match = bullet_re.match(line)
- if more_issues_on_next_line or bullet_match is not None:
- content = bullet_match.group(1) if bullet_match is not None else line
- for issue in issue_list_re.findall(content):
- (lucene_issues if issue.startswith('LUCENE-') else solr_issues).append(issue.rsplit('-', 1)[-1])
- more_issues_on_next_line = more_issues_on_next_line_re.match(content)
- if not requested_version_found:
- raise Exception('Could not find %s in %s' % (version, filename))
- print('\nRegex to match JIRAs in the %s release section in %s:' % (version, filename))
- if len(lucene_issues) > 0:
- print(r'LUCENE-(?:%s)\b' % '|'.join(lucene_issues), end='')
- if len(solr_issues) > 0:
- print('|', end='')
- if len(solr_issues) > 0:
- print(r'SOLR-(?:%s)\b' % '|'.join(solr_issues), end='')
- print()
-
-def read_config():
- parser = argparse.ArgumentParser(description='Tools to help manage a Lucene/Solr release')
- parser.add_argument('version', type=Version.parse, help='Version of the form X.Y.Z')
- c = parser.parse_args()
-
- c.branch_type = find_branch_type()
- c.matching_branch = c.version.is_bugfix_release() and c.branch_type == BranchType.release or \
- c.version.is_minor_release() and c.branch_type == BranchType.stable or \
- c.version.is_major_release() and c.branch_type == BranchType.unstable
-
- print ("branch_type is %s " % c.branch_type)
-
- return c
-
-def main():
- c = read_config()
- # TODO: add other commands to perform, specifiable via cmdline param
- # Right now, only one operation is performed: generate regex matching JIRAs for the given version from CHANGES.txt
- print_changes_jira_regex('lucene/CHANGES.txt', c.version)
- print_changes_jira_regex('solr/CHANGES.txt', c.version)
-
-if __name__ == '__main__':
- try:
- main()
- except KeyboardInterrupt:
- print('\nReceived Ctrl-C, exiting early')
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/4fd61c62/dev-tools/scripts/releasedJirasRegex.py
----------------------------------------------------------------------
diff --git a/dev-tools/scripts/releasedJirasRegex.py b/dev-tools/scripts/releasedJirasRegex.py
new file mode 100644
index 0000000..3ed57a5
--- /dev/null
+++ b/dev-tools/scripts/releasedJirasRegex.py
@@ -0,0 +1,92 @@
+# 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 os
+sys.path.append(os.path.dirname(__file__))
+from scriptutil import *
+import argparse
+import re
+
+# Pulls out all JIRAs mentioned at the beginning of bullet items
+# under the given version in the given CHANGES.txt file
+# and prints a regular expression that will match all of them
+#
+# Caveat: only works with modern CHANGES releases that use bullets
+# ('*' or '-') - other list item mechanisms (numbers or letters)
+# are not handled properly.
+def print_released_jiras_regex(version, filename):
+ release_boundary_re = re.compile(r'\s*====*\s+(.*)\s+===')
+ version_re = re.compile(r'%s(?:$|[^-])' % version)
+ bullet_re = re.compile(r'\s*(?:[-*]|\d+\.(?=(?:\s|(?:LUCENE|SOLR)-)))(.*)')
+ jira_ptn = r'(?:LUCENE|SOLR)-\d+'
+ jira_re = re.compile(jira_ptn)
+ jira_list_ptn = r'(?:[:,/()\s]*(?:%s))+' % jira_ptn
+ jira_list_re = re.compile(jira_list_ptn)
+ more_jiras_on_next_line_re = re.compile(r'%s\s*,\s*$' % jira_list_ptn) # JIRA list with trailing comma
+ under_requested_version = False
+ requested_version_found = False
+ more_jiras_on_next_line = False
+ lucene_jiras = []
+ solr_jiras = []
+ with open(filename, 'r') as changes:
+ for line in changes:
+ version_boundary = release_boundary_re.match(line)
+ if version_boundary is not None:
+ if under_requested_version:
+ break # No longer under the requested version - stop looking for JIRAs
+ else:
+ if version_re.search(version_boundary.group(1)):
+ under_requested_version = True # Start looking for JIRAs
+ requested_version_found = True
+ else:
+ if under_requested_version:
+ bullet_match = bullet_re.match(line)
+ if more_jiras_on_next_line or bullet_match is not None:
+ content = line if bullet_match is None else bullet_match.group(1)
+ jira_list_match = jira_list_re.match(content)
+ if jira_list_match is not None:
+ jira_match = jira_re.findall(jira_list_match.group(0))
+ for jira in jira_match:
+ (lucene_jiras if jira.startswith('LUCENE-') else solr_jiras).append(jira.rsplit('-', 1)[-1])
+ more_jiras_on_next_line = more_jiras_on_next_line_re.match(content)
+ if not requested_version_found:
+ raise Exception('Could not find %s in %s' % (version, filename))
+ print()
+ if (len(lucene_jiras) == 0 and len(solr_jiras) == 0):
+ print('(No JIRAs => no regex)', end='')
+ else:
+ if len(lucene_jiras) > 0:
+ print(r'LUCENE-(?:%s)\b%s' % ('|'.join(lucene_jiras), '|' if len(solr_jiras) > 0 else ''), end='')
+ if len(solr_jiras) > 0:
+ print(r'SOLR-(?:%s)\b' % '|'.join(solr_jiras), end='')
+ print()
+
+def read_config():
+ parser = argparse.ArgumentParser(
+ description='Prints a regex matching JIRAs fixed in the given version by parsing the given CHANGES.txt file')
+ parser.add_argument('version', type=Version.parse, help='Version of the form X.Y.Z')
+ parser.add_argument('changes', help='CHANGES.txt file to parse')
+ return parser.parse_args()
+
+def main():
+ config = read_config()
+ print_released_jiras_regex(config.version, config.changes)
+
+if __name__ == '__main__':
+ try:
+ main()
+ except KeyboardInterrupt:
+ print('\nReceived Ctrl-C, exiting early')
[6/6] lucene-solr:branch_5_5: Renamed manageRelease.py to
releasedJirasRegex.py, cleaned it up a bit,
fixed a bug (matching JIRAs not at the beginning of bullets),
and added the ability to match older releases' numbered bullets.
Posted by sa...@apache.org.
Renamed manageRelease.py to releasedJirasRegex.py, cleaned it up a bit, fixed a bug (matching JIRAs not at the beginning of bullets), and added the ability to match older releases' numbered bullets.
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/74f9bc9f
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/74f9bc9f
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/74f9bc9f
Branch: refs/heads/branch_5_5
Commit: 74f9bc9f7d028e072c05a86188133c3e1ae62a45
Parents: 4ead2c2
Author: Steve Rowe <sa...@apache.org>
Authored: Mon Jun 27 16:10:44 2016 -0400
Committer: Steve Rowe <sa...@apache.org>
Committed: Mon Jun 27 16:11:57 2016 -0400
----------------------------------------------------------------------
dev-tools/scripts/releasedJirasRegex.py | 92 ++++++++++++++++++++++++++++
1 file changed, 92 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/74f9bc9f/dev-tools/scripts/releasedJirasRegex.py
----------------------------------------------------------------------
diff --git a/dev-tools/scripts/releasedJirasRegex.py b/dev-tools/scripts/releasedJirasRegex.py
new file mode 100644
index 0000000..3ed57a5
--- /dev/null
+++ b/dev-tools/scripts/releasedJirasRegex.py
@@ -0,0 +1,92 @@
+# 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 os
+sys.path.append(os.path.dirname(__file__))
+from scriptutil import *
+import argparse
+import re
+
+# Pulls out all JIRAs mentioned at the beginning of bullet items
+# under the given version in the given CHANGES.txt file
+# and prints a regular expression that will match all of them
+#
+# Caveat: only works with modern CHANGES releases that use bullets
+# ('*' or '-') - other list item mechanisms (numbers or letters)
+# are not handled properly.
+def print_released_jiras_regex(version, filename):
+ release_boundary_re = re.compile(r'\s*====*\s+(.*)\s+===')
+ version_re = re.compile(r'%s(?:$|[^-])' % version)
+ bullet_re = re.compile(r'\s*(?:[-*]|\d+\.(?=(?:\s|(?:LUCENE|SOLR)-)))(.*)')
+ jira_ptn = r'(?:LUCENE|SOLR)-\d+'
+ jira_re = re.compile(jira_ptn)
+ jira_list_ptn = r'(?:[:,/()\s]*(?:%s))+' % jira_ptn
+ jira_list_re = re.compile(jira_list_ptn)
+ more_jiras_on_next_line_re = re.compile(r'%s\s*,\s*$' % jira_list_ptn) # JIRA list with trailing comma
+ under_requested_version = False
+ requested_version_found = False
+ more_jiras_on_next_line = False
+ lucene_jiras = []
+ solr_jiras = []
+ with open(filename, 'r') as changes:
+ for line in changes:
+ version_boundary = release_boundary_re.match(line)
+ if version_boundary is not None:
+ if under_requested_version:
+ break # No longer under the requested version - stop looking for JIRAs
+ else:
+ if version_re.search(version_boundary.group(1)):
+ under_requested_version = True # Start looking for JIRAs
+ requested_version_found = True
+ else:
+ if under_requested_version:
+ bullet_match = bullet_re.match(line)
+ if more_jiras_on_next_line or bullet_match is not None:
+ content = line if bullet_match is None else bullet_match.group(1)
+ jira_list_match = jira_list_re.match(content)
+ if jira_list_match is not None:
+ jira_match = jira_re.findall(jira_list_match.group(0))
+ for jira in jira_match:
+ (lucene_jiras if jira.startswith('LUCENE-') else solr_jiras).append(jira.rsplit('-', 1)[-1])
+ more_jiras_on_next_line = more_jiras_on_next_line_re.match(content)
+ if not requested_version_found:
+ raise Exception('Could not find %s in %s' % (version, filename))
+ print()
+ if (len(lucene_jiras) == 0 and len(solr_jiras) == 0):
+ print('(No JIRAs => no regex)', end='')
+ else:
+ if len(lucene_jiras) > 0:
+ print(r'LUCENE-(?:%s)\b%s' % ('|'.join(lucene_jiras), '|' if len(solr_jiras) > 0 else ''), end='')
+ if len(solr_jiras) > 0:
+ print(r'SOLR-(?:%s)\b' % '|'.join(solr_jiras), end='')
+ print()
+
+def read_config():
+ parser = argparse.ArgumentParser(
+ description='Prints a regex matching JIRAs fixed in the given version by parsing the given CHANGES.txt file')
+ parser.add_argument('version', type=Version.parse, help='Version of the form X.Y.Z')
+ parser.add_argument('changes', help='CHANGES.txt file to parse')
+ return parser.parse_args()
+
+def main():
+ config = read_config()
+ print_released_jiras_regex(config.version, config.changes)
+
+if __name__ == '__main__':
+ try:
+ main()
+ except KeyboardInterrupt:
+ print('\nReceived Ctrl-C, exiting early')
[3/6] lucene-solr:branch_6_1: Renamed manageRelease.py to
releasedJirasRegex.py, cleaned it up a bit,
fixed a bug (matching JIRAs not at the beginning of bullets),
and added the ability to match older releases' numbered bullets.
Posted by sa...@apache.org.
Renamed manageRelease.py to releasedJirasRegex.py, cleaned it up a bit, fixed a bug (matching JIRAs not at the beginning of bullets), and added the ability to match older releases' numbered bullets.
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/bc52d4ad
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/bc52d4ad
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/bc52d4ad
Branch: refs/heads/branch_6_1
Commit: bc52d4ad7aa41104f47289c180db4dfa5af67167
Parents: f6b0e19
Author: Steve Rowe <sa...@apache.org>
Authored: Mon Jun 27 16:10:44 2016 -0400
Committer: Steve Rowe <sa...@apache.org>
Committed: Mon Jun 27 16:11:30 2016 -0400
----------------------------------------------------------------------
dev-tools/scripts/manageRelease.py | 90 ---------------------------
dev-tools/scripts/releasedJirasRegex.py | 92 ++++++++++++++++++++++++++++
2 files changed, 92 insertions(+), 90 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/bc52d4ad/dev-tools/scripts/manageRelease.py
----------------------------------------------------------------------
diff --git a/dev-tools/scripts/manageRelease.py b/dev-tools/scripts/manageRelease.py
deleted file mode 100644
index 212edd0..0000000
--- a/dev-tools/scripts/manageRelease.py
+++ /dev/null
@@ -1,90 +0,0 @@
-# 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 os
-sys.path.append(os.path.dirname(__file__))
-from scriptutil import *
-import argparse
-import re
-
-# Pulls out all JIRAs mentioned in the given CHANGES.txt filename under the given version
-# and outputs a regular expression that will match all of them
-def print_changes_jira_regex(filename, version):
- release_section_re = re.compile(r'\s*====*\s+(.*)\s+===')
- version_re = re.compile(r'%s(?:$|[^-])' % version)
- bullet_re = re.compile(r'\s*[-*]\s*(.*)')
- issue_list_re = re.compile(r'[:,/()\s]*((?:LUCENE|SOLR)-\d+)')
- more_issues_on_next_line_re = re.compile(r'(?:[:,/()\s]*(?:LUCENE|SOLR)-\d+)+\s*,\s*$') # JIRA list with trailing comma
- under_requested_version = False
- requested_version_found = False
- more_issues_on_next_line = False
- lucene_issues = []
- solr_issues = []
- with open(filename, 'r') as changes:
- for line in changes:
- version_boundary = release_section_re.match(line)
- if version_boundary is not None:
- if under_requested_version:
- break # No longer under the requested version - stop looking for JIRAs
- else:
- if version_re.search(version_boundary.group(1)):
- under_requested_version = True # Start looking for JIRAs
- requested_version_found = True
- else:
- if under_requested_version:
- bullet_match = bullet_re.match(line)
- if more_issues_on_next_line or bullet_match is not None:
- content = bullet_match.group(1) if bullet_match is not None else line
- for issue in issue_list_re.findall(content):
- (lucene_issues if issue.startswith('LUCENE-') else solr_issues).append(issue.rsplit('-', 1)[-1])
- more_issues_on_next_line = more_issues_on_next_line_re.match(content)
- if not requested_version_found:
- raise Exception('Could not find %s in %s' % (version, filename))
- print('\nRegex to match JIRAs in the %s release section in %s:' % (version, filename))
- if len(lucene_issues) > 0:
- print(r'LUCENE-(?:%s)\b' % '|'.join(lucene_issues), end='')
- if len(solr_issues) > 0:
- print('|', end='')
- if len(solr_issues) > 0:
- print(r'SOLR-(?:%s)\b' % '|'.join(solr_issues), end='')
- print()
-
-def read_config():
- parser = argparse.ArgumentParser(description='Tools to help manage a Lucene/Solr release')
- parser.add_argument('version', type=Version.parse, help='Version of the form X.Y.Z')
- c = parser.parse_args()
-
- c.branch_type = find_branch_type()
- c.matching_branch = c.version.is_bugfix_release() and c.branch_type == BranchType.release or \
- c.version.is_minor_release() and c.branch_type == BranchType.stable or \
- c.version.is_major_release() and c.branch_type == BranchType.unstable
-
- print ("branch_type is %s " % c.branch_type)
-
- return c
-
-def main():
- c = read_config()
- # TODO: add other commands to perform, specifiable via cmdline param
- # Right now, only one operation is performed: generate regex matching JIRAs for the given version from CHANGES.txt
- print_changes_jira_regex('lucene/CHANGES.txt', c.version)
- print_changes_jira_regex('solr/CHANGES.txt', c.version)
-
-if __name__ == '__main__':
- try:
- main()
- except KeyboardInterrupt:
- print('\nReceived Ctrl-C, exiting early')
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/bc52d4ad/dev-tools/scripts/releasedJirasRegex.py
----------------------------------------------------------------------
diff --git a/dev-tools/scripts/releasedJirasRegex.py b/dev-tools/scripts/releasedJirasRegex.py
new file mode 100644
index 0000000..3ed57a5
--- /dev/null
+++ b/dev-tools/scripts/releasedJirasRegex.py
@@ -0,0 +1,92 @@
+# 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 os
+sys.path.append(os.path.dirname(__file__))
+from scriptutil import *
+import argparse
+import re
+
+# Pulls out all JIRAs mentioned at the beginning of bullet items
+# under the given version in the given CHANGES.txt file
+# and prints a regular expression that will match all of them
+#
+# Caveat: only works with modern CHANGES releases that use bullets
+# ('*' or '-') - other list item mechanisms (numbers or letters)
+# are not handled properly.
+def print_released_jiras_regex(version, filename):
+ release_boundary_re = re.compile(r'\s*====*\s+(.*)\s+===')
+ version_re = re.compile(r'%s(?:$|[^-])' % version)
+ bullet_re = re.compile(r'\s*(?:[-*]|\d+\.(?=(?:\s|(?:LUCENE|SOLR)-)))(.*)')
+ jira_ptn = r'(?:LUCENE|SOLR)-\d+'
+ jira_re = re.compile(jira_ptn)
+ jira_list_ptn = r'(?:[:,/()\s]*(?:%s))+' % jira_ptn
+ jira_list_re = re.compile(jira_list_ptn)
+ more_jiras_on_next_line_re = re.compile(r'%s\s*,\s*$' % jira_list_ptn) # JIRA list with trailing comma
+ under_requested_version = False
+ requested_version_found = False
+ more_jiras_on_next_line = False
+ lucene_jiras = []
+ solr_jiras = []
+ with open(filename, 'r') as changes:
+ for line in changes:
+ version_boundary = release_boundary_re.match(line)
+ if version_boundary is not None:
+ if under_requested_version:
+ break # No longer under the requested version - stop looking for JIRAs
+ else:
+ if version_re.search(version_boundary.group(1)):
+ under_requested_version = True # Start looking for JIRAs
+ requested_version_found = True
+ else:
+ if under_requested_version:
+ bullet_match = bullet_re.match(line)
+ if more_jiras_on_next_line or bullet_match is not None:
+ content = line if bullet_match is None else bullet_match.group(1)
+ jira_list_match = jira_list_re.match(content)
+ if jira_list_match is not None:
+ jira_match = jira_re.findall(jira_list_match.group(0))
+ for jira in jira_match:
+ (lucene_jiras if jira.startswith('LUCENE-') else solr_jiras).append(jira.rsplit('-', 1)[-1])
+ more_jiras_on_next_line = more_jiras_on_next_line_re.match(content)
+ if not requested_version_found:
+ raise Exception('Could not find %s in %s' % (version, filename))
+ print()
+ if (len(lucene_jiras) == 0 and len(solr_jiras) == 0):
+ print('(No JIRAs => no regex)', end='')
+ else:
+ if len(lucene_jiras) > 0:
+ print(r'LUCENE-(?:%s)\b%s' % ('|'.join(lucene_jiras), '|' if len(solr_jiras) > 0 else ''), end='')
+ if len(solr_jiras) > 0:
+ print(r'SOLR-(?:%s)\b' % '|'.join(solr_jiras), end='')
+ print()
+
+def read_config():
+ parser = argparse.ArgumentParser(
+ description='Prints a regex matching JIRAs fixed in the given version by parsing the given CHANGES.txt file')
+ parser.add_argument('version', type=Version.parse, help='Version of the form X.Y.Z')
+ parser.add_argument('changes', help='CHANGES.txt file to parse')
+ return parser.parse_args()
+
+def main():
+ config = read_config()
+ print_released_jiras_regex(config.version, config.changes)
+
+if __name__ == '__main__':
+ try:
+ main()
+ except KeyboardInterrupt:
+ print('\nReceived Ctrl-C, exiting early')