aboutsummaryrefslogtreecommitdiff
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-29 23:41:34 +0000
commit5168ecf6545ddde03bb801e4200d8a6563789be3 (patch)
treee05676eb96344a21dda2d50e34738bfc25aca83a
parent33418ed064fe9cff5b4803f09135a81d9170c189 (diff)
downloadopenembedded-core-5168ecf6545ddde03bb801e4200d8a6563789be3.zip
openembedded-core-5168ecf6545ddde03bb801e4200d8a6563789be3.tar.gz
openembedded-core-5168ecf6545ddde03bb801e4200d8a6563789be3.tar.bz2
verify-bashisms: use argparse, add verbose option
Signed-off-by: Ross Burton <ross.burton@intel.com>
-rwxr-xr-xscripts/verify-bashisms15
1 files changed, 11 insertions, 4 deletions
diff --git a/scripts/verify-bashisms b/scripts/verify-bashisms
index dab64ef..a979bd2 100755
--- a/scripts/verify-bashisms
+++ b/scripts/verify-bashisms
@@ -89,7 +89,13 @@ def get_tinfoil():
return tinfoil
if __name__=='__main__':
- import shutil
+ import argparse, shutil
+
+ parser = argparse.ArgumentParser(description='Bashim detector for shell fragments in recipes.')
+ parser.add_argument("recipes", metavar="RECIPE", nargs="*", help="recipes to check (if not specified, all will be checked)")
+ parser.add_argument("--verbose", default=False, action="store_true")
+ args = parser.parse_args()
+
if shutil.which("checkbashisms.pl") is None:
print("Cannot find checkbashisms.pl on $PATH, get it from https://anonscm.debian.org/cgit/collab-maint/devscripts.git/plain/scripts/checkbashisms.pl")
sys.exit(1)
@@ -99,6 +105,8 @@ if __name__=='__main__':
# bitbake server is crucial, don't change it.
def func(item):
(filename, key, lineno), script = item
+ if args.verbose:
+ print("Scanning %s:%s" % (filename, key))
return process(filename, key, lineno, script)
import multiprocessing
@@ -110,9 +118,8 @@ if __name__=='__main__':
# recipecaches to handle multiconfig environments
pkg_pn = tinfoil.cooker.recipecaches[""].pkg_pn
- # TODO: use argparse and have --help
- if len(sys.argv) > 1:
- initial_pns = sys.argv[1:]
+ if args.recipes:
+ initial_pns = args.recipes
else:
initial_pns = sorted(pkg_pn)