diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2015-02-17 12:57:29 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-02-20 12:58:19 +0000 |
commit | 6dbd214fdf8fa20f0e16e802b458e05c5a50a374 (patch) | |
tree | ec5800ba9aebf749cf6913bc939f1470b4a17491 /bitbake/lib/toaster | |
parent | c368d83bd6b34c2420c3d1d7269d8dc2edba1ce9 (diff) | |
download | poky-6dbd214fdf8fa20f0e16e802b458e05c5a50a374.tar.gz |
bitbake: toaster: properly detect starting in rolling log file
This patch brings in properly detection of system start in
a rolling toaster_ui log file.
(Bitbake rev: 6da36cbf5eeb30b8352c22aed3e0ede35705e13c)
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster')
-rw-r--r-- | bitbake/lib/toaster/bldcontrol/localhostbecontroller.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py b/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py index 6bd019ae30..25ce0522b5 100644 --- a/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py +++ b/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py | |||
@@ -107,6 +107,13 @@ class LocalhostBEController(BuildEnvironmentController): | |||
107 | 107 | ||
108 | logger.debug("localhostbecontroller: running the listener at %s" % own_bitbake) | 108 | logger.debug("localhostbecontroller: running the listener at %s" % own_bitbake) |
109 | 109 | ||
110 | toaster_ui_log_filepath = os.path.join(self.be.builddir, "toaster_ui.log") | ||
111 | # get the file length; we need to detect the _last_ start of the toaster UI, not the first | ||
112 | toaster_ui_log_filelength = 0 | ||
113 | if os.path.exists(toaster_ui_log_filepath): | ||
114 | with open(toaster_ui_log_filepath, "r") as f: | ||
115 | f.seek(0, 2) # jump to the end | ||
116 | toaster_ui_log_filelength = f.tell() | ||
110 | 117 | ||
111 | cmd = "bash -c \"source %s/oe-init-build-env %s && bitbake --read conf/toaster-pre.conf --postread conf/toaster.conf --server-only -t xmlrpc -B 0.0.0.0:0 >toaster_server.log && DATABASE_URL=%s BBSERVER=0.0.0.0:-1 daemon -d -i -D %s -o toaster_ui.log -- %s --observe-only -u toasterui &\"" % (self.pokydirname, self.be.builddir, | 118 | cmd = "bash -c \"source %s/oe-init-build-env %s && bitbake --read conf/toaster-pre.conf --postread conf/toaster.conf --server-only -t xmlrpc -B 0.0.0.0:0 >toaster_server.log && DATABASE_URL=%s BBSERVER=0.0.0.0:-1 daemon -d -i -D %s -o toaster_ui.log -- %s --observe-only -u toasterui &\"" % (self.pokydirname, self.be.builddir, |
112 | self.dburl, self.be.builddir, own_bitbake) | 119 | self.dburl, self.be.builddir, own_bitbake) |
@@ -117,10 +124,11 @@ class LocalhostBEController(BuildEnvironmentController): | |||
117 | port = i.split(" ")[-1] | 124 | port = i.split(" ")[-1] |
118 | logger.debug("localhostbecontroller: Found bitbake server port %s" % port) | 125 | logger.debug("localhostbecontroller: Found bitbake server port %s" % port) |
119 | 126 | ||
120 | def _toaster_ui_started(filepath): | 127 | def _toaster_ui_started(filepath, filepos = 0): |
121 | if not os.path.exists(filepath): | 128 | if not os.path.exists(filepath): |
122 | return False | 129 | return False |
123 | with open(filepath, "r") as f: | 130 | with open(filepath, "r") as f: |
131 | f.seek(filepos) | ||
124 | for line in f: | 132 | for line in f: |
125 | if line.startswith("NOTE: ToasterUI waiting for events"): | 133 | if line.startswith("NOTE: ToasterUI waiting for events"): |
126 | return True | 134 | return True |
@@ -129,7 +137,7 @@ class LocalhostBEController(BuildEnvironmentController): | |||
129 | retries = 0 | 137 | retries = 0 |
130 | started = False | 138 | started = False |
131 | while not started and retries < 10: | 139 | while not started and retries < 10: |
132 | started = _toaster_ui_started(os.path.join(self.be.builddir, "toaster_ui.log")) | 140 | started = _toaster_ui_started(toaster_ui_log_filepath, toaster_ui_log_filelength) |
133 | import time | 141 | import time |
134 | logger.debug("localhostbecontroller: Waiting bitbake server to start") | 142 | logger.debug("localhostbecontroller: Waiting bitbake server to start") |
135 | time.sleep(0.5) | 143 | time.sleep(0.5) |