diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/verify-bashisms | 15 |
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 | ||
91 | if __name__=='__main__': | 91 | if __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 | ||