[Toaster] [PATCH 05/11] toaster: update BuildEnvironmentController and BitbakeController
Michael Wood
michael.g.wood at intel.com
Thu Feb 25 10:21:19 PST 2016
From: Sujith H <sujith.h at gmail.com>
Remove getBBController function from BuildEnvironmentController.
The constructor of BitbakeController is updated appropriately so that
call can be made to connect to running server.
The call to startBBServer is removed from bbcontroller and handledin
localhostbecontroller.
[YOCTO #6787]
Signed-off-by: Sujith H <sujith.h at gmail.com>
---
bitbake/lib/toaster/bldcontrol/bbcontroller.py | 26 ++++------------------
.../toaster/bldcontrol/localhostbecontroller.py | 6 +++--
2 files changed, 8 insertions(+), 24 deletions(-)
diff --git a/bitbake/lib/toaster/bldcontrol/bbcontroller.py b/bitbake/lib/toaster/bldcontrol/bbcontroller.py
index 068b835..c382927 100644
--- a/bitbake/lib/toaster/bldcontrol/bbcontroller.py
+++ b/bitbake/lib/toaster/bldcontrol/bbcontroller.py
@@ -37,11 +37,12 @@ class BitbakeController(object):
It is outside the scope of this class on how the server is started and aquired
"""
- def __init__(self, connection):
- self.connection = connection
+ def __init__(self, be):
+ self.connection = bb.server.xmlrpc._create_server(be.bbaddress,
+ int(be.bbport))[0]
def _runCommand(self, command):
- result, error = self.connection.connection.runCommand(command)
+ result, error = self.connection.runCommand(command)
if error:
raise Exception(error)
return result
@@ -155,25 +156,6 @@ class BuildEnvironmentController(object):
raise Exception("FIXME: Must override setLayers")
- def getBBController(self):
- """ returns a BitbakeController to an already started server; this is the point where the server
- starts if needed; or reconnects to the server if we can
- """
- if not self.connection:
- self.startBBServer()
- self.be.lock = BuildEnvironment.LOCK_RUNNING
- self.be.save()
-
- server = bb.server.xmlrpc.BitBakeXMLRPCClient()
- server.initServer()
- server.saveConnectionDetails("%s:%s" % (self.be.bbaddress, self.be.bbport))
- self.connection = server.establishConnection([])
-
- self.be.bbtoken = self.connection.transport.connection_token
- self.be.save()
-
- return BitbakeController(self.connection)
-
def getArtifact(self, path):
""" This call returns an artifact identified by the 'path'. How 'path' is interpreted as
up to the implementing BEC. The return MUST be a REST URL where a GET will actually return
diff --git a/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py b/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py
index efd82c3..7de4f63 100644
--- a/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py
+++ b/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py
@@ -32,7 +32,7 @@ import subprocess
from toastermain import settings
-from bbcontroller import BuildEnvironmentController, ShellCmdException, BuildSetupException
+from bbcontroller import BuildEnvironmentController, ShellCmdException, BuildSetupException, BitbakeController
import logging
logger = logging.getLogger("toaster")
@@ -100,6 +100,7 @@ class LocalhostBEController(BuildEnvironmentController):
self.be.bbaddress = "localhost"
self.be.bbstate = BuildEnvironment.SERVER_STARTED
+ self.be.lock = BuildEnvironment.LOCK_RUNNING
self.be.save()
def getGitCloneDirectory(self, url, branch):
@@ -306,7 +307,8 @@ class LocalhostBEController(BuildEnvironmentController):
conf.write('INHERIT+="toaster buildhistory"')
# get the bb server running with the build req id and build env id
- bbctrl = self.getBBController()
+ self.startBBServer()
+ bbctrl = BitbakeController(self.be)
# set variables; TOASTER_BRBE is not set on the server, as this
# causes events from command-line builds to be attached to the last
--
2.1.4
More information about the toaster
mailing list