Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Ed Bartosh <ed.bartosh@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH] bitbake: toastergui: show relative paths in configvars view
Date: Tue,  5 May 2015 15:57:13 +0300	[thread overview]
Message-ID: <1430830633-30115-1-git-send-email-ed.bartosh@linux.intel.com> (raw)
In-Reply-To: <D16E537B.5AAE0%belen.barros.pena@intel.com>

Stripped topdir from paths to config files in configvars view.

[YOCTO #7463]

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
---
 bitbake/lib/toaster/toastergui/templates/configvars.html   | 4 ++--
 bitbake/lib/toaster/toastergui/templatetags/projecttags.py | 6 ++++++
 bitbake/lib/toaster/toastergui/views.py                    | 2 ++
 3 files changed, 10 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:153}}</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..67762a5 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
 import re
 from django import template
 from django.utils import timezone
@@ -326,3 +327,8 @@ def cut_layer_path_prefix(fullpath,layer_names):
                 parts = re.split(lname, fullpath, 1)
                 return lname + parts[1]
     return fullpath
+
+@register.filter
+def cut_topdir_path_prefix(fullpath, topdir):
+    """Cut topdir from the fullpath."""
+    return relpath(fullpath, topdir) if fullpath.startswith(topdir) else 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



       reply	other threads:[~2015-05-05 12:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <D16E537B.5AAE0%belen.barros.pena@intel.com>
2015-05-05 12:57 ` Ed Bartosh [this message]
2015-05-05 14:35   ` [PATCH] bitbake: toastergui: show relative paths in configvars view Ed Bartosh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1430830633-30115-1-git-send-email-ed.bartosh@linux.intel.com \
    --to=ed.bartosh@linux.intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox