diff options
author | Dave Lerner <dave.lerner@windriver.com> | 2015-03-11 15:05:08 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-03-25 12:39:51 +0000 |
commit | e1a5d8150032b884bd85fcb20de14cd14cfd2b92 (patch) | |
tree | 21424e5a3170c1b396d8a8bd8e15ee835a34b710 /bitbake/lib/toaster/toastergui/templatetags/projecttags.py | |
parent | fa595132b337861898b391229ef54fc5b451a148 (diff) | |
download | poky-e1a5d8150032b884bd85fcb20de14cd14cfd2b92.tar.gz |
bitbake: 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]
(Bitbake rev: ef6e854a50ea6894b0e320025280431a6fc8a9a5)
Signed-off-by: Dave Lerner <dave.lerner@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/templatetags/projecttags.py')
-rw-r--r-- | bitbake/lib/toaster/toastergui/templatetags/projecttags.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py index e66910cd9d..0ccf73a619 100644 --- a/bitbake/lib/toaster/toastergui/templatetags/projecttags.py +++ b/bitbake/lib/toaster/toastergui/templatetags/projecttags.py | |||
@@ -307,3 +307,18 @@ def is_shaid(text): | |||
307 | return False | 307 | return False |
308 | except ValueError: | 308 | except ValueError: |
309 | return False | 309 | return False |
310 | |||
311 | @register.filter | ||
312 | def cut_layer_path_prefix(fullpath,layer_names): | ||
313 | ### if some part of the full local path to a layer matches | ||
314 | ### an entry in layer_names (sorted desc), return the layer | ||
315 | ### name relative path. | ||
316 | for lname in layer_names: | ||
317 | # import rpdb; rpdb.set_trace() | ||
318 | # only try layer names that are non-trivial to avoid false matches | ||
319 | if len(lname) >= 4: | ||
320 | # match layer name with as a subdir / or for remote layers /_ | ||
321 | if re.search('/' + lname, fullpath) or re.search('/_' + lname, fullpath): | ||
322 | parts = re.split(lname, fullpath, 1) | ||
323 | return lname + parts[1] | ||
324 | return fullpath | ||