diff options
Diffstat (limited to 'scripts/verify-bashisms')
-rwxr-xr-x | scripts/verify-bashisms | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/scripts/verify-bashisms b/scripts/verify-bashisms index fb0cc719ea..fc3677c6ed 100755 --- a/scripts/verify-bashisms +++ b/scripts/verify-bashisms | |||
@@ -1,11 +1,13 @@ | |||
1 | #!/usr/bin/env python3 | 1 | #!/usr/bin/env python3 |
2 | # | 2 | # |
3 | # Copyright OpenEmbedded Contributors | ||
4 | # | ||
3 | # SPDX-License-Identifier: GPL-2.0-only | 5 | # SPDX-License-Identifier: GPL-2.0-only |
4 | # | 6 | # |
5 | 7 | ||
6 | import sys, os, subprocess, re, shutil | 8 | import sys, os, subprocess, re, shutil |
7 | 9 | ||
8 | whitelist = ( | 10 | allowed = ( |
9 | # type is supported by dash | 11 | # type is supported by dash |
10 | 'if type systemctl >/dev/null 2>/dev/null; then', | 12 | 'if type systemctl >/dev/null 2>/dev/null; then', |
11 | 'if type systemd-tmpfiles >/dev/null 2>/dev/null; then', | 13 | 'if type systemd-tmpfiles >/dev/null 2>/dev/null; then', |
@@ -19,8 +21,8 @@ whitelist = ( | |||
19 | '. $target_sdk_dir/${oe_init_build_env_path} $target_sdk_dir >> $LOGFILE' | 21 | '. $target_sdk_dir/${oe_init_build_env_path} $target_sdk_dir >> $LOGFILE' |
20 | ) | 22 | ) |
21 | 23 | ||
22 | def is_whitelisted(s): | 24 | def is_allowed(s): |
23 | for w in whitelist: | 25 | for w in allowed: |
24 | if w in s: | 26 | if w in s: |
25 | return True | 27 | return True |
26 | return False | 28 | return False |
@@ -49,7 +51,7 @@ def process(filename, function, lineno, script): | |||
49 | output = e.output.replace(fn.name, function) | 51 | output = e.output.replace(fn.name, function) |
50 | if not output or not output.startswith('possible bashism'): | 52 | if not output or not output.startswith('possible bashism'): |
51 | # Probably starts with or contains only warnings. Dump verbatim | 53 | # Probably starts with or contains only warnings. Dump verbatim |
52 | # with one space indention. Can't do the splitting and whitelist | 54 | # with one space indention. Can't do the splitting and allowed |
53 | # checking below. | 55 | # checking below. |
54 | return '\n'.join([filename, | 56 | return '\n'.join([filename, |
55 | ' Unexpected output from checkbashisms.pl'] + | 57 | ' Unexpected output from checkbashisms.pl'] + |
@@ -65,7 +67,7 @@ def process(filename, function, lineno, script): | |||
65 | # ... | 67 | # ... |
66 | # ... | 68 | # ... |
67 | result = [] | 69 | result = [] |
68 | # Check the results against the whitelist | 70 | # Check the results against the allowed list |
69 | for message, source in zip(output[0::2], output[1::2]): | 71 | for message, source in zip(output[0::2], output[1::2]): |
70 | if not is_whitelisted(source): | 72 | if not is_whitelisted(source): |
71 | if lineno is not None: | 73 | if lineno is not None: |
@@ -100,7 +102,7 @@ if __name__=='__main__': | |||
100 | args = parser.parse_args() | 102 | args = parser.parse_args() |
101 | 103 | ||
102 | if shutil.which("checkbashisms.pl") is None: | 104 | if shutil.which("checkbashisms.pl") is None: |
103 | print("Cannot find checkbashisms.pl on $PATH, get it from https://anonscm.debian.org/cgit/collab-maint/devscripts.git/plain/scripts/checkbashisms.pl") | 105 | print("Cannot find checkbashisms.pl on $PATH, get it from https://salsa.debian.org/debian/devscripts/raw/master/scripts/checkbashisms.pl") |
104 | sys.exit(1) | 106 | sys.exit(1) |
105 | 107 | ||
106 | # The order of defining the worker function, | 108 | # The order of defining the worker function, |