summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2013-10-04 15:06:36 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-10-07 09:37:34 +0100
commite0e30c6239c73f5c2f3b6b7500e992f677a6f3c1 (patch)
tree5160a75890a328c8ac1b9c6a0aa2be4200840cf1
parent7c72144419bb9c4e918144f90903a88b27c44d79 (diff)
downloadpoky-e0e30c6239c73f5c2f3b6b7500e992f677a6f3c1.tar.gz
poky-e0e30c6239c73f5c2f3b6b7500e992f677a6f3c1.tar.bz2
poky-e0e30c6239c73f5c2f3b6b7500e992f677a6f3c1.zip
bitbake: bitbake-diffsigs: refactor argument parsing slightly
* Use OptionParser to parse the two options to -t rather than trying to pick them out ourselves. * Add a description shown with --help output (Bitbake rev: daab42d19463b4108968fc88b207936e5ac84154) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-xbitbake/bin/bitbake-diffsigs29
1 files changed, 13 insertions, 16 deletions
diff --git a/bitbake/bin/bitbake-diffsigs b/bitbake/bin/bitbake-diffsigs
index 79f1d6a438..11b40b4e94 100755
--- a/bitbake/bin/bitbake-diffsigs
+++ b/bitbake/bin/bitbake-diffsigs
@@ -74,6 +74,7 @@ def find_compare_task(bbhandler, pn, taskname):
parser = optparse.OptionParser(
+ description = "Compares siginfo/sigdata files written out by BitBake",
usage = """
%prog -t recipename taskname
%prog sigdatafile1 sigdatafile2
@@ -81,25 +82,21 @@ parser = optparse.OptionParser(
parser.add_option("-t", "--task",
help = "find the signature data files for last two runs of the specified task and compare them",
- action="store_true", dest="taskmode")
+ action="store", dest="taskargs", nargs=2, metavar='recipename taskname')
options, args = parser.parse_args(sys.argv)
-if len(args) == 1:
- parser.print_help()
+if options.taskargs:
+ tinfoil = bb.tinfoil.Tinfoil()
+ tinfoil.prepare(config_only = True)
+ find_compare_task(tinfoil, options.taskargs[0], options.taskargs[1])
else:
- if options.taskmode:
- tinfoil = bb.tinfoil.Tinfoil()
- if len(args) < 3:
- logger.error("Please specify a recipe and task name")
- sys.exit(1)
- tinfoil.prepare(config_only = True)
- find_compare_task(tinfoil, args[1], args[2])
+ if len(args) == 1:
+ parser.print_help()
+ elif len(args) == 2:
+ output = bb.siggen.dump_sigfile(sys.argv[1])
else:
- if len(args) == 2:
- output = bb.siggen.dump_sigfile(sys.argv[1])
- else:
- output = bb.siggen.compare_sigfiles(sys.argv[1], sys.argv[2])
+ output = bb.siggen.compare_sigfiles(sys.argv[1], sys.argv[2])
- if output:
- print '\n'.join(output)
+ if output:
+ print '\n'.join(output)