summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/views.py
diff options
context:
space:
mode:
authorElliot Smith <elliot.smith@intel.com>2016-01-15 13:00:46 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-01-15 16:29:59 +0000
commit417f1d3f5306c668e30f2223048b542a46dd5d59 (patch)
tree8523bf84d908b51745469e83623238fa8c50c83e /bitbake/lib/toaster/toastergui/views.py
parentc02ee05857b67efe879848f379a7e8442c928770 (diff)
downloadpoky-417f1d3f5306c668e30f2223048b542a46dd5d59.tar.gz
bitbake: toaster: check inferred file suffixes against list of known types
The algorithm for finding the suffix for image files produced by the build doesn't reference a list of known file suffixes, so could be prone to error. Modify how file suffixes are parsed from the file path so that they are compared against a list of known types; if this fails, use the part of the basename of the file path after the first '.' character. Also rationalise the places in the views code where we extract the file name extensions for builds, so they both use the same algorithm (before, the same code was duplicated in two places). [YOCTO #8417] (Bitbake rev: dd1c509696b8ab5e593cc64637060a58e95fcd1f) Signed-off-by: Elliot Smith <elliot.smith@intel.com> Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/views.py')
-rwxr-xr-xbitbake/lib/toaster/toastergui/views.py38
1 files changed, 4 insertions, 34 deletions
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index 4cd7afde7c..8148623a8b 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -2008,23 +2008,10 @@ if True:
2008 context_date,today_begin,yesterday_begin = _add_daterange_context(queryset_all, request, {'started_on','completed_on'}) 2008 context_date,today_begin,yesterday_begin = _add_daterange_context(queryset_all, request, {'started_on','completed_on'})
2009 2009
2010 # set up list of fstypes for each build 2010 # set up list of fstypes for each build
2011 fstypes_map = {}; 2011 fstypes_map = {}
2012
2012 for build in build_info: 2013 for build in build_info:
2013 targets = Target.objects.filter( build_id = build.id ) 2014 fstypes_map[build.id] = build.get_image_file_extensions()
2014 comma = "";
2015 extensions = "";
2016 for t in targets:
2017 if ( not t.is_image ):
2018 continue
2019 tif = Target_Image_File.objects.filter( target_id = t.id )
2020 for i in tif:
2021 s=re.sub('.*tar.bz2', 'tar.bz2', i.file_name)
2022 if s == i.file_name:
2023 s=re.sub('.*\.', '', i.file_name)
2024 if None == re.search(s,extensions):
2025 extensions += comma + s
2026 comma = ", "
2027 fstypes_map[build.id]=extensions
2028 2015
2029 # send the data to the template 2016 # send the data to the template
2030 context = { 2017 context = {
@@ -3047,24 +3034,7 @@ if True:
3047 # translate the project's build target strings 3034 # translate the project's build target strings
3048 fstypes_map = {}; 3035 fstypes_map = {};
3049 for project in project_info: 3036 for project in project_info:
3050 try: 3037 fstypes_map[project.id] = project.get_last_build_extensions()
3051 targets = Target.objects.filter( build_id = project.get_last_build_id() )
3052 comma = "";
3053 extensions = "";
3054 for t in targets:
3055 if ( not t.is_image ):
3056 continue
3057 tif = Target_Image_File.objects.filter( target_id = t.id )
3058 for i in tif:
3059 s=re.sub('.*tar.bz2', 'tar.bz2', i.file_name)
3060 if s == i.file_name:
3061 s=re.sub('.*\.', '', i.file_name)
3062 if None == re.search(s,extensions):
3063 extensions += comma + s
3064 comma = ", "
3065 fstypes_map[project.id]=extensions
3066 except (Target.DoesNotExist,IndexError):
3067 fstypes_map[project.id]=project.get_last_imgfiles
3068 3038
3069 context = { 3039 context = {
3070 'mru' : build_mru, 3040 'mru' : build_mru,