- session.execute('''
- INSERT INTO hashfile (path, suite_id)
- VALUES (:p, :id)''',
- {'p': hashfile, 'id': suite.suite_id})
+ new.append(hashfile)
+
+ if updated:
+ session.execute("""
+ UPDATE hashfile SET unreferenced = NULL
+ WHERE path = ANY(:p) AND suite_id = :id""",
+ {'p': updated, 'id': suite.suite_id})
+ if new:
+ session.execute("""
+ INSERT INTO hashfile (path, suite_id)
+ VALUES (:p, :id)""",
+ [{'p': hashfile, 'id': suite.suite_id} for hashfile in new])
+
+ session.commit()
+
+ if suite.byhash:
+ # Create hardlinks in by-hash directories
+ for filename in fileinfo:
+ if not os.path.exists(filename):
+ # probably an uncompressed index we didn't generate
+ continue