diff options
Diffstat (limited to 'bitbake/lib/toaster/bldcontrol/localhostbecontroller.py')
-rw-r--r-- | bitbake/lib/toaster/bldcontrol/localhostbecontroller.py | 39 |
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 | ||