From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by yocto-www.yoctoproject.org (Postfix, from userid 118) id CF763E009A1; Sat, 2 May 2015 03:37:27 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on yocto-www.yoctoproject.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-HAM-Report: * -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high * trust * [192.55.52.115 listed in list.dnswl.org] * -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% * [score: 0.0000] Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by yocto-www.yoctoproject.org (Postfix) with ESMTP id 8FAFEE0098A for ; Sat, 2 May 2015 03:37:23 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP; 02 May 2015 03:37:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,355,1427785200"; d="scan'208";a="565183362" Received: from linux.intel.com ([10.23.219.25]) by orsmga003.jf.intel.com with ESMTP; 02 May 2015 03:37:08 -0700 Received: from vmed.fi.intel.com (vmed.fi.intel.com [10.237.72.65]) by linux.intel.com (Postfix) with ESMTP id 9FD0D6A408F; Sat, 2 May 2015 03:36:40 -0700 (PDT) From: Ed Bartosh To: toaster@yoctoproject.org Date: Sat, 2 May 2015 13:37:04 +0300 Message-Id: <1430563024-2118-1-git-send-email-ed.bartosh@linux.intel.com> X-Mailer: git-send-email 2.1.4 Subject: [review-request][PATCH] bitbake: toastergui: show relative paths in configvars view X-BeenThere: toaster@yoctoproject.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Web based interface for BitBake List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 May 2015 10:37:27 -0000 Strip topdir from paths to config files in configvars view. Got rid of specific filter cut_layer_path_prefix. [YOCTO #7463] Signed-off-by: Ed Bartosh --- .../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 @@ {{variable.variable_value|truncatechars:153}} {% 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 %} @@ -115,7 +115,7 @@ {% for vh in variable.vhistory.all %} - {{forloop.counter}}{{vh.file_name|cut_layer_path_prefix:layer_names}}{{vh.operation}}{{vh.line_number}} + {{forloop.counter}}{{vh.file_name|cut_path_prefix:topdir}}{{vh.operation}}{{vh.line_number}} {%endfor%} 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=build_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