Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 21E32E00D17; Thu, 25 Feb 2016 10:21:36 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature * 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily * valid Received: from mail-wm0-f52.google.com (mail-wm0-f52.google.com [74.125.82.52]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 4FB5DE00D0E for ; Thu, 25 Feb 2016 10:21:34 -0800 (PST) Received: by mail-wm0-f52.google.com with SMTP id g62so41457591wme.1 for ; Thu, 25 Feb 2016 10:21:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=C+ExI4VdiPh9GjrmQD3u1nGcoUvdgBgvwcDFG5LG2pk=; b=zyIKRDbVtL9QTZr9hhGvmxSNPB0ksqwf3iuD6tKC6ZD8Tg86p80pykYG90X1E/u2x8 nINLyTQAtR6zwdvjtL3m/tOT++phwK0jc6IIttB07oz0dnN192yJ1j55VdkxSohOZKaB 8BxehW/wLAQF6tHQt/+y1l2iIQwYSTNKUPOaijcF+pd+bRZ5qEReh1cdrFP7i802K0qs 4mpp4peUMpSsMMWFFWSGLMAHAk4ELWyXAp9NyxT5dX25YuMncyK9QsS6fWCajQukbrd3 eVB+wH5jEW8N5tg9YyASiMYBSWn65BBU0COrs55Yk6tE7zf5yklZTYr/pb+5jU+dgkRU vKgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=C+ExI4VdiPh9GjrmQD3u1nGcoUvdgBgvwcDFG5LG2pk=; b=j9sQS8Xa5l8zU6vETHt2+QeJ1TEZVrh8wqOcpUnpgu56L1r6Wxzbt8z2Vl7t9rqfBa 9wAFoHTGlbA/yleh2oeYNXzqqBtYGQXRLR13XBmUBBxzQKK+jbj52ME7+ZGjFOl5RyK6 M3uzA8BvII696AAVh4nMzW0BXzezgBYDXgttBDBnbynb3wgbpKZN9JWzQyz0BqGyvV/T Es7nORr+HNIOulZnMaBUPzpFIB1SYqLWM+GdsOXNHzft7IIGwC+P358r7QQLZH4x3ATY 2IDBWQyaE5B3zGqp2hIJOgTOacKilNAMivHYMDLUl0kWKHgpdMTK2CBr1Q38EeJJpZ9h rVtA== X-Gm-Message-State: AG10YOSa99NhjcLuEItDnSy64g8sgJLD86mQRHfAm2Px91r37vmIxwhAdDhlGvrYVVxBYnV2 X-Received: by 10.28.54.159 with SMTP id y31mr10120wmh.89.1456424494204; Thu, 25 Feb 2016 10:21:34 -0800 (PST) Received: from draco.icx.intel.com ([83.217.123.106]) by smtp.gmail.com with ESMTPSA id az8sm3084010wjc.17.2016.02.25.10.21.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 25 Feb 2016 10:21:33 -0800 (PST) From: Michael Wood To: toaster@yoctoproject.org Date: Thu, 25 Feb 2016 18:21:19 +0000 Message-Id: <1456424485-6566-6-git-send-email-michael.g.wood@intel.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1456424485-6566-1-git-send-email-michael.g.wood@intel.com> References: <1456424485-6566-1-git-send-email-michael.g.wood@intel.com> Subject: [PATCH 05/11] toaster: update BuildEnvironmentController and BitbakeController X-BeenThere: toaster@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Web based interface for BitBake List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Feb 2016 18:21:36 -0000 From: Sujith H 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 --- 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