From 08b2323f564252585cce5ce8d10a09f9861dff80 Mon Sep 17 00:00:00 2001 From: Torsten Werner Date: Wed, 9 Mar 2011 09:14:05 +0100 Subject: [PATCH] Add workaround for duplicate filenames in contents. Signed-off-by: Torsten Werner --- daklib/contents.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 -- 2.39.5