toaster.bbclass: fix crash on buildstats collection

Toaster needs buildstats to be enabled in order to
collect task statistics. The toaster.bbclass didn't
have a guard to stop task data collection if the buildstats
weren't enabled, leading to a crash.

This patch verifies that the task variables are defined before
trying to use them.

(From OE-Core rev: 7f2637ec8d1b8840c31255572b5cb058777382e7)

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Alexandru DAMIAN 2013-12-18 19:24:47 +00:00 committed by Richard Purdie
parent 2ccdb82a35
commit 405c322c72
1 changed files with 3 additions and 0 deletions

View File

@ -165,6 +165,9 @@ python toaster_collect_task_stats() {
import bb.utils
import os
if not e.data.getVar('BUILDSTATS_BASE', True):
return # if we don't have buildstats, we cannot collect stats
def _append_read_list(v):
lock = bb.utils.lockfile(e.data.expand("${TOPDIR}/toaster.lock"), False, True)