summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2017-11-09 12:12:04 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-11-30 10:49:20 +0000
commita67c4f3f6f7df4080f665904fc9ab1e000041992 (patch)
treebd27885f30632ea7eb742de5f72e898ec156ab40 /scripts
parent8a0d9d9bc41891440c9ec8f342df6c786e7414a9 (diff)
downloadpoky-a67c4f3f6f7df4080f665904fc9ab1e000041992.tar.gz
verify-bashisms: use argparse, add verbose option
(From OE-Core rev: 5168ecf6545ddde03bb801e4200d8a6563789be3) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/verify-bashisms15
1 files changed, 11 insertions, 4 deletions
diff --git a/scripts/verify-bashisms b/scripts/verify-bashisms
index dab64ef501..a979bd2965 100755
--- a/scripts/verify-bashisms
+++ b/scripts/verify-bashisms
@@ -89,7 +89,13 @@ def get_tinfoil():
89 return tinfoil 89 return tinfoil
90 90
91if __name__=='__main__': 91if __name__=='__main__':
92 import shutil 92 import argparse, shutil
93
94 parser = argparse.ArgumentParser(description='Bashim detector for shell fragments in recipes.')
95 parser.add_argument("recipes", metavar="RECIPE", nargs="*", help="recipes to check (if not specified, all will be checked)")
96 parser.add_argument("--verbose", default=False, action="store_true")
97 args = parser.parse_args()
98
93 if shutil.which("checkbashisms.pl") is None: 99 if shutil.which("checkbashisms.pl") is None:
94 print("Cannot find checkbashisms.pl on $PATH, get it from https://anonscm.debian.org/cgit/collab-maint/devscripts.git/plain/scripts/checkbashisms.pl") 100 print("Cannot find checkbashisms.pl on $PATH, get it from https://anonscm.debian.org/cgit/collab-maint/devscripts.git/plain/scripts/checkbashisms.pl")
95 sys.exit(1) 101 sys.exit(1)
@@ -99,6 +105,8 @@ if __name__=='__main__':
99 # bitbake server is crucial, don't change it. 105 # bitbake server is crucial, don't change it.
100 def func(item): 106 def func(item):
101 (filename, key, lineno), script = item 107 (filename, key, lineno), script = item
108 if args.verbose:
109 print("Scanning %s:%s" % (filename, key))
102 return process(filename, key, lineno, script) 110 return process(filename, key, lineno, script)
103 111
104 import multiprocessing 112 import multiprocessing
@@ -110,9 +118,8 @@ if __name__=='__main__':
110 # recipecaches to handle multiconfig environments 118 # recipecaches to handle multiconfig environments
111 pkg_pn = tinfoil.cooker.recipecaches[""].pkg_pn 119 pkg_pn = tinfoil.cooker.recipecaches[""].pkg_pn
112 120
113 # TODO: use argparse and have --help 121 if args.recipes:
114 if len(sys.argv) > 1: 122 initial_pns = args.recipes
115 initial_pns = sys.argv[1:]
116 else: 123 else:
117 initial_pns = sorted(pkg_pn) 124 initial_pns = sorted(pkg_pn)
118 125