From a1ffd5510f19253cf19861e7f81cdc305f371dcd Mon Sep 17 00:00:00 2001 From: lhinds Date: Mon, 19 Jun 2017 16:41:40 +0100 Subject: Provides clarification that LICENSE is in repo This change peforms a clarification that a LICENSE file exists within the root folder of the set project repo. This feature is only for complete project scans and not a patch scan. JIRA:RELENG-235 Change-Id: I6d238158f7501aaff6c21ecc59b505b5c79565f2 Signed-off-by: lhinds --- anteater/src/project_scan.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'anteater') diff --git a/anteater/src/project_scan.py b/anteater/src/project_scan.py index 9b143e9..09a4791 100644 --- a/anteater/src/project_scan.py +++ b/anteater/src/project_scan.py @@ -57,6 +57,7 @@ def prepare_project(project, project_dir): # Perform licence header checks licence_check(licence_ext, licence_ignore, project, project_dir) + licence_root_check(project_dir, project) def scan_file(project_dir, project, binary_list, binary_project_list, @@ -124,6 +125,20 @@ def scan_file(project_dir, project, binary_list, binary_project_list, format(full_path)) +def licence_root_check(project_dir, project): + if os.path.isfile(project_dir + '/LICENSE'): + logger.info('LICENSE file present in: {0}'. + format(project_dir)) + else: + logger.error('LICENSE file missing in: {0}'. + format(project_dir)) + with open(reports_dir + "licence-" + project + ".log", + "a") \ + as gate_report: + gate_report.write('LICENSE file missing in: {0}\n'. + format(project_dir)) + + def licence_check(licence_ext, licence_ignore, project, project_dir): """ Peform basic checks for the presence of licence strings """ for root, dirs, files in os.walk(project_dir): -- cgit 1.2.3-korg