summaryrefslogtreecommitdiffstats
path: root/scripts/verify-bashisms
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/verify-bashisms')
-rwxr-xr-xscripts/verify-bashisms12
1 files changed, 7 insertions, 5 deletions
diff --git a/scripts/verify-bashisms b/scripts/verify-bashisms
index 14d8c298e9..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
6import sys, os, subprocess, re, shutil 8import sys, os, subprocess, re, shutil
7 9
8whitelist = ( 10allowed = (
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
22def is_whitelisted(s): 24def 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: