summaryrefslogtreecommitdiffstats
path: root/lib/toaster/toastergui/templatetags
diff options
context:
space:
mode:
authorDave Lerner <dave.lerner@windriver.com>2015-03-11 15:05:08 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-03-24 22:54:36 +0000
commitef6e854a50ea6894b0e320025280431a6fc8a9a5 (patch)
tree1418b9f0c1a5ac6a445666ce58bc1b0c583f4de2 /lib/toaster/toastergui/templatetags
parent4f2a6d5b515dec4b6199cc4517cd13dcc331f3c3 (diff)
downloadbitbake-contrib-ef6e854a50ea6894b0e320025280431a6fc8a9a5.tar.gz
toaster: layer-relative paths for config files
Change bitbake variables table to show the path to the file in which the variable was defined using a layer-relative path instead of the full path to the file. The layer-relative path is found by matching on the full defining file path with entries in a list of layer names, sorted in descending order, and with 'meta' appended as a built-in layer to the end of the list. Additional filters are used to reduce false matches, although even if there is a false match, the actual path to the defining file will be obvious and not misleading. [YOCTO #7414] Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Diffstat (limited to 'lib/toaster/toastergui/templatetags')
-rw-r--r--lib/toaster/toastergui/templatetags/projecttags.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/toaster/toastergui/templatetags/projecttags.py b/lib/toaster/toastergui/templatetags/projecttags.py
index e66910cd9..0ccf73a61 100644
--- a/lib/toaster/toastergui/templatetags/projecttags.py
+++ b/lib/toaster/toastergui/templatetags/projecttags.py
@@ -307,3 +307,18 @@ def is_shaid(text):
return False
except ValueError:
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