From d40ac966b22e1fa1956d8f2fe37fd55fa670e88f Mon Sep 17 00:00:00 2001 From: Farrell Wymore Date: Tue, 11 Mar 2014 14:48:52 -0700 Subject: bitbake: toaster: added file types to the Outputs column in the build page The file types are displayed in the Outputs column in the build page. The file types are derived from the target image filenames. [YOCTO #5947] (Bitbake rev: 37ae4e94d6991d4f05b0236b525e29797ed6e49c) Signed-off-by: Farrell Wymore Signed-off-by: Richard Purdie --- .../toaster/toastergui/templatetags/projecttags.py | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'bitbake/lib/toaster/toastergui/templatetags/projecttags.py') diff --git a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py index 857680b350..60d5dd0b7c 100644 --- a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py +++ b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py @@ -24,6 +24,8 @@ import re from django import template from django.utils import timezone from django.template.defaultfilters import filesizeformat +from orm.models import Target_Installed_Package, Target_Image_File +from orm.models import Build, Target, Task, Layer, Layer_Version register = template.Library() @@ -188,3 +190,28 @@ def string_slice(strvar,slicevar): else: return strvar[int(first):int(last)] +@register.filter +def get_image_extensions( build ): + """ + This is a simple filter that returns a list (string) + of extensions of the build-targets-image files. Note + that each build can have multiple targets and each + target can yield more than one image file + """ + targets = Target.objects.filter( build_id = build.id ); + comma = ""; + extensions = ""; + for t in targets: + if ( not t.is_image ): + continue; + tif = Target_Image_File.objects.filter( target_id = t.id ); + for i in tif: + try: + ndx = i.file_name.index( "." ); + except ValueError: + ndx = 0; + s = i.file_name[ ndx + 1 : ]; + extensions += comma + s; + comma = ", "; + return( extensions ); + -- cgit v1.2.3-54-g00ecf