summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2014-10-13 17:10:39 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-10-30 13:39:51 +0000
commit2837b110ae8fd5ff0ca3ac5959cadb7d4a5ce6cc (patch)
treefca7aba2e90cbcb6f3b11a90bb00665850fa2460 /bitbake/lib/toaster/bldcontrol/localhostbecontroller.py
parenta0660718e6599538dd65cadadbc04c6adc951b57 (diff)
downloadpoky-2837b110ae8fd5ff0ca3ac5959cadb7d4a5ce6cc.tar.gz
bitbake: toaster: change startup parameter passing to avoid race
We avoid a race between the setting the TOASTER_BRBE variable and reading the variable in toaster ui by supplying the variable at server startup time through the toaster.conf post-read file. Additional small changes are included, including marking the build request with the environment id of where the build took place. (Bitbake rev: 7c333350418c4140e6c988c5272940f8057d327d) Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/bldcontrol/localhostbecontroller.py')
-rw-r--r--bitbake/lib/toaster/bldcontrol/localhostbecontroller.py39
1 files changed, 32 insertions, 7 deletions
diff --git a/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py b/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py
index fe7fd81fb9..a272860ec0 100644
--- a/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py
+++ b/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py
@@ -74,14 +74,35 @@ class LocalhostBEController(BuildEnvironmentController):
74 self._createdirpath(self.be.builddir) 74 self._createdirpath(self.be.builddir)
75 self._shellcmd("bash -c \"source %s/oe-init-build-env %s\"" % (self.pokydirname, self.be.builddir)) 75 self._shellcmd("bash -c \"source %s/oe-init-build-env %s\"" % (self.pokydirname, self.be.builddir))
76 76
77 def startBBServer(self): 77 def startBBServer(self, brbe):
78 assert self.pokydirname and os.path.exists(self.pokydirname) 78 assert self.pokydirname and os.path.exists(self.pokydirname)
79 assert self.islayerset 79 assert self.islayerset
80 print("DEBUG: executing ", "bash -c \"source %s/oe-init-build-env %s && DATABASE_URL=%s source toaster start noweb && sleep 1\"" % (self.pokydirname, self.be.builddir, self.dburl)) 80
81 print self._shellcmd("bash -c \"source %s/oe-init-build-env %s && DATABASE_URL=%s source toaster start noweb && sleep 1\"" % (self.pokydirname, self.be.builddir, self.dburl)) 81 try:
82 # FIXME unfortunate sleep 1 - we need to make sure that bbserver is started and the toaster ui is connected 82 os.remove(os.path.join(self.be.builddir, "toaster_ui.log"))
83 # but since they start async without any return, we just wait a bit 83 except OSError as e:
84 print "Started server" 84 import errno
85 if e.errno != errno.ENOENT:
86 raise
87
88 cmd = "bash -c \"source %s/oe-init-build-env %s && DATABASE_URL=%s source toaster start noweb brbe=%s\"" % (self.pokydirname, self.be.builddir, self.dburl, brbe)
89 print("DEBUG: executing ", cmd)
90 print self._shellcmd(cmd)
91 def _toaster_ui_started(filepath):
92 if not os.path.exists(filepath):
93 return False
94 with open(filepath, "r") as f:
95 for line in f:
96 if line.startswith("NOTE: ToasterUI waiting for events"):
97 return True
98 return False
99
100 while not _toaster_ui_started(os.path.join(self.be.builddir, "toaster_ui.log")):
101 import time
102 print "DEBUG: Waiting server to start"
103 time.sleep(0.5)
104
105 print("DEBUG: Started server")
85 assert self.be.sourcedir and os.path.exists(self.be.builddir) 106 assert self.be.sourcedir and os.path.exists(self.be.builddir)
86 self.be.bbaddress = "localhost" 107 self.be.bbaddress = "localhost"
87 self.be.bbport = "8200" 108 self.be.bbport = "8200"
@@ -172,9 +193,13 @@ class LocalhostBEController(BuildEnvironmentController):
172 conflines = open(bblayerconf, "r").readlines() 193 conflines = open(bblayerconf, "r").readlines()
173 194
174 bblayerconffile = open(bblayerconf, "w") 195 bblayerconffile = open(bblayerconf, "w")
196 skip = 0
175 for i in xrange(len(conflines)): 197 for i in xrange(len(conflines)):
198 if skip > 0:
199 skip =- 1
200 continue
176 if conflines[i].startswith("# line added by toaster"): 201 if conflines[i].startswith("# line added by toaster"):
177 i += 2 202 skip = 1
178 else: 203 else:
179 bblayerconffile.write(conflines[i]) 204 bblayerconffile.write(conflines[i])
180 205