Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id 68EB3E00BB6; Tue, 8 Dec 2015 13:17:50 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low * trust * [209.85.192.171 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] * 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily * valid * -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Received: from mail-pf0-f171.google.com (mail-pf0-f171.google.com [209.85.192.171]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 9138BE00BAB for ; Tue, 8 Dec 2015 13:17:07 -0800 (PST) Received: by pfdd184 with SMTP id d184so17918021pfd.3 for ; Tue, 08 Dec 2015 13:17:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PAistf822xaeXVVNy0fXNx5NhGom7t8sQzINw6SRa/4=; b=0N0xxAnkoGKoUYuqNgN9GYa4qWwAHw77qK75+DIhdLWyGQK3k0PzeZXImH1Tuk+YAb hMjaA0i7fY0UfXZdbhVBAiYFpZATj6T0i0Sq9NyrUo6zKRCxTT0HqSl8w2ZlRfCTHdR+ WkyzTZqJacxIyS7S64ApXY05WCwXHKcUT09a60Cpmuem+JKmf/Rc+x7ZnRWhYyhZkrbB jcBinqb6toIj4T6oT5C+mUWXcD6vkdxxtuekbtaqDgxQmoRURsESz0IZvH1iAhPEGHWn YN89sf1Br+UGSfG6Dao2Md3CiptrKenSwYAV9TFxXkQxZSjIJ+RJv9hSseHnHksF+uHW XywQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PAistf822xaeXVVNy0fXNx5NhGom7t8sQzINw6SRa/4=; b=MbVjrXsV/d+BLRgKKw2KXOe71ldDSA2pZUgEDZ0krNrPvVuWjU/Io9V8+d8bvED7Al dNhGTpHhPMGAV6G/Tv8hDdXbhVq6SlZIUQ7u/LcwhheVcT9eQhjYzJuQouymLd0xe0gM 1SkL9S2z7hwpH9i/R+PvMO/HRDTeoZUQSrVM18Ohg9EAZrDCASFWjPyDYMzEzcEHkw/5 FVbcCIqTeAa+O/gWdpcUOh7Q0Lbo1z1/AV1YG8OM5+QlXqFzX1pnXcAz81tZ7VeleUsx iu91jtXUVYKdrU7e2PPxmBupu79N810HIRpfOMK1oLgU19Sfl19e5Qsa8DOxF+PakC09 ljTA== X-Gm-Message-State: ALoCoQlDOqcrjxGULzyPjBRgHnNfNYJC8Cz1qGNOUXKnRoNj43B/eBObKgOB8+a+0cO2GkYK9lid+lt2KMzPZOJ5pPiLZqu7Qw== X-Received: by 10.98.75.83 with SMTP id y80mr7905561pfa.77.1449609427384; Tue, 08 Dec 2015 13:17:07 -0800 (PST) Received: from draco.ger.corp.intel.com ([192.55.54.40]) by smtp.gmail.com with ESMTPSA id v64sm6675766pfi.50.2015.12.08.13.17.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 08 Dec 2015 13:17:06 -0800 (PST) From: Michael Wood To: toaster@yoctoproject.org Date: Tue, 8 Dec 2015 21:15:59 +0000 Message-Id: <1449609380-11073-14-git-send-email-michael.g.wood@intel.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1449609380-11073-1-git-send-email-michael.g.wood@intel.com> References: <1449609380-11073-1-git-send-email-michael.g.wood@intel.com> Subject: [PATCH 13/34] toaster: views Add view to download custom recipe X-BeenThere: toaster@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Web based interface for BitBake List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Dec 2015 21:17:50 -0000 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. Signed-off-by: Michael Wood --- bitbake/lib/toaster/toastergui/urls.py | 3 +++ bitbake/lib/toaster/toastergui/views.py | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/bitbake/lib/toaster/toastergui/urls.py b/bitbake/lib/toaster/toastergui/urls.py index a1adbb7..50acb1b 100644 --- a/bitbake/lib/toaster/toastergui/urls.py +++ b/bitbake/lib/toaster/toastergui/urls.py @@ -134,6 +134,9 @@ urlpatterns = patterns('toastergui.views', 'customrecipe', name="customrecipe"), + url(r'^project/(?P\d+)/customrecipe/(?P\d+)/download$', + 'customrecipe_download', + name="customrecipedownload"), # typeahead api end points diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index 45fb055..c10b19f 100755 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py @@ -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 @@ -2749,6 +2749,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): """ -- 2.1.4