Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id CD2ECE00C27; Mon, 1 Feb 2016 06:30:59 -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 * [134.134.136.24 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 97A33E00C1E for ; Mon, 1 Feb 2016 06:30:56 -0800 (PST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP; 01 Feb 2016 06:30:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,380,1449561600"; d="scan'208";a="905881321" Received: from unknown (HELO lp.ger.corp.intel.com) ([10.252.22.6]) by fmsmga002.fm.intel.com with ESMTP; 01 Feb 2016 06:30:52 -0800 From: Elliot Smith To: toaster@yoctoproject.org Date: Mon, 1 Feb 2016 14:30:40 +0000 Message-Id: <1454337042-14865-2-git-send-email-elliot.smith@intel.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1454337042-14865-1-git-send-email-elliot.smith@intel.com> References: <1454337042-14865-1-git-send-email-elliot.smith@intel.com> Subject: [review-request][PATCH 1/3] command: fire CommandExecution event before a command runs 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, 01 Feb 2016 14:30:59 -0000 Cooker commands and the arguments passed to them are currently inaccessible to UI components which may need that data. For example, knowing the targets passed on the command line could enable a UI to show the targets in cases where the build failed due to an invalid target. Add events to Command which are fired just before a sync or async command is started, containing data about the command which is going to run and its arguments. Add the new event to knotty's event mask to avoid seeing "Unknown event" errors when bitbake is run on the command line. Signed-off-by: Elliot Smith --- bitbake/lib/bb/command.py | 7 +++++++ bitbake/lib/bb/ui/knotty.py | 10 ++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py index 74106d1..3f3a7a7 100644 --- a/bitbake/lib/bb/command.py +++ b/bitbake/lib/bb/command.py @@ -31,6 +31,11 @@ Commands are queued in a CommandQueue import bb.event import bb.cooker +class CommandExecution(bb.event.Event): + def __init__(self, command, commandline): + self.command = command + self.commandline = commandline + class CommandCompleted(bb.event.Event): pass @@ -70,6 +75,7 @@ class Command: try: if getattr(command_method, 'needconfig', False): self.cooker.updateCacheSync() + bb.event.fire(CommandExecution(command, commandline), self.cooker.expanded_data) result = command_method(self, commandline) except CommandError as exc: return None, exc.args[0] @@ -101,6 +107,7 @@ class Command: self.cooker.updateCache() return True else: + bb.event.fire(CommandExecution(command, options), self.cooker.expanded_data) commandmethod(self.cmds_async, self, options) return False else: diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py index a8b968c..335e6f9 100644 --- a/bitbake/lib/bb/ui/knotty.py +++ b/bitbake/lib/bb/ui/knotty.py @@ -245,9 +245,10 @@ _evt_list = [ "bb.runqueue.runQueueExitWait", "bb.event.LogExecTTY", "logging.Lo "bb.build.TaskFailed", "bb.build.TaskBase", "bb.event.ParseStarted", "bb.event.ParseProgress", "bb.event.ParseCompleted", "bb.event.CacheLoadStarted", "bb.event.CacheLoadProgress", "bb.event.CacheLoadCompleted", "bb.command.CommandFailed", - "bb.command.CommandExit", "bb.command.CommandCompleted", "bb.cooker.CookerExit", - "bb.event.MultipleProviders", "bb.event.NoProvider", "bb.runqueue.sceneQueueTaskStarted", - "bb.runqueue.runQueueTaskStarted", "bb.runqueue.runQueueTaskFailed", "bb.runqueue.sceneQueueTaskFailed", + "bb.command.CommandExit", "bb.command.CommandCompleted", "bb.cooker.CommandExecution", + "bb.cooker.CookerExit", "bb.event.MultipleProviders", "bb.event.NoProvider", + "bb.runqueue.sceneQueueTaskStarted", "bb.runqueue.runQueueTaskStarted", + "bb.runqueue.runQueueTaskFailed", "bb.runqueue.sceneQueueTaskFailed", "bb.event.BuildBase", "bb.build.TaskStarted", "bb.build.TaskSucceeded", "bb.build.TaskFailedSilent"] def main(server, eventHandler, params, tf = TerminalFilter): @@ -514,7 +515,8 @@ def main(server, eventHandler, params, tf = TerminalFilter): bb.event.OperationStarted, bb.event.OperationCompleted, bb.event.OperationProgress, - bb.event.DiskFull)): + bb.event.DiskFull, + bb.command.CommandExecution)): continue logger.error("Unknown event: %s", event) -- Elliot Smith Software Engineer Intel OTC --------------------------------------------------------------------- Intel Corporation (UK) Limited Registered No. 1134945 (England) Registered Office: Pipers Way, Swindon SN3 1RJ VAT No: 860 2173 47 This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.