From 36284dea9d632483bc3c61a5734252acd8c86534 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Mon, 29 Feb 2016 19:10:55 +0000 Subject: Implement the -s option to filter-active.py It's existed since day 1. Never had any effect. git-svn-id: svn+ssh://svn.debian.org/svn/kernel-sec@4209 e094ebfe-e918-0410-adfb-c712417f3574 --- scripts/filter-active.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'scripts') diff --git a/scripts/filter-active.py b/scripts/filter-active.py index ca2b166b..de7ca541 100755 --- a/scripts/filter-active.py +++ b/scripts/filter-active.py @@ -72,17 +72,15 @@ def parse_status(s): else: return m -def filter_out_states(issues, releases, states): +def filter_out_states(issues, releases, states, notstates): filteredissues = [] for i in issues: for release in releases or i.get_releases(): + # Current state must be within 'states' (if specified), and + # must not be within 'notstates' (if specified). m = parse_status(i.status(release)) - drop = False - for s in states: - if s == m.group('state'): - drop = True - break - if drop == False: + if ((m.group('state') in states if states else True) and + (m.group('state') not in notstates if notstates else True)): filteredissues.append(i) break @@ -128,8 +126,9 @@ if __name__ == '__main__': for d in options.dirs: issues = issues + get_issues(d) - if options.notstates: - issues = filter_out_states(issues, options.release, options.notstates) + if options.states or options.notstates: + issues = filter_out_states(issues, options.release, + options.states, options.notstates) if not options.release: all_releases = set() -- cgit v1.2.3