Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 47734E006E9; Thu, 3 Nov 2016 10:24:18 -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,DKIM_SIGNED, DKIM_VALID,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.192.175 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily * valid * -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Received: from mail-pf0-f175.google.com (mail-pf0-f175.google.com [209.85.192.175]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id AD271E00509 for ; Thu, 3 Nov 2016 10:24:13 -0700 (PDT) Received: by mail-pf0-f175.google.com with SMTP id i88so34792542pfk.2 for ; Thu, 03 Nov 2016 10:24:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=MlZ7dSmgpdt77DvQIahnkzSUK3OyyKCJlbAV6E4Egr0=; b=nxQLkBV6A+Yo/Y/BF7pFd4SVWoeav8JSQwTSevQNrnKmQjjvYJse4SXfVd47xldXsN KJdxq7lfQQtBuRROIyZcAv+ifvUq1U30HEzkyT/Pd8zcEmQHUuejVXcsidrPd9+AqoER Qg8Rbw7uwGQ99Nmnm5QTEBA3r9a5yor72tMn4HOyDOLpZlQWoDkcMCTboAmwyRcxjopi 5/DIGpWOwcRsVifnUY0qJNai+fyt9AdzLjz8LkdbQmbke0cJT/MJA45IRNlawNCp30DM A2TupWilVGbu46bE8aX+EpUTRag/mv/8Hirx33lmbSG0PnMOKaOE7F8vxK06N16PGMfW sBNw== 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; bh=MlZ7dSmgpdt77DvQIahnkzSUK3OyyKCJlbAV6E4Egr0=; b=iSzbzvPOc/4UzUetvi6vxL4hUlkLcmRYRrwcprbDWWdQzgBbbb693muY00P7jUovOz awT0W23n0DrKcT4Fwi1w/5EkLfUGTuQ3DsKQe+HcJsSA+SeFC6xlNp3W61/XiE/n1MwL 4fSBE/0KTTe8eLIc+Ql0OsgLt/D+OHlNEmf6LkJvUZYzZcINzZcGekv1FGQGgv7VbBqg rluQfEGYQRVPv/MRdEEFWfwh+8QpYSkt0y5IE4SI4Sq8s4ncAgVNsYLsOnpEGYhvdhZJ k6EritWbOLDiNrtlm/B4eUIouT9PyKx2kaETAioztFZ6q1cjOhXLSgbZcneTJBdOAU8W VjOg== X-Gm-Message-State: ABUngvfpuh3/EZEX6xmrChyEc8a84bkzjF+ucUJijCHWqnwkrFAeWfGyA5ljeWxX258LM4/A X-Received: by 10.99.3.202 with SMTP id 193mr15528413pgd.157.1478193852931; Thu, 03 Nov 2016 10:24:12 -0700 (PDT) Received: from orion.ger.corp.intel.com ([192.55.54.42]) by smtp.gmail.com with ESMTPSA id s8sm14145835pfj.45.2016.11.03.10.24.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 03 Nov 2016 10:24:12 -0700 (PDT) From: Michael Wood To: toaster@yoctoproject.org Date: Thu, 3 Nov 2016 17:24:06 +0000 Message-Id: <1478193846-9494-1-git-send-email-michael.g.wood@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [PATCH] toaster: buildinfohelper toaster-custom-images layer 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, 03 Nov 2016 17:24:18 -0000 This fixes the unidentified layers issue by making the toaster-custom-images layer a local layer. By doing this we also fix the git assumptions made for the local layers which stop recipes and other meta data being associated with them. This also removed some of the special casing previously needed when we didn't have the concept of a local (non git) layer. [YOCTO #10220] Signed-off-by: Michael Wood --- bitbake/lib/bb/ui/buildinfohelper.py | 7 +----- .../toaster/bldcontrol/localhostbecontroller.py | 25 ++++++++++++++++------ bitbake/lib/toaster/orm/models.py | 3 ++- bitbake/lib/toaster/toastergui/api.py | 5 +++-- 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py index 5b69660..6d87a4e 100644 --- a/bitbake/lib/bb/ui/buildinfohelper.py +++ b/bitbake/lib/bb/ui/buildinfohelper.py @@ -42,7 +42,7 @@ from orm.models import Variable, VariableHistory from orm.models import Package, Package_File, Target_Installed_Package, Target_File from orm.models import Task_Dependency, Package_Dependency from orm.models import Recipe_Dependency, Provides -from orm.models import Project, CustomImagePackage, CustomImageRecipe +from orm.models import Project, CustomImagePackage from orm.models import signal_runbuilds from bldcontrol.models import BuildEnvironment, BuildRequest @@ -361,11 +361,6 @@ class ORMWrapper(object): def get_update_layer_version_object(self, build_obj, layer_obj, layer_version_information): if isinstance(layer_obj, Layer_Version): - # Special case the toaster-custom-images layer which is created - # on the fly so don't update the values which may cause the layer - # to be duplicated on a future get_or_create - if layer_obj.layer.name == CustomImageRecipe.LAYER_NAME: - return layer_obj # We already found our layer version for this build so just # update it with the new build information logger.debug("We found our layer from toaster") diff --git a/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py b/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py index e5f7c98..7d90999 100644 --- a/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py +++ b/bitbake/lib/toaster/bldcontrol/localhostbecontroller.py @@ -228,13 +228,22 @@ class LocalhostBEController(BuildEnvironmentController): br_layer_base_recipe = layers.get( layer_version=customrecipe.base_recipe.layer_version) - br_layer_base_dirpath = \ - os.path.join(self.be.sourcedir, - self.getGitCloneDirectory( - br_layer_base_recipe.giturl, - br_layer_base_recipe.commit), - customrecipe.base_recipe.layer_version.dirpath - ) + # If the layer is one that we've cloned we know where it lives + if br_layer_base_recipe.giturl and br_layer_base_recipe.commit: + layer_path = self.getGitCloneDirectory( + br_layer_base_recipe.giturl, + br_layer_base_recipe.commit) + # Otherwise it's a local layer + elif br_layer_base_recipe.local_source_dir: + layer_path = br_layer_base_recipe.local_source_dir + else: + logger.error("Unable to workout the dir path for the custom" + " image recipe") + + br_layer_base_dirpath = os.path.join( + self.be.sourcedir, + layer_path, + customrecipe.base_recipe.layer_version.dirpath) customrecipe.base_recipe.layer_version.dirpath = \ br_layer_base_dirpath @@ -249,6 +258,8 @@ class LocalhostBEController(BuildEnvironmentController): # Update the layer and recipe objects customrecipe.layer_version.dirpath = layerpath + customrecipe.layer_version.layer.local_source_dir = layerpath + customrecipe.layer_version.layer.save() customrecipe.layer_version.save() customrecipe.file_path = recipe_path diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py index 4f8510c..dad8246 100644 --- a/bitbake/lib/toaster/orm/models.py +++ b/bitbake/lib/toaster/orm/models.py @@ -1631,7 +1631,8 @@ class CustomImageRecipe(Recipe): if base_recipe_path: base_recipe = open(base_recipe_path, 'r').read() else: - raise IOError("Based on recipe file not found") + raise IOError("Based on recipe file not found: %s" % + base_recipe_path) # Add a special case for when the recipe we have based a custom image # recipe on requires another recipe. diff --git a/bitbake/lib/toaster/toastergui/api.py b/bitbake/lib/toaster/toastergui/api.py index ae1f150..f816fa4 100644 --- a/bitbake/lib/toaster/toastergui/api.py +++ b/bitbake/lib/toaster/toastergui/api.py @@ -293,8 +293,7 @@ class XhrCustomRecipe(View): # create layer 'Custom layer' and verion if needed layer = Layer.objects.get_or_create( name=CustomImageRecipe.LAYER_NAME, - summary="Layer for custom recipes", - vcs_url="file:///toaster_created_layer")[0] + summary="Layer for custom recipes")[0] # Check if we have a layer version already # We don't use get_or_create here because the dirpath will change @@ -306,6 +305,8 @@ class XhrCustomRecipe(View): lver, created = Layer_Version.objects.get_or_create( project=params['project'], layer=layer, + layer_source=LayerSource.TYPE_LOCAL, + local_source_dir="toaster_created_layer", dirpath="toaster_created_layer") # Add a dependency on our layer to the base recipe's layer -- 2.7.4