From: "Randle, William C" <william.c.randle@intel.com>
To: "joshua.g.lock@linux.intel.com" <joshua.g.lock@linux.intel.com>,
"yocto@yoctoproject.org" <yocto@yoctoproject.org>
Subject: Re: [yocto-autobuilder][PATCH 2/4] BuildImages.py: build toaster eventlog only when requested
Date: Sat, 16 Jul 2016 14:45:05 +0000 [thread overview]
Message-ID: <1468680305.17397.8.camel@intel.com> (raw)
In-Reply-To: <1468626854.17397.2.camel@intel.com>
[-- Attachment #1: Type: text/plain, Size: 4451 bytes --]
On Fri, 2016-07-15 at 16:54 -0700, Randle, William C wrote:
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@intel.com<mailto:william.c.randle@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).
To clarify a bit more, if you look at the full source file (BuildImages.py), you will see that standard way to check a property is:
try:
somevar = self.getProperty("propname")
except:
somevar = default_value
In the added code, it actually sets the default value first:
self.create_eventlog = "False"
because there are several checks made. Since the default is already set, there's no reason to set it again in the except caluse, hence I just did a 'pass'.
-Bill
+
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)]
[-- Attachment #2: Type: text/html, Size: 8209 bytes --]
next prev parent reply other threads:[~2016-07-16 14:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-14 17:05 [yocto-autobuilder][PATCH 0/4] autobuilder: make toaster eventlog creation optional Bill Randle
2016-07-14 17:05 ` [yocto-autobuilder][PATCH 1/4] remote_kick.py: add default entry for new 'create_eventlog' property Bill Randle
2016-07-14 17:05 ` [yocto-autobuilder][PATCH 2/4] BuildImages.py: build toaster eventlog only when requested Bill Randle
2016-07-15 21:37 ` Joshua G Lock
2016-07-15 23:54 ` Randle, William C
2016-07-16 14:45 ` Randle, William C [this message]
2016-07-14 17:05 ` [yocto-autobuilder][PATCH 3/4] UploadToasterEventlog.py: handle multiple eventlog files Bill Randle
2016-07-14 17:05 ` [yocto-autobuilder][PATCH 4/4] buildset-config.controller: add new 'create_eventlog' forced build property Bill Randle
2016-07-19 15:42 ` [yocto-autobuilder][PATCH 0/4] autobuilder: make toaster eventlog creation optional Beth 'pidge' Flanagan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1468680305.17397.8.camel@intel.com \
--to=william.c.randle@intel.com \
--cc=joshua.g.lock@linux.intel.com \
--cc=yocto@yoctoproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.