summaryrefslogtreecommitdiffstats
path: root/bitbake
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 /bitbake
parent7c72144419bb9c4e918144f90903a88b27c44d79 (diff)
downloadpoky-e0e30c6239c73f5c2f3b6b7500e992f677a6f3c1.tar.gz
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>
Diffstat (limited to 'bitbake')
-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):
74 74
75 75
76parser = optparse.OptionParser( 76parser = optparse.OptionParser(
77 description = "Compares siginfo/sigdata files written out by BitBake",
77 usage = """ 78 usage = """
78 %prog -t recipename taskname 79 %prog -t recipename taskname
79 %prog sigdatafile1 sigdatafile2 80 %prog sigdatafile1 sigdatafile2
@@ -81,25 +82,21 @@ parser = optparse.OptionParser(
81 82
82parser.add_option("-t", "--task", 83parser.add_option("-t", "--task",
83 help = "find the signature data files for last two runs of the specified task and compare them", 84 help = "find the signature data files for last two runs of the specified task and compare them",
84 action="store_true", dest="taskmode") 85 action="store", dest="taskargs", nargs=2, metavar='recipename taskname')
85 86
86options, args = parser.parse_args(sys.argv) 87options, args = parser.parse_args(sys.argv)
87 88
88if len(args) == 1: 89if options.taskargs:
89 parser.print_help() 90 tinfoil = bb.tinfoil.Tinfoil()
91 tinfoil.prepare(config_only = True)
92 find_compare_task(tinfoil, options.taskargs[0], options.taskargs[1])
90else: 93else:
91 if options.taskmode: 94 if len(args) == 1:
92 tinfoil = bb.tinfoil.Tinfoil() 95 parser.print_help()
93 if len(args) < 3: 96 elif len(args) == 2:
94 logger.error("Please specify a recipe and task name") 97 output = bb.siggen.dump_sigfile(sys.argv[1])
95 sys.exit(1)
96 tinfoil.prepare(config_only = True)
97 find_compare_task(tinfoil, args[1], args[2])
98 else: 98 else:
99 if len(args) == 2: 99 output = bb.siggen.compare_sigfiles(sys.argv[1], sys.argv[2])
100 output = bb.siggen.dump_sigfile(sys.argv[1])
101 else:
102 output = bb.siggen.compare_sigfiles(sys.argv[1], sys.argv[2])
103 100
104 if output: 101 if output:
105 print '\n'.join(output) 102 print '\n'.join(output)