From 1f7f07746629a55e4efd5f505e84eb6c66567115 Mon Sep 17 00:00:00 2001 From: Elliot Smith Date: Wed, 10 Feb 2016 18:34:10 +0000 Subject: bitbake: buildinfohelper: unset brbe variable when build finishes The brbe variable is set on the bitbake server when the Toaster UI starts. This enables Toaster to associate events with the correct build and build environment. However, the brbe variable is also used when a build starts to identify whether a new build needs to be created, or an existing one looked up. This causes a bug for command-line builds which happen after a Toaster-triggered build: because the brbe variable is never unset on the server or the buildinfohelper, the new command-line build events are treated as originating from the previous build. Ensure the brbe variable is reset when the buildinfohelper "closes" a build, so that each build then either sets the brbe variable (Toaster-triggered builds) or leaves it blank (command-line builds). Also modify the localhostbecontroller so that the brbe variable is not set on the server and not looked up from the server. This ensures that it is only set when the triggerBuild() method is called, and that it remains as None for command-line builds. [YOCTO #9021] (Bitbake rev: 4a6a8d0074f62208d843b06344be31ae73d9b745) Signed-off-by: Elliot Smith Signed-off-by: Michael Wood Signed-off-by: Richard Purdie --- bitbake/lib/bb/ui/buildinfohelper.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'bitbake/lib/bb/ui') diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py index c049b4a150..81abede803 100644 --- a/bitbake/lib/bb/ui/buildinfohelper.py +++ b/bitbake/lib/bb/ui/buildinfohelper.py @@ -832,8 +832,13 @@ class BuildInfoHelper(object): self.orm_wrapper = ORMWrapper() self.has_build_history = has_build_history self.tmp_dir = self.server.runCommand(["getVariable", "TMPDIR"])[0] - self.brbe = self.server.runCommand(["getVariable", "TOASTER_BRBE"])[0] - self.project = self.server.runCommand(["getVariable", "TOASTER_PROJECT"])[0] + + # this is set for Toaster-triggered builds by localhostbecontroller + # via toasterui + self.brbe = None + + self.project = None + logger.debug(1, "buildinfohelper: Build info helper inited %s" % vars(self)) @@ -843,8 +848,6 @@ class BuildInfoHelper(object): def _get_build_information(self, build_log_path): build_info = {} - # Generate an identifier for each new build - build_info['machine'] = self.server.runCommand(["getVariable", "MACHINE"])[0] build_info['distro'] = self.server.runCommand(["getVariable", "DISTRO"])[0] build_info['distro_version'] = self.server.runCommand(["getVariable", "DISTRO_VERSION"])[0] @@ -853,9 +856,7 @@ class BuildInfoHelper(object): build_info['cooker_log_path'] = build_log_path build_info['build_name'] = self.server.runCommand(["getVariable", "BUILDNAME"])[0] build_info['bitbake_version'] = self.server.runCommand(["getVariable", "BB_VERSION"])[0] - build_info['brbe'] = self.server.runCommand(["getVariable", "TOASTER_BRBE"])[0] build_info['project'] = self.project = self.server.runCommand(["getVariable", "TOASTER_PROJECT"])[0] - return build_info def _get_task_information(self, event, recipe): @@ -967,7 +968,6 @@ class BuildInfoHelper(object): build_information = self._get_build_information(build_log_path) # Update brbe and project as they can be changed for every build - self.brbe = build_information['brbe'] self.project = build_information['project'] build_obj = self.orm_wrapper.create_build_object(build_information, self.brbe, self.project) @@ -1487,3 +1487,8 @@ class BuildInfoHelper(object): if not connection.features.autocommits_when_autocommit_is_off: transaction.set_autocommit(True) + + # unset the brbe; this is to prevent subsequent command-line builds + # being incorrectly attached to the previous Toaster-triggered build; + # see https://bugzilla.yoctoproject.org/show_bug.cgi?id=9021 + self.brbe = None -- cgit v1.2.3-54-g00ecf