From 48ce2a2317eb86b73b6da297c8ed9082b06faf9f Mon Sep 17 00:00:00 2001 From: lhinds Date: Sun, 25 Jun 2017 18:43:51 +0100 Subject: 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 --- anteater/src/get_lists.py | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'anteater/src/get_lists.py') 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) try: 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 -- cgit 1.2.3-korg