Added tool to filter out bugs of specified importance
Some LP bugs are not really bugs, in a sense that they are actual features required. Those fixes are not applicable for stable backports, and hence should be ignored when determining candidates for stable branches. Also, for some older stable branches, we may want to filter out those bugs that do not satisfy importance criteria [e.g. for stable/kilo we require that only High+ bugs are to be backported]. This script is useful if you already have a list of bugs to consider for backports. F.e. you can generate the list with bugs-fixed-since.py tool. Common use case would be: ./bugs-fixed-since.py --start=<prev-hash> | ./lp-filter-bugs-by-importance.py neutron That would give you the list of bug numbers that were fixed in neutron master since <prev-hash> and that are not of Wishlist importance. Change-Id: I07e8d50b826aff35df2c2360d09bf029c036b070
This commit is contained in:
parent
d336f4133c
commit
0e91182780
24
README.rst
24
README.rst
|
@ -888,3 +888,27 @@ List bugs mentioned in master commit messages starting from a specified commit.
|
|||
Example::
|
||||
|
||||
./bugs-fixed-since.py -r ../neutron --start=8.0.0
|
||||
|
||||
|
||||
lp-filter-bugs-by-importance.py
|
||||
-------------------------------
|
||||
|
||||
Reads the list of Launchpad bug numbers on stdin and filters out those of
|
||||
importance specified. Filtering out Wishlist bugs if importance not specified.
|
||||
|
||||
Example::
|
||||
|
||||
./bugs-fixed-since.py --start=8.0.0 | \
|
||||
./lp-filter-bugs-by-importance.py neutron
|
||||
|
||||
List bugs that are fixed in master since 8.0.0 that are not of Wishlist
|
||||
importance.
|
||||
|
||||
Example::
|
||||
|
||||
./bugs-fixed-since.py --start=8.0.0 | \
|
||||
./lp-filter-bugs-by-importance.py neutron | \
|
||||
./lp-filter-bugs-by-importance.py neutron --importance Low
|
||||
|
||||
List bugs that are fixed in master since 8.0.0 that are not of Wishlist or Low
|
||||
importance.
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
#!/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 Launchpad tool is used to filter out bugs of specified importance.
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import sys
|
||||
|
||||
from launchpadlib.launchpad import Launchpad
|
||||
|
||||
|
||||
VALID_IMPORTANCES = ('Undecided', 'Wishlist', 'Low', 'Normal', 'High', 'Critical')
|
||||
|
||||
|
||||
def _parse_args():
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Filter out bugs of specified importance.')
|
||||
parser.add_argument(
|
||||
'project', help='Launchpad project name')
|
||||
parser.add_argument(
|
||||
'--importance',
|
||||
nargs='?', choices=VALID_IMPORTANCES, default='Wishlist',
|
||||
help='Bug importance to filter')
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def _filter_bugs(lp, project, importance, bugs):
|
||||
return [
|
||||
bug
|
||||
for bug in bugs
|
||||
for task in lp.bugs[bug].bug_tasks
|
||||
if task.bug_target_name == project and task.importance != importance
|
||||
]
|
||||
|
||||
|
||||
def main():
|
||||
args = _parse_args()
|
||||
|
||||
lp = Launchpad.login_with('openstack-releasing', 'production')
|
||||
|
||||
bugs = [line.strip() for line in sys.stdin.readlines()]
|
||||
for bug in _filter_bugs(lp, args.project, args.importance, bugs):
|
||||
print(bug)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Loading…
Reference in New Issue