[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[dak/master] 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 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/daklib/upload.py b/daklib/upload.py
index a6f1e4b..059cc51 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
 
-- 
1.7.2.5


Reply to: