From a9a87ae7891e991d868e34ef11ed64d95252bd36 Mon Sep 17 00:00:00 2001 From: Bastian Blank Date: Sat, 17 Jun 2017 19:34:22 +0000 Subject: [PATCH] Re-use old by-hash file if new file hash matches Force the file to have the same mtime if the checksum shows that it was not changed. --- dak/generate_releases.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/dak/generate_releases.py b/dak/generate_releases.py index 613c972f..0c106b43 100755 --- a/dak/generate_releases.py +++ b/dak/generate_releases.py @@ -231,6 +231,16 @@ class ReleaseWriter(object): # probably an uncompressed index we didn't generate continue + for h in hashes: + field = h.release_field + hashfile = os.path.join(os.path.dirname(filename), 'by-hash', field, fileinfo[filename][field]) + + # if the hash is known to exist, re-use the old file + if os.path.exists(hashfile): + os.unlink(filename) + os.link(hashfile, filename) + break + for h in hashes: field = h.release_field hashfile = os.path.join(os.path.dirname(filename), 'by-hash', field, fileinfo[filename][field]) -- GitLab