From: Torsten Werner Date: Tue, 15 Mar 2011 17:58:39 +0000 (+0100) Subject: Add filename de-duplication to contents scanning. X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=1bb2f8229e750b48ec0944f46ee17ee791036a6b;p=dak.git Add filename de-duplication to contents scanning. Signed-off-by: Torsten Werner --- diff --git a/daklib/contents.py b/daklib/contents.py index bbbacd4a..27ffdda6 100755 --- a/daklib/contents.py +++ b/daklib/contents.py @@ -257,18 +257,12 @@ class ContentsScanner(object): ''' session = DBConn().session() binary = session.query(DBBinary).get(self.binary_id) - empty_package = True - for filename in binary.scan_contents(): + fileset = set(binary.scan_contents()) + if len(fileset) == 0: + fileset.add('EMPTY_PACKAGE') + for filename in fileset: binary.contents.append(BinContents(file = filename)) - empty_package = False - if empty_package: - binary.contents.append(BinContents(file = 'EMPTY_PACKAGE')) - try: - session.commit() - except IntegrityError: - session.rollback() - binary.contents.append(BinContents(file = 'DUPLICATE_FILENAMES')) - session.commit() + session.commit() session.close() @classmethod