[Toaster] [review-request][PATCH v4] bitbake: toastergui: show relative paths in configvars view
Barros Pena, Belen
belen.barros.pena at intel.com
Thu May 7 02:54:13 PDT 2015
On 06/05/2015 22:03, "Ed Bartosh" <ed.bartosh at linux.intel.com> wrote:
>Stripped topdir and its parent directory from paths to
>config files in configvars view.
Ed, I am so sorry about this :( But there are still a couple of issues
with the paths:
1. Paths to files inside /bitbake are showing the parent of the /bitbake
directory. Here is an example in the BBFILES variable
http://i.imgur.com/xfUutMN.png
I spoke to Paul Eggleton and he thinks we should be showing that path from
the /bitbake directory. So in the screenshot above, the path should be:
bitbake/lib/bb/cooker.py
2. Something strange is going on when you apply a filter to the table.
It's a bit hard to explain, so this is how to reproduce it.
* Build something. When the build is done, click on the build target name,
then click on 'Configuration' in the left nav.
* Search for 'DISTRO_VERSION'. The path looks as expected.
* Now click on the little filter button in the "Set in file" column
heading.
* In the options listed, select the radio button for "Distro configuration
variables", then click the "Apply" button
The table shows the paths to the 2 distro files that touched the
DISTRO_VERSION variable: this works as expected. But the second path is
showing in full. However, if you click on the variable name, in the
history the paths display correctly.
This only happens when you use a filter AND a single table cell shows more
than one path.
I am really sorry about this: didn't think this was going to be so tricky
:/
Cheers
Belén
>
>[YOCTO #7463]
>
>Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
>---
> bitbake/lib/toaster/toastergui/templates/configvars.html | 4 ++--
> bitbake/lib/toaster/toastergui/templatetags/projecttags.py | 9 +++++++++
> bitbake/lib/toaster/toastergui/views.py | 2 ++
> 3 files changed, 13 insertions(+), 2 deletions(-)
>
>diff --git a/bitbake/lib/toaster/toastergui/templates/configvars.html
>b/bitbake/lib/toaster/toastergui/templates/configvars.html
>index 3e4c7e8..99ffe8b 100644
>--- a/bitbake/lib/toaster/toastergui/templates/configvars.html
>+++ b/bitbake/lib/toaster/toastergui/templates/configvars.html
>@@ -55,7 +55,7 @@
> <td class="variable_value"><a data-toggle="modal"
>href="#variable-{{variable.pk}}">{{variable.variable_value|truncatechars:1
>53}}</a></td>
> <td class="file"><a data-toggle="modal"
>href="#variable-{{variable.pk}}">
> {% if variable.vhistory.all %} {% autoescape off %}
>- {{variable.vhistory.all | filter_setin_files:file_filter
>| cut_layer_path_prefix:layer_names}}
>+ {{variable.vhistory.all | filter_setin_files:file_filter
>| cut_layer_path_prefix:layer_names | cut_topdir_path_prefix:topdir}}
> {% endautoescape %} {% endif %}
> </a></td>
> <td class="description">
>@@ -115,7 +115,7 @@
> <tbody>
> {% for vh in variable.vhistory.all %}
> <tr>
>-
><td>{{forloop.counter}}</td><td>{{vh.file_name|cut_layer_path_prefix:layer
>_names}}</td><td>{{vh.operation}}</td><td>{{vh.line_number}}</td>
>+
><td>{{forloop.counter}}</td><td>{{vh.file_name|cut_layer_path_prefix:layer
>_names|cut_topdir_path_prefix:topdir}}</td><td>{{vh.operation}}</td><td>{{
>vh.line_number}}</td>
> </tr>
> {%endfor%}
> </tbody>
>diff --git a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py
>b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py
>index 54700e3..f77e42e 100644
>--- a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py
>+++ b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py
>@@ -20,6 +20,7 @@
> # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
>
> from datetime import datetime, timedelta
>+from os.path import relpath, dirname
> import re
> from django import template
> from django.utils import timezone
>@@ -326,3 +327,11 @@ def cut_layer_path_prefix(fullpath,layer_names):
> parts = re.split(lname, fullpath, 1)
> return lname + parts[1]
> return fullpath
>+
>+ at register.filter
>+def cut_topdir_path_prefix(fullpath, topdir):
>+ """Cut topdir and its parent directory from the fullpath."""
>+ for prefix in (topdir, dirname(topdir)):
>+ if fullpath.startswith(prefix):
>+ return relpath(fullpath, prefix)
>+ return fullpath
>diff --git a/bitbake/lib/toaster/toastergui/views.py
>b/bitbake/lib/toaster/toastergui/views.py
>index 7849b50..d2cd367 100755
>--- a/bitbake/lib/toaster/toastergui/views.py
>+++ b/bitbake/lib/toaster/toastergui/views.py
>@@ -39,6 +39,7 @@ from datetime import timedelta, datetime, date
> from django.utils import formats
> from toastergui.templatetags.projecttags import json as jsonfilter
> import json
>+from os.path import dirname
>
> # all new sessions should come through the landing page;
> # determine in which mode we are running in, and redirect appropriately
>@@ -1326,6 +1327,7 @@ def configvars(request, build_id):
> 'default_orderby' : 'variable_name:+',
> 'search_term':search_term,
> 'layer_names' : layer_names,
>+ 'topdir': dirname(build_dir),
> # 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',
>--
>2.1.4
>
>--
>_______________________________________________
>toaster mailing list
>toaster at yoctoproject.org
>https://lists.yoctoproject.org/listinfo/toaster
More information about the toaster
mailing list