All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Improve bitbake-dumpsig
@ 2017-03-11  5:22 Peter Kjellerstedt
  2017-03-11  5:22 ` [PATCH 1/3] bitbake-dumpsig: Allow recipe and task to be specified Peter Kjellerstedt
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Peter Kjellerstedt @ 2017-03-11  5:22 UTC (permalink / raw)
  To: bitbake-devel

This adds support to bitbake-dumpsig to specify the signature file to
dump by specifying a recipie and task using --task (-t), the same way
it is possible to do for bitbake-diffsigs.

It also adds support to bitbake-dumpsig and bitbake-diffsigs to output
some debug data (currently the names of the identified signature
files) by specifying --debug (-D).

//Peter

The following changes since commit 760e81678cec80dcdaab12c2a0a0148e3e0ba275:

  go: Add recipes for golang compilers and tools (2017-03-10 15:51:55 +0000)

are available in the git repository at:

  git://git.yoctoproject.org/poky-contrib pkj/bitbake-dumpsig
  http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=pkj/bitbake-dumpsig

Peter Kjellerstedt (3):
  bitbake-dumpsig: Allow recipe and task to be specified
  bitbake-dumpsig: Add debug support
  bitbake-diffsigs: Add debug support

 bitbake/bin/bitbake-diffsigs |  9 +++++++
 bitbake/bin/bitbake-dumpsig  | 61 ++++++++++++++++++++++++++++++++++++--------
 2 files changed, 59 insertions(+), 11 deletions(-)

-- 
2.12.0



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] bitbake-dumpsig: Allow recipe and task to be specified
  2017-03-11  5:22 [PATCH 0/3] Improve bitbake-dumpsig Peter Kjellerstedt
@ 2017-03-11  5:22 ` Peter Kjellerstedt
  2017-03-11  5:22 ` [PATCH 2/3] bitbake-dumpsig: Add debug support Peter Kjellerstedt
  2017-03-11  5:22 ` [PATCH 3/3] bitbake-diffsigs: " Peter Kjellerstedt
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Kjellerstedt @ 2017-03-11  5:22 UTC (permalink / raw)
  To: bitbake-devel

Use --task <recipe> <task> to dump the signature info for a given
recipe and task. This is similar to the --task option of
bitbake-diffsigs.

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
---
 bitbake/bin/bitbake-dumpsig | 53 +++++++++++++++++++++++++++++++++++----------
 1 file changed, 42 insertions(+), 11 deletions(-)

diff --git a/bitbake/bin/bitbake-dumpsig b/bitbake/bin/bitbake-dumpsig
index 58ba1cad04..b1fce2510d 100755
--- a/bitbake/bin/bitbake-dumpsig
+++ b/bitbake/bin/bitbake-dumpsig
@@ -27,6 +27,7 @@ import pickle
 
 sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), 'lib'))
 
+import bb.tinfoil
 import bb.siggen
 
 def logger_create(name, output=sys.stderr):
@@ -42,24 +43,54 @@ def logger_create(name, output=sys.stderr):
 
 logger = logger_create('bitbake-dumpsig')
 
+def find_siginfo_task(bbhandler, pn, taskname):
+    """ Find the most recent signature file for the specified PN/task """
+
+    if not hasattr(bb.siggen, 'find_siginfo'):
+        logger.error('Metadata does not support finding signature data files')
+        sys.exit(1)
+
+    if not taskname.startswith('do_'):
+        taskname = 'do_%s' % taskname
+
+    filedates = bb.siggen.find_siginfo(pn, taskname, None, bbhandler.config_data)
+    latestfiles = sorted(filedates.keys(), key=lambda f: filedates[f])[-1:]
+    if not latestfiles:
+        logger.error('No sigdata files found matching %s %s' % (pn, taskname))
+        sys.exit(1)
+
+    return latestfiles[0]
+
 parser = optparse.OptionParser(
     description = "Dumps siginfo/sigdata files written out by BitBake",
     usage = """
+  %prog -t recipename taskname
   %prog sigdatafile""")
 
+parser.add_option("-t", "--task",
+        help = "find the signature data file for the specified task",
+        action="store", dest="taskargs", nargs=2, metavar='recipename taskname')
+
 options, args = parser.parse_args(sys.argv)
 
-if len(args) == 1:
+if options.taskargs:
+    tinfoil = bb.tinfoil.Tinfoil()
+    tinfoil.prepare(config_only = True)
+    file = find_siginfo_task(tinfoil, options.taskargs[0], options.taskargs[1])
+elif len(args) == 1:
     parser.print_help()
+    sys.exit(0)
 else:
-    try:
-        output = bb.siggen.dump_sigfile(args[1])
-    except IOError as e:
-        logger.error(str(e))
-        sys.exit(1)
-    except (pickle.UnpicklingError, EOFError):
-        logger.error('Invalid signature data - ensure you are specifying a sigdata/siginfo file')
-        sys.exit(1)
+    file = args[1]
+
+try:
+    output = bb.siggen.dump_sigfile(file)
+except IOError as e:
+    logger.error(str(e))
+    sys.exit(1)
+except (pickle.UnpicklingError, EOFError):
+    logger.error('Invalid signature data - ensure you are specifying a sigdata/siginfo file')
+    sys.exit(1)
 
