summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2015-11-04 15:14:06 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-10 13:29:17 +0000
commit43f0a05fa4da39be3ed84a49a3fba6951110a8fd (patch)
tree48173b37ac8a30c8b6daccb7c2f307d8134803fc /bitbake
parent2cf55afb9714827401500c631d95d0fc3a10efdd (diff)
downloadpoky-43f0a05fa4da39be3ed84a49a3fba6951110a8fd.tar.gz
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>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/toaster/toastergui/urls.py3
-rwxr-xr-xbitbake/lib/toaster/toastergui/views.py15
2 files changed, 17 insertions, 1 deletions
diff --git a/bitbake/lib/toaster/toastergui/urls.py b/bitbake/lib/toaster/toastergui/urls.py
index c8c1c6a1fe..2164c4c8f7 100644
--- a/bitbake/lib/toaster/toastergui/urls.py
+++ b/bitbake/lib/toaster/toastergui/urls.py
@@ -140,6 +140,9 @@ urlpatterns = patterns('toastergui.views',
140 'customrecipe', 140 'customrecipe',
141 name="customrecipe"), 141 name="customrecipe"),
142 142
143 url(r'^project/(?P<pid>\d+)/customrecipe/(?P<recipe_id>\d+)/download$',
144 'customrecipe_download',
145 name="customrecipedownload"),
143 146
144 147
145 # typeahead api end points 148 # typeahead api end points
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index 389457daf3..b58f916d8c 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -27,7 +27,7 @@ import operator,re
27 27
28from django.db.models import F, Q, Sum, Count, Max 28from django.db.models import F, Q, Sum, Count, Max
29from django.db import IntegrityError, Error 29from django.db import IntegrityError, Error
30from django.shortcuts import render, redirect 30from django.shortcuts import render, redirect, get_object_or_404
31from orm.models import Build, Target, Task, Layer, Layer_Version, Recipe, LogMessage, Variable 31from orm.models import Build, Target, Task, Layer, Layer_Version, Recipe, LogMessage, Variable
32from orm.models import Task_Dependency, Recipe_Dependency, Package, Package_File, Package_Dependency 32from orm.models import Task_Dependency, Recipe_Dependency, Package, Package_File, Package_Dependency
33from orm.models import Target_Installed_Package, Target_File, Target_Image_File, BuildArtifact 33from orm.models import Target_Installed_Package, Target_File, Target_Image_File, BuildArtifact
@@ -2462,6 +2462,19 @@ if True:
2462 else: 2462 else:
2463 return {"error": "Method %s is not supported" % request.method} 2463 return {"error": "Method %s is not supported" % request.method}
2464 2464
2465 def customrecipe_download(request, pid, recipe_id):
2466 recipe = get_object_or_404(CustomImageRecipe, pk=recipe_id)
2467
2468 file_data = recipe.generate_recipe_file_contents()
2469
2470 response = HttpResponse(file_data, content_type='text/plain')
2471 response['Content-Disposition'] = \
2472 'attachment; filename="%s_%s.bb"' % (recipe.name,
2473 recipe.version)
2474
2475 return response
2476
2477
2465 @xhr_response 2478 @xhr_response
2466 def xhr_customrecipe_packages(request, recipe_id, package_id): 2479 def xhr_customrecipe_packages(request, recipe_id, package_id):
2467 """ 2480 """