* [PATCH] verify-bashisms: use argparse, add verbose option
@ 2017-11-21 13:14 Ross Burton
2017-11-21 14:05 ` Robert P. J. Day
0 siblings, 1 reply; 2+ messages in thread
From: Ross Burton @ 2017-11-21 13:14 UTC (permalink / raw)
To: openembedded-core
Signed-off-by: Ross Burton <ross.burton@intel.com>
---
scripts/verify-bashisms | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/scripts/verify-bashisms b/scripts/verify-bashisms
index dab64ef5019..a979bd29650 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)
--
2.11.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] verify-bashisms: use argparse, add verbose option
2017-11-21 13:14 [PATCH] verify-bashisms: use argparse, add verbose option Ross Burton
@ 2017-11-21 14:05 ` Robert P. J. Day
0 siblings, 0 replies; 2+ messages in thread
From: Robert P. J. Day @ 2017-11-21 14:05 UTC (permalink / raw)
To: Ross Burton; +Cc: openembedded-core
On Tue, 21 Nov 2017, Ross Burton wrote:
> Signed-off-by: Ross Burton <ross.burton@intel.com>
> ---
> scripts/verify-bashisms | 15 +++++++++++----
> 1 file changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/scripts/verify-bashisms b/scripts/verify-bashisms
> index dab64ef5019..a979bd29650 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.')
^^^^^^ ???
rday
--
========================================================================
Robert P. J. Day Ottawa, Ontario, CANADA
http://crashcourse.ca
Twitter: http://twitter.com/rpjday
LinkedIn: http://ca.linkedin.com/in/rpjday
========================================================================
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-11-21 14:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-21 13:14 [PATCH] verify-bashisms: use argparse, add verbose option Ross Burton
2017-11-21 14:05 ` Robert P. J. Day
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.