diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2014-11-03 13:47:16 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-11-12 17:04:48 +0000 |
commit | 0ca70ce37aa8cec6a74ec874a7b11597b608c403 (patch) | |
tree | 65e74aa95de35de101286746cd5b9f6acca80468 /bitbake/lib/toaster/bldcontrol/sshbecontroller.py | |
parent | baa1082c64beb0385aca2807ae6da26bee5dbcbf (diff) | |
download | poky-0ca70ce37aa8cec6a74ec874a7b11597b608c403.tar.gz |
bitbake: toaster script: webport option and other improvements
We add the "webport=" command line option as to allow starting
the web server on a custom port.
The bitbake server port is now auto-allocated. This is needed
to be able to run multiple toaster environments on a single machine.
We tackle bug 6023 (toaster refusing to start when lock file is present)
by using more specific checks, and automatically recover from
bitbake server down / webserver up error mode.
Command line parameters are now read on both interactive and managed
modes.
The localhost and ssh controllers are updated to work with the modified
toaster launcher script.
[YOCTO #6023]
(Bitbake rev: cd3eb5b051743463cfe51dba97cae4da75420048)
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/sshbecontroller.py')
-rw-r--r-- | bitbake/lib/toaster/bldcontrol/sshbecontroller.py | 46 |
1 files changed, 31 insertions, 15 deletions
diff --git a/bitbake/lib/toaster/bldcontrol/sshbecontroller.py b/bitbake/lib/toaster/bldcontrol/sshbecontroller.py index f9fd51e5f8..45e15392e5 100644 --- a/bitbake/lib/toaster/bldcontrol/sshbecontroller.py +++ b/bitbake/lib/toaster/bldcontrol/sshbecontroller.py | |||
@@ -80,13 +80,18 @@ class SSHBEController(BuildEnvironmentController): | |||
80 | def startBBServer(self, brbe): | 80 | def startBBServer(self, brbe): |
81 | assert self.pokydirname and self._pathexists(self.pokydirname) | 81 | assert self.pokydirname and self._pathexists(self.pokydirname) |
82 | assert self.islayerset | 82 | assert self.islayerset |
83 | print self._shellcmd("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)) | 83 | cmd = self._shellcmd("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)) |
84 | # FIXME unfortunate sleep 1 - we need to make sure that bbserver is started and the toaster ui is connected | 84 | |
85 | # but since they start async without any return, we just wait a bit | 85 | port = "-1" |
86 | print "Started server" | 86 | for i in cmd.split("\n"): |
87 | if i.startswith("Bitbake server address"): | ||
88 | port = i.split(" ")[-1] | ||
89 | print "Found bitbake server port ", port | ||
90 | |||
91 | |||
87 | assert self.be.sourcedir and self._pathexists(self.be.builddir) | 92 | assert self.be.sourcedir and self._pathexists(self.be.builddir) |
88 | self.be.bbaddress = self.be.address.split("@")[-1] | 93 | self.be.bbaddress = self.be.address.split("@")[-1] |
89 | self.be.bbport = "8200" | 94 | self.be.bbport = port |
90 | self.be.bbstate = BuildEnvironment.SERVER_STARTED | 95 | self.be.bbstate = BuildEnvironment.SERVER_STARTED |
91 | self.be.save() | 96 | self.be.save() |
92 | 97 | ||
@@ -99,6 +104,19 @@ class SSHBEController(BuildEnvironmentController): | |||
99 | self.be.save() | 104 | self.be.save() |
100 | print "Stopped server" | 105 | print "Stopped server" |
101 | 106 | ||
107 | |||
108 | def _copyFile(self, filepath1, filepath2): | ||
109 | p = subprocess.Popen("scp '%s' '%s'" % (filepath1, filepath2), stdout=subprocess.PIPE, stderr = subprocess.PIPE, shell=True) | ||
110 | (out, err) = p.communicate() | ||
111 | if p.returncode: | ||
112 | raise ShellCmdException(err) | ||
113 | |||
114 | def pullFile(self, local_filename, remote_filename): | ||
115 | _copyFile(local_filename, "%s:%s" % (self.be.address, remote_filename)) | ||
116 | |||
117 | def pushFile(self, local_filename, remote_filename): | ||
118 | _copyFile("%s:%s" % (self.be.address, remote_filename), local_filename) | ||
119 | |||
102 | def setLayers(self, bitbakes, layers): | 120 | def setLayers(self, bitbakes, layers): |
103 | """ a word of attention: by convention, the first layer for any build will be poky! """ | 121 | """ a word of attention: by convention, the first layer for any build will be poky! """ |
104 | 122 | ||
@@ -110,7 +128,7 @@ class SSHBEController(BuildEnvironmentController): | |||
110 | gitrepos = {} | 128 | gitrepos = {} |
111 | gitrepos[bitbakes[0].giturl] = [] | 129 | gitrepos[bitbakes[0].giturl] = [] |
112 | gitrepos[bitbakes[0].giturl].append( ("bitbake", bitbakes[0].dirpath, bitbakes[0].commit) ) | 130 | gitrepos[bitbakes[0].giturl].append( ("bitbake", bitbakes[0].dirpath, bitbakes[0].commit) ) |
113 | 131 | ||
114 | for layer in layers: | 132 | for layer in layers: |
115 | # we don't process local URLs | 133 | # we don't process local URLs |
116 | if layer.giturl.startswith("file://"): | 134 | if layer.giturl.startswith("file://"): |
@@ -171,17 +189,15 @@ class SSHBEController(BuildEnvironmentController): | |||
171 | if not self._pathexists(bblayerconf): | 189 | if not self._pathexists(bblayerconf): |
172 | raise BuildSetupException("BE is not consistent: bblayers.conf file missing at %s" % bblayerconf) | 190 | raise BuildSetupException("BE is not consistent: bblayers.conf file missing at %s" % bblayerconf) |
173 | 191 | ||
174 | conflines = open(bblayerconf, "r").readlines() | 192 | import uuid |
193 | local_bblayerconf = "/tmp/" + uuid.uuid4() + "-bblayer.conf" | ||
175 | 194 | ||
176 | bblayerconffile = open(bblayerconf, "w") | 195 | self.pullFile(bblayerconf, local_bblayerconf) |
177 | for i in xrange(len(conflines)): | 196 | |
178 | if conflines[i].startswith("# line added by toaster"): | 197 | BuildEnvironmentController._updateBBLayers(local_bblayerconf, layerlist) |
179 | i += 2 | 198 | self.pushFile(local_bblayerconf, bblayerconf) |
180 | else: | ||
181 | bblayerconffile.write(conflines[i]) | ||
182 | 199 | ||
183 | bblayerconffile.write("\n# line added by toaster build control\nBBLAYERS = \"" + " ".join(layerlist) + "\"") | 200 | os.unlink(local_bblayerconf) |
184 | bblayerconffile.close() | ||
185 | 201 | ||
186 | self.islayerset = True | 202 | self.islayerset = True |
187 | return True | 203 | return True |