]> err.no Git - dak/commitdiff
Add workaround for duplicate filenames in contents.
authorTorsten Werner <twerner@debian.org>
Wed, 9 Mar 2011 08:14:05 +0000 (09:14 +0100)
committerTorsten Werner <twerner@debian.org>
Wed, 9 Mar 2011 08:14:05 +0000 (09:14 +0100)
Signed-off-by: Torsten Werner <twerner@debian.org>
daklib/contents.py

index e2e381736bc218a4b1713a10664c72520dea46e5..65e7e3f1c31dedd1f0fc660550d0b0ed3f077268 100755 (executable)
@@ -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