From 74e2f8501997143162855b970ffd9fdb33d24bd8 Mon Sep 17 00:00:00 2001 From: David Reyna Date: Tue, 8 Apr 2014 16:25:44 +0000 Subject: bitbake: toaster: regex alternation filter caused django error The combination of a regex filter specification that uses alternate, plus a search string, plus multiple search_allowed_fields, leads to a Django fatal error. Replace this regex filter for variables in local files with a simpler 'contains' against the project's directory plus a '/conf/' string. Alex rebased this on top of fix for #6048. [YOCTO #5962] (Bitbake rev: fd57128dc3a35ca87031f3df1a531a085e89baf0) Signed-off-by: David Reyna Signed-off-by: Alexandru DAMIAN Signed-off-by: Richard Purdie --- bitbake/lib/toaster/toastergui/templatetags/projecttags.py | 6 +++--- bitbake/lib/toaster/toastergui/views.py | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'bitbake') diff --git a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py index aa1ebf8017..e8634574c0 100644 --- a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py +++ b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py @@ -163,7 +163,7 @@ def filter_setin_files(file_list,matchstr): # match only filters if search == '': for i in range(len(file_list)): - if file_list[i].file_name.find(filter) >= 0: + if re.search(filter, file_list[i].file_name): if htmlstr.find(file_list[i].file_name + "

") < 0: htmlstr += file_list[i].file_name + "

" return htmlstr @@ -171,7 +171,7 @@ def filter_setin_files(file_list,matchstr): # match only search string, plus always last file if filter == "": for i in range(len(file_list)-1): - if file_list[i].file_name.find(search) >= 0: + if re.search(search,file_list[i].file_name): if htmlstr.find(file_list[i].file_name + "

") < 0: htmlstr += file_list[i].file_name + "

" if htmlstr.find(file_list[len(file_list)-1].file_name) < 0: @@ -180,7 +180,7 @@ def filter_setin_files(file_list,matchstr): # match filter or search string for i in range(len(file_list)): - if (file_list[i].file_name.find(filter) >= 0) or (file_list[i].file_name.find(search) >= 0): + if re.search(filter, file_list[i].file_name) or re.search(search,file_list[i].file_name): if htmlstr.find(file_list[i].file_name + "

") < 0: htmlstr += file_list[i].file_name + "

" return htmlstr diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index 4ed99400c8..78726a88bc 100644 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py @@ -1154,17 +1154,17 @@ def configvars(request, build_id): variables = _build_page_range(Paginator(queryset, request.GET.get('count', 50)), request.GET.get('page', 1)) + # show all matching files (not just the last one) file_filter= search_term + ":" - if filter_string.find('conf/local.conf') > 0: - file_filter += 'conf/local.conf' - if filter_string.find('conf/bblayers.conf') > 0: - file_filter += 'conf/bblayers.conf' + if filter_string.find('/conf/') > 0: + file_filter += 'conf/(local|bblayers).conf' if filter_string.find('conf/machine/') > 0: file_filter += 'conf/machine/' if filter_string.find('conf/distro/') > 0: file_filter += 'conf/distro/' if filter_string.find('/bitbake.conf') > 0: file_filter += '/bitbake.conf' + build_dir=re.sub("/tmp/log/.*","",Build.objects.filter(pk=build_id)[0].cooker_log_path) context = { 'objectname': 'configvars', @@ -1193,7 +1193,7 @@ def configvars(request, build_id): 'class' : 'vhistory__file_name', 'label': 'Show:', 'options' : [ - ('Local configuration variables', 'vhistory__file_name__regex:conf/(local|bblayers).conf', queryset_with_search.filter(vhistory__file_name__regex='conf/(local|bblayers).conf').count(), 'Select this filter to see variables set by the local.conf and bblayers.conf configuration files inside the /build/conf/ directory'), + ('Local configuration variables', 'vhistory__file_name__contains:'+build_dir+'/conf/',queryset_with_search.filter(vhistory__file_name__contains=build_dir+'/conf/').count(), 'Select this filter to see variables set by the local.conf and bblayers.conf configuration files inside the /build/conf/ directory'), ('Machine configuration variables', 'vhistory__file_name__contains:conf/machine/',queryset_with_search.filter(vhistory__file_name__contains='conf/machine').count(), 'Select this filter to see variables set by the configuration file(s) inside your layers /conf/machine/ directory'), ('Distro configuration variables', 'vhistory__file_name__contains:conf/distro/',queryset_with_search.filter(vhistory__file_name__contains='conf/distro').count(), 'Select this filter to see variables set by the configuration file(s) inside your layers /conf/distro/ directory'), ('Layer configuration variables', 'vhistory__file_name__contains:conf/layer.conf',queryset_with_search.filter(vhistory__file_name__contains='conf/layer.conf').count(), 'Select this filter to see variables set by the layer.conf configuration file inside your layers'), -- cgit v1.2.3-54-g00ecf