From fa8ade3695b836fb788c57c0d56b546b47f1603a Mon Sep 17 00:00:00 2001 From: David Reyna Date: Wed, 3 Oct 2018 23:10:51 -0700 Subject: bitbake: toaster: custom image enable layer add, protect pre-cloned layers When creating custom image recipes, the layer add for new layers needs missing xhrLayerUrl data. Also, code is needed to check and inform user if the newly added layer has not been cloned yet, and provide helpful error message instead of the current frozen dialog. [YOCTO #12887] (Bitbake rev: b310031972a53d0881a87a627f07bdcf7d9c6b79) Signed-off-by: David Reyna Signed-off-by: Richard Purdie --- bitbake/lib/toaster/toastergui/api.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (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 1bec56d468..564d595a1c 100644 --- a/bitbake/lib/toaster/toastergui/api.py +++ b/bitbake/lib/toaster/toastergui/api.py @@ -677,7 +677,13 @@ class XhrCustomRecipe(View): recipe_path = os.path.join(layerpath, "recipes", "%s.bb" % recipe.name) with open(recipe_path, "w") as recipef: - recipef.write(recipe.generate_recipe_file_contents()) + content = recipe.generate_recipe_file_contents() + if not content: + # Delete this incomplete image recipe object + recipe.delete() + return error_response("recipe-parent-not-exist") + else: + recipef.write(recipe.generate_recipe_file_contents()) return JsonResponse( {"error": "ok", -- cgit v1.2.3-54-g00ecf