[yocto] [yocto-autobuilder][PATCH 2/4] BuildImages.py: build toaster eventlog only when requested

Randle, William C william.c.randle at intel.com
Fri Jul 15 16:54:14 PDT 2016


On Fri, 2016-07-15 at 22:37 +0100, Joshua G Lock wrote:

On Thu, 2016-07-14 at 10:05 -0700, Bill Randle wrote:


Qualify creation of the toaster eventlog based on the setting of the
new
'custom_create_eventlog' property. Place the eventlog in
build/tmp/log,
instead of build and add a timestamp to the eventlog filename since
multiple event logs can be generated during a multi-image buildset
and
otherwise only the last one would otherwise be saved.

[YOCTO #9884]

Signed-off-by: Bill Randle <william.c.randle at intel.com<mailto:william.c.randle at intel.com>>
---
 .../autobuilder/buildsteps/BuildImages.py          | 24
+++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/lib/python2.7/site-
packages/autobuilder/buildsteps/BuildImages.py b/lib/python2.7/site-
packages/autobuilder/buildsteps/BuildImages.py
index 7ef8aab..9ea350f 100644
--- a/lib/python2.7/site-
packages/autobuilder/buildsteps/BuildImages.py
+++ b/lib/python2.7/site-
packages/autobuilder/buildsteps/BuildImages.py
@@ -15,7 +15,7 @@ from buildbot.steps.shell import ShellCommand
 from buildbot.process.buildstep import LogLineObserver
 from distutils.version import StrictVersion
 from buildbot.status.results import SUCCESS, SKIPPED
-import os
+import os, datetime

 from lib.buildsteps import BitbakeShellCommand

@@ -47,8 +47,23 @@ class BuildImages(BitbakeShellCommand):
             self.deploycheck =
self.getProperty('custom_deploy_artifacts')
         except:
             self.deploycheck = "True"
+
+        # the eventlog capability exists only in bitbake 1.25 and
newer
+        self.create_eventlog = "False"
+        if self.getProperty('bitbakeversion') \
+           and StrictVersion(self.getProperty('bitbakeversion')) >=
StrictVersion("1.25"):
+            try:
+                self.create_eventlog =
self.getProperty("custom_create_eventlog")
+                if self.create_eventlog == "True":
+                    timestamp =
datetime.datetime.now().strftime("%Y%m%d%H%M%S")
+                    self.eventlog_name = "tmp/log/bitbake_eventlog-
%s.json" % timestamp
+            except:
+                pass



Do we really want to catch all exceptions here and ignore them? What
exception might be thrown by the above code?



The only exception I know of would be the case where the property is not defined because the code was invoked from a page that did not set it (not all pages do).



+
         if self.images == "#TOASTER":
-            bitbakeflags = "-k -w 'bitbake_eventlog.json' "
+            bitbakeflags = "-k "
+            if self.create_eventlog == "True":
+                bitbakeflags += "-w '" + self.eventlog_name + "' "
             self.images=self.getProperty("custom_images")
             self.command = ". ./oe-init-build-env; bitbake " +
bitbakeflags + self.images
             self.description = ["Building " + str(self.images)]
@@ -130,9 +145,8 @@ class BuildImages(BitbakeShellCommand):
                 self.description = ["Skipping Build. No Images to be
built"]
             else:
                 bitbakeflags = "-k "
-                # -w only exists in bitbake 1.25 and newer, use
distroversion string and make sure we're on poky >1.7
-                if self.getProperty('bitbakeversion') and
StrictVersion(self.getProperty('bitbakeversion')) >=
StrictVersion("1.25"):
-                    bitbakeflags += "-w 'bitbake_eventlog.json' "
+                if self.create_eventlog == "True":
+                    bitbakeflags += "-w '" + self.eventlog_name + "'
"
                 if self.minnowExists is None or self.minnowExists ==
"True":
                     self.command = ". ./oe-init-build-env; bitbake "
+ bitbakeflags + self.images
                     self.description = ["Building " +
str(self.images)]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20160715/0981b0b1/attachment.html>


More information about the yocto mailing list