-    if output:
-        print('\n'.join(output))
+if output:
+    print('\n'.join(output))
-- 
2.12.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] bitbake-dumpsig: Add debug support
  2017-03-11  5:22 [PATCH 0/3] Improve bitbake-dumpsig Peter Kjellerstedt
  2017-03-11  5:22 ` [PATCH 1/3] bitbake-dumpsig: Allow recipe and task to be specified Peter Kjellerstedt
@ 2017-03-11  5:22 ` Peter Kjellerstedt
  2017-03-11  5:22 ` [PATCH 3/3] bitbake-diffsigs: " Peter Kjellerstedt
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Kjellerstedt @ 2017-03-11  5:22 UTC (permalink / raw)
  To: bitbake-devel

Currently shows the name of the signature file that was found when
--task is used.
---
 bitbake/bin/bitbake-dumpsig | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/bitbake/bin/bitbake-dumpsig b/bitbake/bin/bitbake-dumpsig
index b1fce2510d..38efd22864 100755
--- a/bitbake/bin/bitbake-dumpsig
+++ b/bitbake/bin/bitbake-dumpsig
@@ -67,16 +67,24 @@ parser = optparse.OptionParser(
   %prog -t recipename taskname
   %prog sigdatafile""")
 
+parser.add_option("-D", "--debug",
+        help = "enable debug",
+        action = "store_true", dest="debug", default = False)
+
 parser.add_option("-t", "--task",
         help = "find the signature data file for the specified task",
         action="store", dest="taskargs", nargs=2, metavar='recipename taskname')
 
 options, args = parser.parse_args(sys.argv)
 
+if options.debug:
+    logger.setLevel(logging.DEBUG)
+
 if options.taskargs:
     tinfoil = bb.tinfoil.Tinfoil()
     tinfoil.prepare(config_only = True)
     file = find_siginfo_task(tinfoil, options.taskargs[0], options.taskargs[1])
+    logger.debug("Signature file: %s" % file)
 elif len(args) == 1:
     parser.print_help()
     sys.exit(0)
-- 
2.12.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] bitbake-diffsigs: Add debug support
  2017-03-11  5:22 [PATCH 0/3] Improve bitbake-dumpsig Peter Kjellerstedt
  2017-03-11  5:22 ` [PATCH 1/3] bitbake-dumpsig: Allow recipe and task to be specified Peter Kjellerstedt
  2017-03-11  5:22 ` [PATCH 2/3] bitbake-dumpsig: Add debug support Peter Kjellerstedt
@ 2017-03-11  5:22 ` Peter Kjellerstedt
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Kjellerstedt @ 2017-03-11  5:22 UTC (permalink / raw)
  To: bitbake-devel

Currently shows the name of the signature files that were found when
--task is used.
---
 bitbake/bin/bitbake-diffsigs | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/bitbake/bin/bitbake-diffsigs b/bitbake/bin/bitbake-diffsigs
index 527d2c7a9c..c087f99bc5 100755
--- a/bitbake/bin/bitbake-diffsigs
+++ b/bitbake/bin/bitbake-diffsigs
@@ -94,6 +94,8 @@ def find_compare_task(bbhandler, pn, taskname):
             return recout
 
         # Recurse into signature comparison
+        logger.debug("Signature file (previous): %s" % latestfiles[0])
+        logger.debug("Signature file (latest): %s" % latestfiles[1])
         output = bb.siggen.compare_sigfiles(latestfiles[0], latestfiles[1], recursecb)
         if output:
             print('\n'.join(output))
@@ -108,12 +110,19 @@ parser = optparse.OptionParser(
   %prog sigdatafile1 sigdatafile2
   %prog sigdatafile1""")
 
+parser.add_option("-D", "--debug",
+        help = "enable debug",
+        action = "store_true", dest="debug", default = False)
+
 parser.add_option("-t", "--task",
         help = "find the signature data files for last two runs of the specified task and compare them",
         action="store", dest="taskargs", nargs=2, metavar='recipename taskname')
 
 options, args = parser.parse_args(sys.argv)
 
+if options.debug:
+    logger.setLevel(logging.DEBUG)
+
 if options.taskargs:
     with bb.tinfoil.Tinfoil() as tinfoil:
         tinfoil.prepare(config_only=True)
-- 
2.12.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-03-11  5:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-11  5:22 [PATCH 0/3] Improve bitbake-dumpsig Peter Kjellerstedt
2017-03-11  5:22 ` [PATCH 1/3] bitbake-dumpsig: Allow recipe and task to be specified Peter Kjellerstedt
2017-03-11  5:22 ` [PATCH 2/3] bitbake-dumpsig: Add debug support Peter Kjellerstedt
2017-03-11  5:22 ` [PATCH 3/3] bitbake-diffsigs: " Peter Kjellerstedt

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.