提交 d6f184c3 编写于 作者: J Julien Cristau

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: NJulien Cristau <jcristau@debian.org>
上级 01da85b8
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册