-class HashesCheck(Check):
- """Check hashes in .changes and .dsc are valid."""
- def check(self, upload):
- what = None
- try:
- changes = upload.changes
- what = changes.filename
- for f in changes.files.itervalues():
- f.check(upload.directory)
- source = changes.source
- if source is not None:
- what = source.filename
- for f in source.files.itervalues():
- f.check(upload.directory)
- except IOError as e:
- if e.errno == errno.ENOENT:
- raise Reject('{0} refers to non-existing file: {1}\n'
- 'Perhaps you need to include it in your upload?'
- .format(what, os.path.basename(e.filename)))
- raise
- except InvalidHashException as e:
- raise Reject('{0}: {1}'.format(what, unicode(e)))
-