Fix for CCL 4.0 Licenses. 95/37195/1
authorlhinds <lhinds@redhat.com>
Tue, 11 Jul 2017 16:36:38 +0000 (17:36 +0100)
committerlhinds <lhinds@redhat.com>
Tue, 11 Jul 2017 16:36:38 +0000 (17:36 +0100)
A follow up patch should move the patterns list into yaml

Change-Id: Id814d6fc09631d5037f6825f32daca8d74edc118
Signed-off-by: lhinds <lhinds@redhat.com>
anteater/src/patch_scan.py
anteater/src/project_scan.py

index 0a32f3e..1deb68f 100644 (file)
@@ -147,9 +147,9 @@ def licence_check(project, licence_ext,
         # Note: Hardcoded use of 'copyright' & 'spdx' is the result
         # of a decision made at 2017 plugfest to limit searches to
         # just these two strings.
-        if re.search("copyright", content, re.IGNORECASE):
-            logger.info('Contains needed Licence string: %s', patch_file)
-        elif re.search("spdx", content, re.IGNORECASE):
+        patterns = ['copyright', 'spdx',
+                    'http://creativecommons.org/licenses/by/4.0']
+        if any(i in content.lower() for i in patterns):
             logger.info('Contains needed Licence string: %s', patch_file)
         else:
             logger.error('Licence header missing in file: %s', patch_file)
index f33ccca..5ac8b10 100644 (file)
@@ -159,9 +159,9 @@ def licence_check(licence_ext, licence_ignore, project, project_dir):
                     # Note: Hardcoded use of 'copyright' & 'spdx' is the result
                     # of a decision made at 2017 plugfest to limit searches to
                     # just these two strings.
-                    if re.search("copyright", content, re.IGNORECASE):
-                        logger.info('Licence string present: %s', full_path)
-                    elif re.search("spdx", content, re.IGNORECASE):
+                    patterns = ['copyright', 'spdx',
+                                'http://creativecommons.org/licenses/by/4.0']
+                    if any(i in content.lower() for i in patterns):
                         logger.info('Licence string present: %s', full_path)
                     else:
                         logger.error('Licence header missing: %s', full_path)