Skip to content

Commit 9a3a5a8

Browse files
committed
Update kernel_checker.py with new version and copyright date.
Update kernel_checker.py to handle assembly and python files
1 parent adfc533 commit 9a3a5a8

File tree

2 files changed

+76
-16
lines changed

2 files changed

+76
-16
lines changed

.github/scripts/find_replace.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
old_text=$1
3+
new_text=$2
4+
echo "Old text: ${old_text}"
5+
echo "New text: ${new_text}"
6+
grep -rl "${old_text}" . | xargs gsed -i -e '1h;2,$H;$!d;g' -e "s/${old_text}/${new_text}/g"
7+

.github/scripts/kernel_checker.py

Lines changed: 69 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,31 @@
11
#!/usr/bin/env python3
2+
#/*
3+
# * FreeRTOS Kernel <DEVELOPMENT BRANCH>
4+
# * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5+
# *
6+
# * SPDX-License-Identifier: MIT
7+
# *
8+
# * Permission is hereby granted, free of charge, to any person obtaining a copy of
9+
# * this software and associated documentation files (the "Software"), to deal in
10+
# * the Software without restriction, including without limitation the rights to
11+
# * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
12+
# * the Software, and to permit persons to whom the Software is furnished to do so,
13+
# * subject to the following conditions:
14+
# *
15+
# * The above copyright notice and this permission notice shall be included in all
16+
# * copies or substantial portions of the Software.
17+
# *
18+
# * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
# * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
20+
# * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
21+
# * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
22+
# * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23+
# * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24+
# *
25+
# * https://www.FreeRTOS.org
26+
# * https://github.com/FreeRTOS
27+
# *
28+
# */
229

330
import os
431
from common.header_checker import HeaderChecker
@@ -7,7 +34,9 @@
734
# CONFIG
835
#--------------------------------------------------------------------------------------------------
936
KERNEL_IGNORED_FILES = [
10-
'FreeRTOS-openocd.c'
37+
'FreeRTOS-openocd.c',
38+
'Makefile',
39+
'.DS_Store'
1140
]
1241

1342
KERNEL_IGNORED_EXTENSIONS = [
@@ -34,23 +63,45 @@
3463
'.txt'
3564
]
3665

66+
KERNEL_ASM_EXTENSIONS = [
67+
'.s',
68+
'.S',
69+
'.src',
70+
'.inc',
71+
'.s26',
72+
'.s43',
73+
'.s79',
74+
'.s85',
75+
'.s87',
76+
'.s90',
77+
'.asm',
78+
'.h'
79+
]
80+
81+
KERNEL_PY_EXTENSIONS = [
82+
'.py'
83+
]
84+
3785
KERNEL_IGNORED_PATTERNS = [
3886
r'.*\.git.*',
87+
r'.*portable/IAR/AtmelSAM7S64/.*AT91SAM7.*',
88+
r'.*portable/GCC/ARM7_AT91SAM7S/.*',
89+
r'.*portable/MPLAB/PIC18F/stdio.h'
90+
]
91+
92+
KERNEL_THIRD_PARTY_PATTERNS = [
3993
r'.*portable/ThirdParty/GCC/Posix/port*',
40-
r'.*portable.*Xtensa_ESP32\/include\/portmacro\.h',
41-
r'.*portable.*CDK\/T-HEAD_CK802\/portmacro\.h',
42-
r'.*portable.*GCC\/Posix\/portmacro\.h',
43-
r'.*portable.*Xtensa_ESP32.*port\.c',
44-
r'.*portable.*Xtensa_ESP32.*portasm\.S',
45-
r'.*portable.*Xtensa_ESP32.*xtensa_.*',
46-
r'.*portable.*Xtensa_ESP32.*portmux_impl.*',
47-
r'.*portable.*Xtensa_ESP32.*xt_asm_utils\.h'
94+
r'.*portable/ThirdParty/*',
95+
r'.*portable/IAR/AVR32_UC3/.*',
96+
r'.*portable/GCC/AVR32_UC3/.*',
4897
]
4998

5099
KERNEL_HEADER = [
51100
'/*\n',
52-
' * FreeRTOS Kernel V10.4.3\n',
53-
' * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n',
101+
' * FreeRTOS Kernel <DEVELOPMENT BRANCH>\n',
102+
' * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n',
103+
' *\n',
104+
' * SPDX-License-Identifier: MIT\n',
54105
' *\n',
55106
' * Permission is hereby granted, free of charge, to any person obtaining a copy of\n',
56107
' * this software and associated documentation files (the "Software"), to deal in\n',
@@ -75,16 +126,18 @@
75126
' */\n',
76127
]
77128

78-
79129
def main():
80130
parser = HeaderChecker.configArgParser()
81131
args = parser.parse_args()
82132

83133
# Configure the checks then run
84-
checker = HeaderChecker(KERNEL_HEADER)
85-
checker.ignoreExtension(*KERNEL_IGNORED_EXTENSIONS)
86-
checker.ignorePattern(*KERNEL_IGNORED_PATTERNS)
87-
checker.ignoreFile(*KERNEL_IGNORED_FILES)
134+
checker = HeaderChecker(KERNEL_HEADER,
135+
ignored_files=KERNEL_IGNORED_FILES,
136+
ignored_ext=KERNEL_IGNORED_EXTENSIONS,
137+
ignored_patterns=KERNEL_IGNORED_PATTERNS,
138+
third_party_patterns=KERNEL_THIRD_PARTY_PATTERNS,
139+
py_ext=KERNEL_PY_EXTENSIONS,
140+
asm_ext=KERNEL_ASM_EXTENSIONS)
88141
checker.ignoreFile(os.path.split(__file__)[-1])
89142

90143
rc = checker.processArgs(args)

0 commit comments

Comments
 (0)