Skip to contentSkip to conversation

toaster.bbclass: Fix ValueError

PATCH In review Ed Bartosh 2 participants 2 messages Jul 27, 2015

lore
Share & tools
lore

Ed Bartosh

author
#0 lore raw

PATCH 1/1 toaster.bbclass: Fix ValueError

The reason for this exception was usage of ':' as a field delimiter in toasterstatlist file. As target can optionally contain ':<task>' suffix it caused split(':') to throw exception:

File "toaster_collect_task_stats(e)", line 71, in toaster_collect_task_stats(e=<bb.event.BuildCompleted object at 0x7f8434deed50>)
ValueError: too many values to unpack

Fixed by changing delimiter ':' -> '::'

---
 meta/classes/toaster.bbclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meta/classes/toaster.bbclass +2 -2
index eeca9de..d63cff5 100644
@@ -192,7 +192,7 @@ python toaster_collect_task_stats() {
             bn = get_bn(e)
             bsdir = os.path.join(e.data.getVar('BUILDSTATS_BASE', True), bn)
             taskdir = os.path.join(bsdir, e.data.expand("${PF}"))
-            fout.write("%s:%s:%s:%s\n" % (e.taskfile, e.taskname, os.path.join(taskdir, e.task), e.data.expand("${PN}")))
+            fout.write("%s::%s::%s::%s\n" % (e.taskfile, e.taskname, os.path.join(taskdir, e.task), e.data.expand("${PN}")))
 
         bb.utils.unlockfile(lock)
 
@@ -245,7 +245,7 @@ python toaster_collect_task_stats() {
         events = []
         with open(os.path.join(e.data.getVar('BUILDSTATS_BASE', True), "toasterstatlist"), "r") as fin:
             for line in fin:
-                (taskfile, taskname, filename, recipename) = line.strip().split(":")
+                (taskfile, taskname, filename, recipename) = line.strip().split("::")
                 events.append((taskfile, taskname, _read_stats(filename), recipename))
         bb.event.fire(bb.event.MetadataEvent("BuildStatsList", events), e.data)
         os.unlink(os.path.join(e.data.getVar('BUILDSTATS_BASE', True), "toasterstatlist"))
Signature · 1 line
2.1.4
#1 lore raw
Quoted 4 lines · Ed Bartosh

The reason for this exception was usage of ':' as a field delimiter in toasterstatlist file. As target can optionally contain ':<task>' suffix it caused split(':') to throw exception:

Quoted 8 lines

File "toaster_collect_task_stats(e)", line 71, in toaster_collect_task_stats(e=<bb.event.BuildCompleted object at 0x7f8434deed50>)
ValueError: too many values to unpack

Fixed by changing delimiter ':' -> '::'

Since this is causing other blockages and is simple I've merged it, thanks!

One thing I did tweak was mentioning in the commit message that "bitbake xxx:do_yyy" triggers this.

Cheers,

Richard