From d4699ba04f5b98bed2513f58946296d4a479c8ea Mon Sep 17 00:00:00 2001 From: Joerg Jaspert Date: Sat, 30 Jan 2010 14:44:51 +0100 Subject: [PATCH] utils, parse_changes reject in case we are missing mandantory fields in .changes file Signed-off-by: Joerg Jaspert --- daklib/utils.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) mode change 100644 => 100755 daklib/utils.py diff --git a/daklib/utils.py b/daklib/utils.py old mode 100644 new mode 100755 index 37b542da..8c96dc06 --- a/daklib/utils.py +++ b/daklib/utils.py @@ -268,7 +268,21 @@ def parse_changes(filename, signing_rules=0): unicode(content, 'utf-8') except UnicodeError: raise ChangesUnicodeError, "Changes file not proper utf-8" - return parse_deb822(content, signing_rules) + changes = parse_deb822(content, signing_rules) + + # Finally ensure that everything needed is there + must_keywords = ('Format', 'Date', 'Source', 'Binary', 'Architecture', 'Version', + 'Distribution', 'Maintainer', 'Description', 'Changes', 'Files') + + missingfields=[] + for keyword in must_keywords: + if not changes.has_key(keyword.lower()): + missingfields.append(keyword) + + if len(missingfields): + raise ParseChangesError, "Missing mandantory field(s) in changes file (policy 5.5): %s" % (missingfields) + + return changes ################################################################################ -- 2.39.5