Skip to contentSkip to conversation

bitbake-diffsigs: Merge with bitbake-dumpsig

PATCH Peter Kjellerstedt 1 participant 2 messages Dec 28, 2018 – Jan 7, 2019

lore
Share & tools
lore
#0 lore raw

Assuming these are accepted into master, I would also like for them to be cherry-picked to Thud, to make bitbake-dumpsig work again.

//Peter

Quoted 420 lines

-----Original Message-----
From: [email protected] <bitbake-devel- [email protected]> On Behalf Of Peter Kjellerstedt
Sent: den 28 december 2018 18:31
To: [email protected]
Cc: Paul Eggleton <[email protected]>
Subject: [bitbake-devel] [PATCH 1/2] bitbake-diffsigs: Merge with bitbake-dumpsig

The functionalities of bitbake-diffsigs and bitbake-dumpsig are so similar that they can be merged into one. Add an option --dump to make bitbake-diffsigs dump the last signature data instead of comparing it. Keep bitbake-dumpsig as a symbolic link to bitbake-diffsigs. When it is called as bitbake-dumpsig, it behaves as if --dump was specified.

Also make -D the short option for --debug again (the way it used to be, and still was for bitbake-dumpsig), so that -d can be used as the short option for --dump.

---
 bitbake/bin/bitbake-diffsigs | 139 +++++++++++++++++++++++++----------
--------
 bitbake/bin/bitbake-dumpsig  |  95 +----------------------------
 2 files changed, 82 insertions(+), 152 deletions(-)
 mode change 100755 => 120000 bitbake/bin/bitbake-dumpsig
bitbake/bin/bitbake- renamed from bitbake/bin/bitbake-diffsigs +0 -0

diffsigs
index 4e6bbddcd8..b0869e1143 100755

bitbake/bin/bitbake-diffsigs +6 -5
@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 
-# bitbake-diffsigs
-# BitBake task signature data comparison utility
+# bitbake-diffsigs / bitbake-dumpsig
+# BitBake task signature data dump and comparison utility
 #
 # Copyright (C) 2012-2013, 2017 Intel Corporation
 #
@@ -21,7 +21,6 @@
 import os
 import sys
 import warnings
-import fnmatch
 import argparse
 import logging
 import pickle
@@ -32,7 +31,10 @@ import bb.tinfoil
 import bb.siggen
 import bb.msg
 
-logger = bb.msg.logger_create('bitbake-diffsigs')
+myname = os.path.basename(sys.argv[0])
+logger = bb.msg.logger_create(myname)
+
+is_dump = myname == 'bitbake-dumpsig'
 
 def find_siginfo(tinfoil, pn, taskname, sigs=None):
     result = None
@@ -59,8 +61,8 @@ def find_siginfo(tinfoil, pn, taskname, sigs=None):
         sys.exit(2)
     return result
 
-def find_compare_task(bbhandler, pn, taskname, sig1=None, sig2=None,

color=False):
- """ Find the most recent signature files for the specified PN/task
and compare them """

bitbake/bin/bitbake-diffsigs +2 -0
+def find_siginfo_task(bbhandler, pn, taskname, sig1=None, sig2=None):
+    """ Find the most recent signature files for the specified PN/task

"""

if not taskname.startswith('do_'):
taskname = 'do_%s' % taskname

