From: Julien Cristau Date: Wed, 18 May 2016 13:33:07 +0000 (+0200) Subject: generate_releases: separate hashfile table update from hardlink creation X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=01da85b852ddbc70065026d72fb8e6da011a8ec7;p=dak.git 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 --- 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))