Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 363A9E00C52; Thu, 12 Nov 2015 04:39:37 -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 0786EE00C43 for ; Thu, 12 Nov 2015 04:39:10 -0800 (PST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP; 12 Nov 2015 04:39:11 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,281,1444719600"; d="scan'208";a="599059096" Received: from linux.intel.com ([10.23.219.25]) by FMSMGA003.fm.intel.com with ESMTP; 12 Nov 2015 04:39:10 -0800 Received: from vmed.fi.intel.com (vmed.fi.intel.com [10.237.72.51]) by linux.intel.com (Postfix) with ESMTP id C837F6A4087 for ; Thu, 12 Nov 2015 04:38:04 -0800 (PST) From: Ed Bartosh To: toaster@yoctoproject.org Date: Thu, 12 Nov 2015 14:04:49 +0200 Message-Id: <997bf349f0e0da2d697b07d5f3bcc80655295ca3.1447328916.git.ed.bartosh@linux.intel.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: In-Reply-To: References: Subject: [PATCH 26/26] toaster: get rid of complicated heuristics 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: Thu, 12 Nov 2015 12:39:37 -0000 Removed buildinfohelper code which was trying to guess layer version of the recipe using build request information. The code caused creation of duplicated recipes as it resulted in layer version from layer index instead of returning build layer version. As a result of this Toaster UI was not showing any information about recipes. Default approach used to find layer version seems to work much better as it finds proper layer version. Now toaster will use it as the only way to find layer version. Signed-off-by: Ed Bartosh --- bitbake/lib/bb/ui/buildinfohelper.py | 47 +++++++----------------------------- 1 file changed, 9 insertions(+), 38 deletions(-) diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py index 5ea9284..1d41bba 100644 --- a/bitbake/lib/bb/ui/buildinfohelper.py +++ b/bitbake/lib/bb/ui/buildinfohelper.py @@ -815,44 +815,15 @@ class BuildInfoHelper(object): assert path.startswith("/") assert 'build' in self.internal_state - if self.brbe is None: - def _slkey_interactive(layer_version): - assert isinstance(layer_version, Layer_Version) - return len(layer_version.local_path) - - # Heuristics: we always match recipe to the deepest layer path in the discovered layers - for lvo in sorted(self.orm_wrapper.layer_version_objects, reverse=True, key=_slkey_interactive): - # we can match to the recipe file path - if path.startswith(lvo.local_path): - return lvo - - else: - br_id, be_id = self.brbe.split(":") - from bldcontrol.bbcontroller import getBuildEnvironmentController - bc = getBuildEnvironmentController(pk = be_id) - - def _slkey_managed(layer_version): - return len(bc.getGitCloneDirectory(layer_version.giturl, layer_version.commit) + layer_version.dirpath) - - # Heuristics: we match the path to where the layers have been checked out - for brl in sorted(BuildRequest.objects.get(pk = br_id).brlayer_set.all(), reverse = True, key = _slkey_managed): - localdirname = os.path.join(bc.getGitCloneDirectory(brl.giturl, brl.commit), brl.dirpath) - # we get a relative path, unless running in HEAD mode where the path is absolute - if not localdirname.startswith("/"): - localdirname = os.path.join(bc.be.sourcedir, localdirname) - if path.startswith(localdirname): - # If the build request came from toaster this field - # should contain the information from the layer_version - # That created this build request. - if brl.layer_version: - return brl.layer_version - - #logger.warn("-- managed: matched path %s with layer %s " % (path, localdirname)) - # we matched the BRLayer, but we need the layer_version that generated this br - - for lvo in self.orm_wrapper.layer_version_objects: - if brl.name == lvo.layer.name: - return lvo + def _slkey_interactive(layer_version): + assert isinstance(layer_version, Layer_Version) + return len(layer_version.local_path) + + # Heuristics: we always match recipe to the deepest layer path in the discovered layers + for lvo in sorted(self.orm_wrapper.layer_version_objects, reverse=True, key=_slkey_interactive): + # we can match to the recipe file path + if path.startswith(lvo.local_path): + return lvo #if we get here, we didn't read layers correctly; dump whatever information we have on the error log logger.warn("Could not match layer version for recipe path %s : %s", path, self.orm_wrapper.layer_version_objects) -- 2.1.4