From: Torsten Werner Date: Wed, 9 Mar 2011 08:14:05 +0000 (+0100) Subject: Add workaround for duplicate filenames in contents. X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=08b2323f564252585cce5ce8d10a09f9861dff80;p=dak.git Add workaround for duplicate filenames in contents. Signed-off-by: Torsten Werner --- diff --git a/daklib/contents.py b/daklib/contents.py index e2e38173..65e7e3f1 100755 --- a/daklib/contents.py +++ b/daklib/contents.py @@ -31,6 +31,7 @@ from daklib.threadpool import ThreadPool from multiprocessing import Pool from sqlalchemy import desc, or_ +from sqlalchemy.exc import IntegrityError from subprocess import Popen, PIPE, call import os.path @@ -253,7 +254,12 @@ class ContentsScanner(object): binary = session.query(DBBinary).get(self.binary_id) for filename in binary.scan_contents(): binary.contents.append(BinContents(file = filename)) - session.commit() + try: + session.commit() + except IntegrityError: + session.rollback() + binary.contents.append(BinContents(file = 'DUPLICATE_FILENAMES')) + session.commit() session.close() @classmethod