Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 06249E00C4A; Mon, 22 Feb 2016 03:31:44 -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=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low * trust * [209.85.192.174 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily * valid * -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Received: from mail-pf0-f174.google.com (mail-pf0-f174.google.com [209.85.192.174]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id E2EEDE00C36 for ; Mon, 22 Feb 2016 03:31:25 -0800 (PST) Received: by mail-pf0-f174.google.com with SMTP id q63so91444499pfb.0 for ; Mon, 22 Feb 2016 03:31:25 -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=rP6/9dZ1Knr8tOeOM3LxUt1xNrIK/rybv7OvU8S9Iuo=; b=yT/uO/OdfnKAfk+jckfrnjl5/YpsduacouwdNfq62DBa+n/jtp0gkyd/DKmCbCG7fy wUX3AYKmYttF+D7q1b0HE3Ri3jpfeIIZAuDT0m/UqE+thk/IyhFrVoZXvR6eM7/1pp9g XO3FBkFKBU7orzHU8zQib4MegWGDfL7zLctpeZmgdrHl3YOQRPwrHlFJ+bjntPUP/jMI Iqi2S0lb3liK9xxnLlpJLHBdL4381/jW3YoTBtIYYkC8puFDA7o7uSPf9e3DrIpDTH3o sbdxijceMJV+20fiLyQQ/Ot7ba6fc/jpmmLtle1Yg/Q5zYdon5fmnxYlSKyCCT3oKXzR KLig== 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=rP6/9dZ1Knr8tOeOM3LxUt1xNrIK/rybv7OvU8S9Iuo=; b=kA1U3uJ8RYXKOr0JrePEPtLMMMVPUW2O3kI73UqkKZ5JvG5YISnp4QD0auga+pFL+q 6oMQIre98HMNGBVPcubV0YZlgEJtyLMikHHE7xeLqQmXsisNWgxcUi1Wbd3n6tpjtdc7 f5M0i29tEpEgHSvBbhLW9+ZudooOZwEMREeBSdMPcEKX/jYZxMMSmZY8mwb5JsTVxMHx GxoMXNX/vVtP94vx5G/uXWxFFq+Cu/yYJggNUNV5Wx5JFyMD0Fq3sMQBqpyzyT+xQeuk d5hg1gle1cyVl7o6bCElUtfBB6FQ4K/dyE+Tfa3fmCblzUfVDwFzAfdc303VMzPdTChu LF5Q== X-Gm-Message-State: AG10YOSMpgMF4h+D8EzsSqP8U46A6obk6iRBGZuO3ZTM3RuBYfU5kYXVuSnVY8ruP4Sbw8ST X-Received: by 10.98.80.206 with SMTP id g75mr37491317pfj.127.1456140685223; Mon, 22 Feb 2016 03:31:25 -0800 (PST) Received: from dorado.ger.corp.intel.com (fmdmzpr01-ext.fm.intel.com. [192.55.54.36]) by smtp.gmail.com with ESMTPSA id n78sm36216801pfb.53.2016.02.22.03.31.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 22 Feb 2016 03:31:24 -0800 (PST) From: Michael Wood To: toaster@yoctoproject.org Date: Mon, 22 Feb 2016 11:31:01 +0000 Message-Id: <1456140666-5344-6-git-send-email-michael.g.wood@intel.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1456140666-5344-1-git-send-email-michael.g.wood@intel.com> References: <1456140666-5344-1-git-send-email-michael.g.wood@intel.com> Subject: [PATCH 05/10] 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: Mon, 22 Feb 2016 11:31:44 -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.5.0