path: root/anteater/src/get_lists.py
diff options
authorlhinds <lhinds@redhat.com>2017-06-25 18:43:51 +0100
committerlhinds <lhinds@redhat.com>2017-06-25 18:50:26 +0100
commit48ce2a2317eb86b73b6da297c8ed9082b06faf9f (patch)
tree7f43ce80b63c0a5662cb8cdd50629c18753a4e2d /anteater/src/get_lists.py
parent0b6fc6f47d2ce40d64659f398d025d5bcf2c7feb (diff)
Implements sha256 exception functionality
This patch adds functionality for file checksum verfications for binary files. The master_list.yaml binaries yaml directive now only contains simple exceptions (for common artefacts that are gitignored) Each project_exception file now has a filename and a sha256 hash. If a binary file is not found, or the hash is mismatched, it will output the hash for the user to include in an exception patch. This functionality has been added to complete project scans and patchset scans JIRA: RELENG-240 Change-Id: Iafa5710f4a0da192fc74335b1200b504413f8a8b Signed-off-by: lhinds <lhinds@redhat.com>
Diffstat (limited to 'anteater/src/get_lists.py')
1 files changed, 10 insertions, 15 deletions
diff --git a/anteater/src/get_lists.py b/anteater/src/get_lists.py
index 713321f..d7b0c47 100644
--- a/anteater/src/get_lists.py
+++ b/anteater/src/get_lists.py
@@ -69,28 +69,23 @@ class GetLists(object):
self.loaded = True
def binary_list(self, project):
- project_list = False
- self.load_project_exception_file(yl.get('project_exceptions'), project)
default_list = (yl['binaries']['binary_ignore'])
except KeyError:
logger.error('Key Error processing binary list values')
- try:
- project_list = (yl['binaries'][project]['binary_ignore'])
- except KeyError:
- logger.info('No binary waivers found for {0}'.
- format(project))
binary_re = re.compile("|".join(default_list),
- flags=re.IGNORECASE)
+ flags=re.IGNORECASE)
+ return binary_re
- if project_list:
- binary_project_re = re.compile("|".join(project_list),
- flags=re.IGNORECASE)
- return binary_re, binary_project_re
- else:
- binary_project_re = re.compile("")
- return binary_re, binary_project_re
+ def binary_hash(self, project, patch_file):
+ self.load_project_exception_file(yl.get('project_exceptions'), project)
+ file_name = os.path.basename(patch_file)
+ try:
+ binary_hash = (yl['binaries'][project][file_name])
+ except KeyError:
+ logger.error('Key Error processing binary hash values')
+ return binary_hash
def file_audit_list(self, project):
project_list = False