summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/toaster/toastergui/views.py')
-rwxr-xr-xbitbake/lib/toaster/toastergui/views.py106
1 files changed, 105 insertions, 1 deletions
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index 4fae70b48b..5fcad63e45 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -2270,6 +2270,55 @@ if toastermain.settings.MANAGED:
2270 return HttpResponse(jsonfilter({"error":str(e) + "\n" + traceback.format_exc()}), content_type = "application/json") 2270 return HttpResponse(jsonfilter({"error":str(e) + "\n" + traceback.format_exc()}), content_type = "application/json")
2271 2271
2272 2272
2273 def xhr_configvaredit(request, pid):
2274 try:
2275 prj = Project.objects.get(id = pid)
2276 # add conf variables
2277 if 'configvarAdd' in request.POST:
2278 t=request.POST['configvarAdd'].strip()
2279 if ":" in t:
2280 variable, value = t.split(":")
2281 else:
2282 variable = t
2283 value = ""
2284
2285 pt, created = ProjectVariable.objects.get_or_create(project = prj, name = variable, value = value)
2286 # change conf variables
2287 if 'configvarChange' in request.POST:
2288 t=request.POST['configvarChange'].strip()
2289 if ":" in t:
2290 variable, value = t.split(":")
2291 else:
2292 variable = t
2293 value = ""
2294
2295 try:
2296 pt = ProjectVariable.objects.get(project = prj, name = variable)
2297 pt.value=value
2298 pt.save()
2299 except ObjectDoesNotExist:
2300 print("the entry doesn't exist.")
2301 # remove conf variables
2302 if 'configvarDel' in request.POST:
2303 t=request.POST['configvarDel'].strip()
2304 pt = ProjectVariable.objects.get(pk = int(t)).delete()
2305
2306 # return all project settings
2307 vars_managed,vars_fstypes,vars_blacklist = get_project_configvars_context()
2308 return HttpResponse(json.dumps( {
2309 "error": "ok",
2310 'configvars' : map(lambda x: (x.name, x.value, x.pk), ProjectVariable.objects.filter(project_id = pid).all()),
2311 'distro' : ProjectVariable.objects.get(project = prj, name = "DISTRO").value,
2312 'fstypes' : ProjectVariable.objects.get(project = prj, name = "IMAGE_FSTYPES").value,
2313 'image_install_append': ProjectVariable.objects.get(project = prj, name = "IMAGE_INSTALL_append").value,
2314 'package_classes': ProjectVariable.objects.get(project = prj, name = "PACKAGE_CLASSES").value,
2315 'sdk_machine' : ProjectVariable.objects.get(project = prj, name = "SDKMACHINE").value,
2316 }), content_type = "application/json")
2317
2318 except Exception as e:
2319 return HttpResponse(json.dumps({"error":str(e) + "\n" + traceback.format_exc()}), content_type = "application/json")
2320
2321
2273 def xhr_importlayer(request): 2322 def xhr_importlayer(request):
2274 if (not request.POST.has_key('vcs_url') or 2323 if (not request.POST.has_key('vcs_url') or
2275 not request.POST.has_key('name') or 2324 not request.POST.has_key('name') or
@@ -2737,11 +2786,66 @@ if toastermain.settings.MANAGED:
2737 2786
2738 return render(request, template, context) 2787 return render(request, template, context)
2739 2788
2789
2790 def get_project_configvars_context():
2791 # Vars managed outside of this view
2792 vars_managed = {
2793 'MACHINE'
2794 }
2795
2796 vars_blacklist = {
2797 'DL_DR','PARALLEL_MAKE','BB_NUMBER_THREADS','SSTATE_DIR',
2798 'BB_DISKMON_DIRS','BB_NUMBER_THREADS','CVS_PROXY_HOST','CVS_PROXY_PORT',
2799 'DL_DIR','PARALLEL_MAKE','SSTATE_DIR','SSTATE_DIR','SSTATE_MIRRORS','TMPDIR',
2800 'all_proxy','ftp_proxy','http_proxy ','https_proxy'
2801 }
2802
2803 vars_fstypes = {
2804 'btrfs','cpio','cpio.gz','cpio.lz4','cpio.lzma','cpio.xz','cramfs',
2805 'elf','ext2','ext2.bz2','ext2.gz','ext2.lzma' 'ext3','ext3.gz','hddimg',
2806 'iso','jffs2','jffs2.sum','squashfs','squashfs-lzo','squashfs-xz','tar.bz2',
2807 'tar.lz4','tar.xz','tartar.gz','ubi','ubifs','vmdk'
2808 }
2809
2810 return(vars_managed,sorted(vars_fstypes),vars_blacklist)
2811
2740 def projectconf(request, pid): 2812 def projectconf(request, pid):
2741 template = "projectconf.html" 2813 template = "projectconf.html"
2814
2815 try:
2816 prj = Project.objects.get(id = pid)
2817 except Project.DoesNotExist:
2818 return HttpResponseNotFound("<h1>Project id " + pid + " is unavailable</h1>")
2819
2820 vars_managed,vars_fstypes,vars_blacklist = get_project_configvars_context()
2742 context = { 2821 context = {
2743 'configvars': ProjectVariable.objects.filter(project_id = pid), 2822 'configvars': ProjectVariable.objects.filter(project_id = pid).all(),
2823 'vars_managed': vars_managed,
2824 'vars_fstypes': vars_fstypes,
2825 'vars_blacklist': vars_blacklist,
2744 } 2826 }
2827
2828 try:
2829 context['distro'] = ProjectVariable.objects.get(project = prj, name = "DISTRO").value
2830 except ProjectVariable.DoesNotExist:
2831 pass
2832 try:
2833 context['fstypes'] = ProjectVariable.objects.get(project = prj, name = "IMAGE_FSTYPES").value
2834 except ProjectVariable.DoesNotExist:
2835 pass
2836 try:
2837 context['image_install_append'] = ProjectVariable.objects.get(project = prj, name = "IMAGE_INSTALL_append").value
2838 except ProjectVariable.DoesNotExist:
2839 pass
2840 try:
2841 context['package_classes'] = ProjectVariable.objects.get(project = prj, name = "PACKAGE_CLASSES").value
2842 except ProjectVariable.DoesNotExist:
2843 pass
2844 try:
2845 context['sdk_machine'] = ProjectVariable.objects.get(project = prj, name = "SDKMACHINE").value
2846 except ProjectVariable.DoesNotExist:
2847 pass
2848
2745 return render(request, template, context) 2849 return render(request, template, context)
2746 2850
2747 def projectbuilds(request, pid): 2851 def projectbuilds(request, pid):