[oe-commits] [bitbake] 02/02: fixes needed

git at git.openembedded.org git at git.openembedded.org
Wed May 11 21:50:26 UTC 2016


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

commit 44d1e9f0727a76b84657b021846affd0fa7f725a
Author: Richard Purdie <richard.purdie at linuxfoundation.org>
AuthorDate: Wed May 11 14:26:28 2016 +0100

    fixes needed
    
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/bb/cooker.py                   |  2 +-
 lib/bb/cookerdata.py               |  3 +++
 lib/bb/data.py                     |  1 +
 lib/bb/data_smart.py               |  2 +-
 lib/bb/event.py                    |  6 ++++--
 lib/bb/fetch2/__init__.py          |  4 ++--
 lib/bb/main.py                     | 14 +++++++-------
 lib/bb/msg.py                      |  5 +++--
 lib/bb/parse/parse_py/BBHandler.py |  2 +-
 lib/bb/siggen.py                   |  3 ++-
 lib/bb/tests/fetch.py              |  8 ++++----
 11 files changed, 29 insertions(+), 21 deletions(-)

diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index ca1f84c..be9717f 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -2161,7 +2161,7 @@ class CookerParser(object):
             self.error += 1
             etype, value, tb = sys.exc_info()
             if hasattr(value, "recipe"):
-                logger.error('Unable to parse %s', value.recipe,
+                logger.error('Unable to parse %s' % value.recipe, 
                             exc_info=(etype, value, exc.traceback))
             else:
                 # Most likely, an exception occurred during raising an exception
diff --git a/lib/bb/cookerdata.py b/lib/bb/cookerdata.py
index 50259a9..a8f1bef 100644
--- a/lib/bb/cookerdata.py
+++ b/lib/bb/cookerdata.py
@@ -187,12 +187,15 @@ def catch_parse_error(func):
 
             bbdir = os.path.dirname(__file__) + os.sep
             exc_class, exc, tb = sys.exc_info()
+            parselog.critical("Unable to parse %s: %s" % (fn, exc))
             for tb in iter(lambda: tb.tb_next, None):
                 # Skip frames in bitbake itself, we only want the metadata
                 fn, _, _, _ = traceback.extract_tb(tb, 1)[0]
                 if not fn.startswith(bbdir):
                     break
+            parselog.critical("Unable to parse %s: %s" % (fn, exc))
             parselog.critical("Unable to parse %s", fn, exc_info=(exc_class, exc, tb))
+            sys.exit(1)
         except bb.parse.ParseError as exc:
             parselog.critical(str(exc))
             sys.exit(1)
diff --git a/lib/bb/data.py b/lib/bb/data.py
index e9ce0ad..9bc7e6a 100644
--- a/lib/bb/data.py
+++ b/lib/bb/data.py
@@ -408,6 +408,7 @@ def build_dependencies(key, keys, shelldeps, varflagsexcl, d):
         deps -= set(varflags.get("vardepsexclude", "").split())
     except Exception as e:
         bb.warn("Exception during build_dependencies for %s" % key)
+        bb.warn(str(e))
         raise
     return deps, value
     #bb.note("Variable %s references %s and calls %s" % (key, str(deps), str(execs)))
diff --git a/lib/bb/data_smart.py b/lib/bb/data_smart.py
index 9c5fe98..4f90713 100644
--- a/lib/bb/data_smart.py
+++ b/lib/bb/data_smart.py
@@ -398,7 +398,7 @@ class DataSmart(MutableMapping):
                 raise
             except Exception as exc:
                 exc_class, exc, tb = sys.exc_info()
-                raise ExpansionError, ExpansionError(varname, s, exc), tb
+                raise ExpansionError(varname, s, exc)
 
         varparse.value = s
 
diff --git a/lib/bb/event.py b/lib/bb/event.py
index 3955f9d..023300b 100644
--- a/lib/bb/event.py
+++ b/lib/bb/event.py
@@ -157,7 +157,8 @@ def fire_ui_handlers(event, d):
                 _ui_handlers[h].event.sendpickle((pickle.dumps(event)))
              else:
                 _ui_handlers[h].event.send(event)
-        except:
+        except Exception as e:
+            print(str(e))
             errors.append(h)
     for h in errors:
         del _ui_handlers[h]
@@ -607,8 +608,9 @@ class LogHandler(logging.Handler):
             if hasattr(tb, 'tb_next'):
                 tb = list(bb.exceptions.extract_traceback(tb, context=3))
             # Need to turn the value into something the logging system can pickle
-            value = str(value)
             record.bb_exc_info = (etype, value, tb)
+            record.bb_exc_formatted = bb.exceptions.format_exception(etype, value, tb, limit=5)
+            value = str(value)
             record.exc_info = None
         fire(record, None)
 
diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py
index 3082b19..af7162b 100644
--- a/lib/bb/fetch2/__init__.py
+++ b/lib/bb/fetch2/__init__.py
@@ -292,7 +292,7 @@ class URI(object):
             if self.query else '')
 
     def _param_str_split(self, string, elmdelim, kvdelim="="):
