mirror of
https://git.yoctoproject.org/poky
synced 2026-05-02 18:32:15 +02:00
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 <David.Reyna@windriver.com> Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
f88a343773
commit
74e2f85019
@@ -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 + "<p>") < 0:
|
||||
htmlstr += file_list[i].file_name + "<p>"
|
||||
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 + "<p>") < 0:
|
||||
htmlstr += file_list[i].file_name + "<p>"
|
||||
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 + "<p>") < 0:
|
||||
htmlstr += file_list[i].file_name + "<p>"
|
||||
return htmlstr
|
||||
|
||||
@@ -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 <code>local.conf</code> and <code>bblayers.conf</code> configuration files inside the <code>/build/conf/</code> 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 <code>local.conf</code> and <code>bblayers.conf</code> configuration files inside the <code>/build/conf/</code> 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 <code>/conf/machine/</code> 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 <code>/conf/distro/</code> 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 <code>layer.conf</code> configuration file inside your layers'),
|
||||
|
||||
Reference in New Issue
Block a user