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 <David.Reyna@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
if base_recipe_path:
base_recipe = open(base_recipe_path, 'r').read()
else:
- raise IOError("Based on recipe file not found: %s" %
- base_recipe_path)
+ # Pass back None to trigger error message to user
+ return None
# Add a special case for when the recipe we have based a custom image
# recipe on requires another recipe.
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",
function _addRmLayer(layerObj, add, doneCb){
if (layerObj.xhrLayerUrl === undefined){
- throw("xhrLayerUrl is undefined")
+ alert("ERROR: missing xhrLayerUrl object. Please file a bug.");
+ return;
}
if (add === true) {
var duplicateNameMsg = "An image with this name already exists. Image names must be unique.";
var duplicateImageInProjectMsg = "An image with this name already exists in this project."
var invalidBaseRecipeIdMsg = "Please select an image to customise.";
+ var missingParentRecipe = "The parent recipe file was not found. Cancel this action, build any target (like 'quilt-native') to force all new layers to clone, and try again";
+ var unknownError = "Unexpected error: ";
// set button to "submit" state and enable text entry so user can
// enter the custom recipe name
if (nameInput.val().length > 0) {
libtoaster.createCustomRecipe(nameInput.val(), baseRecipeId,
function(ret) {
+ showSubmitState();
if (ret.error !== "ok") {
console.warn(ret.error);
if (ret.error === "invalid-name") {
} else if (ret.error === "image-already-exists") {
showNameError(duplicateImageInProjectMsg);
return;
+ } else if (ret.error === "recipe-parent-not-exist") {
+ showNameError(missingParentRecipe);
+ } else {
+ showNameError(unknownError + ret.error);
}
} else {
imgCustomModal.modal('hide');
>
Customise
</button>
-<button class="btn btn-default btn-block layer-add-{{data.layer_version.pk}} layerbtn" data-layer='{ "id": {{data.layer_version.pk}}, "name": "{{data.layer_version.layer.name}}", "layerdetailurl": "{%url 'layerdetails' extra.pid data.layer_version.pk%}"}' data-directive="add"
+<button class="btn btn-default btn-block layer-add-{{data.layer_version.pk}} layerbtn"
+ data-layer='{ "id": {{data.layer_version.pk}}, "name": "{{data.layer_version.layer.name}}",
+ "layerdetailurl": "{%url 'layerdetails' extra.pid data.layer_version.pk%}",
+ "xhrLayerUrl": "{% url "xhr_layer" extra.pid data.layer_version.pk %}"}'
+ data-directive="add"
{% if data.layer_version.pk in extra.current_layers %}
style="display:none;"
{% endif %}