From 62db74b621cfa2c9bf00938371fc1dcccb7fd492 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Fri, 12 Feb 2016 21:29:19 +0000 Subject: filter-active: Show all releases by default, using columnar format Add support for showing multiple releases, with status truncated to 20 characters. Show the release names as column headings. When filtering by state, include all issues where any release has a state that should be included. Make the -r option truly optional, and default to showing all releases found in any issue. git-svn-id: svn+ssh://svn.debian.org/svn/kernel-sec@4154 e094ebfe-e918-0410-adfb-c712417f3574 --- scripts/filter-active.py | 44 +++++++++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 11 deletions(-) (limited to 'scripts') diff --git a/scripts/filter-active.py b/scripts/filter-active.py index 18c19e43..4fb599f0 100755 --- a/scripts/filter-active.py +++ b/scripts/filter-active.py @@ -72,24 +72,26 @@ def parse_status(s): else: return m -def filter_out_states(issues, release, states): +def filter_out_states(issues, releases, states): filteredissues = [] for i in issues: - m = parse_status(i.status(release)) - drop = False - for s in states: - if s == m.group('state'): - drop = True + for release in releases or i.get_releases(): + m = parse_status(i.status(release)) + drop = False + for s in states: + if s == m.group('state'): + drop = True + break + if drop == False: + filteredissues.append(i) break - if drop == False: - filteredissues.append(i) return filteredissues if __name__ == '__main__': parser = OptionParser() parser.add_option("-d", "--dirs", action="append") - parser.add_option("-r", "--release", dest="release") + parser.add_option("-r", "--release", action="append") parser.add_option("-s", "--states", action="append") parser.add_option("-n", "--notstates", action="append") @@ -108,6 +110,26 @@ if __name__ == '__main__': if options.notstates: issues = filter_out_states(issues, options.release, options.notstates) + if not options.release: + all_releases = set() + for i in issues: + all_releases |= set(i.get_releases()) + options.release = sorted(list(all_releases)) + + if len(options.release) == 1: + min_width = 0 + max_width = 1000 + else: + min_width = 20 + max_width = 20 + sys.stdout.write(" ") + for release in options.release: + sys.stdout.write(" %-20.20s " % release) + sys.stdout.write("\n") + for i in issues: - sys.stdout.write(" %s: %s\n" % (i.name, - i.status(options.release) or "unknown")) + sys.stdout.write(" %s:" % i.name) + for release in options.release: + sys.stdout.write(" %-*.*s " % + (min_width, max_width, i.status(release) or "unknown")) + sys.stdout.write("\n") -- cgit v1.2.3