bitbake/bin/bitbake-diffsigs +0 -0
@@ -79,73 +81,81 @@ def find_compare_task(bbhandler, pn, taskname,

sig1=None, sig2=None, color=False
latestfiles = [sigfiles[sig1], sigfiles[sig2]]
else:
filedates = find_siginfo(bbhandler, pn, taskname)
- latestfiles = sorted(filedates.keys(), key=lambda f:
filedates[f])[-3:]
+ latestfiles = sorted(filedates.keys(), key=lambda f:
filedates[f])[-2:]
if not latestfiles:
logger.error('No sigdata files found matching %s %s' %
(pn, taskname))

             sys.exit(1)
bitbake/bin/bitbake-diffsigs +0 -2
-        elif len(latestfiles) < 2:
-            logger.error('Only one matching sigdata file found for the

specified task (%s %s)' % (pn, taskname))

bitbake/bin/bitbake-diffsigs +0 -9
-            sys.exit(1)
 
-    # Define recursion callback
-    def recursecb(key, hash1, hash2):
-        hashes = [hash1, hash2]
-        hashfiles = find_siginfo(bbhandler, key, None, hashes)
-
-        recout = []
-        if len(hashfiles) == 0:
-            recout.append("Unable to find matching sigdata for %s with

hashes %s or %s" % (key, hash1, hash2))

bitbake/bin/bitbake-diffsigs +0 -2
-        elif not hash1 in hashfiles:
-            recout.append("Unable to find matching sigdata for %s with

hash %s" % (key, hash1))

bitbake/bin/bitbake-diffsigs +0 -2
-        elif not hash2 in hashfiles:
-            recout.append("Unable to find matching sigdata for %s with

hash %s" % (key, hash2))

bitbake/bin/bitbake-diffsigs +0 -2
-        else:
-            out2 = bb.siggen.compare_sigfiles(hashfiles[hash1],

hashfiles[hash2], recursecb, color=color)

bitbake/bin/bitbake-diffsigs +1 -8
-            for change in out2:
-                for line in change.splitlines():
-                    recout.append('  ' + line)
+    return latestfiles
 
-        return recout
 
-    # Recurse into signature comparison
-    logger.debug("Signature file (previous): %s" % latestfiles[-2])
-    logger.debug("Signature file (latest): %s" % latestfiles[-1])
-    output = bb.siggen.compare_sigfiles(latestfiles[-2], latestfiles[-

1], recursecb, color=color)

bitbake/bin/bitbake-diffsigs +8 -3
-    if output:
-        print('\n'.join(output))
-    sys.exit(0)
+# Define recursion callback
+def recursecb(key, hash1, hash2):
+    hashes = [hash1, hash2]
+    hashfiles = find_siginfo(tinfoil, key, None, hashes)
+
+    recout = []
+    if len(hashfiles) == 0:
+        recout.append("Unable to find matching sigdata for %s with

hashes %s or %s" % (key, hash1, hash2))

bitbake/bin/bitbake-diffsigs +2 -0
+    elif not hash1 in hashfiles:
+        recout.append("Unable to find matching sigdata for %s with

hash %s" % (key, hash1))

bitbake/bin/bitbake-diffsigs +2 -0
+    elif not hash2 in hashfiles:
+        recout.append("Unable to find matching sigdata for %s with

hash %s" % (key, hash2))

bitbake/bin/bitbake-diffsigs +2 -0
+    else:
+        out2 = bb.siggen.compare_sigfiles(hashfiles[hash1],

hashfiles[hash2], recursecb, color=color)

bitbake/bin/bitbake-diffsigs +4 -1
+        for change in out2:
+            for line in change.splitlines():
+                recout.append('  ' + line)
 
+    return recout
 
 
 parser = argparse.ArgumentParser(
-    description="Compares siginfo/sigdata files written out by

BitBake")
+ description=("Dumps" if is_dump else "Compares") + "
siginfo/sigdata files written out by BitBake")

bitbake/bin/bitbake-diffsigs +1 -4
-parser.add_argument('-d', '--debug',
+parser.add_argument('-D', '--debug',
                     help='Enable debug output',
                     action='store_true')
 
-parser.add_argument('--color',
-        help='Colorize output (where %(metavar)s is %(choices)s)',
-        choices=['auto', 'always', 'never'], default='auto',

metavar='color')

bitbake/bin/bitbake-diffsigs +3 -0
+if is_dump:
+    parser.add_argument("-t", "--task",
+            help="find the signature data file for the last run of the

specified task",
+ action="store", dest="taskargs", nargs=2,
metavar=('recipename', 'taskname'))

bitbake/bin/bitbake-diffsigs +0 -2
-parser.add_argument("-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'))

bitbake/bin/bitbake-diffsigs +2 -0
+    parser.add_argument("sigdatafile1",
+            help="Signature file to dump. Not used when using -t/--

task.",

bitbake/bin/bitbake-diffsigs +4 -0
+            action="store", nargs='?', metavar="sigdatafile")
+else:
+    parser.add_argument('-c', '--color',
+            help='Colorize the output (where %(metavar)s is

%(choices)s)',
+ choices=['auto', 'always', 'never'], default='auto',
metavar='color')

bitbake/bin/bitbake-diffsigs +3 -0
+
+    parser.add_argument('-d', '--dump',
+            help='Dump the last signature data instead of comparing

(equivalent to using bitbake-dumpsig)',

bitbake/bin/bitbake-diffsigs +1 -2
+            action='store_true')
 
-parser.add_argument("-s", "--signature",
-        help="With -t/--task, specify the signatures to look for

instead of taking the last two",
- action="store", dest="sigargs", nargs=2, metavar=('fromsig',
'tosig'))

bitbake/bin/bitbake-diffsigs +2 -0
+    parser.add_argument("-t", "--task",
+            help="find the signature data files for the last two runs

of the specified task and compare them",
+ action="store", dest="taskargs", nargs=2,
metavar=('recipename', 'taskname'))

bitbake/bin/bitbake-diffsigs +0 -2
-parser.add_argument("sigdatafile1",
-        help="First signature file to compare (or signature file to

dump, if second not specified). Not used when using -t/--task.",

bitbake/bin/bitbake-diffsigs +2 -1
-        action="store", nargs='?')
+    parser.add_argument("-s", "--signature",
+            help="With -t/--task, specify the signatures to look for

instead of taking the last two",
+ action="store", dest="sigargs", nargs=2,
metavar=('fromsig', 'tosig'))

bitbake/bin/bitbake-diffsigs +2 -3
-parser.add_argument("sigdatafile2",
-        help="Second signature file to compare",
-        action="store", nargs='?')
+    parser.add_argument("sigdatafile1",
+            help="First signature file to compare (or signature file

to dump, if second not specified). Not used when using -t/--task.",

bitbake/bin/bitbake-diffsigs +9 -0
+            action="store", nargs='?')
 
+    parser.add_argument("sigdatafile2",
+            help="Second signature file to compare",
+            action="store", nargs='?')
 
 options = parser.parse_args()
+if is_dump:
+    options.color = 'never'
+    options.dump = True
+    options.sigdatafile2 = None
+    options.sigargs = None
 
 if options.debug:
     logger.setLevel(logging.DEBUG)
@@ -155,16 +165,29 @@ color = (options.color == 'always' or

(options.color == 'auto' and sys.stdout.is
if options.taskargs:
with bb.tinfoil.Tinfoil() as tinfoil:
tinfoil.prepare(config_only=True)

bitbake/bin/bitbake-diffsigs +0 -2
-        if options.sigargs:
-            find_compare_task(tinfoil, options.taskargs[0],

options.taskargs[1], options.sigargs[0], options.sigargs[1], color=color)

bitbake/bin/bitbake-diffsigs +2 -0
+        if not options.dump and options.sigargs:
+            files = find_siginfo_task(tinfoil, options.taskargs[0],

options.taskargs[1], options.sigargs[0], options.sigargs[1])

bitbake/bin/bitbake-diffsigs +2 -0
+        else:
+            files = find_siginfo_task(tinfoil, options.taskargs[0],

options.taskargs[1])

bitbake/bin/bitbake-diffsigs +4 -1
+
+        if options.dump:
+            logger.debug("Signature file: %s" % files[-1])
+            output = bb.siggen.dump_sigfile(files[-1])
         else:
-            find_compare_task(tinfoil, options.taskargs[0],

options.taskargs[1], color=color)

bitbake/bin/bitbake-diffsigs +2 -0
+            if len(files) < 2:
+                logger.error('Only one matching sigdata file found for

the specified task (%s %s)' % (options.taskargs[0], options.taskargs[1]))

bitbake/bin/bitbake-diffsigs +6 -0
+                sys.exit(1)
+
+            # Recurse into signature comparison
+            logger.debug("Signature file (previous): %s" % files[-2])
+            logger.debug("Signature file (latest): %s" % files[-1])
+            output = bb.siggen.compare_sigfiles(files[-2], files[-1],

recursecb, color=color)
else:
if options.sigargs:
logger.error('-s/--signature can only be used together with -
t/--task')

         sys.exit(1)
     try:
bitbake/bin/bitbake-diffsigs +1 -1
-        if options.sigdatafile1 and options.sigdatafile2:
+        if not options.dump and options.sigdatafile1 and

options.sigdatafile2:
output = bb.siggen.compare_sigfiles(options.sigdatafile1,
options.sigdatafile2, color=color)
elif options.sigdatafile1:
output = bb.siggen.dump_sigfile(options.sigdatafile1)

bitbake/bin/bitbake-diffsigs +2 -2
@@ -179,5 +202,5 @@ else:
         logger.error('Invalid signature data - ensure you are
 specifying sigdata/siginfo files')
         sys.exit(1)
 
-    if output:
-        print('\n'.join(output))
+if output:
+    print('\n'.join(output))
bitbake/bin/bitbake-dumpsig deleted +0 -17
deleted file mode 100755
index 95ebd93546..0000000000
@@ -1,94 +0,0 @@
-#!/usr/bin/env python3
-
-# bitbake-dumpsig
-# BitBake task signature dump utility
-#
-# Copyright (C) 2013 Intel Corporation
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License

along
-# with this program; if not, write to the Free Software Foundation, Inc.,

bitbake/bin/bitbake-dumpsig deleted +0 -10
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-import os
-import sys
-import warnings
-import optparse
-import logging
-import pickle
-
-sys.path.insert(0,

os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), 'lib'))

bitbake/bin/bitbake-dumpsig deleted +0 -9
-
-import bb.tinfoil
-import bb.siggen
-import bb.msg
-
-logger = bb.msg.logger_create('bitbake-dumpsig')
-
-def find_siginfo_task(bbhandler, pn, taskname):
-    """ Find the most recent signature file for the specified PN/task

"""

bitbake/bin/bitbake-dumpsig deleted +0 -3
-
-    if not hasattr(bb.siggen, 'find_siginfo'):
-        logger.error('Metadata does not support finding signature data

files')

bitbake/bin/bitbake-dumpsig deleted +0 -6
-        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:]

bitbake/bin/bitbake-dumpsig deleted +0 -2
-    if not latestfiles:
-        logger.error('No sigdata files found matching %s %s' % (pn,

taskname))

bitbake/bin/bitbake-dumpsig deleted +0 -6
-        sys.exit(1)
-
-    return latestfiles[0]
-
-parser = optparse.OptionParser(
-    description = "Dumps siginfo/sigdata files written out by

BitBake",

bitbake/bin/bitbake-dumpsig deleted +0 -11
-    usage = """
-  %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')

bitbake/bin/bitbake-dumpsig deleted +0 -10
-
-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])

bitbake/bin/bitbake-dumpsig deleted +0 -14
-    logger.debug("Signature file: %s" % file)
-elif len(args) == 1:
-    parser.print_help()
-    sys.exit(0)
-else:
-    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')

bitbake/bin/bitbake-dumpsig deleted +0 -4
-    sys.exit(1)
-
-if output:
-    print('\n'.join(output))
bitbake/bin/bitbake-dumpsig new file +1 -1
new file mode 120000
index 0000000000..b1e8489b45
@@ -0,0 +1 @@
+bitbake-diffsigs
\ No newline at end of file
--

2.12.0

--
_______________________________________________
bitbake-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/bitbake-devel

#1 lore raw

Since these two patches now have made it into master, can you please also cherry-pick them to Thud?

//Peter

Quoted 468 lines

-----Original Message-----
From: [email protected] <bitbake-devel- [email protected]> On Behalf Of Peter Kjellerstedt
Sent: den 28 december 2018 18:37
To: [email protected]
Cc: Paul Eggleton <[email protected]>
Subject: Re: [bitbake-devel] [PATCH 1/2] bitbake-diffsigs: Merge with bitbake-dumpsig

Assuming these are accepted into master, I would also like for them to be cherry-picked to Thud, to make bitbake-dumpsig work again.

//Peter

Quoted 11 lines

-----Original Message-----
From: [email protected] <bitbake-devel- [email protected]> On Behalf Of Peter Kjellerstedt
Sent: den 28 december 2018 18:31
To: [email protected]
Cc: Paul Eggleton <[email protected]>
Subject: [bitbake-devel] [PATCH 1/2] bitbake-diffsigs: Merge with bitbake-dumpsig

The functionalities of bitbake-diffsigs and bitbake-dumpsig are so similar that they can be merged into one. Add an option --dump to

make

Quoted 1 line

bitbake-diffsigs dump the last signature data instead of comparing

it.

Quoted 1 line

Keep bitbake-dumpsig as a symbolic link to bitbake-diffsigs. When it

is

Quoted 3 lines

called as bitbake-dumpsig, it behaves as if --dump was specified.

Also make -D the short option for --debug again (the way it used to

be,

Quoted 1 line

and still was for bitbake-dumpsig), so that -d can be used as the

short

Quoted 5 lines

option for --dump.

---
 bitbake/bin/bitbake-diffsigs | 139 +++++++++++++++++++++++++--------

--

Quoted 45 lines

--------

 bitbake/bin/bitbake-dumpsig  |  95 +----------------------------
 2 files changed, 82 insertions(+), 152 deletions(-)
 mode change 100755 => 120000 bitbake/bin/bitbake-dumpsig
bitbake/bin/bitbake- renamed from bitbake/bin/bitbake-diffsigs +0 -0

diffsigs
index 4e6bbddcd8..b0869e1143 100755

bitbake/bin/bitbake-diffsigs +6 -5
@@ -1,7 +1,7 @@
 #!/usr/bin/env python3
 
-# bitbake-diffsigs
-# BitBake task signature data comparison utility
+# bitbake-diffsigs / bitbake-dumpsig
+# BitBake task signature data dump and comparison utility
 #
 # Copyright (C) 2012-2013, 2017 Intel Corporation
 #
@@ -21,7 +21,6 @@
 import os
 import sys
 import warnings
-import fnmatch
 import argparse
 import logging
 import pickle
@@ -32,7 +31,10 @@ import bb.tinfoil
 import bb.siggen
 import bb.msg
 
-logger = bb.msg.logger_create('bitbake-diffsigs')
+myname = os.path.basename(sys.argv[0])
+logger = bb.msg.logger_create(myname)
+
+is_dump = myname == 'bitbake-dumpsig'
 
 def find_siginfo(tinfoil, pn, taskname, sigs=None):
     result = None
@@ -59,8 +61,8 @@ def find_siginfo(tinfoil, pn, taskname, sigs=None):
         sys.exit(2)
     return result
 
-def find_compare_task(bbhandler, pn, taskname, sig1=None, sig2=None,
Quoted 2 lines

color=False):
- """ Find the most recent signature files for the specified

PN/task

Quoted 2 lines

and compare them """
+def find_siginfo_task(bbhandler, pn, taskname, sig1=None,

sig2=None):

Quoted 1 line

+ """ Find the most recent signature files for the specified

PN/task

Quoted 17 lines

"""

if not taskname.startswith('do_'):
taskname = 'do_%s' % taskname

bitbake/bin/bitbake-diffsigs +0 -0
@@ -79,73 +81,81 @@ def find_compare_task(bbhandler, pn, taskname,

sig1=None, sig2=None, color=False
latestfiles = [sigfiles[sig1], sigfiles[sig2]]
else:
filedates = find_siginfo(bbhandler, pn, taskname)
- latestfiles = sorted(filedates.keys(), key=lambda f:
filedates[f])[-3:]
+ latestfiles = sorted(filedates.keys(), key=lambda f:
filedates[f])[-2:]
if not latestfiles:
logger.error('No sigdata files found matching %s %s' %
(pn, taskname))

             sys.exit(1)

bitbake/bin/bitbake-diffsigs

Quoted 2 lines
bitbake/bin/bitbake-diffsigs +0 -2
-        elif len(latestfiles) < 2:
-            logger.error('Only one matching sigdata file found for

the

bitbake/bin/bitbake-diffsigs

Quoted 11 lines

specified task (%s %s)' % (pn, taskname))

bitbake/bin/bitbake-diffsigs +0 -9
-            sys.exit(1)
 
-    # Define recursion callback
-    def recursecb(key, hash1, hash2):
-        hashes = [hash1, hash2]
-        hashfiles = find_siginfo(bbhandler, key, None, hashes)
-
-        recout = []
-        if len(hashfiles) == 0:
-            recout.append("Unable to find matching sigdata for %s

with

bitbake/bin/bitbake-diffsigs

Quoted 3 lines

hashes %s or %s" % (key, hash1, hash2))

bitbake/bin/bitbake-diffsigs +0 -2
-        elif not hash1 in hashfiles:
-            recout.append("Unable to find matching sigdata for %s

with

bitbake/bin/bitbake-diffsigs

Quoted 3 lines

hash %s" % (key, hash1))

bitbake/bin/bitbake-diffsigs +0 -2
-        elif not hash2 in hashfiles:
-            recout.append("Unable to find matching sigdata for %s

with

Quoted 5 lines

hash %s" % (key, hash2))

bitbake/bin/bitbake-diffsigs +0 -2
-        else:
-            out2 = bb.siggen.compare_sigfiles(hashfiles[hash1],

hashfiles[hash2], recursecb, color=color)

bitbake/bin/bitbake-diffsigs +0 -1
-            for change in out2:

bitbake/bin/bitbake-diffsigs

Quoted 10 lines
bitbake/bin/bitbake-diffsigs +1 -7
-                for line in change.splitlines():
-                    recout.append('  ' + line)
+    return latestfiles
 
-        return recout
 
-    # Recurse into signature comparison
-    logger.debug("Signature file (previous): %s" % latestfiles[-2])
-    logger.debug("Signature file (latest): %s" % latestfiles[-1])
-    output = bb.siggen.compare_sigfiles(latestfiles[-2],

latestfiles[-

Quoted 44 lines

1], recursecb, color=color)

bitbake/bin/bitbake-diffsigs +8 -3
-    if output:
-        print('\n'.join(output))
-    sys.exit(0)
+# Define recursion callback
+def recursecb(key, hash1, hash2):
+    hashes = [hash1, hash2]
+    hashfiles = find_siginfo(tinfoil, key, None, hashes)
+
+    recout = []
+    if len(hashfiles) == 0:
+        recout.append("Unable to find matching sigdata for %s with

hashes %s or %s" % (key, hash1, hash2))

bitbake/bin/bitbake-diffsigs +2 -0
+    elif not hash1 in hashfiles:
+        recout.append("Unable to find matching sigdata for %s with

hash %s" % (key, hash1))

bitbake/bin/bitbake-diffsigs +2 -0
+    elif not hash2 in hashfiles:
+        recout.append("Unable to find matching sigdata for %s with

hash %s" % (key, hash2))

bitbake/bin/bitbake-diffsigs +2 -0
+    else:
+        out2 = bb.siggen.compare_sigfiles(hashfiles[hash1],

hashfiles[hash2], recursecb, color=color)

bitbake/bin/bitbake-diffsigs +4 -1
+        for change in out2:
+            for line in change.splitlines():
+                recout.append('  ' + line)
 
+    return recout
 
 
 parser = argparse.ArgumentParser(
-    description="Compares siginfo/sigdata files written out by

BitBake")
+ description=("Dumps" if is_dump else "Compares") + "
siginfo/sigdata files written out by BitBake")

bitbake/bin/bitbake-diffsigs +1 -4
-parser.add_argument('-d', '--debug',
+parser.add_argument('-D', '--debug',
                     help='Enable debug output',
                     action='store_true')
 
-parser.add_argument('--color',
-        help='Colorize output (where %(metavar)s is %(choices)s)',
-        choices=['auto', 'always', 'never'], default='auto',

metavar='color')

bitbake/bin/bitbake-diffsigs

Quoted 3 lines
bitbake/bin/bitbake-diffsigs +3 -0
+if is_dump:
+    parser.add_argument("-t", "--task",
+            help="find the signature data file for the last run of

the

Quoted 30 lines

specified task",
+ action="store", dest="taskargs", nargs=2,
metavar=('recipename', 'taskname'))

bitbake/bin/bitbake-diffsigs +0 -2
-parser.add_argument("-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'))

bitbake/bin/bitbake-diffsigs +2 -0
+    parser.add_argument("sigdatafile1",
+            help="Signature file to dump. Not used when using -t/--

task.",

bitbake/bin/bitbake-diffsigs +4 -0
+            action="store", nargs='?', metavar="sigdatafile")
+else:
+    parser.add_argument('-c', '--color',
+            help='Colorize the output (where %(metavar)s is

%(choices)s)',
+ choices=['auto', 'always', 'never'], default='auto',
metavar='color')

bitbake/bin/bitbake-diffsigs +3 -0
+
+    parser.add_argument('-d', '--dump',
+            help='Dump the last signature data instead of comparing

(equivalent to using bitbake-dumpsig)',

bitbake/bin/bitbake-diffsigs +1 -2
+            action='store_true')
 
-parser.add_argument("-s", "--signature",
-        help="With -t/--task, specify the signatures to look for

instead of taking the last two",
- action="store", dest="sigargs", nargs=2, metavar=('fromsig',
'tosig'))

bitbake/bin/bitbake-diffsigs

Quoted 2 lines
bitbake/bin/bitbake-diffsigs +2 -0
+    parser.add_argument("-t", "--task",
+            help="find the signature data files for the last two

runs

Quoted 57 lines

of the specified task and compare them",
+ action="store", dest="taskargs", nargs=2,
metavar=('recipename', 'taskname'))

bitbake/bin/bitbake-diffsigs +0 -2
-parser.add_argument("sigdatafile1",
-        help="First signature file to compare (or signature file to

dump, if second not specified). Not used when using -t/--task.",

bitbake/bin/bitbake-diffsigs +2 -1
-        action="store", nargs='?')
+    parser.add_argument("-s", "--signature",
+            help="With -t/--task, specify the signatures to look for

instead of taking the last two",
+ action="store", dest="sigargs", nargs=2,
metavar=('fromsig', 'tosig'))

bitbake/bin/bitbake-diffsigs +2 -3
-parser.add_argument("sigdatafile2",
-        help="Second signature file to compare",
-        action="store", nargs='?')
+    parser.add_argument("sigdatafile1",
+            help="First signature file to compare (or signature file

to dump, if second not specified). Not used when using -t/--task.",

bitbake/bin/bitbake-diffsigs +9 -0
+            action="store", nargs='?')
 
+    parser.add_argument("sigdatafile2",
+            help="Second signature file to compare",
+            action="store", nargs='?')
 
 options = parser.parse_args()
+if is_dump:
+    options.color = 'never'
+    options.dump = True
+    options.sigdatafile2 = None
+    options.sigargs = None
 
 if options.debug:
     logger.setLevel(logging.DEBUG)
@@ -155,16 +165,29 @@ color = (options.color == 'always' or

(options.color == 'auto' and sys.stdout.is
if options.taskargs:
with bb.tinfoil.Tinfoil() as tinfoil:
tinfoil.prepare(config_only=True)

bitbake/bin/bitbake-diffsigs +0 -2
-        if options.sigargs:
-            find_compare_task(tinfoil, options.taskargs[0],

options.taskargs[1], options.sigargs[0], options.sigargs[1], color=color)

bitbake/bin/bitbake-diffsigs +2 -0
+        if not options.dump and options.sigargs:
+            files = find_siginfo_task(tinfoil, options.taskargs[0],

options.taskargs[1], options.sigargs[0], options.sigargs[1])

bitbake/bin/bitbake-diffsigs +2 -0
+        else:
+            files = find_siginfo_task(tinfoil, options.taskargs[0],

options.taskargs[1])

bitbake/bin/bitbake-diffsigs +4 -1
+
+        if options.dump:
+            logger.debug("Signature file: %s" % files[-1])
+            output = bb.siggen.dump_sigfile(files[-1])
         else:
-            find_compare_task(tinfoil, options.taskargs[0],

options.taskargs[1], color=color)

bitbake/bin/bitbake-diffsigs

Quoted 2 lines
bitbake/bin/bitbake-diffsigs +2 -0
+            if len(files) < 2:
+                logger.error('Only one matching sigdata file found

for

bitbake/bin/bitbake-diffsigs

Quoted 6 lines

the specified task (%s %s)' % (options.taskargs[0], options.taskargs[1]))

bitbake/bin/bitbake-diffsigs +4 -0
+                sys.exit(1)
+
+            # Recurse into signature comparison
+            logger.debug("Signature file (previous): %s" % files[-

2])

bitbake/bin/bitbake-diffsigs

Quoted 2 lines
bitbake/bin/bitbake-diffsigs +2 -0
+            logger.debug("Signature file (latest): %s" % files[-1])
+            output = bb.siggen.compare_sigfiles(files[-2], files[-

1],

Quoted 4 lines

recursecb, color=color)
else:
if options.sigargs:
logger.error('-s/--signature can only be used together with

-

Quoted 7 lines

t/--task')

         sys.exit(1)
     try:
bitbake/bin/bitbake-diffsigs +1 -1
-        if options.sigdatafile1 and options.sigdatafile2:
+        if not options.dump and options.sigdatafile1 and

options.sigdatafile2:
output =

bb.siggen.compare_sigfiles(options.sigdatafile1,

bitbake/bin/bitbake-

Quoted 13 lines

options.sigdatafile2, color=color)
elif options.sigdatafile1:
output = bb.siggen.dump_sigfile(options.sigdatafile1)

bitbake/bin/bitbake-diffsigs +2 -2
@@ -179,5 +202,5 @@ else:
         logger.error('Invalid signature data - ensure you are
 specifying sigdata/siginfo files')
         sys.exit(1)
 
-    if output:
-        print('\n'.join(output))
+if output:
+    print('\n'.join(output))
bitbake/bin/bitbake- renamed from bitbake/bin/bitbake-dumpsig +0 -0

dumpsig

bitbake/bin/bitbake-dumpsig line 8

Quoted 13 lines

deleted file mode 100755
index 95ebd93546..0000000000

bitbake/bin/bitbake-dumpsig deleted +0 -8
@@ -1,94 +0,0 @@
-#!/usr/bin/env python3
-
-# bitbake-dumpsig
-# BitBake task signature dump utility
-#
-# Copyright (C) 2013 Intel Corporation
-#
-# This program is free software; you can redistribute it and/or

modify

Quoted 23 lines
bitbake/bin/bitbake-dumpsig deleted +0 -9
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License

along
-# with this program; if not, write to the Free Software Foundation, Inc.,

bitbake/bin/bitbake-dumpsig deleted +0 -10
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-import os
-import sys
-import warnings
-import optparse
-import logging
-import pickle
-
-sys.path.insert(0,

os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), 'lib'))

bitbake/bin/bitbake-dumpsig

Quoted 9 lines
bitbake/bin/bitbake-dumpsig deleted +0 -9
-
-import bb.tinfoil
-import bb.siggen
-import bb.msg
-
-logger = bb.msg.logger_create('bitbake-dumpsig')
-
-def find_siginfo_task(bbhandler, pn, taskname):
-    """ Find the most recent signature file for the specified

PN/task

bitbake/bin/bitbake-dumpsig

Quoted 4 lines

"""

bitbake/bin/bitbake-dumpsig deleted +0 -3
-
-    if not hasattr(bb.siggen, 'find_siginfo'):
-        logger.error('Metadata does not support finding signature

data

Quoted 20 lines

files')

bitbake/bin/bitbake-dumpsig deleted +0 -6
-        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:]

bitbake/bin/bitbake-dumpsig deleted +0 -2
-    if not latestfiles:
-        logger.error('No sigdata files found matching %s %s' % (pn,

taskname))

bitbake/bin/bitbake-dumpsig deleted +0 -6
-        sys.exit(1)
-
-    return latestfiles[0]
-
-parser = optparse.OptionParser(
-    description = "Dumps siginfo/sigdata files written out by

BitBake",

bitbake/bin/bitbake-dumpsig

Quoted 10 lines
bitbake/bin/bitbake-dumpsig deleted +0 -10
-    usage = """
-  %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",

Quoted 1 line

- action="store", dest="taskargs", nargs=2,

metavar='recipename

Quoted 16 lines

taskname')

bitbake/bin/bitbake-dumpsig deleted +0 -10
-
-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])

bitbake/bin/bitbake-dumpsig deleted +0 -4
-    logger.debug("Signature file: %s" % file)
-elif len(args) == 1:
-    parser.print_help()
-    sys.exit(0)

bitbake/bin/bitbake-dumpsig

Quoted 10 lines
bitbake/bin/bitbake-dumpsig deleted +0 -10
-else:
-    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

bitbake/bin/bitbake-

Quoted 6 lines

sigdata/siginfo file')

bitbake/bin/bitbake-dumpsig deleted +0 -4
-    sys.exit(1)
-
-if output:
-    print('\n'.join(output))
bitbake/bin/bitbake- renamed from bitbake/bin/bitbake-dumpsig +0 -0

dumpsig

Quoted 10 lines

new file mode 120000
index 0000000000..b1e8489b45

bitbake/bin/bitbake-dumpsig new file +1 -1
@@ -0,0 +1 @@
+bitbake-diffsigs
\ No newline at end of file
--

2.12.0

Quoted 5 lines

--
_______________________________________________
bitbake-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/bitbake-devel

--
_______________________________________________
bitbake-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/bitbake-devel