From 1bb2f8229e750b48ec0944f46ee17ee791036a6b Mon Sep 17 00:00:00 2001 From: Torsten Werner Date: Tue, 15 Mar 2011 18:58:39 +0100 Subject: [PATCH] Add filename de-duplication to contents scanning. Signed-off-by: Torsten Werner --- daklib/contents.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) 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 -- 2.39.5