From 4717749fd651e6983a31e3cefe3f210d2646ca87 Mon Sep 17 00:00:00 2001 From: David Reyna Date: Fri, 28 Feb 2014 05:55:46 -0800 Subject: bitbake: toaster: implement the configuration pagedreyna/configure-detail-view Update the configuration page with the file list pop-up, implement the file and description filters. [YOCTO #4259] (Bitbake rev: 54a767809960b66b2fe2d3bc46aa9c7e040c4ae3) Signed-off-by: David Reyna Signed-off-by: Richard Purdie --- bitbake/lib/toaster/toastergui/templates/base.html | 53 +++++++++++ .../toastergui/templates/configuration.html | 32 +++++-- .../toaster/toastergui/templates/configvars.html | 98 +++++++++++++++++--- .../toaster/toastergui/templatetags/projecttags.py | 59 ++++++++++++ bitbake/lib/toaster/toastergui/views.py | 101 ++++++++++++++++----- 5 files changed, 299 insertions(+), 44 deletions(-) diff --git a/bitbake/lib/toaster/toastergui/templates/base.html b/bitbake/lib/toaster/toastergui/templates/base.html index 8d4771c10e..96f093f627 100644 --- a/bitbake/lib/toaster/toastergui/templates/base.html +++ b/bitbake/lib/toaster/toastergui/templates/base.html @@ -48,6 +48,59 @@ function reload_params(params) { } + + + diff --git a/bitbake/lib/toaster/toastergui/templates/configuration.html b/bitbake/lib/toaster/toastergui/templates/configuration.html index 467fbd02ad..ddfa5af9ca 100644 --- a/bitbake/lib/toaster/toastergui/templates/configuration.html +++ b/bitbake/lib/toaster/toastergui/templates/configuration.html @@ -3,6 +3,8 @@
  • Configuration
  • {% endblock %} +{% load projecttags %} + {% block buildinfomain %}
    @@ -22,15 +24,19 @@

    Build configuration

    -
    BitBake version
    1.19.1
    -
    Build system
    x86_64-linux
    -
    Host distribution
    Ubuntu-12.04
    -
    Target system
    i586-poky-linux
    -
    Machine
    atom-pc
    -
    Distro
    poky
    -
    Distro version
    1.4+snapshot-20130718
    -
    Tune features
    m32 i586
    -
    Target(s)
    core-image-sato
    + {%if BB_VERSION %}
    BitBake version
    {{BB_VERSION}}
    {% endif %} + {%if BUILD_SYS %}
    Build system
    {{BUILD_SYS}}
    {% endif %} + {%if NATIVELSBSTRING %}
    Host distribution
    {{NATIVELSBSTRING}}
    {% endif %} + {%if TARGET_SYS %}
    Target system
    {{TARGET_SYS}}
    {% endif %} + {%if MACHINE %}
    Machine
    {{MACHINE}}
    {% endif %} + {%if DISTRO %}
    Distro
    {{DISTRO}}
    {% endif %} + {%if DISTRO_VERSION %}
    Distro version
    {{DISTRO_VERSION}}
    {% endif %} + {%if TUNE_FEATURES %}
    Tune features
    {{TUNE_FEATURES}}
    {% endif %} + {%if TARGET_FPU %}
    Target FPU
    {{TARGET_FPU}}
    {% endif %} + {%if targets.all %}
    Target(s)
    +
      {% for target in targets.all %} +
    • {{target.target}}{%if forloop.counter > 1 %}
      {% endif %}
    • + {% endfor %}
    {% endif %}

    Layers

    @@ -45,7 +51,13 @@ {% for lv in build.layer_version_build.all %} - {{lv.layer.name}} {{lv.branch}}{{lv.commit|slice:":8"}}...{{lv.layer.local_path}} + {{lv.layer.name}} + {{lv.branch}} + + {{lv.commit|truncatechars:13}} + + {{lv.layer.local_path}} {% endfor %} diff --git a/bitbake/lib/toaster/toastergui/templates/configvars.html b/bitbake/lib/toaster/toastergui/templates/configvars.html index ae45119f39..cd41cca7e5 100644 --- a/bitbake/lib/toaster/toastergui/templates/configvars.html +++ b/bitbake/lib/toaster/toastergui/templates/configvars.html @@ -3,38 +3,110 @@
  • Configuration
  • {% endblock %} +{% load projecttags %} + {% block buildinfomain %}
    + +{% for variable in objects %} + {% if variable.vhistory.count %} + + {% endif %} +{% endfor %} + +
    -
    {% endblock %} diff --git a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py index b1e573b16d..857680b350 100644 --- a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py +++ b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py @@ -129,3 +129,62 @@ def check_filter_status(options, filter): if filter == option[1]: return "" return "checked" + +@register.filter +def variable_parent_name(value): + """ filter extended variable names to the parent name + """ + value=re.sub('_\$.*', '', value) + return re.sub('_[a-z].*', '', value) + +@register.filter +def filter_setin_files(file_list,matchstr): + """ filter/search the 'set in' file lists. Note + that this output is not autoescaped to allow + the

    marks, but this is safe as the data + is file paths + """ + + # no filters, show last file (if any) + if matchstr == ":": + if file_list: + return file_list[len(file_list)-1].file_name + else: + return '' + + search, filter = matchstr.partition(':')[::2] + htmlstr="" + # match only filters + if search == '': + for i in range(len(file_list)): + if file_list[i].file_name.find(filter) >= 0: + htmlstr += file_list[i].file_name + "

    " + return htmlstr + + # 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: + htmlstr += file_list[i].file_name + "

    " + htmlstr += file_list[len(file_list)-1].file_name + return htmlstr + + # 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): + htmlstr += file_list[i].file_name + "

    " + return htmlstr + + +@register.filter +def string_slice(strvar,slicevar): + """ slice a string with |string_slice:'[first]:[last]' + """ + first,last= slicevar.partition(':')[::2] + if first=='': + return strvar[:int(last)] + elif last=='': + return strvar[int(first):] + else: + return strvar[int(first):int(last)] + diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index b77be1a6e7..3a362e6fe6 100644 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py @@ -733,59 +733,118 @@ def recipes(request, build_id): def configuration(request, build_id): template = 'configuration.html' - context = {'build': Build.objects.filter(pk=build_id)[0]} + + variables = Variable.objects.filter(build=build_id) + BB_VERSION=variables.filter(variable_name='BB_VERSION')[0].variable_value + BUILD_SYS=variables.filter(variable_name='BUILD_SYS')[0].variable_value + NATIVELSBSTRING=variables.filter(variable_name='NATIVELSBSTRING')[0].variable_value + TARGET_SYS=variables.filter(variable_name='TARGET_SYS')[0].variable_value + MACHINE=variables.filter(variable_name='MACHINE')[0].variable_value + DISTRO=variables.filter(variable_name='DISTRO')[0].variable_value + DISTRO_VERSION=variables.filter(variable_name='DISTRO_VERSION')[0].variable_value + TUNE_FEATURES=variables.filter(variable_name='TUNE_FEATURES')[0].variable_value + TARGET_FPU=variables.filter(variable_name='TARGET_FPU')[0].variable_value + + targets = Target.objects.filter(build=build_id) + + context = { + 'objectname': 'configuration', + 'object_search_display':'variables', + 'filter_search_display':'variables', + 'build': Build.objects.filter(pk=build_id)[0], + 'BB_VERSION':BB_VERSION, + 'BUILD_SYS':BUILD_SYS, + 'NATIVELSBSTRING':NATIVELSBSTRING, + 'TARGET_SYS':TARGET_SYS, + 'MACHINE':MACHINE, + 'DISTRO':DISTRO, + 'DISTRO_VERSION':DISTRO_VERSION, + 'TUNE_FEATURES':TUNE_FEATURES, + 'TARGET_FPU':TARGET_FPU, + 'targets':targets, + } return render(request, template, context) def configvars(request, build_id): template = 'configvars.html' - mandatory_parameters = { 'count': 100, 'page' : 1}; + mandatory_parameters = { 'count': 100, 'page' : 1, 'orderby':'variable_name:+', 'filter':'description__regex:.+'}; retval = _verify_parameters( request.GET, mandatory_parameters ) if retval: return _redirect_parameters( 'configvars', request.GET, mandatory_parameters, build_id = build_id) (filter_string, search_term, ordering_string) = _search_tuple(request, Variable) - queryset = Variable.objects.filter(build=build_id) + queryset = Variable.objects.filter(build=build_id).exclude(variable_name__istartswith='B_').exclude(variable_name__istartswith='do_') queryset = _get_queryset(Variable, queryset, filter_string, search_term, ordering_string) + # remove duplicate records from multiple search hits in the VariableHistory table + queryset = queryset.distinct() + # remove records where the value is empty AND there are no history files + queryset = queryset.exclude(variable_value='',vhistory__file_name__isnull=True) variables = _build_page_range(Paginator(queryset, request.GET.get('count', 50)), request.GET.get('page', 1)) + file_filter= search_term + ":" + if filter_string.find('conf/local.conf') > 0: + file_filter += 'conf/local.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' + context = { + 'objectname': 'configvars', + 'object_search_display':'variables', + 'filter_search_display':'variables', + 'file_filter': file_filter, 'build': Build.objects.filter(pk=build_id)[0], 'objects' : variables, # Specifies the display of columns for the table, appearance in "Edit columns" box, toggling default show/hide, and specifying filters for columns 'tablecols' : [ {'name': 'Variable ', - 'qhelp': "Base variable expanded name", - 'clclass' : 'variable', + 'qhelp': "BitBake is a generic task executor that considers a list of tasks with dependencies and handles metadata that consists of variables in a certain format that get passed to the tasks", 'dclass' : "span3", 'orderfield': _get_toggle_order(request, "variable_name"), + 'ordericon':_get_toggle_order_icon(request, "variable_name"), }, {'name': 'Value ', 'qhelp': "The value assigned to the variable", - 'clclass': 'variable_value', 'dclass': "span4", 'orderfield': _get_toggle_order(request, "variable_value"), + 'ordericon':_get_toggle_order_icon(request, "variable_value"), }, - {'name': 'Configuration file(s) ', - 'qhelp': "The configuration file(s) that touched the variable value", - 'clclass': 'file', + {'name': 'Set in file', + 'qhelp': "The last configuration file that touched the variable value", + 'clclass': 'file', 'hidden' : 0, 'dclass': "span6", - 'orderfield': _get_toggle_order(request, "variable_vhistory__file_name"), - 'filter' : { 'class': 'file', 'label' : 'Show only', 'options' : { - } - } + 'orderfield': _get_toggle_order(request, "vhistory__file_name"), + 'ordericon':_get_toggle_order_icon(request, "vhistory__file_name"), + 'filter' : { + 'class' : 'vhistory__file_name', + 'label': 'Show:', + 'options' : [ + ('Local configuration variables', 'vhistory__file_name__contains:conf/local.conf'), + ('Machine configuration variables', 'vhistory__file_name__contains:conf/machine/'), + ('Distro configuration variables', 'vhistory__file_name__contains:conf/distro/'), + ('Layer configuration variables', 'vhistory__file_name__contains:conf/layer.conf'), + ('bitbake.conf variables', 'vhistory__file_name__contains:/bitbake.conf'), + ] + }, }, {'name': 'Description ', - 'qhelp': "A brief explanation of a variable", - 'clclass': 'description', + 'qhelp': "A brief explanation of the variable", + 'clclass': 'description', 'hidden' : 0, 'dclass': "span5", - 'orderfield': _get_toggle_order(request, "description"), - 'filter' : { 'class' : 'description', 'label' : 'No', 'options' : { - } - }, - } - ] + 'filter' : { + 'class' : 'description', + 'label': 'Show:', + 'options' : [ + ('Variables with description', 'description__regex:.+'), + ] + }, + }, + ], } return render(request, template, context) -- cgit v1.2.3-54-g00ecf