except InvalidDscError, line:
utils.warn("syntax error in .dsc file '%s', line %s." % (f, line))
count += 1
+ except ChangesUnicodeError:
+ utils.warn("found invalid changes file, not properly utf-8 encoded")
+ count += 1
if count:
utils.warn("Found %s invalid .dsc files." % (count))
try:
changes = utils.parse_changes(filename)
files = utils.build_file_list(changes)
+ except ChangesUnicodeError:
+ utils.warn("Improperly encoded changes file, not utf-8")
+ return
except:
utils.warn("Error parsing changes file '%s'" % (filename))
return
foldable_output(changes_filename, "changes", changes, norow=True)
def check_changes (changes_filename):
- changes = utils.parse_changes (changes_filename)
+ try:
+ changes = utils.parse_changes (changes_filename)
+ except ChangesUnicodeError:
+ utils.warn("Encoding problem with changes file %s" % (changes_filename))
display_changes(changes['distribution'], changes_filename)
files = utils.build_file_list(changes)
except ParseChangesError, line:
reject("%s: parse error, can't grok: %s." % (filename, line))
return 0
+ except ChangesUnicodeError:
+ reject("%s: changes file not proper utf-8" % (filename))
+ return 0
# Parse the Files field from the .changes into another dictionary
try:
reject("%s: parse error, can't grok: %s." % (dsc_filename, line))
except InvalidDscError, line:
reject("%s: syntax error on line %s." % (dsc_filename, line))
+ except ChangesUnicodeError:
+ reject("%s: dsc file not proper utf-8." % (dsc_filename))
+
# Build up the file list of files mentioned by the .dsc
try:
dsc_files.update(utils.build_file_list(dsc, is_a_dsc=1))
"NoFreeFilenameError": """Exception raised when no alternate filename was found.""",
"TransitionsError": """Exception raised when transitions file can't be parsed.""",
"NoSourceFieldError": """Exception raised - we cant find the source - wtf?""",
- "DBUpdateError": """Exception raised - could not update the database"""
+ "DBUpdateError": """Exception raised - could not update the database""",
+ "ChangesUnicodeError": """Exception raised - changes file not properly utf-8 encoded"""
} #: All dak exceptions
def construct_dak_exception(name, description):
changes_in = open_file(filename)
content = changes_in.read()
changes_in.close()
+ try:
+ unicode(content, 'utf-8')
+ except UnicodeError:
+ raise ChangesUnicodeError, "Changes file not proper utf-8"
return parse_deb822(content, signing_rules)
################################################################################