From 927e8117674a080eb744b284f2962a174f082a3c Mon Sep 17 00:00:00 2001 From: Mattia Rizzolo Date: Sun, 28 Jun 2015 17:56:05 +0000 Subject: reproducible: html_notes: also clean up old issues page --- bin/reproducible_html_notes.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/bin/reproducible_html_notes.py b/bin/reproducible_html_notes.py index 51a0c990..5776c3de 100755 --- a/bin/reproducible_html_notes.py +++ b/bin/reproducible_html_notes.py @@ -299,6 +299,7 @@ def gen_html_issue(issue, suite): affected_pkgs=affected, suite=suite, suite_links=suite_links) + def purge_old_notes(notes): removed_pages = [] to_rebuild = [] @@ -324,6 +325,23 @@ def purge_old_notes(notes): gen_packages_html(to_rebuild) +def purge_old_issues(issues): + for root, dirs, files in os.walk(ISSUES_PATH): + if not files: + continue + for file in files: + try: + issue = file.rsplit('_', 1)[0] + except ValueError: + log.critical('/'.join([root, file]) + ' does not seems like ' + + 'a file that should be there') + sys.exit(1) + if issue not in issues: + log.warning('removing ' + '/'.join([root, file]) + '...') + #os.remove('/'.join([root, file])) + log.warning('\t not removing for real now, please enable this') + + def iterate_over_notes(notes): num_notes = str(len(notes)) i = 0 @@ -413,6 +431,7 @@ if __name__ == '__main__': iterate_over_issues(issues) index_issues(issues) purge_old_notes(notes) + purge_old_issues(issues) gen_packages_html(notes) # regenerate all rb-pkg/ pages for suite in SUITES: for arch in ARCHES: -- cgit v1.2.3-70-g09d2