Static-checks: Take into account the new copyright string
Allow for both old and new style copyright lines to coexist
Also excluse psa/crypto_lms.h from the list of file to check
as we don't want to have PSA files checked as eventually they
will be owned by the Mbed TLS project, even if they are TFM
only extensions for now.
Signed-off-by: Antonio de Angelis <antonio.deangelis@arm.com>
Change-Id: I6a772a193ff8e9e52c28c60c3d3511d47214c8ea
diff --git a/script/static-checks/check-copyright.py b/script/static-checks/check-copyright.py
index c1fb61d..5c2bb07 100755
--- a/script/static-checks/check-copyright.py
+++ b/script/static-checks/check-copyright.py
@@ -64,7 +64,8 @@
'interface/include/psa/crypto_sizes.h',
'interface/include/psa/crypto_struct.h',
'interface/include/psa/crypto_types.h',
- 'interface/include/psa/crypto_values.h'
+ 'interface/include/psa/crypto_values.h',
+ 'interface/include/psa/crypto_values_lms.h'
)
# Supported comment styles (Python regex)
@@ -88,10 +89,12 @@
# File must contain both lines to pass the check
COPYRIGHT_LINE = LINE_START + 'Copyright' + '.*' + TIME_PERIOD + '.*' + EOL
+COPYRIGHT_LINE_ALT = LINE_START + 'SPDX-FileCopyrightText: Copyright The TrustedFirmware-M Contributors' + EOL
LICENSE_ID_LINE = LINE_START + 'SPDX-License-Identifier:' + LICENSE_ID + EOL
# Compiled license patterns
COPYRIGHT_PATTERN = re.compile(COPYRIGHT_LINE, re.MULTILINE)
+COPYRIGHT_PATTERN_ALT = re.compile(COPYRIGHT_LINE_ALT, re.MULTILINE)
LICENSE_ID_PATTERN = re.compile(LICENSE_ID_LINE, re.MULTILINE)
CURRENT_YEAR = str(datetime.datetime.now().year)
@@ -108,7 +111,8 @@
file_content = file_.read()
copyright_line = COPYRIGHT_PATTERN.search(file_content)
- if not copyright_line:
+ coypright_line_alt = COPYRIGHT_PATTERN_ALT.search(file_content)
+ if not copyright_line and not copyright_line_alt:
print("ERROR: Missing copyright in " + file_.name)
result = COPYRIGHT_ERROR