summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/api.py
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2016-11-24 11:20:00 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-11-30 15:48:10 +0000
commit30a9f65dcc043c1f51fd3128653ea5ecef8e25a0 (patch)
treedcf3d5ef0a4d62469d234954ea3edaeb9bd1ccf5 /bitbake/lib/toaster/toastergui/api.py
parentfa5ea98d3b4610e94a9bf8eae7801e52984defb6 (diff)
downloadpoky-30a9f65dcc043c1f51fd3128653ea5ecef8e25a0.tar.gz
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 <michael.g.wood@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/api.py')
-rw-r--r--bitbake/lib/toaster/toastergui/api.py16
1 files changed, 10 insertions, 6 deletions
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):
291 return error_response("recipe-already-exists") 291 return error_response("recipe-already-exists")
292 292
293 # create layer 'Custom layer' and verion if needed 293 # create layer 'Custom layer' and verion if needed
294 layer = Layer.objects.get_or_create( 294 layer, l_created = Layer.objects.get_or_create(
295 name=CustomImageRecipe.LAYER_NAME, 295 name=CustomImageRecipe.LAYER_NAME,
296 summary="Layer for custom recipes", 296 summary="Layer for custom recipes")
297 vcs_url="file:///toaster_created_layer")[0] 297
298 if l_created:
299 layer.local_source_dir = "toaster_created_layer"
300 layer.save()
298 301
299 # Check if we have a layer version already 302 # Check if we have a layer version already
300 # We don't use get_or_create here because the dirpath will change 303 # We don't use get_or_create here because the dirpath will change
@@ -303,9 +306,10 @@ class XhrCustomRecipe(View):
303 Q(layer=layer) & 306 Q(layer=layer) &
304 Q(build=None)).last() 307 Q(build=None)).last()
305 if lver is None: 308 if lver is None:
306 lver, created = Layer_Version.objects.get_or_create( 309 lver, lv_created = Layer_Version.objects.get_or_create(
307 project=params['project'], 310 project=params['project'],
308 layer=layer, 311 layer=layer,
312 layer_source=LayerSource.TYPE_LOCAL,
309 dirpath="toaster_created_layer") 313 dirpath="toaster_created_layer")
310 314
311 # Add a dependency on our layer to the base recipe's layer 315 # Add a dependency on our layer to the base recipe's layer
@@ -319,7 +323,7 @@ class XhrCustomRecipe(View):
319 optional=False) 323 optional=False)
320 324
321 # Create the actual recipe 325 # Create the actual recipe
322 recipe, created = CustomImageRecipe.objects.get_or_create( 326 recipe, r_created = CustomImageRecipe.objects.get_or_create(
323 name=request.POST["name"], 327 name=request.POST["name"],
324 base_recipe=params["base"], 328 base_recipe=params["base"],
325 project=params["project"], 329 project=params["project"],
@@ -329,7 +333,7 @@ class XhrCustomRecipe(View):
329 # If we created the object then setup these fields. They may get 333 # If we created the object then setup these fields. They may get
330 # overwritten later on and cause the get_or_create to create a 334 # overwritten later on and cause the get_or_create to create a
331 # duplicate if they've changed. 335 # duplicate if they've changed.
332 if created: 336 if r_created:
333 recipe.file_path = request.POST["name"] 337 recipe.file_path = request.POST["name"]
334 recipe.license = "MIT" 338 recipe.license = "MIT"
335 recipe.version = "0.1" 339 recipe.version = "0.1"