X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Fcontents.py;h=056da53f18d244c8ed28a51a440d0dac364d3c11;hb=ddf0f7dd6691ac530013468c68b6e81118c67a31;hp=e2e381736bc218a4b1713a10664c72520dea46e5;hpb=4de40902223f28face536ebdfb5f00bec04b9294;p=dak.git diff --git a/daklib/contents.py b/daklib/contents.py index e2e38173..056da53f 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 @@ -91,7 +92,7 @@ unique_override as where o.suite = :overridesuite and o.type = :type_id and o.section = s.id and o.component = :component) -select bc.file, substring(o.section from position('/' in o.section) + 1) || '/' || b.package as package +select bc.file, o.section || '/' || b.package as package from newest_binaries b, bin_contents bc, unique_override o where b.id = bc.binary_id and o.package = b.package order by bc.file, b.package''' @@ -119,7 +120,7 @@ unique_override as where o.suite = :overridesuite and o.type = :type_id and o.section = s.id order by o.package, s.section, o.modified desc) -select bc.file, substring(o.section from position('/' in o.section) + 1) || '/' || b.package as package +select bc.file, o.section || '/' || b.package as package from newest_binaries b, bin_contents bc, unique_override o where b.id = bc.binary_id and o.package = b.package order by bc.file, b.package''' @@ -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