Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 75FC9E00C45; Tue, 13 Oct 2015 15:12:08 -0700 (PDT) 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,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.220.51 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] Received: from mail-pa0-f51.google.com (mail-pa0-f51.google.com [209.85.220.51]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id E1D7AE00BDE for ; Tue, 13 Oct 2015 15:12:06 -0700 (PDT) Received: by pabrc13 with SMTP id rc13so33199649pab.0 for ; Tue, 13 Oct 2015 15:12:05 -0700 (PDT) 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=XWT5tqgkECJFihKvoDURStLMVp80ngdqRYRXvWGylpo=; b=ZqA1ZuDRqTJhr1cY6dFctnHarJYaOwGv/imymveJXjjNakbIURMsL62TPl8SCHLXLU w4vrzwa5GYGjua19Tgf/NGzL2T2cpWVKzZxdA2RrvFUaxzh/8tqia48JHbgGyh2JaNo2 lyXs5qivSln4oTM9K23co0O0LvjeMVXVamROUeiuv/P4GHXB5XuX0oTeVo0pv/t7rya0 3W52bXRTpRGjuAr8sOO3KWwpx+Cr2ZMy/AeBnPYh1YTKGPNL2+Vaa+Fj0i/pbjqDbPKs cJh/5PYWCNSiMHbyxe6YSiHCrJhJoF6m6VOFTgqLYeCixzOL30fXm/ZYN6xSjJLR7aHP PPFw== X-Gm-Message-State: ALoCoQnJynG9NLyBjGBFE6mdqjgvNFk2fp5DBkPzAOuFinyrlpaFTArIniLglIkf/bLq6oUA1n2h X-Received: by 10.66.55.41 with SMTP id o9mr43417698pap.44.1444774325651; Tue, 13 Oct 2015 15:12:05 -0700 (PDT) Received: from draco.ger.corp.intel.com ([192.55.54.42]) by smtp.gmail.com with ESMTPSA id tb9sm5735986pab.13.2015.10.13.15.12.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 13 Oct 2015 15:12:05 -0700 (PDT) From: Michael Wood To: toaster@yoctoproject.org Date: Tue, 13 Oct 2015 23:11:52 +0100 Message-Id: <1444774312-8330-2-git-send-email-michael.g.wood@intel.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1444774312-8330-1-git-send-email-michael.g.wood@intel.com> References: <1444774312-8330-1-git-send-email-michael.g.wood@intel.com> Subject: [PATCH] toaster: buildinfohelper Detect command line builds 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: Tue, 13 Oct 2015 22:12:08 -0000 When we're building using toaster as just a listener to bitbake (analysis mode) we need to handle the case where the toaster configuration data isn't present so we don't need to try and update the existing information. Signed-off-by: Michael Wood --- bitbake/lib/bb/ui/buildinfohelper.py | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py index 67c239e..701efa2 100644 --- a/bitbake/lib/bb/ui/buildinfohelper.py +++ b/bitbake/lib/bb/ui/buildinfohelper.py @@ -297,9 +297,13 @@ class ORMWrapper(object): break - - if created and must_exist: - raise NotExisting("Recipe object created when expected to exist", recipe_information) + # If we're in analysis mode then we are wholly responsible for the data + # and therefore we return the 'real' recipe rather than the build + # history copy of the recipe. + if recipe_information['layer_version'].build is not None and \ + recipe_information['layer_version'].build.project == \ + Project.objects.get_default_project(): + return recipe return built_recipe @@ -332,14 +336,20 @@ class ORMWrapper(object): assert 'priority' in layer_version_information assert 'local_path' in layer_version_information + # If we're doing a command line build then associate this new layer with the + # project to avoid it 'contaminating' toaster data + project = None + if build_obj.project == Project.objects.get_default_project(): + project = build_obj.project + layer_version_object, _ = Layer_Version.objects.get_or_create( - build = build_obj, - layer = layer_obj, - branch = layer_version_information['branch'], - commit = layer_version_information['commit'], - priority = layer_version_information['priority'], - local_path = layer_version_information['local_path'], - ) + build = build_obj, + layer = layer_obj, + branch = layer_version_information['branch'], + commit = layer_version_information['commit'], + priority = layer_version_information['priority'], + local_path = layer_version_information['local_path'], + project=project) self.layer_version_objects.append(layer_version_object) @@ -844,7 +854,7 @@ class BuildInfoHelper(object): logger.warn("Could not match layer version for recipe path %s : %s", path, self.orm_wrapper.layer_version_objects) #mockup the new layer - unknown_layer, _ = Layer.objects.get_or_create(name="__FIXME__unidentified_layer", layer_index_url="") + unknown_layer, _ = Layer.objects.get_or_create(name="Unidentified layer", layer_index_url="") unknown_layer_version_obj, _ = Layer_Version.objects.get_or_create(layer = unknown_layer, build = self.internal_state['build']) # append it so we don't run into this error again and again @@ -1072,7 +1082,7 @@ class BuildInfoHelper(object): task_information['disk_io'] = taskstats['disk_io'] if 'elapsed_time' in taskstats: task_information['elapsed_time'] = taskstats['elapsed_time'] - self.orm_wrapper.get_update_task_object(task_information, True) # must exist + self.orm_wrapper.get_update_task_object(task_information) def update_and_store_task(self, event): assert 'taskfile' in vars(event) -- 2.1.4