summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Laska <jlaska@redhat.com>2011-04-21 16:38:27 -0400
committerJames Laska <jlaska@redhat.com>2011-04-21 16:38:27 -0400
commit930e6545a06ca6e987a3a72d0191fe63a8dc085d (patch)
tree43445172596e743cdbac38018d897d044ce0290c
parent5623a7202766d27dbd99d9af5c82715b37c8d92d (diff)
downloadscripts-930e6545a06ca6e987a3a72d0191fe63a8dc085d.tar.gz
scripts-930e6545a06ca6e987a3a72d0191fe63a8dc085d.tar.xz
scripts-930e6545a06ca6e987a3a72d0191fe63a8dc085d.zip
Ignore bugs with keyword:Tracking. Attempt to find additional dependencies.
-rwxr-xr-xupdate-blocker-wiki71
1 files changed, 57 insertions, 14 deletions
diff --git a/update-blocker-wiki b/update-blocker-wiki
index ec88197..7892ec2 100755
--- a/update-blocker-wiki
+++ b/update-blocker-wiki
@@ -5,6 +5,7 @@ import sys
import locale
import optparse
import re
+import copy
from getpass import getpass
try:
@@ -30,9 +31,9 @@ BLOCKER_PROPOSED = {'status_whiteboard': 'AcceptedBlocker RejectedBlocker',
# NTH query values
NTH_ACCEPTED = {'status_whiteboard': 'AcceptedNTH',
- 'status_whiteboard_type': 'anywords'}
+ 'status_whiteboard_type': 'anywords'}
NTH_PROPOSED = {'status_whiteboard': 'AcceptedNTH RejectedNTH',
- 'status_whiteboard_type': 'nowords'}
+ 'status_whiteboard_type': 'nowords'}
COOKIE_FILE = os.path.join(os.environ.get('HOME','/tmp'), '.fedora_cookiefile')
@@ -123,6 +124,36 @@ def parse_args():
return opts
+def flatten_bug_list(query_args, max_depth=4):
+ buglist = bz.query(query_args)
+
+ # avoid endless recursion
+ if max_depth <= 0:
+ return buglist
+
+ # find any additional dependencies
+ new_deps = list()
+ for b in buglist:
+ if len(b.dependson) > 0:
+ new_deps.append(b.bug_id)
+
+ # Remove any duplicates
+ existing_deps = {int(bug):True for bug in query_args['value0-0-0'].split()}.keys()
+ new_deps = {bug:True for bug in new_deps}.keys()
+
+ # Ignore anything already being tracked
+ copy_new_deps = copy.deepcopy(new_deps)
+ for bug in copy_new_deps:
+ if bug in existing_deps:
+ new_deps.remove(bug)
+
+ if len(new_deps) > 0:
+ query_args['value0-0-0'] = ' '.join([str(bug) for bug in existing_deps]) + ' ' + ' '.join([str(bug) for bug in new_deps])
+ if opts.verbose: print ' additional dependencies: %s' % ' '.join([str(bug) for bug in new_deps])
+ return flatten_bug_list(query_args, max_depth-1)
+
+ return buglist
+
if __name__ == '__main__':
opts = parse_args()
@@ -139,38 +170,38 @@ if __name__ == '__main__':
# Get a list of accepted blocker bugs
if opts.verbose: print 'Querying accepted blocker bugs ...'
q = {'bug_status': BUG_STATUS,
- 'value0-0-0': opts.blocker,
- 'type0-0-0': 'substring',
+ 'value0-0-0': str(opts.blocker),
+ 'type0-0-0': 'anywords',
'field0-0-0': 'blocked'}
q.update(BLOCKER_ACCEPTED)
- accepted_blockers = bz.query(q)
+ accepted_blockers = flatten_bug_list(q)
# Get a list of proposed blocker bugs
if opts.verbose: print 'Querying proposed blocker bugs ...'
q = {'bug_status': BUG_STATUS,
- 'value0-0-0': opts.blocker,
- 'type0-0-0': 'substring',
+ 'value0-0-0': str(opts.blocker),
+ 'type0-0-0': 'anywords',
'field0-0-0': 'blocked'}
q.update(BLOCKER_PROPOSED)
- proposed_blockers = bz.query(q)
+ proposed_blockers = flatten_bug_list(q)
# Get a list of accepted NTH bugs
if opts.verbose: print 'Querying accepted nice-to-have bugs ...'
q = {'bug_status': BUG_STATUS,
- 'value0-0-0': opts.nth,
- 'type0-0-0': 'substring',
+ 'value0-0-0': str(opts.nth),
+ 'type0-0-0': 'anywords',
'field0-0-0': 'blocked'}
q.update(NTH_ACCEPTED)
- accepted_nths = bz.query(q)
+ accepted_nths = flatten_bug_list(q)
# Get a list of proposed NTH bugs
if opts.verbose: print 'Querying proposed nice-to-have bugs ...'
q = {'bug_status': BUG_STATUS,
- 'value0-0-0': opts.nth,
- 'type0-0-0': 'substring',
+ 'value0-0-0': str(opts.nth),
+ 'type0-0-0': 'anywords',
'field0-0-0': 'blocked'}
q.update(NTH_PROPOSED)
- proposed_nths = bz.query(q)
+ proposed_nths = flatten_bug_list(q)
# Organize bugs for later reference
if opts.verbose: print 'Organizing bugs ...'
@@ -179,6 +210,9 @@ if __name__ == '__main__':
# walk accepted blockers
accepted_blocker_by_component = dict()
for b in accepted_blockers:
+ # Skip Tracking bugs
+ if 'Tracking' in b.keywords:
+ continue
if not accepted_blocker_by_component.has_key(b.component):
accepted_blocker_by_component[b.component] = list()
accepted_blocker_by_component[b.component].append(b.bug_id)
@@ -187,6 +221,9 @@ if __name__ == '__main__':
# walk proposed blockers
proposed_blocker_by_component = dict()
for b in proposed_blockers:
+ # Skip Tracking bugs
+ if 'Tracking' in b.keywords:
+ continue
if not proposed_blocker_by_component.has_key(b.component):
proposed_blocker_by_component[b.component] = list()
proposed_blocker_by_component[b.component].append(b.bug_id)
@@ -195,6 +232,9 @@ if __name__ == '__main__':
# walk accepted nths
accepted_nth_by_component = dict()
for b in accepted_nths:
+ # Skip Tracking bugs
+ if 'Tracking' in b.keywords:
+ continue
if not accepted_nth_by_component.has_key(b.component):
accepted_nth_by_component[b.component] = list()
accepted_nth_by_component[b.component].append(b.bug_id)
@@ -203,6 +243,9 @@ if __name__ == '__main__':
# walk proposed nths
proposed_nth_by_component = dict()
for b in proposed_nths:
+ # Skip Tracking bugs
+ if 'Tracking' in b.keywords:
+ continue
if not proposed_nth_by_component.has_key(b.component):
proposed_nth_by_component[b.component] = list()
proposed_nth_by_component[b.component].append(b.bug_id)