bitbake: toaster: views Add view to download custom recipe
View to provide the custom recipe download feature. The recipe is generated on-demand to make sure that it is the most current version of the Custom recipe. (Bitbake rev: 2101c854bb2d7ff1e3a4f00ad4d33d77859439ed) Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: brian avery <avery.brian@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
2cf55afb97
commit
43f0a05fa4
|
@ -140,6 +140,9 @@ urlpatterns = patterns('toastergui.views',
|
|||
'customrecipe',
|
||||
name="customrecipe"),
|
||||
|
||||
url(r'^project/(?P<pid>\d+)/customrecipe/(?P<recipe_id>\d+)/download$',
|
||||
'customrecipe_download',
|
||||
name="customrecipedownload"),
|
||||
|
||||
|
||||
# typeahead api end points
|
||||
|
|
|
@ -27,7 +27,7 @@ import operator,re
|
|||
|
||||
from django.db.models import F, Q, Sum, Count, Max
|
||||
from django.db import IntegrityError, Error
|
||||
from django.shortcuts import render, redirect
|
||||
from django.shortcuts import render, redirect, get_object_or_404
|
||||
from orm.models import Build, Target, Task, Layer, Layer_Version, Recipe, LogMessage, Variable
|
||||
from orm.models import Task_Dependency, Recipe_Dependency, Package, Package_File, Package_Dependency
|
||||
from orm.models import Target_Installed_Package, Target_File, Target_Image_File, BuildArtifact
|
||||
|
@ -2462,6 +2462,19 @@ if True:
|
|||
else:
|
||||
return {"error": "Method %s is not supported" % request.method}
|
||||
|
||||
def customrecipe_download(request, pid, recipe_id):
|
||||
recipe = get_object_or_404(CustomImageRecipe, pk=recipe_id)
|
||||
|
||||
file_data = recipe.generate_recipe_file_contents()
|
||||
|
||||
response = HttpResponse(file_data, content_type='text/plain')
|
||||
response['Content-Disposition'] = \
|
||||
'attachment; filename="%s_%s.bb"' % (recipe.name,
|
||||
recipe.version)
|
||||
|
||||
return response
|
||||
|
||||
|
||||
@xhr_response
|
||||
def xhr_customrecipe_packages(request, recipe_id, package_id):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue