[oe-commits] [bitbake] 01/04: bb.cooker: show limited traceback for parsing ExpansionError

git at git.openembedded.org git at git.openembedded.org
Tue May 17 22:25:06 UTC 2016


rpurdie pushed a commit to branch master-next
in repository bitbake.

commit 7ff5b9eed82b7f4fd138fc6d746a0b79efbea98a
Author: Christopher Larson <chris_larson at mentor.com>
AuthorDate: Sat Apr 30 12:52:46 2016 -0700

    bb.cooker: show limited traceback for parsing ExpansionError
    
    It's useful to see tracebacks for ExpansionErrors, but only if we skip the
    leading bitbake-internal elements, otherwise we see elements of the expansion
    process.
    
    As one example:
    
    Before:
    
        ERROR: ExpansionError during parsing /scratch/yocto-new/external-as-needed/poky/meta/recipes-core/glibc/glibc-locale_2.23.bb: Failure expanding variable PV[:=], expression was ${@get_external_libc_version(d)} which triggered exception AttributeError: 'module' object has no attribute 'external'
    
    After:
    
        ERROR: ExpansionError during parsing /scratch/yocto-new/external-as-needed/poky/meta/recipes-core/glibc/glibc-locale_2.23.bb
        Traceback (most recent call last):
          File "PV[:=]", line 1, in <module>
          File "/scratch/yocto-new/external-as-needed/meta-sourcery/recipes-external/glibc/glibc-external-version.inc", line 3, in get_external_libc_version(d=<bb.data_smart.DataSmart
        object at 0x7f05d2566950>):
                 sopattern = os.path.join(d.getVar('base_libdir', True), 'libc-*.so')
            >    found_paths = oe.external.find_sysroot_files([sopattern], d)
                 if found_paths:
        ExpansionError: Failure expanding variable PV[:=], expression was ${@get_external_libc_version(d)} which triggered exception AttributeError: 'module' object has no attribute 'external'
    
    Signed-off-by: Christopher Larson <chris_larson at mentor.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/bb/cooker.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index 5b76b4d..219c79e 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -2147,8 +2147,11 @@ class CookerParser(object):
             return False
         except bb.data_smart.ExpansionError as exc:
             self.error += 1
-            _, value, _ = sys.exc_info()
-            logger.error('ExpansionError during parsing %s: %s', value.recipe, str(exc))
+            bbdir = os.path.dirname(__file__) + os.sep
+            etype, value, _ = sys.exc_info()
+            tb = list(itertools.dropwhile(lambda e: e.filename.startswith(bbdir), exc.traceback))
+            logger.error('ExpansionError during parsing %s', value.recipe,
+                         exc_info=(etype, value, tb))
             self.shutdown(clean=False)
             return False
         except Exception as exc:

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list