diff options
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 | ||