From 5b73e91da92d1a329e996cb7591b365c30abe750 Mon Sep 17 00:00:00 2001 From: Ansgar Burchardt Date: Thu, 7 Mar 2013 07:17:27 +0100 Subject: [PATCH] parse_file_list: handle files without an entry in the Files field If a file is only listed in the Checksums-* fields, "entry" will be None and we cannot call the get method to compare the size in the different fields. This change just skips the comparison when "entry" is None. We can do this as we later check that each entry has all required checksums (i.e. is listed in Files and the Checksums-* fields). --- daklib/upload.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/daklib/upload.py b/daklib/upload.py index a6f1e4b8..059cc511 100644 --- a/daklib/upload.py +++ b/daklib/upload.py @@ -191,7 +191,7 @@ def parse_file_list(control, has_priority_and_section): continue (sha1sum, size, filename) = line.split() entry = entries.get(filename, None) - if entry.get('size', None) != long(size): + if entry is not None and entry.get('size', None) != long(size): raise InvalidChangesException('Size for {0} in Files and Checksum-Sha1 fields differ.'.format(filename)) entry['sha1sum'] = sha1sum @@ -200,9 +200,7 @@ def parse_file_list(control, has_priority_and_section): continue (sha256sum, size, filename) = line.split() entry = entries.get(filename, None) - if entry is None: - raise InvalidChangesException('No sha256sum for {0}.'.format(filename)) - if entry.get('size', None) != long(size): + if entry is not None and entry.get('size', None) != long(size): raise InvalidChangesException('Size for {0} in Files and Checksum-Sha256 fields differ.'.format(filename)) entry['sha256sum'] = sha256sum -- 2.39.5