All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Barros Pena, Belen" <belen.barros.pena@intel.com>
To: Ed Bartosh <ed.bartosh@linux.intel.com>,
	"toaster@yoctoproject.org" <toaster@yoctoproject.org>
Subject: Re: [review-request][PATCH] bitbake: toastergui: show relative paths in configvars view
Date: Tue, 5 May 2015 10:08:39 +0000	[thread overview]
Message-ID: <D16E537B.5AAE0%belen.barros.pena@intel.com> (raw)
In-Reply-To: <1430563024-2118-1-git-send-email-ed.bartosh@linux.intel.com>


On 02/05/2015 11:37, "Ed Bartosh" <ed.bartosh@linux.intel.com> wrote:

>Strip topdir from paths to config files in configvars view.
>Got rid of specific filter cut_layer_path_prefix.

The paths in the variables table are not looking as expected when I apply
this. The paths to local.conf and bblayers.conf do show now as relative
paths, but paths to files inside a layer become full paths (instead of
relative paths). So instead of seeing

meta/conf/bitbake.conf


I see 

/home/<user>/<poky_dir>/meta/conf/bitbake.conf

I've uploaded an screenshot here

http://imgur.com/BhehRxF


All paths in this table should be relative paths.

Cheers

Belén

>
>[YOCTO #7463]
>
>Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
>---
> .../lib/toaster/toastergui/templates/configvars.html    |  4 ++--
> .../lib/toaster/toastergui/templatetags/projecttags.py  | 17
>++++-------------
> bitbake/lib/toaster/toastergui/views.py                 |  8 ++------
> 3 files changed, 8 insertions(+), 21 deletions(-)
>
>diff --git a/bitbake/lib/toaster/toastergui/templates/configvars.html
>b/bitbake/lib/toaster/toastergui/templates/configvars.html
>index 3e4c7e8..42d8fa7 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_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_path_prefix:topdir}}</t
>d><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..4c3bffd 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
>@@ -313,16 +314,6 @@ def is_shaid(text):
>         return False
> 
> @register.filter
>-def cut_layer_path_prefix(fullpath,layer_names):
>-    ### if some part of the full local path to a layer matches
>-    ### an entry in layer_names (sorted desc), return the layer
>-    ### name relative path.
>-    for lname in layer_names:
>-        # import rpdb; rpdb.set_trace()
>-        # only try layer names that are non-trivial to avoid false
>matches
>-        if len(lname) >= 4:
>-            # match layer name with as a subdir / or for remote layers /_
>-            if re.search('/' + lname, fullpath) or re.search('/_' +
>lname, fullpath):
>-                parts = re.split(lname, fullpath, 1)
>-                return lname + parts[1]
>-    return fullpath
>+def cut_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 b5c4d87..e7110c8 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,11 +1327,6 @@ def configvars(request, build_id):
> 
>     variables = _build_page_range(Paginator(queryset, pagesize),
>request.GET.get('page', 1))
> 
>-    layers = 
>Layer.objects.filter(layer_version_layer__projectlayer__project__build=bui
>ld_id).order_by("-name")
>-    layer_names = map(lambda layer : layer.name, layers)
>-    # special case for meta built-in layer
>-    layer_names.append('meta')
>-
>     # show all matching files (not just the last one)
>     file_filter= search_term + ":"
>     if filter_string.find('/conf/') > 0:
>@@ -1353,7 +1349,7 @@ def configvars(request, build_id):
>                 'total_count':queryset_with_search.count(),
>                 '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@yoctoproject.org
>https://lists.yoctoproject.org/listinfo/toaster



  reply	other threads:[~2015-05-05 10:08 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-02 10:37 [review-request][PATCH] bitbake: toastergui: show relative paths in configvars view Ed Bartosh
2015-05-05 10:08 ` Barros Pena, Belen [this message]
2015-05-05 12:57   ` [PATCH] " Ed Bartosh
2015-05-05 14:35     ` Ed Bartosh
2015-05-05 12:59   ` [review-request][PATCH] " Ed Bartosh
2015-05-06 18:03     ` Barros Pena, Belen
2015-05-06 21:00       ` [review-request][PATCH v3] " Ed Bartosh
2015-05-06 21:03       ` [review-request][PATCH v4] " Ed Bartosh
2015-05-07  9:26         ` Damian, Alexandru
2015-05-07  9:54         ` Barros Pena, Belen
2015-05-18  8:48           ` [review-request][PATCH v5] " Ed Bartosh
2015-05-18  9:03           ` [review-request][PATCH v6] " Ed Bartosh
2015-05-18 12:41             ` Barros Pena, Belen
2015-05-21  9:49               ` Damian, Alexandru
2015-05-21 10:18                 ` 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=D16E537B.5AAE0%belen.barros.pena@intel.com \
    --to=belen.barros.pena@intel.com \
    --cc=ed.bartosh@linux.intel.com \
    --cc=toaster@yoctoproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.