mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-01-17 07:17:12 +00:00
Merge pull request #9088 from ronald-cron-arm/check-framework-files
Extend basic checks and C coding style check to framework files
This commit is contained in:
commit
c15544e217
@ -75,16 +75,37 @@ def get_src_files(since: Optional[str]) -> List[str]:
|
|||||||
output = subprocess.check_output(["git", "ls-files"] + file_patterns,
|
output = subprocess.check_output(["git", "ls-files"] + file_patterns,
|
||||||
universal_newlines=True)
|
universal_newlines=True)
|
||||||
src_files = output.split()
|
src_files = output.split()
|
||||||
|
output = subprocess.check_output(["git", "-C", "framework", "ls-files"]
|
||||||
|
+ file_patterns, universal_newlines=True)
|
||||||
|
framework_src_files = output.split()
|
||||||
|
|
||||||
if since:
|
if since:
|
||||||
# get all files changed in commits since the starting point
|
# get all files changed in commits since the starting point in ...
|
||||||
cmd = ["git", "log", since + "..HEAD", "--name-only", "--pretty=", "--"] + src_files
|
# ... the main repository
|
||||||
|
cmd = ["git", "log", since + "..HEAD", "--ignore-submodules",
|
||||||
|
"--name-only", "--pretty=", "--"] + src_files
|
||||||
output = subprocess.check_output(cmd, universal_newlines=True)
|
output = subprocess.check_output(cmd, universal_newlines=True)
|
||||||
committed_changed_files = output.split()
|
committed_changed_files = output.split()
|
||||||
# and also get all files with uncommitted changes
|
# ... the framework submodule
|
||||||
|
cmd = ["git", "-C", "framework", "log", since + "..HEAD",
|
||||||
|
"--name-only", "--pretty=", "--"] + framework_src_files
|
||||||
|
output = subprocess.check_output(cmd, universal_newlines=True)
|
||||||
|
committed_changed_files += ["framework/" + s for s in output.split()]
|
||||||
|
|
||||||
|
# and also get all files with uncommitted changes in ...
|
||||||
|
# ... the main repository
|
||||||
cmd = ["git", "diff", "--name-only", "--"] + src_files
|
cmd = ["git", "diff", "--name-only", "--"] + src_files
|
||||||
output = subprocess.check_output(cmd, universal_newlines=True)
|
output = subprocess.check_output(cmd, universal_newlines=True)
|
||||||
uncommitted_changed_files = output.split()
|
uncommitted_changed_files = output.split()
|
||||||
src_files = list(set(committed_changed_files + uncommitted_changed_files))
|
# ... the framework submodule
|
||||||
|
cmd = ["git", "-C", "framework", "diff", "--name-only", "--"] + \
|
||||||
|
framework_src_files
|
||||||
|
output = subprocess.check_output(cmd, universal_newlines=True)
|
||||||
|
uncommitted_changed_files += ["framework/" + s for s in output.split()]
|
||||||
|
|
||||||
|
src_files = committed_changed_files + uncommitted_changed_files
|
||||||
|
else:
|
||||||
|
src_files += ["framework/" + s for s in framework_src_files]
|
||||||
|
|
||||||
generated_files = list_generated_files()
|
generated_files = list_generated_files()
|
||||||
# Don't correct style for third-party files (and, for simplicity,
|
# Don't correct style for third-party files (and, for simplicity,
|
||||||
|
@ -373,7 +373,7 @@ class LicenseIssueTracker(LineIssueTracker):
|
|||||||
r'3rdparty/(?!(p256-m)/.*)',
|
r'3rdparty/(?!(p256-m)/.*)',
|
||||||
# Documentation explaining the license may have accidental
|
# Documentation explaining the license may have accidental
|
||||||
# false positives.
|
# false positives.
|
||||||
r'(ChangeLog|LICENSE|[-0-9A-Z_a-z]+\.md)\Z',
|
r'(ChangeLog|LICENSE|framework\/LICENSE|[-0-9A-Z_a-z]+\.md)\Z',
|
||||||
# Files imported from TF-M, and not used except in test builds,
|
# Files imported from TF-M, and not used except in test builds,
|
||||||
# may be under a different license.
|
# may be under a different license.
|
||||||
r'configs/ext/crypto_config_profile_medium\.h\Z',
|
r'configs/ext/crypto_config_profile_medium\.h\Z',
|
||||||
@ -381,6 +381,7 @@ class LicenseIssueTracker(LineIssueTracker):
|
|||||||
r'configs/ext/README\.md\Z',
|
r'configs/ext/README\.md\Z',
|
||||||
# Third-party file.
|
# Third-party file.
|
||||||
r'dco\.txt\Z',
|
r'dco\.txt\Z',
|
||||||
|
r'framework\/dco\.txt\Z',
|
||||||
]
|
]
|
||||||
path_exemptions = re.compile('|'.join(BINARY_FILE_PATH_RE_LIST +
|
path_exemptions = re.compile('|'.join(BINARY_FILE_PATH_RE_LIST +
|
||||||
LICENSE_EXEMPTION_RE_LIST))
|
LICENSE_EXEMPTION_RE_LIST))
|
||||||
@ -486,9 +487,17 @@ class IntegrityChecker:
|
|||||||
|
|
||||||
These are the regular files commited into Git.
|
These are the regular files commited into Git.
|
||||||
"""
|
"""
|
||||||
|
bytes_output = subprocess.check_output(['git', '-C', 'framework',
|
||||||
|
'ls-files', '-z'])
|
||||||
|
bytes_framework_filepaths = bytes_output.split(b'\0')[:-1]
|
||||||
|
bytes_framework_filepaths = ["framework/".encode() + filepath
|
||||||
|
for filepath in bytes_framework_filepaths]
|
||||||
|
|
||||||
bytes_output = subprocess.check_output(['git', 'ls-files', '-z'])
|
bytes_output = subprocess.check_output(['git', 'ls-files', '-z'])
|
||||||
bytes_filepaths = bytes_output.split(b'\0')[:-1]
|
bytes_filepaths = bytes_output.split(b'\0')[:-1] + \
|
||||||
|
bytes_framework_filepaths
|
||||||
ascii_filepaths = map(lambda fp: fp.decode('ascii'), bytes_filepaths)
|
ascii_filepaths = map(lambda fp: fp.decode('ascii'), bytes_filepaths)
|
||||||
|
|
||||||
# Filter out directories. Normally Git doesn't list directories
|
# Filter out directories. Normally Git doesn't list directories
|
||||||
# (it only knows about the files inside them), but there is
|
# (it only knows about the files inside them), but there is
|
||||||
# at least one case where 'git ls-files' includes a directory:
|
# at least one case where 'git ls-files' includes a directory:
|
||||||
|
Loading…
Reference in New Issue
Block a user