- if not binary_list.search(full_path) \
- and not binary_project_list.search(full_path):
- logger.error('Non Whitelisted Binary: {0}'.
- format(full_path))
- with open(reports_dir + "binaries-" + project + ".log",
- "a") \
- as gate_report:
- gate_report.write('Non Whitelisted Binary: {0}\n'.
- format(full_path))
+ hashlist = get_lists.GetLists()
+ binary_hash = hashlist.binary_hash(project, full_path)
+ if not binary_list.search(full_path):
+ with open(full_path, 'rb') as afile:
+ buf = afile.read()
+ hasher.update(buf)
+ if hasher.hexdigest() in binary_hash:
+ logger.info('Found matching file hash for file: {0}'.
+ format(full_path))
+ else:
+ logger.error('Non Whitelisted Binary file: {0}'.
+ format(full_path))
+ logger.error('Please submit patch with this hash: {0}'.
+ format(hasher.hexdigest()))
+ with open(reports_dir + "binaries-" + project + ".log",
+ "a") \
+ as gate_report:
+ gate_report.write('Non Whitelisted Binary: {0}\n'.
+ format(full_path))