diff options
author | Mattia Rizzolo <mattia@mapreri.org> | 2015-01-08 14:18:00 +0100 |
---|---|---|
committer | Holger Levsen <holger@layer-acht.org> | 2015-01-08 16:42:15 +0100 |
commit | baa89efdfcbdb4e1e108862d96d79be13f5cf114 (patch) | |
tree | 2a404bafb2a0e0b907ba382308e3ab5296fdb4bc /bin | |
parent | d49f21c35b4da0125f70d378ca70b8aa67c17e41 (diff) | |
download | jenkins.debian.net-baa89efdfcbdb4e1e108862d96d79be13f5cf114.tar.xz |
reproducible: reproducible_html_notes.py: add purge_old_notes()
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/reproducible_html_notes.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/bin/reproducible_html_notes.py b/bin/reproducible_html_notes.py index 28081ffa..e7b28d07 100755 --- a/bin/reproducible_html_notes.py +++ b/bin/reproducible_html_notes.py @@ -170,6 +170,16 @@ def gen_html_issue(issue): return issue_html.substitute(issue=issue, urls=url, description=desc, affected_pkgs=affected) + +def purge_old_notes(notes): + presents = os.listdir(NOTES_PATH) + for page in presents: + pkg = page.rsplit('_')[0] + log.debug('checking if ' + page + ' (from ' + pkg + ') is still needed') + if pkg not in notes: + log.info('There are no notes for ' + pkg + '. Removing old page.') + os.remove(NOTES_PATH + '/' + page) + def iterate_over_notes(notes): num_notes = str(len(notes)) i = 0 @@ -226,4 +236,4 @@ if __name__ == '__main__': iterate_over_notes(notes) iterate_over_issues(issues) index_issues(issues) - + purge_old_notes(notes) |