From 01da85b852ddbc70065026d72fb8e6da011a8ec7 Mon Sep 17 00:00:00 2001 From: Julien Cristau Date: Wed, 18 May 2016 15:33:07 +0200 Subject: [PATCH] generate_releases: separate hashfile table update from hardlink creation This way we only touch the filesystem after the db is updated. Signed-off-by: Julien Cristau --- dak/generate_releases.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dak/generate_releases.py b/dak/generate_releases.py index d947def8..34103f72 100755 --- a/dak/generate_releases.py +++ b/dak/generate_releases.py @@ -390,7 +390,16 @@ class ReleaseWriter(object): INSERT INTO hashfile (path, suite_id) VALUES (:p, :id)''', {'p': hashfile, 'id': suite.suite_id}) + session.commit() + for filename in fileinfo: + if not os.path.exists(filename): + # 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]) try: os.makedirs(os.path.dirname(hashfile)) except OSError as exc: @@ -402,7 +411,6 @@ class ReleaseWriter(object): if exc.errno != errno.EEXIST: raise - session.commit() sign_release_dir(suite, os.path.dirname(outfile)) -- 2.39.5