summaryrefslogtreecommitdiffstats
path: root/bitbake/bin/bitbake-diffsigs
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2013-10-04 15:35:29 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-10-07 09:37:35 +0100
commite57bd62e1772a7af52e7439ada8f94ddcadbf94f (patch)
treef03720f795db03690b89d09f0e8693408f5efb78 /bitbake/bin/bitbake-diffsigs
parente0e30c6239c73f5c2f3b6b7500e992f677a6f3c1 (diff)
downloadast2050-yocto-poky-e57bd62e1772a7af52e7439ada8f94ddcadbf94f.zip
ast2050-yocto-poky-e57bd62e1772a7af52e7439ada8f94ddcadbf94f.tar.gz
bitbake: bitbake-diffsigs: improve error handling
* Set up a logger independent of BitBake so we can log errors ourselves * Handle common errors without printing a traceback (Bitbake rev: 77b5f5b8dca4deebb06eeb06a8e7f2ccdbfff46f) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/bin/bitbake-diffsigs')
-rwxr-xr-xbitbake/bin/bitbake-diffsigs30
1 files changed, 25 insertions, 5 deletions
diff --git a/bitbake/bin/bitbake-diffsigs b/bitbake/bin/bitbake-diffsigs
index 11b40b4..78757b0 100755
--- a/bitbake/bin/bitbake-diffsigs
+++ b/bitbake/bin/bitbake-diffsigs
@@ -3,7 +3,7 @@
# bitbake-diffsigs
# BitBake task signature data comparison utility
#
-# Copyright (C) 2012 Intel Corporation
+# Copyright (C) 2012-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
@@ -30,7 +30,18 @@ sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), '
import bb.tinfoil
import bb.siggen
-logger = logging.getLogger('BitBake')
+def logger_create(name, output=sys.stderr):
+ logger = logging.getLogger(name)
+ console = logging.StreamHandler(output)
+ format = bb.msg.BBLogFormatter("%(levelname)s: %(message)s")
+ if output.isatty():
+ format.enable_color()
+ console.setFormatter(format)
+ logger.addHandler(console)
+ logger.setLevel(logging.INFO)
+ return logger
+
+logger = logger_create('bitbake-diffsigs')
def find_compare_task(bbhandler, pn, taskname):
""" Find the most recent signature files for the specified PN/task and compare them """
@@ -93,10 +104,19 @@ if options.taskargs:
else:
if len(args) == 1:
parser.print_help()
- elif len(args) == 2:
- output = bb.siggen.dump_sigfile(sys.argv[1])
else:
- output = bb.siggen.compare_sigfiles(sys.argv[1], sys.argv[2])
+ import cPickle
+ try:
+ if len(args) == 2:
+ output = bb.siggen.dump_sigfile(sys.argv[1])
+ else:
+ output = bb.siggen.compare_sigfiles(sys.argv[1], sys.argv[2])
+ except IOError as e:
+ logger.error(str(e))
+ sys.exit(1)
+ except cPickle.UnpicklingError, EOFError:
+ logger.error('Invalid signature data - ensure you are specifying sigdata/siginfo files')
+ sys.exit(1)
if output:
print '\n'.join(output)
OpenPOWER on IntegriCloud