[bitbake-devel] [PATCH 1/1] bitbake: runqueue: catch HashValidateFailure errors in RunQueueExecuteScenequeue

Hongxu Jia hongxu.jia at windriver.com
Wed Aug 27 11:54:48 UTC 2014


We need to catch the failure of self.rq.hashvalidate which invoked
in RunQueueExecuteScenequeue, and exit in a normal build.

So we add exception HashValidateFailure for this specific error.

Signed-off-by: Hongxu Jia <hongxu.jia at windriver.com>
---
 bitbake/lib/bb/runqueue.py | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index e13dc57..b48b02b 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -1046,7 +1046,15 @@ class RunQueue:
                 self.state = runQueueComplete
             else:
                 self.start_worker()
-                self.rqexe = RunQueueExecuteScenequeue(self)
+                try:
+                    self.rqexe = RunQueueExecuteScenequeue(self)
+                except bb.runqueue.HashValidateFailure:
+                    # While HashValidateFailure, we need exit the normal build.
+                    logger.error("Hash validatation failed in RunQueueExecuteScenequeue")
+                    self.state = runQueueComplete
+                except:
+                    logger.error("RunQueueExecuteScenequeue init failed")
+                    raise
 
         if self.state in [runQueueSceneRun, runQueueRunning, runQueueCleanUp]:
             self.dm.check(self)
@@ -1821,7 +1829,10 @@ 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:
+                raise bb.runqueue.HashValidateFailure()
 
             valid_new = stamppresent
             for v in valid:
@@ -2003,6 +2014,8 @@ class TaskFailure(Exception):
     def __init__(self, x):
         self.args = x
 
+# Exception raised for a hash validation error
+class HashValidateFailure(Exception): pass
 
 class runQueueExitWait(bb.event.Event):
     """
-- 
1.9.1




More information about the bitbake-devel mailing list