From: Julien Cristau Date: Wed, 18 May 2016 13:38:47 +0000 (+0200) Subject: generate_releases: expire by-hash files for all suites X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=d6f184c345b49d95274f245c78d0a7976dcbc115;p=dak.git generate_releases: expire by-hash files for all suites When setting suite.byhash to false, the suite's existing hashfiles need to be marked as unreferenced so they can be cleaned up. Signed-off-by: Julien Cristau --- diff --git a/dak/generate_releases.py b/dak/generate_releases.py index 34103f72..ae3577f3 100755 --- a/dak/generate_releases.py +++ b/dak/generate_releases.py @@ -362,12 +362,12 @@ class ReleaseWriter(object): out.close() os.rename(outfile + '.new', outfile) - if suite.byhash: - query = """ - UPDATE hashfile SET unreferenced = CURRENT_TIMESTAMP - WHERE suite_id = :id AND unreferenced IS NULL""" - session.execute(query, {'id': suite.suite_id}) + query = """ + UPDATE hashfile SET unreferenced = CURRENT_TIMESTAMP + WHERE suite_id = :id AND unreferenced IS NULL""" + session.execute(query, {'id': suite.suite_id}) + if suite.byhash: for filename in fileinfo: if not os.path.exists(filename): # probably an uncompressed index we didn't generate @@ -390,8 +390,9 @@ class ReleaseWriter(object): INSERT INTO hashfile (path, suite_id) VALUES (:p, :id)''', {'p': hashfile, 'id': suite.suite_id}) - session.commit() + session.commit() + if suite.byhash: for filename in fileinfo: if not os.path.exists(filename): # probably an uncompressed index we didn't generate