-        ret = {}
+        ret = collections.OrderedDict()
         for k, v in [x.split(kvdelim, 1) for x in string.split(elmdelim)]:
             ret[k] = v
         return ret
@@ -385,7 +385,7 @@ def decodeurl(url):
         user = ''
         pswd = ''
 
-    p = {}
+    p = collections.OrderedDict()
     if parm:
         for s in parm.split(';'):
             if s:
diff --git a/lib/bb/main.py b/lib/bb/main.py
index f764579..ce9ff48 100755
--- a/lib/bb/main.py
+++ b/lib/bb/main.py
@@ -116,7 +116,7 @@ def _showwarning(message, category, filename, lineno, file=None, line=None):
             _warnings_showwarning(message, category, filename, lineno, file, line)
     else:
         s = warnings.formatwarning(message, category, filename, lineno)
-        warnlog.warn(s)
+        warnlog.warning(s)
 
 warnings.showwarning = _showwarning
 warnings.filterwarnings("ignore")
@@ -335,19 +335,19 @@ def start_server(servermodule, configParams, configuration, features):
         server.addcooker(cooker)
         server.saveConnectionDetails()
     except Exception as e:
-        exc_info = sys.exc_info()
+        import traceback
+        traceback.print_exc()
+        #print("hello" + str(e))
         while hasattr(server, "event_queue"):
-            try:
-                import queue
-            except ImportError:
-                import Queue as queue
+            import queue
             try:
                 event = server.event_queue.get(block=False)
             except (queue.Empty, IOError):
                 break
             if isinstance(event, logging.LogRecord):
                 logger.handle(event)
-        raise exc_info[1], None, exc_info[2]
+        #print(str(e))
+        raise
     server.detach()
     cooker.lock.close()
     return server
diff --git a/lib/bb/msg.py b/lib/bb/msg.py
index e3ced27..8c3ab47 100644
--- a/lib/bb/msg.py
+++ b/lib/bb/msg.py
@@ -90,8 +90,9 @@ class BBLogFormatter(logging.Formatter):
             if self.color_enabled:
                 record = self.colorize(record)
             msg = logging.Formatter.format(self, record)
-
-        if hasattr(record, 'bb_exc_info'):
+        if hasattr(record, 'bb_exc_formatted'):
+            msg += '\n' + ''.join(record.bb_exc_formatted)
+        elif hasattr(record, 'bb_exc_info'):
             etype, value, tb = record.bb_exc_info
             formatted = bb.exceptions.format_exception(etype, value, tb, limit=5)
             msg += '\n' + ''.join(formatted)
diff --git a/lib/bb/parse/parse_py/BBHandler.py b/lib/bb/parse/parse_py/BBHandler.py
index ef72c37..c54a079 100644
--- a/lib/bb/parse/parse_py/BBHandler.py
+++ b/lib/bb/parse/parse_py/BBHandler.py
@@ -25,7 +25,7 @@
 # with this program; if not, write to the Free Software Foundation, Inc.,
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
-from __future__ import absolute_import
+
 import re, bb, os
 import logging
 import bb.build, bb.utils
diff --git a/lib/bb/siggen.py b/lib/bb/siggen.py
index 529e241..9a2bfb8 100644
--- a/lib/bb/siggen.py
+++ b/lib/bb/siggen.py
@@ -149,8 +149,9 @@ class SignatureGeneratorBasic(SignatureGenerator):
 
         try:
             taskdeps = self._build_data(fn, d)
-        except:
+        except Exception as e:
             bb.warn("Error during finalise of %s" % fn)
+            bb.error(str(e))
             raise
 
         #Slow but can be useful for debugging mismatched basehashes
diff --git a/lib/bb/tests/fetch.py b/lib/bb/tests/fetch.py
index bcc465d..49a6c65 100644
--- a/lib/bb/tests/fetch.py
+++ b/lib/bb/tests/fetch.py
@@ -134,10 +134,10 @@ class URITest(unittest.TestCase):
             'userinfo': 'anoncvs:anonymous',
             'username': 'anoncvs',
             'password': 'anonymous',
-            'params': {
-                'tag': 'V0-99-81',
-                'module': 'familiar/dist/ipkg'
-            },
+            'params': collections.OrderedDict([
+                ('tag', 'V0-99-81'),
+                ('module', 'familiar/dist/ipkg')
+            ]),
             'query': {},
             'relative': False
         },

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


More information about the Openembedded-commits mailing list