From 30a9f65dcc043c1f51fd3128653ea5ecef8e25a0 Mon Sep 17 00:00:00 2001 From: Michael Wood Date: Thu, 24 Nov 2016 11:20:00 +0000 Subject: bitbake: toaster: buildinfohelper toaster-custom-images layer 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. Also rename created flag var to a have a different var for each returned value so that the same value isn't used multiple times. [YOCTO #10220] (Bitbake rev: ba5332d4960d7f4f79aef63136796e2fa67284e3) Signed-off-by: Michael Wood Signed-off-by: Richard Purdie --- bitbake/lib/toaster/toastergui/api.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'bitbake/lib/toaster/toastergui/api.py') diff --git a/bitbake/lib/toaster/toastergui/api.py b/bitbake/lib/toaster/toastergui/api.py index ae1f150770..4851047bfa 100644 --- a/bitbake/lib/toaster/toastergui/api.py +++ b/bitbake/lib/toaster/toastergui/api.py @@ -291,10 +291,13 @@ class XhrCustomRecipe(View): return error_response("recipe-already-exists") # create layer 'Custom layer' and verion if needed - layer = Layer.objects.get_or_create( + layer, l_created = 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") + + if l_created: + layer.local_source_dir = "toaster_created_layer" + layer.save() # Check if we have a layer version already # We don't use get_or_create here because the dirpath will change @@ -303,9 +306,10 @@ class XhrCustomRecipe(View): Q(layer=layer) & Q(build=None)).last() if lver is None: - lver, created = Layer_Version.objects.get_or_create( + lver, lv_created = Layer_Version.objects.get_or_create( project=params['project'], layer=layer, + layer_source=LayerSource.TYPE_LOCAL, dirpath="toaster_created_layer") # Add a dependency on our layer to the base recipe's layer @@ -319,7 +323,7 @@ class XhrCustomRecipe(View): optional=False) # Create the actual recipe - recipe, created = CustomImageRecipe.objects.get_or_create( + recipe, r_created = CustomImageRecipe.objects.get_or_create( name=request.POST["name"], base_recipe=params["base"], project=params["project"], @@ -329,7 +333,7 @@ class XhrCustomRecipe(View): # If we created the object then setup these fields. They may get # overwritten later on and cause the get_or_create to create a # duplicate if they've changed. - if created: + if r_created: recipe.file_path = request.POST["name"] recipe.license = "MIT" recipe.version = "0.1" -- cgit v1.2.3-54-g00ecf