From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id C4441E00BBC; Wed, 20 Jan 2016 05:48:02 -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=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high * trust * [192.55.52.93 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id B2D9AE00B9C for ; Wed, 20 Jan 2016 05:47:56 -0800 (PST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP; 20 Jan 2016 05:47:56 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,321,1449561600"; d="scan'208";a="636939834" Received: from linux.intel.com ([10.23.219.25]) by FMSMGA003.fm.intel.com with ESMTP; 20 Jan 2016 05:47:57 -0800 Received: from vmed.fi.intel.com (vmed.fi.intel.com [10.237.72.51]) by linux.intel.com (Postfix) with ESMTP id C82D46A4002 for ; Wed, 20 Jan 2016 06:35:51 -0800 (PST) From: Ed Bartosh To: toaster@yoctoproject.org Date: Wed, 20 Jan 2016 13:50:11 +0200 Message-Id: <8d8468e5639bed673cff0285f8275dc9162bad57.1453290241.git.ed.bartosh@linux.intel.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [review-request][PATCH 3/3] toaster: remove sshbecontroller module 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: Wed, 20 Jan 2016 13:48:02 -0000 The code of this module is broken for a long time. The functionality of it can be easily achieved by running 'manage.py runbuilds.py' on remote machine. [YOCTO #8806] Signed-off-by: Ed Bartosh --- bitbake/lib/toaster/bldcontrol/sshbecontroller.py | 169 ---------------------- 1 file changed, 169 deletions(-) delete mode 100644 bitbake/lib/toaster/bldcontrol/sshbecontroller.py diff --git a/bitbake/lib/toaster/bldcontrol/sshbecontroller.py b/bitbake/lib/toaster/bldcontrol/sshbecontroller.py deleted file mode 100644 index 17dd66c..0000000 --- a/bitbake/lib/toaster/bldcontrol/sshbecontroller.py +++ /dev/null @@ -1,169 +0,0 @@ -# -# ex:ts=4:sw=4:sts=4:et -# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- -# -# BitBake Toaster Implementation -# -# Copyright (C) 2014 Intel Corporation -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - -import sys -import re -from django.db import transaction -from django.db.models import Q -from bldcontrol.models import BuildEnvironment, BRLayer, BRVariable, BRTarget, BRBitbake -import subprocess - -from toastermain import settings - -from bbcontroller import BuildEnvironmentController, ShellCmdException, BuildSetupException - -class NotImplementedException(Exception): - pass - -def DN(path): - return "/".join(path.split("/")[0:-1]) - -class SSHBEController(BuildEnvironmentController): - """ Implementation of the BuildEnvironmentController for the localhost; - this controller manages the default build directory, - the server setup and system start and stop for the localhost-type build environment - - """ - - def __init__(self, be): - super(SSHBEController, self).__init__(be) - self.dburl = settings.getDATABASE_URL() - self.pokydirname = None - self.islayerset = False - - def _shellcmd(self, command, cwd = None): - if cwd is None: - cwd = self.be.sourcedir - - p = subprocess.Popen("ssh %s 'cd %s && %s'" % (self.be.address, cwd, command), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) - (out,err) = p.communicate() - if p.returncode: - if len(err) == 0: - err = "command: %s \n%s" % (command, out) - else: - err = "command: %s \n%s" % (command, err) - raise ShellCmdException(err) - else: - return out.strip() - - def _pathexists(self, path): - try: - self._shellcmd("test -e \"%s\"" % path) - return True - except ShellCmdException as e: - return False - - def _pathcreate(self, path): - self._shellcmd("mkdir -p \"%s\"" % path) - - def _setupBE(self): - assert self.pokydirname and self._pathexists(self.pokydirname) - self._pathcreate(self.be.builddir) - self._shellcmd("bash -c \"source %s/oe-init-build-env %s\"" % (self.pokydirname, self.be.builddir)) - - def startBBServer(self, brbe): - assert self.pokydirname and self._pathexists(self.pokydirname) - assert self.islayerset - 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)) - - port = "-1" - for i in cmd.split("\n"): - if i.startswith("Bitbake server address"): - port = i.split(" ")[-1] - print "Found bitbake server port ", port - - - assert self.be.sourcedir and self._pathexists(self.be.builddir) - self.be.bbaddress = self.be.address.split("@")[-1] - self.be.bbport = port - self.be.bbstate = BuildEnvironment.SERVER_STARTED - self.be.save() - - def _copyFile(self, filepath1, filepath2): - p = subprocess.Popen("scp '%s' '%s'" % (filepath1, filepath2), stdout=subprocess.PIPE, stderr = subprocess.PIPE, shell=True) - (out, err) = p.communicate() - if p.returncode: - raise ShellCmdException(err) - - def pullFile(self, local_filename, remote_filename): - _copyFile(local_filename, "%s:%s" % (self.be.address, remote_filename)) - - def pushFile(self, local_filename, remote_filename): - _copyFile("%s:%s" % (self.be.address, remote_filename), local_filename) - - def setLayers(self, bitbakes, layers): - """ a word of attention: by convention, the first layer for any build will be poky! """ - - assert self.be.sourcedir is not None - assert len(bitbakes) == 1 - # set layers in the layersource - - - raise NotImplementedException("Not implemented: SSH setLayers") - # 3. configure the build environment, so we have a conf/bblayers.conf - assert self.pokydirname is not None - self._setupBE() - - # 4. update the bblayers.conf - bblayerconf = os.path.join(self.be.builddir, "conf/bblayers.conf") - if not self._pathexists(bblayerconf): - raise BuildSetupException("BE is not consistent: bblayers.conf file missing at %s" % bblayerconf) - - import uuid - local_bblayerconf = "/tmp/" + uuid.uuid4() + "-bblayer.conf" - - self.pullFile(bblayerconf, local_bblayerconf) - - BuildEnvironmentController._updateBBLayers(local_bblayerconf, layerlist) - self.pushFile(local_bblayerconf, bblayerconf) - - os.unlink(local_bblayerconf) - - self.islayerset = True - return True - - def release(self): - assert self.be.sourcedir and self._pathexists(self.be.builddir) - import shutil - shutil.rmtree(os.path.join(self.be.sourcedir, "build")) - assert not self._pathexists(self.be.builddir) - - def triggerBuild(self, bitbake, layers, variables, targets): - # set up the buid environment with the needed layers - self.setLayers(bitbake, layers) - self.writeConfFile("conf/toaster-pre.conf", ) - self.writeConfFile("conf/toaster.conf", raw = "INHERIT+=\"toaster buildhistory\"") - - # get the bb server running with the build req id and build env id - bbctrl = self.getBBController() - - # trigger the build command - task = reduce(lambda x, y: x if len(y)== 0 else y, map(lambda y: y.task, targets)) - if len(task) == 0: - task = None - - bbctrl.build(list(map(lambda x:x.target, targets)), task) - - logger.debug("localhostbecontroller: Build launched, exiting. Follow build logs at %s/toaster_ui.log" % self.be.builddir) - - # disconnect from the server - bbctrl.disconnect() -- 2.1.4