Skip to contentSkip to conversation

bitbake: runqueue/cooker: catch hashvalidate error in RunQueueExecuteScenequeue

PATCH New Hongxu Jia 1 participant 2 messages Aug 27, 2014

lore
Share & tools
lore

Hongxu Jia

author
#0 lore raw

v5 cover bitbake: runqueue/cooker: catch hashvalidate error in RunQueueExecuteScenequeue

Changed in V5:
- Tweak execute_runqueue's exception process order.

Changed in V4:
- Use bb.BBHandledException to instead of custom exception HashValidateFailure

Changed in V3:
- Add exception HashValidateFailure for the specific error

Changed in V2:
- Strip the commit message within 80 characters a line

//Hongxu

The following changes since commit 52b788c6df9201764130ab744bf67b770b24b896:

autogen-native: inherit pkgconfig to fix a build failure (2014-08-25 10:26:00 +0100)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib hongxu/bitbake
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=hongxu/bitbake

Hongxu Jia (1):
bitbake: runqueue/cooker: catch hashvalidate error in
RunQueueExecuteScenequeue

 bitbake/lib/bb/cooker.py   |  4 ++--
 bitbake/lib/bb/runqueue.py | 14 ++++++++------
 2 files changed, 10 insertions(+), 8 deletions(-)
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH v5 1/1 bitbake: runqueue/cooker: catch hashvalidate error in RunQueueExecuteScenequeue

We need to catch the failure of self.rq.hashvalidate which invoked in RunQueueExecuteScenequeue, and exit in a normal build. So we raise bb.BBHandledException for this specific error.

Tweak execute_runqueue's exception process order. So the build will exit peacefully while the above failure occurs.

---
 bitbake/lib/bb/cooker.py   |  4 ++--
 bitbake/lib/bb/runqueue.py | 14 ++++++++------
 2 files changed, 10 insertions(+), 8 deletions(-)
bitbake/lib/bb/cooker.py +2 -2
index f463603..4c47cbc 100644
@@ -1147,7 +1147,7 @@ class BBCooker:
             except runqueue.TaskFailure as exc:
                 failures += len(exc.args)
                 retval = False
-            except SystemExit as exc:
+            except (SystemExit, bb.BBHandledException) as exc:
                 self.command.finishAsyncCommand()
                 return False
 
@@ -1180,7 +1180,7 @@ class BBCooker:
             except runqueue.TaskFailure as exc:
                 failures += len(exc.args)
                 retval = False
-            except SystemExit as exc:
+            except (SystemExit, bb.BBHandledException) as exc:
                 self.command.finishAsyncCommand()
                 return False
 
bitbake/lib/bb/runqueue.py +8 -6
index e13dc57..897eccd 100644
@@ -1093,10 +1093,9 @@ class RunQueue:
             return self._execute_runqueue()
         except bb.runqueue.TaskFailure:
             raise
-        except SystemExit:
-            raise
-        except:
-            logger.error("An uncaught exception occured in runqueue, please see the failure below:")
+        except BaseException as e:
+            if not isinstance(e, (SystemExit, bb.BBHandledException)):
+                logger.error("An uncaught exception occured in runqueue, please see the failure below:")
             try:
                 self.teardown_workers()
             except:
@@ -1821,7 +1820,11 @@ class RunQueueExecuteScenequeue(RunQueueExecute):
                 sq_task.append(task)
             call = self.rq.hashvalidate + "(sq_fn, sq_task, sq_hash, sq_hashfn, d)"
             locs = { "sq_fn" : sq_fn, "sq_task" : sq_taskname, "sq_hash" : sq_hash, "sq_hashfn" : sq_hashfn, "d" : self.cooker.data }
-            valid = bb.utils.better_eval(call, locs)
+            try:
+                valid = bb.utils.better_eval(call, locs)
+            except Exception as e:
+                logger.error("Hash validation failed in RunQueueExecuteScenequeue %s" % str(e))
+                raise bb.BBHandledException()
 
             valid_new = stamppresent
             for v in valid:
@@ -2003,7 +2006,6 @@ class TaskFailure(Exception):
     def __init__(self, x):
         self.args = x
 
-
 class runQueueExitWait(bb.event.Event):
     """
     Event when waiting for task processes to exit
Signature · 1 line
1.9.1